diff options
Diffstat (limited to 'linden/scripts/linux/2-trim-libraries-from-SL')
-rwxr-xr-x | linden/scripts/linux/2-trim-libraries-from-SL | 248 |
1 files changed, 248 insertions, 0 deletions
diff --git a/linden/scripts/linux/2-trim-libraries-from-SL b/linden/scripts/linux/2-trim-libraries-from-SL new file mode 100755 index 0000000..b6fcf06 --- /dev/null +++ b/linden/scripts/linux/2-trim-libraries-from-SL | |||
@@ -0,0 +1,248 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | # You may enable or disable the use of your system's library by editing | ||
4 | # the USE_SYSTEM_* variable ("yes" --> use the system library, "no" --> use | ||
5 | # LL's provided ones). | ||
6 | # The script also takes care of updating properly the viewer_manifest.py script | ||
7 | # accordingly, so that you (should) end up with a properly packaged client. | ||
8 | |||
9 | source config-SL-source | ||
10 | |||
11 | |||
12 | ########### functions definitions ########### | ||
13 | |||
14 | function check() { | ||
15 | if [ "$1" != "no" ] ; then | ||
16 | if [ -f $2 ] ; then | ||
17 | echo "Using the system $3..." | ||
18 | return 0 | ||
19 | else | ||
20 | echo "WARNING: system $3 requested but not available..." | ||
21 | fi | ||
22 | fi | ||
23 | return 1 | ||
24 | } | ||
25 | |||
26 | function update_manifest() { | ||
27 | grep -v $1 $PATH_TO_SOURCES/indra/newview/viewer_manifest.py >$TEMP_DIR/viewer_manifest.py | ||
28 | mv -f $TEMP_DIR/viewer_manifest.py $PATH_TO_SOURCES/indra/newview/viewer_manifest.py | ||
29 | chmod +x $PATH_TO_SOURCES/indra/newview/viewer_manifest.py | ||
30 | } | ||
31 | |||
32 | ########### end of functions ########### | ||
33 | |||
34 | if [ "$TEMP_DIR" == "" ] ; then | ||
35 | export TEMP_DIR="/usr/tmp/$USER" | ||
36 | fi | ||
37 | |||
38 | # Use the parameter (if any) as the path to the archives: | ||
39 | |||
40 | PATH_TO_ARCHIVES=`pwd` | ||
41 | if [ "$1" != "" ] && [ "$1" != "--prep" ] ; then | ||
42 | if [ -d $1 ] ; then | ||
43 | PATH_TO_ARCHIVES=$1 | ||
44 | shift | ||
45 | fi | ||
46 | fi | ||
47 | |||
48 | cd $PATH_TO_SOURCES/indra | ||
49 | |||
50 | |||
51 | # Force the vectorization use if we chose so. | ||
52 | if [ "$FORCE_VECTORIZE" == "yes" ] ; then | ||
53 | TUNE_FLAGS="$TUNE_FLAGS -DLL_VECTORIZE=1" | ||
54 | fi | ||
55 | if [ "$ALLOW_WARNINGS" == "yes" ] ; then | ||
56 | FATAL_WARNINGS="-DGCC_DISABLE_FATAL_WARNINGS:BOOL=TRUE" | ||
57 | else | ||
58 | FATAL_WARNINGS="" | ||
59 | fi | ||
60 | |||
61 | # Let's use the system GTK+ if available: | ||
62 | if check $USE_SYSTEM_GTK /usr/include/atk-1.0/atk/atk.h "GTK+" ; then | ||
63 | cd $PATH_TO_SOURCES/libraries/x86_64-linux/lib_release_client | ||
64 | rm -f libgtk* libgdk* libglib* libgmodule* libgobject* libgthread* libpango* libatk* libpixman* | ||
65 | cd ../include | ||
66 | rm -rf atk-1.0/ gtk-2.0/ glib-2.0/ pango-1.0/ pixman-1/ | ||
67 | cp -a /usr/include/atk-1.0 . | ||
68 | cp -a /usr/include/gtk-2.0 . | ||
69 | cp -a /usr/lib/gtk-2.0/include/* gtk-2.0/ | ||
70 | cp -a /usr/include/glib-2.0 . | ||
71 | cp -a /usr/lib/glib-2.0/include/* glib-2.0/ | ||
72 | cp -a /usr/include/pango-1.0 . | ||
73 | if [ -d /usr/include/cairo ] ; then | ||
74 | rm -rf cairo/ | ||
75 | cp -a /usr/include/cairo . | ||
76 | cd ../lib_release_client | ||
77 | rm -f libcairo* | ||
78 | fi | ||
79 | update_manifest libatk | ||
80 | update_manifest cairo | ||
81 | update_manifest libgtk | ||
82 | update_manifest libgdk | ||
83 | update_manifest libglib | ||
84 | update_manifest libgmodule | ||
85 | update_manifest libgobject | ||
86 | update_manifest libgthread | ||
87 | update_manifest libpango | ||
88 | update_manifest libpixman | ||
89 | fi | ||
90 | |||
91 | # Let's use the system zlib if available: | ||
92 | if check $USE_SYSTEM_ZLIB /usr/include/zlib.h "zlib" ; then | ||
93 | cd $PATH_TO_SOURCES/libraries | ||
94 | rm -rf include/zlib/ | ||
95 | rm -f x86_64-linux/lib_release_client/libz.so.1 | ||
96 | mkdir -p include/zlib | ||
97 | cp -a /usr/include/zlib*.h include/zlib/ | ||
98 | fi | ||
99 | |||
100 | # Let's use the system jpeglib if available: | ||
101 | if check $USE_SYSTEM_JPEGLIB /usr/include/jpeglib.h "jpeglib" ; then | ||
102 | cd $PATH_TO_SOURCES/libraries | ||
103 | rm -rf include/jpeglib/ x86_64-linux/lib_release_client/libjpeg.a | ||
104 | mkdir -p include/jpeglib | ||
105 | cp -a /usr/include/j*.h include/jpeglib/ | ||
106 | touch include/jpeglib/jinclude.h | ||
107 | fi | ||
108 | |||
109 | # Let's use the system ogg if available: | ||
110 | if check $USE_SYSTEM_OGG /usr/include/ogg/ogg.h "ogg" ; then | ||
111 | cd $PATH_TO_SOURCES/libraries | ||
112 | rm -rf include/ogg/ x86_64-linux/lib_release_client/libogg* | ||
113 | fi | ||
114 | |||
115 | # Let's use the system vorbis if available: | ||
116 | if check $USE_SYSTEM_VORBIS /usr/include/vorbis/vorbisenc.h "vorbis" ; then | ||
117 | cd $PATH_TO_SOURCES/libraries | ||
118 | rm -rf include/vorbis/ x86_64-linux/lib_release_client/libvorbis* | ||
119 | fi | ||
120 | |||
121 | # Let's use the system SDL if available: | ||
122 | if check $USE_SYSTEM_SDL /usr/include/SDL/SDL.h "SDL" ; then | ||
123 | cd $PATH_TO_SOURCES/libraries/x86_64-linux | ||
124 | rm -rf include/SDL/ lib_release_client/libSDL* | ||
125 | update_manifest libSDL | ||
126 | fi | ||
127 | |||
128 | # Let's use the system openssl if available: | ||
129 | if check $USE_SYSTEM_SSL /usr/include/openssl/opensslconf.h "openssl" ; then | ||
130 | cd $PATH_TO_SOURCES/libraries/x86_64-linux/lib_release_client | ||
131 | rm -f libssl.* libcrypto.* | ||
132 | update_manifest libssl | ||
133 | update_manifest libcrypto | ||
134 | fi | ||
135 | |||
136 | # Let's use the system apr if available: | ||
137 | if check $USE_SYSTEM_APR /usr/include/apr*/apr_base64.h "apr" ; then | ||
138 | cd $PATH_TO_SOURCES/libraries/x86_64-linux | ||
139 | rm -rf include/apr-1/* | ||
140 | rm -f lib_release_client/libapr* | ||
141 | cp -a /usr/include/apr*/* include/apr-1/ | ||
142 | update_manifest libapr | ||
143 | fi | ||
144 | |||
145 | # Let's use the system db4 if available: | ||
146 | if check $USE_SYSTEM_DB4 /usr/include/db4/db.h "db4" ; then | ||
147 | rm -f $PATH_TO_SOURCES/libraries/x86_64-linux/lib_release_client/libdb*.so | ||
148 | update_manifest libdb | ||
149 | if [ $USE_SYSTEM_DB4 != "yes" ] ; then | ||
150 | if ! grep $USE_SYSTEM_DB4 $PATH_TO_SOURCES/indra/cmake/BerkeleyDB.cmake ; then | ||
151 | # If we gave a version number instead of "yes", patch the | ||
152 | # BerkeleyDB.cmake file to use that DB4 version instead of 4.2. | ||
153 | sed -e "s/4.2/$USE_SYSTEM_DB4/" $PATH_TO_SOURCES/indra/cmake/BerkeleyDB.cmake >$TEMP_DIR/BerkeleyDB.cmake | ||
154 | mv -f $TEMP_DIR/BerkeleyDB.cmake $PATH_TO_SOURCES/indra/cmake/BerkeleyDB.cmake | ||
155 | fi | ||
156 | fi | ||
157 | fi | ||
158 | |||
159 | # Let's use the system expat if available: | ||
160 | if check $USE_SYSTEM_EXPAT /usr/include/expat.h "expat" ; then | ||
161 | cd $PATH_TO_SOURCES/libraries | ||
162 | rm -rf include/expat/ | ||
163 | rm -f x86_64-linux/lib_release_client/libexpat* | ||
164 | mkdir -p include/expat | ||
165 | cp -a /usr/include/expat*.h include/expat/ | ||
166 | update_manifest libexpat | ||
167 | fi | ||
168 | |||
169 | # Let's use the system xmlrpc-epi if available: | ||
170 | if check $USE_SYSTEM_XMLRPC /usr/include/xmlrpc.h "xmlrpc-epi" ; then | ||
171 | cd $PATH_TO_SOURCES/libraries | ||
172 | rm -rf include/xmlrpc-epi/ x86_64-linux/lib_release_client/libxmlrpc.a | ||
173 | mkdir -p include/xmlrpc-epi | ||
174 | cp -a /usr/include/xmlrpc*.h include/xmlrpc-epi/ | ||
175 | fi | ||
176 | |||
177 | # Let's use the system c-ares if available: | ||
178 | if check $USE_SYSTEM_CARES /usr/lib/libcares.a "c-ares" ; then | ||
179 | cd $PATH_TO_SOURCES/libraries | ||
180 | rm -f include/ares/* | ||
181 | rm -f x86_64-linux/lib_release_client/libcares.* | ||
182 | cp -a /usr/include/ares* include/ares/ | ||
183 | cp -a /usr/lib/libcares.a x86_64-linux/lib_release_client/ | ||
184 | fi | ||
185 | |||
186 | # Let's use the system curl if available: | ||
187 | if check $USE_SYSTEM_CURL /usr/include/curl/curl.h "curl" ; then | ||
188 | cd $PATH_TO_SOURCES/libraries | ||
189 | rm -rf include/curl/ | ||
190 | rm -f x86_64-linux/lib_release_client/libcurl.* | ||
191 | fi | ||
192 | |||
193 | # Let's use the system uuid if available: | ||
194 | if check $USE_SYSTEM_UUID /lib/libuuid.so.1 "libuuid" ; then | ||
195 | rm -f $PATH_TO_SOURCES/libraries/x86_64-linux/lib_release_client/libuuid.* | ||
196 | update_manifest libuuid | ||
197 | fi | ||
198 | |||
199 | # Let's use the system google-perftools if available: | ||
200 | if check $USE_SYSTEM_PERFTOOLS /usr/include/google/malloc_hook.h "google-perftools" ; then | ||
201 | cd $PATH_TO_SOURCES/libraries/x86_64-linux | ||
202 | rm -f lib_release_client/libtcmalloc.* lib_release_client/libstacktrace.* | ||
203 | rm -rf include/google/ | ||
204 | cp -a /usr/lib/libstacktrace.* /usr/lib/libtcmalloc.so* lib_release_client/ | ||
205 | cp -a /usr/include/google include/ | ||
206 | update_manifest tcmalloc | ||
207 | update_manifest stacktrace | ||
208 | fi | ||
209 | |||
210 | # Let's use the system libELFIO if available: | ||
211 | if check $USE_SYSTEM_ELFIO /usr/include/ELFIO.h "libELFIO" ; then | ||
212 | cd $PATH_TO_SOURCES/libraries/x86_64-linux | ||
213 | rm -f include/ELFIO/* | ||
214 | rm -f lib_release_client/libELFIO.* | ||
215 | cp -af /usr/include/ELF* include/ELFIO/ | ||
216 | cp -af /usr/lib/libELFIO.so lib_release_client/ | ||
217 | update_manifest ELFIO | ||
218 | fi | ||
219 | |||
220 | # Let's use the system libstdc++ if available: | ||
221 | if check $USE_SYSTEM_LIBSTDC /usr/lib/libstdc++.so.6 "libstdc++" ; then | ||
222 | rm -f $PATH_TO_SOURCES/libraries/x86_64-linux/lib_release_client/libstdc++.* | ||
223 | update_manifest libstdc | ||
224 | fi | ||
225 | |||
226 | # Let's use the system boost if available: | ||
227 | if check $USE_SYSTEM_BOOST /usr/include/boost/version.hpp "boost" ; then | ||
228 | cd $PATH_TO_SOURCES/libraries | ||
229 | rm -rf include/boost/ | ||
230 | rm -f x86_64-linux/lib_release/libboost_* | ||
231 | rm -f x86_64-linux/lib_release_client/libboost_* | ||
232 | fi | ||
233 | |||
234 | |||
235 | # Force libkdu inclusion | ||
236 | # (disabled for now (v1.21.0 viewer) as the cmake scripts fail to get libkdu from Internet). | ||
237 | if false; then | ||
238 | # Remove everything dealing with libstdc++ and the crash logger: | ||
239 | update_manifest libstdc | ||
240 | update_manifest logger | ||
241 | # Now, any line with a '#' followed with several spaces _should_ be dealing | ||
242 | # with the libkdu stuff... So, we simply remove the '#"... | ||
243 | sed -e "s/# them/# them/" $PATH_TO_SOURCES/indra/newview/viewer_manifest.py >$TEMP_DIR/viewer_manifest.py | ||
244 | sed -e "s/^# / /" $TEMP_DIR/viewer_manifest.py >$PATH_TO_SOURCES/indra/newview/viewer_manifest.py | ||
245 | rm -f $TEMP_DIR/viewer_manifest.py | ||
246 | chmod +x $PATH_TO_SOURCES/indra/newview/viewer_manifest.py | ||
247 | fi | ||
248 | |||