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