-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_lsmash_macos.sh
74 lines (62 loc) · 1.07 KB
/
build_lsmash_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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
CONFIGURE_FLAGS=""
ARCHS="arm64 x86_64"
# directories
SOURCE="l-smash"
FAT="lsmash-mac"
SCRATCH="scratch-lsmash"
# must be an absolute path
THIN=`pwd`/"thin-lsmash"
COMPILE="y"
LIPO="y"
if [ "$*" ]
then
if [ "$*" = "lipo" ]
then
# skip compile
COMPILE=
else
ARCHS="$*"
if [ $# -eq 1 ]
then
# skip lipo
LIPO=
fi
fi
fi
if [ "$COMPILE" ]
then
CWD=`pwd`
for ARCH in $ARCHS
do
echo "building $ARCH..."
mkdir -p "$SCRATCH/$ARCH"
cd "$SCRATCH/$ARCH"
CFLAGS="-arch $ARCH"
CXXFLAGS="-mmacosx-version-min=10.15"
export MACOSX_DEPLOYMENT_TARGET=10.15
/$CWD/$SOURCE/configure \
$CONFIGURE_FLAGS \
--target-os="$ARCH"-darwin \
--extra-cflags="$CFLAGS" \
--extra-ldflags="$LDFLAGS" \
--prefix="$THIN/$ARCH" || exit 1
make -j3 install || exit 1
cd $CWD
done
fi
if [ "$LIPO" ]
then
echo "building fat binaries..."
mkdir -p $FAT/lib
set - $ARCHS
CWD=`pwd`
cd $THIN/$1/lib
for LIB in *.a
do
cd $CWD
lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB
done
cd $CWD
cp -rf $THIN/$1/include $FAT
fi