This repository has been archived by the owner on Jul 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
createStaticLibs.sh
145 lines (118 loc) · 4.2 KB
/
createStaticLibs.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/sh -v
PATH=$PWD/Binaries:$PATH
buildid_ffmpeg="r`git --git-dir=./ffmpeg/.git rev-parse HEAD`"
if [ "$MACOSX_DEPLOYMENT_TARGET" = "" ]; then
MACOSX_DEPLOYMENT_TARGET="10.6"
fi
CC=`xcrun -find clang`
configureflags="--cc=$CC --disable-amd3dnow --disable-doc --disable-encoders \
--disable-avprobe --disable-avserver --disable-muxers --disable-network \
--disable-avfilter --disable-ffmpeg --disable-avconv --disable-avplay \
--target-os=darwin"
cflags="-isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET -Dattribute_deprecated= -fvisibility=hidden -w"
if [ "$BUILD_STYLE" = "Debug" -o "$CONFIGURATION" = "Debug" ] ; then
configureflags="$configureflags --disable-optimizations --disable-asm"
buildid_ffmpeg="${buildid_ffmpeg}Dev"
else
optcflags="-fstrict-aliasing"
buildid_ffmpeg="${buildid_ffmpeg}Dep"
fi
BUILD_ID_FILE="$BUILT_PRODUCTS_DIR/Universal/buildid"
if [[ -e "$BUILD_ID_FILE" ]] ; then
oldbuildid_ffmpeg=`cat "$BUILD_ID_FILE"`
else
oldbuildid_ffmpeg="buildme"
fi
QUICKBUILD="$BUILT_PRODUCTS_DIR/Universal/quickbuild"
if [[ -e "$QUICKBUILD" ]] ; then
oldbuildid_ffmpeg="quick"
rm "$QUICKBUILD"
fi
if [[ $buildid == "r" ]] ; then
echo "error: you're using svk. Please ask someone to add svk support to the build system. There's a script in Adium svn that can do this."
exit 1;
fi
if [ `echo $ARCHS | grep -c i386` -gt 0 ] ; then
buildi386=1
buildppc=0
else
echo "No valid architectures"
exit 0
fi
if [ "$buildid_ffmpeg" = "$oldbuildid_ffmpeg" ] ; then
echo "Static ffmpeg libs are up-to-date ; not rebuilding"
else
echo "Static ffmpeg libs are out-of-date ; rebuilding"
if [ -e ffmpeg/.git ]; then
if [ -e ffmpeg/patched ] ; then
cd ffmpeg && git reset --hard && rm patched && cd ..
fi
cd ffmpeg
#patch -p1 < ../Patches/0002-Workaround-for-AVI-audio-tracks-importing-1152x-too-.patch
#patch -p1 < ../Patches/config.patch
cd ..
touch ffmpeg/patched
fi
echo "Building i386"
mkdir -p "$BUILT_PRODUCTS_DIR"
arch=`arch`
# files we'd like to keep frame pointers in for in-the-wild debugging
fptargets="libavformat/libavformat.a libavutil/libavutil.a libavcodec/utils.o"
#######################
# Intel shlibs
#######################
if [ $buildi386 -gt 0 ] ; then
BUILDDIR="$BUILT_PRODUCTS_DIR/i386"
mkdir -p "$BUILDDIR"
if [ "$BUILD_STYLE" != "Debug" ] ; then
optcflags_i386="$optcflags -mdynamic-no-pic $x86flags"
fi
cd "$BUILDDIR"
if [ "$oldbuildid_ffmpeg" != "quick" ] ; then
"$SRCROOT/ffmpeg/configure" --extra-ldflags="$cflags -arch i386" \
--cpu=core2 --extra-cflags="-arch i386 $cflags $optcflags_i386 $OTHER_CFLAGS" \
$configureflags || exit 1
make depend > /dev/null 2>&1 || true
fi
fpcflags=`grep -m 1 -e "^CFLAGS=" "$BUILDDIR"/config.mak | sed -e s/CFLAGS=// -e s/-fomit-frame-pointer//`
make -j3 CFLAGS="$fpcflags" V=1 $fptargets || exit 1
make -j3 V=1 || exit 1
fi
#######################
# lipo/copy shlibs
#######################
BUILDDIR="$BUILT_PRODUCTS_DIR/Universal"
INTEL="$BUILT_PRODUCTS_DIR/i386"
PPC="$BUILT_PRODUCTS_DIR/ppc"
rm -rf "$BUILDDIR"
mkdir "$BUILDDIR"
if [ $buildi386 -eq $buildppc ] ; then
# lipo them
for aa in "$INTEL"/*/*.a ; do
echo lipo -create -arch i386 $aa -arch ppc `/bin/echo -n $aa | sed 's/i386/ppc/'` \
-output `echo -n $aa | sed 's/i386\/.*\//Universal\//'`
lipo -create -arch i386 $aa -arch ppc `/bin/echo -n $aa | sed 's/i386/ppc/'` \
-output `echo -n $aa | sed 's/i386\/.*\//Universal\//'`
done
else
if [ $buildppc -gt 0 ] ; then
archDir="ppc"
BUILDARCHDIR=$PPC
else
archDir="i386"
BUILDARCHDIR=$INTEL
fi
# just copy them
for aa in "$BUILDARCHDIR"/*/*.a ; do
echo cp "$aa" `/bin/echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'`
cp "$aa" `/bin/echo -n $aa | sed 's/'$archDir'\/.*\//Universal\//'`
done
fi
/bin/echo -n "$buildid_ffmpeg" > $BUILD_ID_FILE
fi
FINAL_BUILD_ID_FILE="$BUILT_PRODUCTS_DIR/Universal/buildid"
if [[ -e "$FINAL_BUILD_ID_FILE" ]] ; then
oldbuildid_ffmpeg=`cat "$FINAL_BUILD_ID_FILE"`
else
oldbuildid_ffmpeg="buildme"
fi