From 652e210bfb6f3b485f2a802b3e5865c283e9acb6 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 23 May 2022 21:07:30 +0200 Subject: [PATCH] cross-compile --- app/deps/src/build-ffmpeg.sh | 18 ++++++++++++++---- app/deps/src/init_deps | 14 +++++++++++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/deps/src/build-ffmpeg.sh b/app/deps/src/build-ffmpeg.sh index bd679d69..3f7200af 100755 --- a/app/deps/src/build-ffmpeg.sh +++ b/app/deps/src/build-ffmpeg.sh @@ -29,6 +29,7 @@ cd "build-$HOST" params=( --prefix="$INSTALL_DIR" + --arch="$ARCH" --disable-autodetect --disable-programs --disable-everything @@ -44,10 +45,19 @@ params=( --enable-muxer=mp4 --enable-muxer=matroska ) -if [[ "$HOST_SYSTEM" == 'linux' ]] -then - params+=(--enable-libv4l2) -fi + +case "$HOST_SYSTEM" in + linux) + params+=(--enable-libv4l2) + ;; + windows) + params+=(--target-os=mingw32) + params+=(--cross-prefix="$HOST-") + ;; + *) + fail "Unsupported platform: $HOST" + ;; +esac ../configure "${params[@]}" make -j $NJOBS diff --git a/app/deps/src/init_deps b/app/deps/src/init_deps index 06baa573..65e93ca6 100644 --- a/app/deps/src/init_deps +++ b/app/deps/src/init_deps @@ -10,7 +10,19 @@ fail() { } [[ -z "$HOST" ]] && fail '$HOST not defined' -[[ -z "$HOST_SYSTEM" ]] && fail '$HOST_SYSTEM not defined' + +if [[ "$HOST" == *linux* ]] +then + HOST_SYSTEM='linux' +elif [[ "$HOST" == *mingw* ]] +then + HOST_SYSTEM='windows' +else + fail "Host system could not be deduced from '$HOST'" +fi + +ARCH="${HOST%%-*}" +[[ -z "$ARCH" ]] && fail "Arch could not be deduced from '$HOST'" DIR=$(dirname ${BASH_SOURCE[0]}) cd "$DIR"