Move configure flags into each respective image

This commit is contained in:
BtbN 2024-03-14 22:54:42 +01:00
parent c032e0fa41
commit 281ab29417
2 changed files with 52 additions and 35 deletions

View File

@ -4,42 +4,12 @@ shopt -s globstar
cd "$(dirname "$0")"
source util/vars.sh
get_output() {
(
SELF="$1"
source $1
if ffbuild_enabled; then
ffbuild_$2 || exit 0
else
ffbuild_un$2 || exit 0
fi
)
}
source "variants/${TARGET}-${VARIANT}.sh"
for addin in ${ADDINS[*]}; do
source "addins/${addin}.sh"
done
export FFBUILD_PREFIX="$(docker run --rm "$IMAGE" bash -c 'echo $FFBUILD_PREFIX')"
for script in scripts.d/**/*.sh; do
FF_CONFIGURE+=" $(get_output $script configure)"
FF_CFLAGS+=" $(get_output $script cflags)"
FF_CXXFLAGS+=" $(get_output $script cxxflags)"
FF_LDFLAGS+=" $(get_output $script ldflags)"
FF_LDEXEFLAGS+=" $(get_output $script ldexeflags)"
FF_LIBS+=" $(get_output $script libs)"
done
FF_CONFIGURE="$(xargs <<< "$FF_CONFIGURE")"
FF_CFLAGS="$(xargs <<< "$FF_CFLAGS")"
FF_CXXFLAGS="$(xargs <<< "$FF_CXXFLAGS")"
FF_LDFLAGS="$(xargs <<< "$FF_LDFLAGS")"
FF_LDEXEFLAGS="$(xargs <<< "$FF_LDEXEFLAGS")"
FF_LIBS="$(xargs <<< "$FF_LIBS")"
TESTFILE="uidtestfile"
rm -f "$TESTFILE"
docker run --rm -v "$PWD:/uidtestdir" "$IMAGE" touch "/uidtestdir/$TESTFILE"
@ -67,9 +37,9 @@ cat <<EOF >"$BUILD_SCRIPT"
git clone --filter=blob:none --branch='$GIT_BRANCH' '$FFMPEG_REPO' ffmpeg
cd ffmpeg
./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-ldexeflags='$FF_LDEXEFLAGS' --extra-libs='$FF_LIBS' \
./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-ldexeflags='\$FF_LDEXEFLAGS' --extra-libs='\$FF_LIBS' \
--extra-version="\$(date +%Y%m%d)"
make -j\$(nproc) V=1
make install install-doc

View File

@ -1,5 +1,6 @@
#!/bin/bash
set -e
shopt -s globstar
cd "$(dirname "$0")"
source util/vars.sh
@ -34,8 +35,6 @@ exec_dockerstage() {
to_df "ENV SELF=\"$SELF\" STAGENAME=\"$STAGENAME\""
set -x
STG="$(ffbuild_dockerdl)"
if [[ -n "$STG" ]]; then
HASH="$(sha256sum <<<"$STG" | cut -d" " -f1)"
@ -101,3 +100,51 @@ done
to_df "FROM base"
sed "s/__PREVLAYER__/$PREVLAYER/g" Dockerfile.final | sort -u >> Dockerfile
rm Dockerfile.final
###
### Compile list of configure arguments and add them to the final Dockerfile
###
get_output() {
(
SELF="$1"
source $1
if ffbuild_enabled; then
ffbuild_$2 || exit 0
else
ffbuild_un$2 || exit 0
fi
)
}
source "variants/${TARGET}-${VARIANT}.sh"
for addin in ${ADDINS[*]}; do
source "addins/${addin}.sh"
done
export FFBUILD_PREFIX="$(docker run --rm "$IMAGE" bash -c 'echo $FFBUILD_PREFIX')"
for script in scripts.d/**/*.sh; do
FF_CONFIGURE+=" $(get_output $script configure)"
FF_CFLAGS+=" $(get_output $script cflags)"
FF_CXXFLAGS+=" $(get_output $script cxxflags)"
FF_LDFLAGS+=" $(get_output $script ldflags)"
FF_LDEXEFLAGS+=" $(get_output $script ldexeflags)"
FF_LIBS+=" $(get_output $script libs)"
done
FF_CONFIGURE="$(xargs <<< "$FF_CONFIGURE")"
FF_CFLAGS="$(xargs <<< "$FF_CFLAGS")"
FF_CXXFLAGS="$(xargs <<< "$FF_CXXFLAGS")"
FF_LDFLAGS="$(xargs <<< "$FF_LDFLAGS")"
FF_LDEXEFLAGS="$(xargs <<< "$FF_LDEXEFLAGS")"
FF_LIBS="$(xargs <<< "$FF_LIBS")"
to_df "ENV \\"
to_df " FF_CONFIGURE=\"$FF_CONFIGURE\" \\"
to_df " FF_CFLAGS=\"$FF_CFLAGS\" \\"
to_df " FF_CXXFLAGS=\"$FF_CXXFLAGS\" \\"
to_df " FF_LDFLAGS=\"$FF_LDFLAGS\" \\"
to_df " FF_LDEXEFLAGS=\"$FF_LDEXEFLAGS\" \\"
to_df " FF_LIBS=\"$FF_LIBS\""