-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbuild-macos.sh
executable file
·56 lines (42 loc) · 1.04 KB
/
build-macos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
set -eux
cd $(dirname $0)
BASE_DIR=$(pwd)
source common.sh
if [ ! -e $FFMPEG_TARBALL ]
then
curl -s -L -O $FFMPEG_TARBALL_URL
fi
: ${TARGET?}
case $TARGET in
x86_64-*)
ARCH="x86_64"
;;
arm64-*)
ARCH="arm64"
;;
*)
echo "Unknown target: $TARGET"
exit 1
;;
esac
OUTPUT_DIR=artifacts/ffmpeg-$FFMPEG_VERSION-audio-$TARGET
BUILD_DIR=$BASE_DIR/$(mktemp -d build.XXXXXXXX)
trap 'rm -rf $BUILD_DIR' EXIT
cd $BUILD_DIR
tar --strip-components=1 -xf $BASE_DIR/$FFMPEG_TARBALL
FFMPEG_CONFIGURE_FLAGS+=(
--cc=/usr/bin/clang
--prefix=$BASE_DIR/$OUTPUT_DIR
--enable-cross-compile
--target-os=darwin
--arch=$ARCH
--extra-ldflags="-target $TARGET"
--extra-cflags="-target $TARGET"
--enable-runtime-cpudetect
)
./configure "${FFMPEG_CONFIGURE_FLAGS[@]}" || (cat ffbuild/config.log && exit 1)
perl -pi -e 's{HAVE_MACH_MACH_TIME_H 1}{HAVE_MACH_MACH_TIME_H 0}' config.h
make V=1
make install
chown -R $(stat -f '%u:%g' $BASE_DIR) $BASE_DIR/$OUTPUT_DIR