blob: a0031ab79acc98f9dd8d5a2111a8d92475e4dd31 (
plain)
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
|
#!/bin/bash
#set -x
function check_dyloaded_depends
{
b=$(find "$EXTERNAL_LIBS" -name $1 -print)
if [ -f "$b" ]; then
#echo "Processing $b"
if [ ! -f "$TARGET_FRAMEWORKS/$(basename $b)" ]; then
echo " Packaging $b"
cp -f "$b" "$TARGET_FRAMEWORKS/"
chmod u+w "$TARGET_FRAMEWORKS/$(basename $b)"
fi
for a in $(otool -L "$b" | grep "$EXTERNAL_LIBS" | awk ' { print $1 } ') ; do
if [ -f "$a" ]; then
if [ ! -f "$TARGET_FRAMEWORKS/$(basename $a)" ]; then
echo " Packaging $a"
cp -f "$a" "$TARGET_FRAMEWORKS/"
chmod u+w "$TARGET_FRAMEWORKS/$(basename $a)"
install_name_tool -change "$a" "$DYLIB_NAMEPATH/$(basename $a)" "$TARGET_FRAMEWORKS/$(basename $b)"
fi
fi
done
fi
}
function check_xbmc_dylib_depends
{
REWIND="1"
while [ $REWIND = "1" ]
do
let REWIND="0"
for b in $(find "$1" -type f -name "$2" -print) ; do
#echo "Processing $b"
install_name_tool -id "$(basename $b)" "$b"
for a in $(otool -L "$b" | grep "$EXTERNAL_LIBS" | awk ' { print $1 } ') ; do
#echo " Packaging $a"
if [ ! -f "$TARGET_FRAMEWORKS/$(basename $a)" ]; then
echo " Packaging $a"
cp -f "$a" "$TARGET_FRAMEWORKS/"
chmod u+w "$TARGET_FRAMEWORKS/$(basename $a)"
let REWIND="1"
fi
install_name_tool -change "$a" "$DYLIB_NAMEPATH/$(basename $a)" "$b"
done
done
done
}
EXTERNAL_LIBS=$XBMC_DEPENDS
TARGET_NAME=$PRODUCT_NAME.$WRAPPER_EXTENSION
TARGET_CONTENTS=$TARGET_BUILD_DIR/$TARGET_NAME
TARGET_BINARY=$TARGET_CONTENTS/$APP_NAME
TARGET_FRAMEWORKS=$TARGET_CONTENTS/Frameworks
DYLIB_NAMEPATH=@executable_path/Frameworks
XBMC_HOME=$TARGET_CONTENTS/AppData/AppHome
mkdir -p "$TARGET_CONTENTS"
mkdir -p "$TARGET_CONTENTS/AppData/AppHome"
# start clean so we don't keep old dylibs
rm -rf "$TARGET_CONTENTS/Frameworks"
mkdir -p "$TARGET_CONTENTS/Frameworks"
echo "Package $TARGET_BUILD_DIR/$APP_NAME"
# Copy all of XBMC's dylib dependencies and rename their locations to inside the Framework
echo "Checking $TARGET_BINARY dylib dependencies"
for a in $(otool -L "$TARGET_BINARY" | grep "$EXTERNAL_LIBS" | awk ' { print $1 } ') ; do
echo " Packaging $a"
cp -f "$a" "$TARGET_FRAMEWORKS/"
chmod u+w "$TARGET_FRAMEWORKS/$(basename $a)"
install_name_tool -change "$a" "$DYLIB_NAMEPATH/$(basename $a)" "$TARGET_BINARY"
done
echo "Fixing $TARGET_BINARY VideoToolbox dylib name"
VTB_SDK6=/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox
VTB_SDK5=/System/Library/PrivateFrameworks/VideoToolbox.framework/VideoToolbox
install_name_tool -change "$VTB_SDK6" "$VTB_SDK5" "$TARGET_BINARY"
echo "Package $EXTERNAL_LIBS/lib/python2.6"
mkdir -p "$TARGET_CONTENTS/Frameworks/lib"
PYTHONSYNC="rsync -aq --exclude .DS_Store --exclude *.a --exclude *.exe --exclude test --exclude tests"
${PYTHONSYNC} "$EXTERNAL_LIBS/lib/python2.6" "$TARGET_FRAMEWORKS/lib/"
rm -rf "$TARGET_FRAMEWORKS/lib/python2.6/config"
echo "Checking $TARGET_FRAMEWORKS/lib/python2.6 *.so for dylib dependencies"
check_xbmc_dylib_depends "$TARGET_FRAMEWORKS"/lib/python2.6 "*.so"
echo "Checking $XBMC_HOME/system *.so for dylib dependencies"
check_xbmc_dylib_depends "$XBMC_HOME"/system "*.so"
echo "Checking $XBMC_HOME/addons *.so for dylib dependencies"
check_xbmc_dylib_depends "$XBMC_HOME"/addons "*.so"
echo "Checking $XBMC_HOME/addons *.pvr for dylib dependencies"
check_xbmc_dylib_depends "$XBMC_HOME"/addons "*.pvr"
echo "Checking $XBMC_HOME/addons *.xbs for dylib dependencies"
check_xbmc_dylib_depends "$XBMC_HOME"/addons "*.xbs"
echo "Checking xbmc/DllPaths_generated.h for dylib dependencies"
for a in $(grep .dylib "$SRCROOT"/xbmc/DllPaths_generated.h | awk '{print $3}' | sed s/\"//g) ; do
check_dyloaded_depends $a
done
echo "Checking $TARGET_FRAMEWORKS for missing dylib dependencies"
REWIND="1"
while [ $REWIND = "1" ]
do
let REWIND="0"
for b in "$TARGET_FRAMEWORKS/"*dylib* ; do
#echo " Processing $b"
for a in $(otool -L "$b" | grep "$EXTERNAL_LIBS" | awk ' { print $1 } ') ; do
#echo "Processing $a"
if [ ! -f "$TARGET_FRAMEWORKS/$(basename $a)" ]; then
echo " Packaging $a"
cp -f "$a" "$TARGET_FRAMEWORKS/"
chmod u+w "$TARGET_FRAMEWORKS/$(basename $a)"
let REWIND="1"
fi
install_name_tool -change "$a" "$DYLIB_NAMEPATH/$(basename $a)" "$TARGET_FRAMEWORKS/$(basename $b)"
done
done
done
|