From d35d933b8e4769345133d887d1bac0d9dbcec1fd Mon Sep 17 00:00:00 2001 From: paring Date: Tue, 2 May 2023 21:03:21 +0900 Subject: [PATCH] feat: support build of different architecture --- build.sh | 19 ++++++++++++++++++- scripts/build-ffmpeg.sh | 2 +- scripts/build-openh264.sh | 4 +++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 44c60d5..9132c4d 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,18 @@ +export ARCH=$(uname -m) + +while [[ $# -gt 0 ]]; do + case $1 in + --arch) + export ARCH=$2 + shift 2 + ;; + *) + echo "Usage: $0 --arch [arch]" + exit 1 + ;; + esac +done + export workDir=$(pwd)/work export outDir=$(pwd)/out export PREFIX=$workDir/prefix @@ -5,8 +20,10 @@ export PREFIX=$workDir/prefix export PKG_CONFIG_DIR=$PREFIX/lib/pkgconfig export PKG_CONFIG_PATH=$PKG_CONFIG_DIR +rm -rf $PREFIX +mkdir -p $PREFIX + mkdir -p $workDir -mkdir -p $prefix mkdir -p $outDir bash scripts/build-openh264.sh diff --git a/scripts/build-ffmpeg.sh b/scripts/build-ffmpeg.sh index 45d727b..dcb042a 100644 --- a/scripts/build-ffmpeg.sh +++ b/scripts/build-ffmpeg.sh @@ -9,7 +9,7 @@ make distclean ./configure --disable-gpl --disable-nonfree --disable-doc --disable-network \ --disable-ffprobe --disable-ffplay --enable-static --disable-shared \ --enable-libopenh264 \ - --prefix=$PREFIX + --prefix=$PREFIX --enable-cross-compile --arch=$ARCH --cc="clang -arch $ARCH" make -j diff --git a/scripts/build-openh264.sh b/scripts/build-openh264.sh index 21cc8d4..20ca18a 100644 --- a/scripts/build-openh264.sh +++ b/scripts/build-openh264.sh @@ -18,7 +18,9 @@ cd $projectDir git checkout tags/v$OPENH264_VERSION -b v$OPENH264_VERSION -args="PREFIX=$PREFIX" +args="PREFIX=$PREFIX ARCH=$ARCH" + +make clean make -j $args