]> git.pld-linux.org Git - packages/chromium-browser.git/blame - clean-source.sh
merge with master
[packages/chromium-browser.git] / clean-source.sh
CommitLineData
fe547a32 1#!/bin/sh
8f5f6775 2set -xe
fe547a32
ER
3
4# import options
cd09b941
ER
5# remove everything unless it's remove has been disabled with "0"
6# "v8=0" means "do not remove v8"
fe547a32
ER
7eval "$@"
8
9# drop bundled libs, from gentoo
598df428 10gyp_clean() {
598df428
ER
11 local l lib=$1
12 echo "Removing bundled library $lib ..."
13 l=$(find "$lib" -mindepth 1 ! -iname '*.gyp*' -print -delete | wc -l)
14 if [ $l -eq 0 ]; then
fe547a32
ER
15 echo >&2 "No files matched when removing bundled library $1"
16 exit 1
17 fi
18}
19
f888c710 20# https://code.google.com/p/chromium/wiki/LinuxPackaging
99f39995 21# initial list from src/tools/export_tarball/export_tarball.py
1dd58211 22# some scanned with find -name tests -o -name test -o -name test_data
3333a973 23# also removed non-linux files: find -name win -o -name mac
f888c710
ER
24remove_nonessential_dirs() {
25 local dir
26 for dir in \
30ab5de0 27 chrome/common/extensions/docs \
30ab5de0
ER
28 chrome/tools/test/reference_build \
29 courgette/testdata \
30 data \
31 native_client/src/trusted/service_runtime/testdata \
30ab5de0
ER
32 o3d/documentation \
33 o3d/samples \
34 o3d/tests \
35 third_party/angle/samples/gles2_book \
36 third_party/hunspell_dictionaries \
37 third_party/hunspell/tests \
38 third_party/lighttpd \
39 third_party/sqlite/test \
40 third_party/vc_80 \
41 third_party/xdg-utils/tests \
42 third_party/yasm/source/patched-yasm/modules/arch/x86/tests \
43 third_party/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/tests \
44 third_party/yasm/source/patched-yasm/modules/objfmts/bin/tests \
45 third_party/yasm/source/patched-yasm/modules/objfmts/coff/tests \
46 third_party/yasm/source/patched-yasm/modules/objfmts/elf/tests \
47 third_party/yasm/source/patched-yasm/modules/objfmts/macho/tests \
48 third_party/yasm/source/patched-yasm/modules/objfmts/rdf/tests \
49 third_party/yasm/source/patched-yasm/modules/objfmts/win32/tests \
50 third_party/yasm/source/patched-yasm/modules/objfmts/win64/tests \
51 third_party/yasm/source/patched-yasm/modules/objfmts/xdf/tests \
52 third_party/WebKit/Source/JavaScriptCore/tests \
53 third_party/WebKit/LayoutTests \
daa4a66c
ER
54 \
55 breakpad/src/client/mac/tests \
56 breakpad/src/client/windows/tests \
57 breakpad/src/common/linux/tests \
58 breakpad/src/common/tests \
59 chrome/browser/resources/tracing/tests \
60 chrome/browser/ui/tests \
61 content/test/data/layout_tests/LayoutTests/http/tests \
62 content/test/data/layout_tests/LayoutTests/http/tests/websocket/tests \
63 content/test/data/layout_tests/LayoutTests/platform/chromium-win/http/tests \
64 gpu/command_buffer/tests \
65 native_client/tests \
66 native_client/tools/tests \
67 native_client_sdk/src/build_tools/tests \
68 ppapi/native_client/tests \
69 ppapi/tests \
70 sandbox/tests \
71 seccompsandbox/tests \
72 third_party/WebKit/Source/JavaScriptCore/API/tests \
73 third_party/WebKit/Source/JavaScriptCore/qt/tests \
74 third_party/WebKit/Source/WebKit/chromium/tests \
75 third_party/WebKit/Source/WebKit/gtk/tests \
76 third_party/WebKit/Source/WebKit/qt/tests \
77 third_party/WebKit/Source/WebKit2/UIProcess/API/gtk/tests \
78 third_party/WebKit/Source/WebKit2/UIProcess/API/qt/tests \
79 third_party/angle/tests \
80 third_party/ffmpeg/tests \
81 third_party/harfbuzz/tests \
82 third_party/hyphen/tests \
83 third_party/mesa/MesaLib/src/gallium/tests \
84 third_party/mesa/MesaLib/src/gallium/tests/python/tests \
85 third_party/tcmalloc/chromium/src/tests \
86 third_party/tcmalloc/vendor/src/tests \
87 third_party/yasm/source/patched-yasm/libyasm/tests \
88 third_party/yasm/source/patched-yasm/modules/arch/lc3b/tests \
89 third_party/yasm/source/patched-yasm/modules/dbgfmts/stabs/tests \
90 third_party/yasm/source/patched-yasm/modules/parsers/gas/tests \
91 third_party/yasm/source/patched-yasm/modules/parsers/nasm/tests \
92 third_party/yasm/source/patched-yasm/modules/parsers/tasm/tests \
93 third_party/yasm/source/patched-yasm/modules/preprocs/nasm/tests \
94 third_party/yasm/source/patched-yasm/modules/preprocs/raw/tests \
95 third_party/yasm/source/patched-yasm/tools/python-yasm/tests \
96 tools/clang/plugins/tests \
97 tools/page_cycler/webpagereplay/tests \
98 tools/perf_expectations/tests \
99 \
30ab5de0
ER
100 v8/test \
101 webkit/data/layout_tests \
102 webkit/tools/test/reference_build \
99f39995
ER
103 \
104 tools/site_compare \
105 tools/stats_viewer \
106 tools/symsrc \
107 tools/valgrind \
c0808220 108 tools/gyp/test \
1dd58211
ER
109 \
110 ash/test \
111 base/android/javatests/src/org/chromium/base/test \
112 base/test \
113 chrome/browser/chromeos/bluetooth/test \
114 chrome/browser/component_updater/test \
115 chrome/browser/printing/cloud_print/test \
116 chrome/browser/resources/gaia_auth/test \
117 chrome/browser/sync/test \
118 chrome/installer/test \
119 chrome/test/webdriver/test \
120 chrome/tools/test \
121 chrome_frame/test \
122 chrome_frame/tools/test \
123 content/browser/worker_host/test \
124 content/public/test \
125 content/test \
126 media/test \
127 media/tools/layout_tests/test_data \
128 native_client_sdk/src/libraries/c_salt/test \
129 net/test \
130 printing/test \
131 rlz/test \
132 sandbox/linux/seccomp-legacy/tests \
133 sandbox/linux/tests \
134 sandbox/win/tests \
135 sync/internal_api/public/test \
136 sync/internal_api/test \
137 sync/test \
138 testing/gmock/scripts/test \
139 testing/gmock/test \
140 testing/gtest/scripts/test \
141 testing/gtest/test \
142 third_party/WebKit/Source/ThirdParty/gtest/scripts/test \
143 third_party/WebKit/Source/ThirdParty/gtest/test \
144 third_party/WebKit/Source/ThirdParty/gyp/test \
145 third_party/WebKit/Source/ThirdParty/qunit/test \
146 third_party/WebKit/Source/WebCore/bindings/scripts/test \
147 third_party/WebKit/Source/WebKit/efl/tests \
148 third_party/WebKit/Source/WebKit2/UIProcess/API/efl/tests \
149 third_party/WebKit/Tools/Scripts/webkitpy/test \
150 third_party/cacheinvalidation/files/src/google/cacheinvalidation/test \
151 third_party/libexif/sources/test \
152 third_party/libjingle/source/talk/app/webrtc/test \
153 third_party/libphonenumber/src/resources/test \
154 third_party/libphonenumber/src/test \
155 third_party/libsrtp/srtp/crypto/test \
156 third_party/libsrtp/srtp/test \
157 third_party/openssl/openssl/crypto/des/t/test \
158 third_party/openssl/openssl/test \
159 third_party/ots/test \
160 third_party/sfntly/cpp/src/test \
161 third_party/sqlite/src/test \
162 third_party/talloc/libreplace/test \
163 third_party/tlslite/test \
164 third_party/trace-viewer/test_data \
165 third_party/v8-i18n/tests \
166 third_party/webdriver/pylib/test \
167 third_party/webdriver/test_data \
168 ui/app_list/test \
169 ui/aura/test \
170 ui/base/test \
171 ui/compositor/test \
172 ui/gfx/test \
173 ui/test \
174 ui/views/test \
175 webkit/plugins/npapi/test \
3333a973
ER
176 \
177 _base/mac \
178 _base/win \
179 breakpad/src/client/mac \
180 breakpad/src/common/mac \
181 breakpad/src/tools/mac \
182 build/mac \
183 build/win \
184 chrome/app/theme/default_100_percent/mac \
185 chrome/app/theme/default_100_percent/win \
186 chrome/app/theme/default_200_percent/mac \
187 chrome/app/theme/default_200_percent/win \
188 chrome/app/theme/touch_100_percent/win \
189 chrome/app/theme/touch_140_percent/win \
190 chrome/app/theme/touch_180_percent/win \
191 chrome/browser/mac \
192 chrome/common/mac \
193 chrome/installer/mac \
194 chrome/installer/mac/third_party/xz/config/mac \
195 chrome/test/logging/win \
196 chrome/tools/build/mac \
197 chrome/tools/build/win \
198 cloud_print/service/win \
199 cloud_print/virtual_driver/win \
200 _content/common/mac \
201 content/shell/mac \
202 media/audio/mac \
203 media/audio/win \
204 media/video/capture/mac \
205 media/video/capture/win \
206 native_client/build/mac \
207 _native_client/src/include/win \
208 native_client/src/shared/imc/win \
209 native_client/src/shared/platform/win \
210 native_client/src/trusted/debug_stub/win \
211 native_client/src/trusted/desc/win \
212 native_client/src/trusted/nonnacl_util/win \
213 native_client/src/trusted/platform_qualify/win \
214 _native_client/src/trusted/service_runtime/win \
215 native_client_sdk/src/libraries/win \
216 ppapi/native_client/src/trusted/plugin/win \
217 remoting/host/installer/mac \
218 remoting/host/mac \
219 remoting/host/win \
220 rlz/mac \
221 rlz/win \
222 _sandbox/win \
223 sdch/mac \
224 skia/config/win \
225 third_party/WebKit/Source/Platform/chromium/public/mac \
226 third_party/WebKit/Source/Platform/chromium/public/win \
227 third_party/WebKit/Source/WTF/wtf/mac \
228 third_party/WebKit/Source/WTF/wtf/threads/win \
229 third_party/WebKit/Source/WTF/wtf/win \
230 third_party/WebKit/Source/WebCore/WebCore.gyp/mac \
231 third_party/WebKit/Source/WebCore/accessibility/mac \
232 third_party/WebKit/Source/WebCore/accessibility/win \
233 third_party/WebKit/Source/WebCore/editing/mac \
234 third_party/WebKit/Source/WebCore/history/mac \
235 third_party/WebKit/Source/WebCore/loader/mac \
236 third_party/WebKit/Source/WebCore/loader/win \
237 third_party/WebKit/Source/WebCore/page/mac \
238 third_party/WebKit/Source/WebCore/page/scrolling/mac \
239 third_party/WebKit/Source/WebCore/page/win \
240 third_party/WebKit/Source/WebCore/platform/audio/mac \
241 third_party/WebKit/Source/WebCore/platform/cf/win \
242 third_party/WebKit/Source/WebCore/platform/graphics/ca/mac \
243 third_party/WebKit/Source/WebCore/platform/graphics/ca/win \
244 third_party/WebKit/Source/WebCore/platform/graphics/gpu/mac \
245 third_party/WebKit/Source/WebCore/platform/graphics/mac \
246 third_party/WebKit/Source/WebCore/platform/graphics/surfaces/mac \
247 third_party/WebKit/Source/WebCore/platform/graphics/win \
248 third_party/WebKit/Source/WebCore/platform/mac \
249 third_party/WebKit/Source/WebCore/platform/network/mac \
250 third_party/WebKit/Source/WebCore/platform/network/win \
251 third_party/WebKit/Source/WebCore/platform/text/mac \
252 third_party/WebKit/Source/WebCore/platform/text/win \
253 third_party/WebKit/Source/WebCore/platform/win \
254 third_party/WebKit/Source/WebCore/platform/wx/wxcode/mac \
255 third_party/WebKit/Source/WebCore/platform/wx/wxcode/win \
256 third_party/WebKit/Source/WebCore/plugins/mac \
257 third_party/WebKit/Source/WebCore/plugins/win \
258 _third_party/WebKit/Source/WebKit/chromium/public/mac \
259 third_party/WebKit/Source/WebKit/chromium/public/platform/mac \
260 third_party/WebKit/Source/WebKit/chromium/public/platform/win \
261 third_party/WebKit/Source/WebKit/chromium/public/win \
262 third_party/WebKit/Source/WebKit/chromium/src/mac \
263 third_party/WebKit/Source/WebKit/chromium/src/win \
264 third_party/WebKit/Source/WebKit/mac \
265 third_party/WebKit/Source/WebKit/win \
266 third_party/WebKit/Source/WebKit2/Platform/CoreIPC/mac \
267 third_party/WebKit/Source/WebKit2/Platform/CoreIPC/win \
268 third_party/WebKit/Source/WebKit2/Platform/mac \
269 third_party/WebKit/Source/WebKit2/Platform/win \
270 third_party/WebKit/Source/WebKit2/PluginProcess/mac \
271 third_party/WebKit/Source/WebKit2/Shared/API/c/mac \
272 third_party/WebKit/Source/WebKit2/Shared/API/c/win \
273 third_party/WebKit/Source/WebKit2/Shared/Plugins/Netscape/mac \
274 third_party/WebKit/Source/WebKit2/Shared/Plugins/Netscape/win \
275 third_party/WebKit/Source/WebKit2/Shared/Plugins/mac \
276 third_party/WebKit/Source/WebKit2/Shared/cg/win \
277 third_party/WebKit/Source/WebKit2/Shared/mac \
278 third_party/WebKit/Source/WebKit2/Shared/win \
279 third_party/WebKit/Source/WebKit2/UIProcess/API/C/mac \
280 third_party/WebKit/Source/WebKit2/UIProcess/API/C/win \
281 third_party/WebKit/Source/WebKit2/UIProcess/API/mac \
282 third_party/WebKit/Source/WebKit2/UIProcess/Launcher/mac \
283 third_party/WebKit/Source/WebKit2/UIProcess/Launcher/win \
284 third_party/WebKit/Source/WebKit2/UIProcess/Plugins/mac \
285 third_party/WebKit/Source/WebKit2/UIProcess/Plugins/win \
286 third_party/WebKit/Source/WebKit2/UIProcess/mac \
287 third_party/WebKit/Source/WebKit2/UIProcess/win \
288 third_party/WebKit/Source/WebKit2/WebProcess/Authentication/mac \
289 third_party/WebKit/Source/WebKit2/WebProcess/Cookies/mac \
290 third_party/WebKit/Source/WebKit2/WebProcess/Downloads/cf/win \
291 third_party/WebKit/Source/WebKit2/WebProcess/Downloads/mac \
292 third_party/WebKit/Source/WebKit2/WebProcess/FullScreen/mac \
293 third_party/WebKit/Source/WebKit2/WebProcess/FullScreen/win \
294 third_party/WebKit/Source/WebKit2/WebProcess/InjectedBundle/API/c/win \
295 third_party/WebKit/Source/WebKit2/WebProcess/InjectedBundle/mac \
296 third_party/WebKit/Source/WebKit2/WebProcess/InjectedBundle/win \
297 third_party/WebKit/Source/WebKit2/WebProcess/Plugins/Netscape/mac \
298 third_party/WebKit/Source/WebKit2/WebProcess/Plugins/Netscape/win \
299 third_party/WebKit/Source/WebKit2/WebProcess/WebCoreSupport/mac \
300 third_party/WebKit/Source/WebKit2/WebProcess/WebCoreSupport/win \
301 third_party/WebKit/Source/WebKit2/WebProcess/WebPage/ca/mac \
302 third_party/WebKit/Source/WebKit2/WebProcess/WebPage/ca/win \
303 third_party/WebKit/Source/WebKit2/WebProcess/WebPage/mac \
304 third_party/WebKit/Source/WebKit2/WebProcess/WebPage/win \
305 third_party/WebKit/Source/WebKit2/WebProcess/mac \
306 third_party/WebKit/Source/WebKit2/WebProcess/win \
307 third_party/WebKit/Source/WebKit2/mac \
308 third_party/WebKit/Source/WebKit2/win \
309 third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac \
310 third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win \
311 third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/mac \
312 third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/win \
313 third_party/WebKit/Tools/DumpRenderTree/mac \
314 third_party/WebKit/Tools/DumpRenderTree/win \
315 third_party/WebKit/Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac \
316 third_party/WebKit/Tools/TestWebKitAPI/Tests/WebKit/win \
317 third_party/WebKit/Tools/TestWebKitAPI/Tests/WebKit2/mac \
318 third_party/WebKit/Tools/TestWebKitAPI/Tests/WebKit2/win \
319 third_party/WebKit/Tools/TestWebKitAPI/Tests/mac \
320 third_party/WebKit/Tools/TestWebKitAPI/mac \
321 third_party/WebKit/Tools/TestWebKitAPI/win \
322 _third_party/cld/encodings/compact_lang_det/win \
323 third_party/ffmpeg/chromium/binaries/Chromium/win \
324 third_party/ffmpeg/chromium/config/Chrome/mac \
325 third_party/ffmpeg/chromium/config/Chromium/mac \
326 third_party/ffmpeg/chromium/include/win \
327 third_party/leveldatabase/src/port/win \
328 third_party/libjpeg_turbo/mac \
329 third_party/libjpeg_turbo/win \
330 third_party/libvpx/source/config/mac \
331 third_party/libvpx/source/config/win \
332 third_party/libxml/mac \
333 third_party/skia/include/utils/mac \
334 third_party/skia/include/utils/win \
335 third_party/skia/src/gpu/gl/mac \
336 third_party/skia/src/gpu/gl/win \
337 third_party/skia/src/utils/mac \
338 third_party/skia/src/utils/win \
339 third_party/skia/src/views/mac \
340 third_party/skia/src/views/win \
341 third_party/snappy/mac \
342 third_party/webrtc/modules/audio_device/main/source/mac \
343 third_party/webrtc/modules/audio_device/main/source/win \
344 third_party/webrtc/modules/video_render/main/source/mac \
345 third_party/webrtc/test/testsupport/mac \
346 third_party/yasm/source/config/mac \
347 third_party/yasm/source/config/win \
348 tools/mac \
349 tools/win \
350 _ui/base/win \
351 ui/gfx/mac \
352 ui/views/win \
353 webkit/tools/test_shell/mac \
f888c710
ER
354 ; do
355 rm -vfr "$dir"
356 done
357}
358
99f39995
ER
359# Strip tarball from some big directories not needed on the linux platform
360strip_dirs() {
361 # prefix with _ those that we can't remove (just yet) because of the gclient
362 # hooks (see build/all.gyp) or of some unneeded deps/includes
f888c710 363
99f39995
ER
364 local dir
365 for dir in \
366 chrome/test/data/safe_browsing/old \
367 chrome/test/data/firefox2_nss_mac \
368 chrome/third_party/wtl/ \
369 gears \
370 google_update \
df52e8c0 371 gpu/demos \
99f39995
ER
372 o3d \
373 third_party/boost \
374 third_party/bsdiff \
375 third_party/bspatch \
376 third_party/ffmpeg/binaries \
377 third_party/fuzzymatch \
378 third_party/gles_book_examples \
3a0be9f8 379 third_party/gold \
99f39995
ER
380 third_party/hunspell/dictionaries \
381 third_party/icu/mac \
382 third_party/lcov \
383 third_party/lighttpd \
384 third_party/nspr \
385 third_party/nss \
386 third_party/ocmock \
387 third_party/pthread \
388 third_party/pyftpdlib \
389 third_party/simplejson \
390 third_party/scons \
391 _third_party/tcmalloc \
392 tools/symsrc \
393 tools/site_compare \
394 tools/stats_viewer \
395 tools/valgrind \
396 tools/wine_valgrind \
397 v8/test/cctest \
398 webkit/data/layout_tests \
399 ; do
400 rm -vfr "$dir"
401 done
402}
403
404# parts based on ubuntu debian/rules
405# http://bazaar.launchpad.net/~chromium-team/chromium-browser/chromium-browser.head/view/head:/debian/rules
406
407remove_bin_only() {
408 find . -type f \( \
409 -iname \*.exe -o \
410 -iname \*.dll -o \
411 -iname \*.pdb -o \
412 -name \*.o -o \
413 -name \*.a -o \
414 -name \*.dylib \
415 \) -exec rm -fv {} \;
416}
417
418# removes dir, if the bcond is not turned off
419strip_system_dirs() {
420 local dir lib bcond
421 for dir in "$@"; do
422 lib=${dir##*/}
423 bcond=$(eval echo \$$lib)
cd09b941 424 [ "${bcond:-1}" = 0 ] && continue
99f39995
ER
425
426 # skip already removed dirs
427 test -d $dir || continue
428
429 # here we ignore errors, as some dirs contain README.chromium after removal
8f5f6775 430 find $dir -depth -mindepth 1 \! \( -name '*.gyp' -o -name '*.gypi' -o -name README.chromium -o -name '*.patch' -o -path $dir/$lib.h \) -print -delete || :
99f39995
ER
431 done
432}
433
434# There are directories we want to strip, but that are unnecessarily required by the build-system
435# So we drop everything but the gyp/gypi files and README.chromium (to see what that dir contained)
436almost_strip_dirs() {
437 local dir
438 for dir in "$@"; do
8f5f6775 439 find $dir -depth -mindepth 1 \! \( -name '*.gyp' -o -name '*.gypi' -o -name README.chromium \) -print -delete || :
99f39995
ER
440 done
441}
442
443remove_nonessential_dirs | tee -a REMOVED-nonessential_dirs.txt
444remove_bin_only | tee -a REMOVED-bin_only.txt
445
446strip_dirs | tee -a REMOVED-stripped.txt
447
448almost_strip_dirs \
449 courgette \
ed4bcb92 450 chrome/test/data \
99f39995
ER
451 third_party/gles2_book \
452| tee -a REMOVED-stripped.txt
453
454strip_system_dirs \
31187203 455 native_client/src/third_party_mod/jsoncpp \
99f39995 456 third_party/bzip2 \
31187203 457 third_party/flac \
99f39995 458 third_party/icu \
31187203 459 third_party/jsoncpp \
99f39995
ER
460 third_party/libevent \
461 third_party/libjpeg \
462 third_party/libpng \
3ee15dec 463 third_party/libsrtp \
581aec44 464 third_party/libusb \
31187203
ER
465 _third_party/libvpx \
466 third_party/libwebp \
2a97b574 467 third_party/libxml \
99f39995 468 third_party/libxslt \
ed514974 469 third_party/speex \
2a97b574 470 third_party/zlib \
99f39995
ER
471 v8 \
472| tee -a REMOVED-stripped.txt
598df428 473
1dd58211
ER
474# vpx can't be cleaned:
475#make: *** No rule to make target `out/Release/obj.target/libvpx_asm_offsets/third_party/libvpx/source/libvpx/vp8/common/asm_com_offsets.o',
476#needed by `out/Release/obj.target/third_party/libvpx/libvpx_asm_offsets.a'. Stop.
477
30ab5de0 478# 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 479#gyp_clean third_party/yasm
fe547a32 480
99f39995 481rm -vf third_party/expat/files/lib/expat.h
fe547a32 482
cd09b941 483if [ "${v8:-1}" != "0" ]; then
fe547a32
ER
484 # The implementation files include v8 headers with full path,
485 # like #include "v8/include/v8.h". Make sure the system headers
486 # will be used.
598df428 487 rm -rf v8/include
fe547a32
ER
488 ln -s /usr/include v8/include
489fi
490
cd09b941 491if [ "${nacl:-1}" != "0" ]; then
fe547a32
ER
492 # NOTE: here is always x86_64
493 rm -rf native_client/toolchain/linux_x86_newlib
fe547a32 494fi
This page took 0.108326 seconds and 4 git commands to generate.