]>
Commit | Line | Data |
---|---|---|
fe547a32 | 1 | #!/bin/sh |
598df428 ER |
2 | set -e |
3 | set -x | |
fe547a32 ER |
4 | |
5 | # import options | |
6 | eval "$@" | |
7 | ||
8 | # drop bundled libs, from gentoo | |
598df428 | 9 | gyp_clean() { |
598df428 ER |
10 | local l lib=$1 |
11 | echo "Removing bundled library $lib ..." | |
12 | l=$(find "$lib" -mindepth 1 ! -iname '*.gyp*' -print -delete | wc -l) | |
13 | if [ $l -eq 0 ]; then | |
fe547a32 ER |
14 | echo >&2 "No files matched when removing bundled library $1" |
15 | exit 1 | |
16 | fi | |
17 | } | |
18 | ||
f888c710 | 19 | # https://code.google.com/p/chromium/wiki/LinuxPackaging |
99f39995 | 20 | # initial list from src/tools/export_tarball/export_tarball.py |
f888c710 ER |
21 | remove_nonessential_dirs() { |
22 | local dir | |
23 | for dir in \ | |
24 | chrome/common/extensions/docs \ | |
25 | chrome/test/data \ | |
26 | chrome/tools/test/reference_build \ | |
27 | courgette/testdata \ | |
28 | data \ | |
29 | native_client/src/trusted/service_runtime/testdata \ | |
30 | src/chrome/test/data \ | |
31 | o3d/documentation \ | |
32 | o3d/samples \ | |
33 | o3d/tests \ | |
34 | third_party/angle/samples/gles2_book \ | |
35 | third_party/hunspell_dictionaries \ | |
36 | third_party/hunspell/tests \ | |
37 | third_party/lighttpd \ | |
38 | third_party/sqlite/test \ | |
39 | third_party/vc_80 \ | |
40 | third_party/xdg-utils/tests \ | |
41 | third_party/yasm/source/patched-yasm/modules/arch/x86/tests \ | |
42 | third_party/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/tests \ | |
43 | third_party/yasm/source/patched-yasm/modules/objfmts/bin/tests \ | |
44 | third_party/yasm/source/patched-yasm/modules/objfmts/coff/tests \ | |
45 | third_party/yasm/source/patched-yasm/modules/objfmts/elf/tests \ | |
46 | third_party/yasm/source/patched-yasm/modules/objfmts/macho/tests \ | |
47 | third_party/yasm/source/patched-yasm/modules/objfmts/rdf/tests \ | |
48 | third_party/yasm/source/patched-yasm/modules/objfmts/win32/tests \ | |
49 | third_party/yasm/source/patched-yasm/modules/objfmts/win64/tests \ | |
50 | third_party/yasm/source/patched-yasm/modules/objfmts/xdf/tests \ | |
51 | third_party/WebKit/Source/JavaScriptCore/tests \ | |
52 | third_party/WebKit/LayoutTests \ | |
53 | v8/test \ | |
54 | webkit/data/layout_tests \ | |
55 | webkit/tools/test/reference_build \ | |
99f39995 ER |
56 | \ |
57 | tools/site_compare \ | |
58 | tools/stats_viewer \ | |
59 | tools/symsrc \ | |
60 | tools/valgrind \ | |
f888c710 ER |
61 | ; do |
62 | rm -vfr "$dir" | |
63 | done | |
64 | } | |
65 | ||
99f39995 ER |
66 | # Strip tarball from some big directories not needed on the linux platform |
67 | strip_dirs() { | |
68 | # prefix with _ those that we can't remove (just yet) because of the gclient | |
69 | # hooks (see build/all.gyp) or of some unneeded deps/includes | |
f888c710 | 70 | |
99f39995 ER |
71 | local dir |
72 | for dir in \ | |
73 | chrome/test/data/safe_browsing/old \ | |
74 | chrome/test/data/firefox2_nss_mac \ | |
75 | chrome/third_party/wtl/ \ | |
76 | gears \ | |
77 | google_update \ | |
78 | o3d \ | |
79 | third_party/boost \ | |
80 | third_party/bsdiff \ | |
81 | third_party/bspatch \ | |
82 | third_party/ffmpeg/binaries \ | |
83 | third_party/fuzzymatch \ | |
84 | third_party/gles_book_examples \ | |
85 | third_party/hunspell/dictionaries \ | |
86 | third_party/icu/mac \ | |
87 | third_party/lcov \ | |
88 | third_party/lighttpd \ | |
89 | third_party/nspr \ | |
90 | third_party/nss \ | |
91 | third_party/ocmock \ | |
92 | third_party/pthread \ | |
93 | third_party/pyftpdlib \ | |
94 | third_party/simplejson \ | |
95 | third_party/scons \ | |
96 | _third_party/tcmalloc \ | |
97 | tools/symsrc \ | |
98 | tools/site_compare \ | |
99 | tools/stats_viewer \ | |
100 | tools/valgrind \ | |
101 | tools/wine_valgrind \ | |
102 | v8/test/cctest \ | |
103 | webkit/data/layout_tests \ | |
104 | ; do | |
105 | rm -vfr "$dir" | |
106 | done | |
107 | } | |
108 | ||
109 | # parts based on ubuntu debian/rules | |
110 | # http://bazaar.launchpad.net/~chromium-team/chromium-browser/chromium-browser.head/view/head:/debian/rules | |
111 | ||
112 | remove_bin_only() { | |
113 | find . -type f \( \ | |
114 | -iname \*.exe -o \ | |
115 | -iname \*.dll -o \ | |
116 | -iname \*.pdb -o \ | |
117 | -name \*.o -o \ | |
118 | -name \*.a -o \ | |
119 | -name \*.dylib \ | |
120 | \) -exec rm -fv {} \; | |
121 | } | |
122 | ||
123 | # removes dir, if the bcond is not turned off | |
124 | strip_system_dirs() { | |
125 | local dir lib bcond | |
126 | for dir in "$@"; do | |
127 | lib=${dir##*/} | |
128 | bcond=$(eval echo \$$lib) | |
129 | [ "$bcond" = 0 ] && continue | |
130 | ||
131 | # skip already removed dirs | |
132 | test -d $dir || continue | |
133 | ||
134 | # here we ignore errors, as some dirs contain README.chromium after removal | |
135 | find $dir -depth -mindepth 1 \! \( -name \*.gyp -o -name \*.gypi -o -name README.chromium -o -name \*.patch \) -print -delete || : | |
136 | done | |
137 | } | |
138 | ||
139 | # There are directories we want to strip, but that are unnecessarily required by the build-system | |
140 | # So we drop everything but the gyp/gypi files and README.chromium (to see what that dir contained) | |
141 | almost_strip_dirs() { | |
142 | local dir | |
143 | for dir in "$@"; do | |
99f39995 ER |
144 | find $dir -depth -mindepth 1 \! \( -name \*.gyp -o -name \*.gypi -o -name README.chromium \) -print -delete || : |
145 | done | |
146 | } | |
147 | ||
148 | remove_nonessential_dirs | tee -a REMOVED-nonessential_dirs.txt | |
149 | remove_bin_only | tee -a REMOVED-bin_only.txt | |
150 | ||
151 | strip_dirs | tee -a REMOVED-stripped.txt | |
152 | ||
153 | almost_strip_dirs \ | |
154 | courgette \ | |
155 | third_party/gles2_book \ | |
156 | | tee -a REMOVED-stripped.txt | |
157 | ||
158 | strip_system_dirs \ | |
159 | third_party/bzip2 \ | |
160 | third_party/icu \ | |
161 | third_party/libevent \ | |
162 | third_party/libjpeg \ | |
163 | third_party/libpng \ | |
164 | third_party/libxml \ | |
165 | third_party/libxslt \ | |
166 | third_party/zlib \ | |
167 | third_party/libwebp \ | |
168 | v8 \ | |
169 | | tee -a REMOVED-stripped.txt | |
598df428 | 170 | |
fe547a32 | 171 | # third_party/libvpx/libvpx.h should be kept |
598df428 | 172 | #gyp_clean third_party/libvpx |
fe547a32 | 173 | # third_party/yasm/source/patched-yasm/modules/arch/x86/gen_x86_insn.py', needed by `out/Release/obj/gen/third_party/yasm/x86insns.c'. Stop. |
598df428 | 174 | #gyp_clean third_party/yasm |
fe547a32 | 175 | |
99f39995 | 176 | rm -vf third_party/expat/files/lib/expat.h |
fe547a32 | 177 | |
99f39995 | 178 | if [ "$v8" = 1 ]; then |
fe547a32 ER |
179 | # The implementation files include v8 headers with full path, |
180 | # like #include "v8/include/v8.h". Make sure the system headers | |
181 | # will be used. | |
598df428 | 182 | rm -rf v8/include |
fe547a32 ER |
183 | ln -s /usr/include v8/include |
184 | fi | |
185 | ||
186 | if [ "$nacl" = 1 ]; then | |
187 | # NOTE: here is always x86_64 | |
188 | rm -rf native_client/toolchain/linux_x86_newlib | |
189 | ln -s /usr/x86_64-nacl-newlib native_client/toolchain/linux_x86_newlib | |
190 | fi |