forked from ortclib/zzz-obsolete.ortclib-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mergeWebRtciOsLibs.sh
executable file
·53 lines (47 loc) · 1.24 KB
/
mergeWebRtciOsLibs.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
#!/bin/bash
set -e
inputFolderPath1=$1
inputFolderPath2=$2
outputFolderPath=$3
outputLibFolderPath=$4
make_directory()
{
if [ ! -d "$1" ]; then
echo "Creating directory \"$1\"..."
mkdir -p $1
fi
}
merge_libs_with_different_arch()
{
if [ -d "$inputFolderPath1" ] && [ -d "$inputFolderPath2" ]; then
make_directory $outputFolderPath
for f in $(find $inputFolderPath1 -name '*.a'); do
filename=$(basename "${f}")
echo filename: $filename
echo CHECKING $inputFolderPath2/$filename
if [ -f $inputFolderPath2/$filename ]; then
echo filename: MERGING $filename
lipo -create $f $inputFolderPath2/$filename -output $outputFolderPath/$filename
else
echo filename 1: COPYING $filename
cp $f $outputFolderPath
fi
done
for f in $(find $inputFolderPath2 -name '*.a'); do
filename=$(basename "${f}")
if [ ! -f $inputFolderPath1/$filename ]; then
echo filename 2: COPYING $filename
cp $f $outputFolderPath
fi
done
fi
}
make_fat_webrtc()
{
make_directory $outputLibFolderPath
if [ -d "$outputFolderPath" ]; then
libtool -static -o $outputLibFolderPath/webrtc.a $outputFolderPath/*.a
fi
}
merge_libs_with_different_arch
make_fat_webrtc