#!/bin/bash set -xe 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/${VARIANT}.sh" source "variants/${TARGET}-${VARIANT}.sh" 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_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_LIBS="$(xargs <<< "$FF_LIBS")" rm -rf ffbuild mkdir ffbuild docker run --rm -i -u "$(id -u):$(id -g)" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <