Add experimental alpine linux64 base image
This commit is contained in:
parent
3f7d7b73db
commit
d0f6bd727f
18 changed files with 134 additions and 10 deletions
14
build.sh
14
build.sh
|
@ -40,7 +40,7 @@ FF_LIBS="$(xargs <<< "$FF_LIBS")"
|
|||
|
||||
TESTFILE="uidtestfile"
|
||||
rm -f "$TESTFILE"
|
||||
docker run --rm -v "$PWD:/uidtestdir" "$IMAGE" /usr/bin/touch "/uidtestdir/$TESTFILE"
|
||||
docker run --rm -v "$PWD:/uidtestdir" "$IMAGE" touch "/uidtestdir/$TESTFILE"
|
||||
DOCKERUID="$(stat -c "%u" "$TESTFILE")"
|
||||
rm -f "$TESTFILE"
|
||||
[[ "$DOCKERUID" != "$(id -u)" ]] && UIDARGS=( -u "$(id -u):$(id -g)" ) || UIDARGS=()
|
||||
|
@ -59,7 +59,7 @@ docker run --rm -i "${UIDARGS[@]}" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <<E
|
|||
|
||||
./configure --prefix=/ffbuild/prefix --pkg-config-flags="--static" \$FFBUILD_TARGET_FLAGS $FF_CONFIGURE --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" --extra-ldflags="$FF_LDFLAGS" --extra-libs="$FF_LIBS"
|
||||
make -j\$(nproc)
|
||||
make install
|
||||
make install install-doc
|
||||
EOF
|
||||
|
||||
mkdir -p artifacts
|
||||
|
@ -70,12 +70,18 @@ mkdir -p "ffbuild/pkgroot/$BUILD_NAME"
|
|||
package_variant ffbuild/prefix "ffbuild/pkgroot/$BUILD_NAME"
|
||||
|
||||
cd ffbuild/pkgroot
|
||||
zip -9 -r "${ARTIFACTS_PATH}/${BUILD_NAME}.zip" "$BUILD_NAME"
|
||||
if [[ "${TARGET}" == win* ]]; then
|
||||
OUTPUT_FNAME="${BUILD_NAME}.zip"
|
||||
zip -9 -r "${ARTIFACTS_PATH}/${OUTPUT_FNAME}" "$BUILD_NAME"
|
||||
else
|
||||
OUTPUT_FNAME="${BUILD_NAME}.tar.xz"
|
||||
tar cJf "${ARTIFACTS_PATH}/${OUTPUT_FNAME}" "$BUILD_NAME"
|
||||
fi
|
||||
cd -
|
||||
|
||||
rm -rf ffbuild
|
||||
|
||||
if [[ -n "$GITHUB_ACTIONS" ]]; then
|
||||
echo "::set-output name=build_name::${BUILD_NAME}"
|
||||
echo "${BUILD_NAME}.zip" > "${ARTIFACTS_PATH}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}.txt"
|
||||
echo "${OUTPUT_FNAME}" > "${ARTIFACTS_PATH}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}.txt"
|
||||
fi
|
||||
|
|
31
images/base-linux64/Dockerfile
Normal file
31
images/base-linux64/Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
|||
FROM alpine:edge
|
||||
|
||||
ENV CARGO_HOME="/opt/cargo" PATH="/opt/cargo/bin:${PATH}"
|
||||
RUN \
|
||||
apk add --no-cache \
|
||||
yasm nasm diffutils xxd pkgconf git ca-certificates curl wget unzip subversion autoconf automake libtool perl make cmake clang texinfo gperf gettext gettext-dev gettext-static itstool ragel musl-dev openssl-dev zlib-dev bzip2-static gtk-doc gobject-introspection gawk meson samurai p7zip python3 \
|
||||
binutils gcc g++ gfortran \
|
||||
rust cargo && \
|
||||
ln -s python3 /usr/bin/python && \
|
||||
cargo install cargo-c && rm -rf "${CARGO_HOME}"/{registry,git} && \
|
||||
git config --global user.email "builder@localhost" && \
|
||||
git config --global user.name "Builder" && \
|
||||
mkdir /opt/ffbuild
|
||||
|
||||
ADD run_stage.sh /usr/bin/run_stage
|
||||
ADD git-mini-clone.sh /usr/bin/git-mini-clone
|
||||
ADD check-wget.sh /usr/bin/check-wget
|
||||
|
||||
ADD toolchain.cmake /toolchain.cmake
|
||||
ADD cross.meson /cross.meson
|
||||
|
||||
ENV FFBUILD_TARGET_FLAGS="" \
|
||||
FFBUILD_TOOLCHAIN=x86_64-alpine-linux-musl \
|
||||
FFBUILD_CROSS_PREFIX="" \
|
||||
FFBUILD_RUST_TARGET="" \
|
||||
FFBUILD_PREFIX=/opt/ffbuild \
|
||||
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
|
||||
PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig \
|
||||
CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
|
||||
CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
|
||||
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong"
|
10
images/base-linux64/check-wget.sh
Executable file
10
images/base-linux64/check-wget.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
set -xe
|
||||
FNAME="$1"
|
||||
URL="$2"
|
||||
SHA512="$3"
|
||||
SHAFILE="${FNAME}.sha512"
|
||||
wget -O "${FNAME}" "${URL}"
|
||||
trap "rm -f ${SHAFILE}" EXIT
|
||||
echo "${SHA512} ${FNAME}" > "${SHAFILE}"
|
||||
sha512sum -c "${SHAFILE}"
|
15
images/base-linux64/cross.meson
Normal file
15
images/base-linux64/cross.meson
Normal file
|
@ -0,0 +1,15 @@
|
|||
[binaries]
|
||||
c = 'x86_64-alpine-linux-musl-gcc'
|
||||
cpp = x86_64-alpine-linux-musl-g++'
|
||||
ar = 'ar'
|
||||
strip = 'strip'
|
||||
|
||||
[properties]
|
||||
c_link_args = ['-static-libgcc', '-L/opt/ffbuild/lib', '-O2', '-pipe', '-fstack-protector-strong']
|
||||
cpp_link_args = ['-static-libgcc', '-static-libstdc++', '-L/opt/ffbuild/lib', '-O2', '-pipe', '-fstack-protector-strong']
|
||||
|
||||
[host_machine]
|
||||
system = 'linux'
|
||||
cpu_family = 'x86_64'
|
||||
cpu = 'x86_64'
|
||||
endian = 'little'
|
10
images/base-linux64/git-mini-clone.sh
Executable file
10
images/base-linux64/git-mini-clone.sh
Executable file
|
@ -0,0 +1,10 @@
|
|||
#!/bin/bash
|
||||
set -xe
|
||||
REPO="$1"
|
||||
REF="$2"
|
||||
DEST="$3"
|
||||
git init "$DEST"
|
||||
git -C "$DEST" remote add origin "$REPO"
|
||||
git -C "$DEST" fetch --depth=1 origin "$REF"
|
||||
git -C "$DEST" config advice.detachedHead false
|
||||
git -C "$DEST" checkout FETCH_HEAD
|
7
images/base-linux64/run_stage.sh
Executable file
7
images/base-linux64/run_stage.sh
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -xe
|
||||
mkdir -p /stage
|
||||
source "$1"
|
||||
cd /stage
|
||||
ffbuild_dockerbuild
|
||||
rm -rf /stage "$FFBUILD_PREFIX"/bin
|
12
images/base-linux64/toolchain.cmake
Normal file
12
images/base-linux64/toolchain.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
set(CMAKE_SYSTEM_NAME Linux)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
set(CMAKE_C_COMPILER x86_64-alpine-linux-musl-gcc)
|
||||
set(CMAKE_CXX_COMPILER x86_64-alpine-linux-musl-g++)
|
||||
set(CMAKE_RANLIB ranlib)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-alpine-linux-musl /opt/ffbuild)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -5,7 +5,10 @@ source util/vars.sh
|
|||
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
||||
docker build --tag "$BASE_IMAGE" images/base
|
||||
if grep "FROM.*base.*" "images/base-${TARGET}/Dockerfile" >/dev/null 2>&1; then
|
||||
docker build --tag "$BASE_IMAGE" images/base
|
||||
fi
|
||||
|
||||
docker build --build-arg GH_REPO="$REPO" --tag "$TARGET_IMAGE" "images/base-${TARGET}"
|
||||
|
||||
./generate.sh "$TARGET" "$VARIANT" "${ADDINS[@]}"
|
||||
|
|
18
variants/linux-install-shared.sh
Normal file
18
variants/linux-install-shared.sh
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
package_variant() {
|
||||
IN="$1"
|
||||
OUT="$2"
|
||||
|
||||
# mkdir -p "$OUT"/bin
|
||||
# cp "$IN"/bin/* "$OUT"/bin
|
||||
|
||||
mkdir -p "$OUT"/lib
|
||||
cp -a "$IN"/lib/*.so* "$OUT"/lib
|
||||
|
||||
mkdir -p "$OUT"/include
|
||||
cp -r "$IN"/include/* "$OUT"/include
|
||||
|
||||
mkdir -p "$OUT"/doc
|
||||
cp -r "$IN"/share/doc/ffmpeg/* "$OUT"/doc
|
||||
}
|
3
variants/linux64-gpl-shared.sh
Normal file
3
variants/linux64-gpl-shared.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/linux-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-gpl-shared.sh
|
3
variants/linux64-gpl.sh
Normal file
3
variants/linux64-gpl.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/default-install.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-gpl.sh
|
3
variants/linux64-lgpl-shared.sh
Normal file
3
variants/linux64-lgpl-shared.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/linux-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-lgpl-shared.sh
|
3
variants/linux64-lgpl.sh
Normal file
3
variants/linux64-lgpl.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/default-install.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-lgpl.sh
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-gpl-shared.sh
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-lgpl-shared.sh
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-gpl-shared.sh
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")"/default-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/windows-install-shared.sh
|
||||
source "$(dirname "$BASH_SOURCE")"/defaults-lgpl-shared.sh
|
||||
|
|
|
@ -14,6 +14,6 @@ package_variant() {
|
|||
mkdir -p "$OUT"/include
|
||||
cp -r "$IN"/include/* "$OUT"/include
|
||||
|
||||
mkdir -p "$OUT/doc"
|
||||
mkdir -p "$OUT"/doc
|
||||
cp -r "$IN"/share/doc/ffmpeg/* "$OUT"/doc
|
||||
}
|
Loading…
Reference in a new issue