diff --git a/build-mac-arm64.sh b/build-mac-arm64.sh new file mode 100755 index 0000000..59e45be --- /dev/null +++ b/build-mac-arm64.sh @@ -0,0 +1,5 @@ +export OPENH264_ARCH=arm64 +export OPENH264_OS=darwin +export FFMPEG_ARCH=arm64 + +bash build.sh --arch arm64 diff --git a/build.sh b/build.sh index bdb13b7..09cc5c5 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,10 @@ export ARCH=$(uname -m) # do not use all cpus because my computer dies export JOBS=$(awk -v count=$(nproc) 'BEGIN { print ( int( count - 1 ) ) }') +if [[ "$(uname)" == "Darwin" ]]; then + export JOBS=$(awk -v count=$(sysctl -n hw.ncpu) 'BEGIN { print ( int ( count - 1 ) ) }') +fi + while [[ $# -gt 0 ]]; do case $1 in --arch) diff --git a/scripts/build-ffmpeg.sh b/scripts/build-ffmpeg.sh index f2d542e..8ed9c7a 100644 --- a/scripts/build-ffmpeg.sh +++ b/scripts/build-ffmpeg.sh @@ -12,15 +12,13 @@ cp -r $amfPath/amf/public/include $PREFIX/include/AMF make distclean -flags="--cc=$CC --cxx=$CXX" - if [[ $FFMPEG_MSVC == 1 ]]; then flags="--toolchain=msvc" fi -./configure --disable-gpl --disable-nonfree --disable-doc --disable-network \ +LDFLAGS="-arch $ARCH" ./configure --disable-gpl --disable-nonfree --disable-doc --disable-network \ --disable-ffprobe --disable-ffplay --enable-static --disable-shared \ - --enable-libopenh264 \ + --enable-libopenh264 --cc="${CC:-clang -arch $ARCH}" --cxx="${CXX:-g++ -arch $ARCH}" \ --prefix=$PREFIX --enable-cross-compile --arch=$ARCH \ --pkg-config-flags="--static" --target-os=$FFMPEG_OS \ ${flags} ${FFBUILD_FLAGS} diff --git a/scripts/build-openh264.sh b/scripts/build-openh264.sh index baf231d..569dfc4 100644 --- a/scripts/build-openh264.sh +++ b/scripts/build-openh264.sh @@ -16,7 +16,7 @@ git clone https://github.com/cisco/openh264 $projectDir -b v$OPENH264_VERSION -- cd $projectDir -args="PREFIX=$PREFIX OS=$OPENH264_OS ARCH=$OPENH264_ARCH CC=$CC CXX=$CXX AR=$AR" +args="PREFIX=$PREFIX OS=$OPENH264_OS ARCH=$OPENH264_ARCH CC=\"${CC:-clang}\" CXX=\"${CXX:-g++}\" AR=\"${AR:-ar}\"" make clean