]> git.pld-linux.org Git - packages/chromium-browser.git/blob - clean-source.sh
clean samples, windows files, third_party/{ffmpeg,harfbuzz*}, fix unittest cleaning
[packages/chromium-browser.git] / clean-source.sh
1 #!/bin/sh
2 set -xe
3
4 export LC_ALL=C
5
6 # import options
7 # remove everything unless it's remove has been disabled with "0"
8 # "v8=0" means "do not remove v8"
9 eval "$@"
10
11 # Strip tarball from some big directories not needed on the linux platform
12 # https://code.google.com/p/chromium/wiki/LinuxPackaging
13 # initial list from src/tools/export_tarball/export_tarball.py
14 # also removed non-linux files: find -name win -o -name mac -o name android -o name windows
15 # find -type d -name 'android' -o -name 'chromeos' -o -name 'cros'
16 # find -type d -name *doc*
17 # find -type d -name *example*
18 # find -type d -name java
19 # find -type d -name tools
20 # find -type d -name samples
21 # suffix with _ those that we can't remove (just yet) because of the gclient
22 # hooks (see build/all.gyp) or of some unneeded deps/includes
23 remove_nonessential_dirs() {
24         local dir
25         for dir in \
26         android_webview \
27         ash/resources/default_100_percent/cros_ \
28         ash/resources/default_200_percent/cros_ \
29         ash/shell/cocoa \
30         ash/system/chromeos \
31         base/android \
32         base/chromeos \
33         base/ios \
34         base/mac_ \
35         base/win_ \
36         breakpad/src/client/mac \
37         breakpad/src/common/android \
38         breakpad/src/common/mac \
39         breakpad/src/tools/mac \
40         build/android_ \
41         build/mac \
42         build/win \
43         chrome/android \
44         chrome/app/android \
45         chrome/app/resources/terms/chromeos \
46         chrome/app/theme/default_100_percent/cros_ \
47         chrome/app/theme/default_100_percent/mac \
48         chrome/app/theme/default_100_percent/win \
49         chrome/app/theme/default_200_percent/cros_ \
50         chrome/app/theme/default_200_percent/mac \
51         chrome/app/theme/default_200_percent/win \
52         chrome/app/theme/touch_100_percent/win \
53         chrome/app/theme/touch_140_percent/win \
54         chrome/app/theme/touch_180_percent/win \
55         chrome/browser/android \
56         chrome/browser/chromeos/cros \
57         chrome/browser/chromeos_ \
58         chrome/browser/component/web_contents_delegate_android_ \
59         chrome/browser/extensions/docs \
60         chrome/browser/history/android \
61         chrome/browser/mac \
62         chrome/browser/resources/about_welcome_android \
63         chrome/browser/resources/chromeos_ \
64         chrome/browser/resources/ntp_android \
65         chrome/browser/resources/options/chromeos_ \
66         chrome/browser/resources/shared/css/chromeos \
67         chrome/browser/resources/shared/js/chromeos_ \
68         chrome/browser/ui/android \
69         chrome/browser/ui/cocoa \
70         chrome/browser/ui/webui/chromeos \
71         chrome/browser/ui/webui/ntp/android \
72         chrome/browser/ui/webui/options/chromeos \
73         chrome/common/extensions/docs \
74         chrome/common/mac \
75         chrome/installer/mac \
76         chrome/installer/mac/third_party/xz/config/mac \
77         chrome/installer/tools \
78         chrome/third_party/jstemplate/tutorial_examples \
79         chrome/third_party/mock4js/examples \
80         chrome/third_party/wtl/ \
81         chrome/tools/build/chromeos \
82         chrome/tools/build/mac \
83         chrome/tools/build/win \
84         chrome/tools_ \
85         chrome_frame \
86         chromeos_ \
87         cloud_print/service/win \
88         cloud_print/virtual_driver/win \
89         content/app/android \
90         content/browser/android \
91         content/browser/renderer_host/java_ \
92         content/common/android \
93         content/common/mac_ \
94         content/components/navigation_interception/java \
95         content/components/web_contents_delegate_android/java \
96         content/public/android \
97         content/public/browser/android \
98         content/renderer/android \
99         content/renderer/java_ \
100         content/shell/android \
101         content/shell/mac \
102         data \
103         gears \
104         google_update \
105         gpu/command_buffer/docs \
106         gpu/demos \
107         gpu/tools_ \
108         media/audio/android \
109         media/audio/ios \
110         media/audio/mac \
111         media/audio/win \
112         media/base/android \
113         media/tools \
114         media/video/capture/mac \
115         media/video/capture/win \
116         media/webm/chromeos \
117         mesa/MesaLib/src/mesa/drivers/windows \
118         native_client/build/mac \
119         native_client/documentation \
120         native_client/src/include/win_ \
121         native_client/src/shared/imc/win \
122         native_client/src/shared/platform/win \
123         native_client/src/tools \
124         native_client/src/trusted/debug_stub/win \
125         native_client/src/trusted/desc/win \
126         native_client/src/trusted/nonnacl_util/win \
127         native_client/src/trusted/platform_qualify/win \
128         native_client/src/trusted/service_runtime/win_ \
129         native_client/tools \
130         native_client/tools/trusted_cross_toolchains \
131         native_client_sdk \
132         native_client_sdk/src/libraries/win \
133         net/android \
134         net/tools \
135         net/tools/testserver \
136         npapi/npspy/windows \
137         o3d \
138         o3d/documentation \
139         o3d/samples \
140         ppapi/c/documentation \
141         ppapi/cpp/documentation \
142         ppapi/native_client/src/tools \
143         ppapi/native_client/src/trusted/plugin/win \
144         ppapi/native_client/tools \
145         remoting/host/installer/mac \
146         remoting/host/installer/win \
147         remoting/host/mac \
148         remoting/host/setup/win \
149         remoting/host/win \
150         remoting/tools_ \
151         rlz/examples \
152         rlz/mac \
153         rlz/win \
154         sandbox/win/tools \
155         sandbox/win_ \
156         sdch/ios \
157         sdch/mac \
158         skia/config/win \
159         sync/tools \
160         tcmalloc/chromium/src/windows \
161         tcmalloc/vendor/src/windows \
162         third_party/WebKit/Source/JavaScriptCore/docs \
163         third_party/WebKit/Source/JavaScriptCore/tools \
164         third_party/WebKit/Source/Platform/chromium/public/android \
165         third_party/WebKit/Source/Platform/chromium/public/mac \
166         third_party/WebKit/Source/Platform/chromium/public/win \
167         third_party/WebKit/Source/ThirdParty/gtest/samples \
168         third_party/WebKit/Source/ThirdParty/gyp/samples \
169         third_party/WebKit/Source/ThirdParty/gyp/samples/samples \
170         third_party/WebKit/Source/ThirdParty/gyp/tools \
171         third_party/WebKit/Source/WTF/wtf/mac \
172         third_party/WebKit/Source/WTF/wtf/qt \
173         third_party/WebKit/Source/WTF/wtf/threads/win \
174         third_party/WebKit/Source/WTF/wtf/win \
175         third_party/WebKit/Source/WebCore/WebCore.gyp/mac \
176         third_party/WebKit/Source/WebCore/accessibility/mac \
177         third_party/WebKit/Source/WebCore/accessibility/qt \
178         third_party/WebKit/Source/WebCore/accessibility/win \
179         third_party/WebKit/Source/WebCore/bridge/qt \
180         third_party/WebKit/Source/WebCore/editing/android \
181         third_party/WebKit/Source/WebCore/editing/mac \
182         third_party/WebKit/Source/WebCore/editing/qt \
183         third_party/WebKit/Source/WebCore/history/android \
184         third_party/WebKit/Source/WebCore/history/mac \
185         third_party/WebKit/Source/WebCore/history/qt \
186         third_party/WebKit/Source/WebCore/loader/mac \
187         third_party/WebKit/Source/WebCore/loader/win \
188         third_party/WebKit/Source/WebCore/page/android \
189         third_party/WebKit/Source/WebCore/page/mac \
190         third_party/WebKit/Source/WebCore/page/qt \
191         third_party/WebKit/Source/WebCore/page/scrolling/mac \
192         third_party/WebKit/Source/WebCore/page/win \
193         third_party/WebKit/Source/WebCore/platform/android \
194         third_party/WebKit/Source/WebCore/platform/audio/mac \
195         third_party/WebKit/Source/WebCore/platform/audio/qt \
196         third_party/WebKit/Source/WebCore/platform/cf/win \
197         third_party/WebKit/Source/WebCore/platform/cocoa \
198         third_party/WebKit/Source/WebCore/platform/graphics/ca/mac \
199         third_party/WebKit/Source/WebCore/platform/graphics/ca/win \
200         third_party/WebKit/Source/WebCore/platform/graphics/cocoa \
201         third_party/WebKit/Source/WebCore/platform/graphics/gpu/mac \
202         third_party/WebKit/Source/WebCore/platform/graphics/gpu/qt \
203         third_party/WebKit/Source/WebCore/platform/graphics/mac \
204         third_party/WebKit/Source/WebCore/platform/graphics/qt \
205         third_party/WebKit/Source/WebCore/platform/graphics/surfaces/mac \
206         third_party/WebKit/Source/WebCore/platform/graphics/surfaces/qt \
207         third_party/WebKit/Source/WebCore/platform/graphics/surfaces/win \
208         third_party/WebKit/Source/WebCore/platform/graphics/win \
209         third_party/WebKit/Source/WebCore/platform/ios \
210         third_party/WebKit/Source/WebCore/platform/mac \
211         third_party/WebKit/Source/WebCore/platform/network/android \
212         third_party/WebKit/Source/WebCore/platform/network/mac \
213         third_party/WebKit/Source/WebCore/platform/network/qt \
214         third_party/WebKit/Source/WebCore/platform/network/win \
215         third_party/WebKit/Source/WebCore/platform/qt \
216         third_party/WebKit/Source/WebCore/platform/text/android \
217         third_party/WebKit/Source/WebCore/platform/text/mac \
218         third_party/WebKit/Source/WebCore/platform/text/qt \
219         third_party/WebKit/Source/WebCore/platform/text/win \
220         third_party/WebKit/Source/WebCore/platform/win \
221         third_party/WebKit/Source/WebCore/platform/wx/wxcode/mac \
222         third_party/WebKit/Source/WebCore/platform/wx/wxcode/win \
223         third_party/WebKit/Source/WebCore/plugins/mac \
224         third_party/WebKit/Source/WebCore/plugins/qt \
225         third_party/WebKit/Source/WebCore/plugins/win \
226         third_party/WebKit/Source/WebKit/chromium/public/android \
227         third_party/WebKit/Source/WebKit/chromium/public/mac_ \
228         third_party/WebKit/Source/WebKit/chromium/public/platform/android \
229         third_party/WebKit/Source/WebKit/chromium/public/platform/mac \
230         third_party/WebKit/Source/WebKit/chromium/public/platform/win \
231         third_party/WebKit/Source/WebKit/chromium/public/win \
232         third_party/WebKit/Source/WebKit/chromium/src/android \
233         third_party/WebKit/Source/WebKit/chromium/src/mac \
234         third_party/WebKit/Source/WebKit/chromium/src/win \
235         third_party/WebKit/Source/WebKit/gtk/docs \
236         third_party/WebKit/Source/WebKit/mac \
237         third_party/WebKit/Source/WebKit/qt \
238         third_party/WebKit/Source/WebKit/qt/docs \
239         third_party/WebKit/Source/WebKit/qt/examples \
240         third_party/WebKit/Source/WebKit/win \
241         third_party/WebKit/Source/WebKit/wx/bindings/python/samples \
242         third_party/WebKit/Source/WebKit2/Platform/CoreIPC/mac \
243         third_party/WebKit/Source/WebKit2/Platform/CoreIPC/win \
244         third_party/WebKit/Source/WebKit2/Platform/mac \
245         third_party/WebKit/Source/WebKit2/Platform/win \
246         third_party/WebKit/Source/WebKit2/PluginProcess/mac \
247         third_party/WebKit/Source/WebKit2/Shared/API/c/mac \
248         third_party/WebKit/Source/WebKit2/Shared/API/c/win \
249         third_party/WebKit/Source/WebKit2/Shared/Plugins/Netscape/mac \
250         third_party/WebKit/Source/WebKit2/Shared/Plugins/Netscape/win \
251         third_party/WebKit/Source/WebKit2/Shared/Plugins/mac \
252         third_party/WebKit/Source/WebKit2/Shared/cg/win \
253         third_party/WebKit/Source/WebKit2/Shared/mac \
254         third_party/WebKit/Source/WebKit2/Shared/win \
255         third_party/WebKit/Source/WebKit2/UIProcess/API/C/mac \
256         third_party/WebKit/Source/WebKit2/UIProcess/API/C/win \
257         third_party/WebKit/Source/WebKit2/UIProcess/API/mac \
258         third_party/WebKit/Source/WebKit2/UIProcess/Launcher/mac \
259         third_party/WebKit/Source/WebKit2/UIProcess/Launcher/win \
260         third_party/WebKit/Source/WebKit2/UIProcess/Plugins/mac \
261         third_party/WebKit/Source/WebKit2/UIProcess/Plugins/win \
262         third_party/WebKit/Source/WebKit2/UIProcess/mac \
263         third_party/WebKit/Source/WebKit2/UIProcess/win \
264         third_party/WebKit/Source/WebKit2/WebProcess/Authentication/mac \
265         third_party/WebKit/Source/WebKit2/WebProcess/Cookies/mac \
266         third_party/WebKit/Source/WebKit2/WebProcess/Downloads/cf/win \
267         third_party/WebKit/Source/WebKit2/WebProcess/Downloads/mac \
268         third_party/WebKit/Source/WebKit2/WebProcess/FullScreen/mac \
269         third_party/WebKit/Source/WebKit2/WebProcess/FullScreen/win \
270         third_party/WebKit/Source/WebKit2/WebProcess/InjectedBundle/API/c/win \
271         third_party/WebKit/Source/WebKit2/WebProcess/InjectedBundle/mac \
272         third_party/WebKit/Source/WebKit2/WebProcess/InjectedBundle/win \
273         third_party/WebKit/Source/WebKit2/WebProcess/Plugins/Netscape/mac \
274         third_party/WebKit/Source/WebKit2/WebProcess/Plugins/Netscape/win \
275         third_party/WebKit/Source/WebKit2/WebProcess/WebCoreSupport/mac \
276         third_party/WebKit/Source/WebKit2/WebProcess/WebCoreSupport/win \
277         third_party/WebKit/Source/WebKit2/WebProcess/WebPage/ca/mac \
278         third_party/WebKit/Source/WebKit2/WebProcess/WebPage/ca/win \
279         third_party/WebKit/Source/WebKit2/WebProcess/WebPage/mac \
280         third_party/WebKit/Source/WebKit2/WebProcess/WebPage/win \
281         third_party/WebKit/Source/WebKit2/WebProcess/mac \
282         third_party/WebKit/Source/WebKit2/WebProcess/win \
283         third_party/WebKit/Source/WebKit2/mac \
284         third_party/WebKit/Source/WebKit2/win \
285         third_party/WebKit/Tools/DumpRenderTree/mac \
286         third_party/WebKit/Tools/DumpRenderTree/qt \
287         third_party/WebKit/Tools/DumpRenderTree/win \
288         third_party/WebKit/Tools_ \
289         third_party/angle/extensions \
290         third_party/angle/samples \
291         third_party/angle/samples/gles2_book \
292         third_party/boost \
293         third_party/bsdiff \
294         third_party/bspatch \
295         third_party/cacheinvalidation/src/example-app-build \
296         third_party/cacheinvalidation/src/java \
297         third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android \
298         third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android \
299         third_party/cld/encodings/compact_lang_det/win_ \
300         third_party/cros_system_api_ \
301         third_party/ffmpeg/binaries \
302         third_party/ffmpeg/chromium/binaries/Chromium/win \
303         third_party/ffmpeg/chromium/config/Chrome/mac \
304         third_party/ffmpeg/chromium/config/Chrome/win \
305         third_party/ffmpeg/chromium/config/Chromium/mac \
306         third_party/ffmpeg/chromium/config/Chromium/win \
307         third_party/ffmpeg/chromium/include/win \
308         third_party/ffmpeg/doc \
309         third_party/ffmpeg/tools \
310         third_party/fuzzymatch \
311         third_party/gles2_book \
312         third_party/gles_book_examples \
313         third_party/gold \
314         third_party/hunspell/dictionaries \
315         third_party/hunspell_dictionaries \
316         third_party/hyphen/doc \
317         third_party/icu/android \
318         third_party/icu/mac \
319         third_party/lcov \
320         third_party/leveldatabase/src/doc \
321         third_party/leveldatabase/src/port/win \
322         third_party/libjingle/source/talk/examples \
323         third_party/libjpeg_turbo/mac \
324         third_party/libjpeg_turbo/win \
325         third_party/libva/va/android \
326         third_party/libvpx/source/config/mac \
327         third_party/libvpx/source/config/win \
328         third_party/libxml/mac \
329         third_party/lighttpd \
330         third_party/mesa/MesaLib/docs \
331         third_party/mesa/MesaLib/src/gallium/docs \
332         third_party/mozc/chrome/chromeos_ \
333         third_party/npapi/npspy/extern/java \
334         third_party/nspr \
335         third_party/nss \
336         third_party/ocmock \
337         third_party/openssl/config/android \
338         third_party/ots/tools \
339         third_party/pthread \
340         third_party/pyftpdlib \
341         third_party/re2/doc \
342         third_party/scons \
343         third_party/sfntly/cpp/src/sfntly/tools \
344         third_party/simplejson \
345         third_party/skia/include/utils/android \
346         third_party/skia/include/utils/ios \
347         third_party/skia/include/utils/mac \
348         third_party/skia/include/utils/win \
349         third_party/skia/include/views/android \
350         third_party/skia/src/gpu/gl/android \
351         third_party/skia/src/gpu/gl/mac \
352         third_party/skia/src/gpu/gl/win \
353         third_party/skia/src/utils/ios \
354         third_party/skia/src/utils/mac \
355         third_party/skia/src/utils/win \
356         third_party/skia/src/views/ios \
357         third_party/skia/src/views/mac \
358         third_party/skia/src/views/win \
359         third_party/snappy/mac \
360         third_party/sqlite/src/doc \
361         third_party/tcmalloc/vendor/doc \
362         third_party/tcmalloc_ \
363         third_party/trace-viewer/examples \
364         third_party/trace-viewer/third_party/pywebsocket/src/example \
365         third_party/v8-i18n/tools_ \
366         third_party/vc_80 \
367         third_party/webdriver/pylib/docs \
368         third_party/webrtc/modules/audio_device/android \
369         third_party/webrtc/modules/audio_device/ios \
370         third_party/webrtc/modules/audio_device/main/source/mac \
371         third_party/webrtc/modules/audio_device/main/source/win \
372         third_party/webrtc/modules/audio_device/win \
373         third_party/webrtc/modules/video_capture/android/java \
374         third_party/webrtc/modules/video_capture/main/source/android \
375         third_party/webrtc/modules/video_coding/codecs/tools_ \
376         third_party/webrtc/modules/video_render/android/java \
377         third_party/webrtc/modules/video_render/main/source/android \
378         third_party/webrtc/modules/video_render/main/source/mac \
379         third_party/webrtc/system_wrappers/source/android \
380         third_party/webrtc/tools_ \
381         third_party/yasm/source/config/android \
382         third_party/yasm/source/config/mac \
383         third_party/yasm/source/config/win \
384         tools/android \
385         tools/gyp/samples \
386         tools/gyp/samples/samples \
387         tools/gyp/tools \
388         tools/mac \
389         tools/site_compare \
390         tools/stats_viewer \
391         tools/symsrc \
392         tools/valgrind \
393         tools/win \
394         tools/wine_valgrind \
395         ui/android \
396         ui/base/cocoa \
397         ui/base/ime/win \
398         ui/base/win_ \
399         ui/gfx/android \
400         ui/gfx/mac \
401         ui/resources/default_100_percent/cros_ \
402         ui/resources/default_200_percent/cros_ \
403         ui/views/examples \
404         ui/views/win \
405         v8/samples \
406         v8/tools_ \
407         webkit/chromeos \
408         webkit/media/android \
409         webkit/tools_ \
410         webrtc/modules/video_capture/windows \
411         webrtc/modules/video_render/windows \
412         win8 \
413         ; do
414                 rm -vfr "$dir"
415         done
416 }
417
418 # There are directories we want to strip, but that are unnecessarily required by the build-system
419 # So we drop everything but the gyp/gypi files
420 almost_strip_dirs() {
421         local dir
422         for dir in \
423                 breakpad \
424                 build/ios \
425                 courgette \
426                 third_party/cros_dbus_cplusplus \
427                 ; do
428                 find $dir -depth -mindepth 1 \! \( -name '*.gyp' -o -name '*.gypi' \) -print -delete || :
429         done
430
431         find tools -type f \
432                 '!' -iname '*.gyp*' \
433                 '!' -path 'tools/build/*' \
434                 '!' -path 'tools/clang/scripts/plugin_flags.sh' \
435                 '!' -path 'tools/generate_library_loader/*' \
436                 '!' -path 'tools/generate_shim_headers/generate_shim_headers.py' \
437                 '!' -path 'tools/generate_stubs/*' \
438                 '!' -path 'tools/grit/*' \
439                 '!' -path 'tools/gritsettings/*' \
440                 '!' -path 'tools/gyp/*' \
441                 '!' -path 'tools/json_comment_eater.py' \
442                 '!' -path 'tools/json_schema_compiler/*' \
443                 '!' -path 'tools/json_to_struct/*' \
444                 '!' -path 'tools/protoc_wrapper/*' \
445                 '!' -path 'tools/uuidgen.py' \
446                 '!' -path 'tools/zip2msi.py' \
447                 '!' -path 'tools/usb_ids/*' \
448                 -print -delete
449 }
450
451 # clean third party
452 # list based from archlinux PKGBUILD
453 # https://aur.archlinux.org/packages/ch/chromium-dev/PKGBUILD
454 clean_third_party() {
455         local dir
456         for dir in \
457                 third_party/ashmem \
458                 third_party/npapi/npspy \
459                 third_party/re2/benchlog \
460                 third_party/eyesfree \
461                 third_party/guava \
462                 third_party/icon_family \
463                 third_party/isimpledom \
464                 third_party/jsoncpp \
465                 third_party/jsr-305 \
466                 third_party/libexif \
467                 third_party/mach_override \
468                 third_party/snappy \
469                 third_party/iaccessible2 \
470                 third_party/sudden_motion_sensor \
471                 third_party/sqlite/*.patch \
472                 third_party/sqlite/src/*.patch \
473                 ; do
474                 rm -vfr "$dir"
475         done
476
477         find third_party -type f \! -iname '*.gyp*' \
478                 \! -path 'third_party/WebKit/*' \
479                 \! -path 'third_party/adobe/flash/*' \
480                 \! -path 'third_party/angle/*' \
481                 \! -path 'third_party/cacheinvalidation/*' \
482                 \! -path 'third_party/cld/*' \
483                 \! -path 'third_party/cros_system_api/*' \
484                 \! -path 'third_party/flac/flac.h' \
485                 \! -path 'third_party/flot/*.js' \
486                 \! -path 'third_party/hunspell/*' \
487                 \! -path 'third_party/hyphen/*' \
488                 \! -path 'third_party/iccjpeg/*' \
489                 \! -path 'third_party/khronos/*' \
490                 \! -path 'third_party/leveldatabase/*' \
491                 \! -path 'third_party/libXNVCtrl/*' \
492                 \! -path 'third_party/libjingle/*' \
493                 \! -path 'third_party/libphonenumber/*' \
494                 \! -path 'third_party/libusb/libusb.h' \
495                 \! -path 'third_party/libva/*' \
496                 \! -path 'third_party/libvpx/libvpx.h' \
497                 \! -path 'third_party/libxml/chromium/*' \
498                 \! -path 'third_party/libyuv/*' \
499                 \! -path 'third_party/lss/*.h' \
500                 \! -path 'third_party/mesa/*' \
501                 \! -path 'third_party/modp_b64/*' \
502                 \! -path 'third_party/mt19937ar/*' \
503                 \! -path 'third_party/npapi/*' \
504                 \! -path 'third_party/opus/opus.h*' \
505                 \! -path 'third_party/ots/*' \
506                 \! -path 'third_party/protobuf/*' \
507                 \! -path 'third_party/qcms/*' \
508                 \! -path 'third_party/re2/*' \
509                 \! -path 'third_party/sfntly/*' \
510                 \! -path 'third_party/skia/*' \
511                 \! -path 'third_party/smhasher/*' \
512                 \! -path 'third_party/speex/speex.h' \
513                 \! -path 'third_party/sqlite/*' \
514                 \! -path 'third_party/tcmalloc/*' \
515                 \! -path 'third_party/trace-viewer/*' \
516                 \! -path 'third_party/undoview/*' \
517                 \! -path 'third_party/v8-i18n/*' \
518                 \! -path 'third_party/v8/*' \
519                 \! -path 'third_party/webrtc/*' \
520                 \! -path 'third_party/widevine/*' \
521                 -print -delete
522
523         rm -vf third_party/expat/files/lib/expat.h
524 }
525
526 # parts based on ubuntu debian/rules
527 # http://bazaar.launchpad.net/~chromium-team/chromium-browser/chromium-browser.head/view/head:/debian/rules
528 remove_bin_only() {
529         find -type f \( \
530                 -iname \*.exe -o \
531                 -iname \*.nexe -o \
532                 -iname \*.fon -o \
533                 -iname \*.ttf  -o \
534                 -iname \*.dll -o \
535                 -iname \*.pdb -o \
536                 -name \*.o -o \
537                 -name \*.a -o \
538                 -name \*.dylib \
539         \) -exec rm -fv {} \;
540 }
541
542 # removes dir, if the bcond is not turned off
543 strip_system_dirs() {
544         local dir lib bcond
545         for dir in "$@"; do
546                 lib=${dir##*/}
547                 bcond=$(eval echo \$$lib)
548                 [ "${bcond:-1}" = 0 ] && continue
549
550                 # skip already removed dirs
551                 test -d $dir || continue
552
553                 find $dir -depth -mindepth 1 \! \( -name '*.gyp' -o -name '*.gypi' -o -path $dir/$lib.h \) -print -delete
554         done
555 }
556
557 # remove test data and files
558 # some scanned with find -name tests -o -name test -o -name test_data -o name testdata
559 # and find -iname *test*
560 remove_tests() {
561         local dir
562
563         # full remove
564         for dir in \
565         ash/test \
566         base/test \
567         breakpad/src/client/windows/tests \
568         breakpad/src/common/linux/tests \
569         breakpad/src/common/tests \
570         cc/test \
571         chrome/browser/chromeos/bluetooth/test \
572         chrome/browser/component_updater/test \
573         chrome/browser/extensions/api/test_ \
574         chrome/browser/printing/cloud_print/test \
575         chrome/browser/resources/gaia_auth/test \
576         chrome/browser/resources/tracing/tests \
577         chrome/browser/sync/test \
578         chrome/browser/ui/cocoa/test \
579         chrome/browser/ui/gtk/test \
580         chrome/browser/ui/tests \
581         chrome/browser/ui/views/test \
582         chrome/installer/test \
583         chrome/test/chromeos \
584         chrome/test/data/firefox2_nss_mac \
585         chrome/test/data/safe_browsing/old \
586         chrome/test/logging/win \
587         chrome/test/pyautolib/chromeos \
588         chrome/test/webdriver/test \
589         chrome/test_ \
590         chrome/tools/test \
591         chrome_frame/test \
592         chrome_frame/tools/test \
593         content/browser/worker_host/test \
594         content/common/gpu/testdata \
595         content/public/test \
596         content/test \
597         courgette/testdata \
598         device/bluetooth/test \
599         device/test \
600         gpu/command_buffer/tests \
601         media/test \
602         media/tools/layout_tests/test_data \
603         native_client/buildbot \
604         native_client/src/shared/platform/testdata \
605         native_client/src/trusted/gio/testdata \
606         native_client/src/trusted/interval_multiset/testdata \
607         native_client/src/trusted/service_runtime/testdata \
608         native_client/src/trusted/validator/x86/decoder/generator/testdata \
609         native_client/src/trusted/validator/x86/testing \
610         native_client/src/trusted/validator_arm/testdata \
611         native_client/src/trusted/validator_mips/testdata \
612         native_client/src/trusted/validator_x86/testdata \
613         native_client/tests \
614         native_client/tools/testdata \
615         native_client/tools/tests \
616         native_client_sdk/src/build_tools/tests \
617         native_client_sdk/src/libraries/c_salt/test \
618         net/test \
619         o3d/tests \
620         ppapi/native_client/tests \
621         ppapi/tests \
622         printing/test \
623         rlz/test \
624         sandbox/linux/seccomp-legacy/tests \
625         sandbox/linux/tests \
626         sandbox/tests \
627         sandbox/win/tests \
628         sdch/open-vcdiff/testdata \
629         seccompsandbox/tests \
630         sync/internal_api/public/test \
631         sync/internal_api/test \
632         sync/test \
633         testing/android \
634         testing/gmock/scripts/test \
635         testing/gmock/test \
636         testing/gtest/scripts/test \
637         testing/gtest/test \
638         third_party/WebKit/LayoutTests \
639         third_party/WebKit/Source/JavaScriptCore/API/tests \
640         third_party/WebKit/Source/JavaScriptCore/qt/tests \
641         third_party/WebKit/Source/JavaScriptCore/tests \
642         third_party/WebKit/Source/ThirdParty/gtest/scripts/test \
643         third_party/WebKit/Source/ThirdParty/gtest/test \
644         third_party/WebKit/Source/ThirdParty/gyp/test \
645         third_party/WebKit/Source/ThirdParty/qunit/test \
646         third_party/WebKit/Source/WebCore/bindings/scripts/test \
647         third_party/WebKit/Source/WebCore/testing_ \
648         third_party/WebKit/Source/WebKit/chromium/tests \
649         third_party/WebKit/Source/WebKit/efl/tests \
650         third_party/WebKit/Source/WebKit/gtk/tests \
651         third_party/WebKit/Source/WebKit/qt/tests \
652         third_party/WebKit/Source/WebKit2/UIProcess/API/efl/tests \
653         third_party/WebKit/Source/WebKit2/UIProcess/API/gtk/tests \
654         third_party/WebKit/Source/WebKit2/UIProcess/API/qt/tests \
655         third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/mac \
656         third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win \
657         third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/mac \
658         third_party/WebKit/Tools/DumpRenderTree/TestNetscapePlugIn/win \
659         third_party/WebKit/Tools/Scripts/webkitpy/test \
660         third_party/WebKit/Tools/TestWebKitAPI/Tests/TestWebKitAPI/mac \
661         third_party/WebKit/Tools/TestWebKitAPI/Tests/WebKit/win \
662         third_party/WebKit/Tools/TestWebKitAPI/Tests/WebKit2/mac \
663         third_party/WebKit/Tools/TestWebKitAPI/Tests/WebKit2/win \
664         third_party/WebKit/Tools/TestWebKitAPI/Tests/mac \
665         third_party/WebKit/Tools/TestWebKitAPI/mac \
666         third_party/WebKit/Tools/TestWebKitAPI/win \
667         third_party/angle/tests \
668         third_party/cacheinvalidation/files/src/google/cacheinvalidation/test \
669         third_party/cacheinvalidation/src/google/cacheinvalidation/test \
670         third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/testing \
671         third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/testing/android \
672         third_party/ffmpeg/tests \
673         third_party/harfbuzz/tests \
674         third_party/hunspell/tests \
675         third_party/hyphen/tests \
676         third_party/libexif/sources/test \
677         third_party/libjingle/source/talk/app/webrtc/test \
678         third_party/libjingle/source/talk/media/testdata \
679         third_party/libphonenumber/src/resources/test \
680         third_party/libphonenumber/src/test \
681         third_party/libsrtp/srtp/crypto/test \
682         third_party/libsrtp/srtp/test \
683         third_party/libyuv/unit_test/testdata \
684         third_party/mesa/MesaLib/src/gallium/tests \
685         third_party/openssl/openssl/crypto/des/t/test \
686         third_party/openssl/openssl/test \
687         third_party/ots/test \
688         third_party/protobuf/src/google/protobuf/testdata \
689         third_party/protobuf/src/google/protobuf/testing \
690         third_party/re2/re2/testing \
691         third_party/safe_browsing/testing \
692         third_party/sfntly/cpp/src/test \
693         third_party/sqlite/src/test \
694         third_party/sqlite/test \
695         third_party/talloc/libreplace/test \
696         third_party/tcmalloc/chromium/src/tests \
697         third_party/tcmalloc/vendor/src/tests \
698         third_party/tlslite/test \
699         third_party/trace-viewer/test_data \
700         third_party/trace-viewer/third_party/pywebsocket/src/test \
701         third_party/trace-viewer/third_party/pywebsocket/src/test/testdata \
702         third_party/v8-i18n/tests \
703         third_party/webdriver/pylib/test \
704         third_party/webdriver/test_data \
705         third_party/webrtc/modules/audio_device/test/android \
706         third_party/webrtc/modules/audio_processing/test/android \
707         third_party/webrtc/modules/utility/test \
708         third_party/webrtc/modules/video_capture/main/test/android \
709         third_party/webrtc/system_wrappers/test \
710         third_party/webrtc/test \
711         third_party/webrtc/test/testsupport/mac \
712         third_party/webrtc/video_engine/test/android \
713         third_party/webrtc/video_engine/test/auto_test/android \
714         third_party/webrtc/voice_engine/test/android \
715         third_party/xdg-utils/tests \
716         third_party/yasm/source/patched-yasm/libyasm/tests \
717         third_party/yasm/source/patched-yasm/modules/arch/lc3b/tests \
718         third_party/yasm/source/patched-yasm/modules/arch/x86/tests \
719         third_party/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/tests \
720         third_party/yasm/source/patched-yasm/modules/dbgfmts/stabs/tests \
721         third_party/yasm/source/patched-yasm/modules/objfmts/bin/tests \
722         third_party/yasm/source/patched-yasm/modules/objfmts/coff/tests \
723         third_party/yasm/source/patched-yasm/modules/objfmts/elf/tests \
724         third_party/yasm/source/patched-yasm/modules/objfmts/macho/tests \
725         third_party/yasm/source/patched-yasm/modules/objfmts/rdf/tests \
726         third_party/yasm/source/patched-yasm/modules/objfmts/win32/tests \
727         third_party/yasm/source/patched-yasm/modules/objfmts/win64/tests \
728         third_party/yasm/source/patched-yasm/modules/objfmts/xdf/tests \
729         third_party/yasm/source/patched-yasm/modules/parsers/gas/tests \
730         third_party/yasm/source/patched-yasm/modules/parsers/nasm/tests \
731         third_party/yasm/source/patched-yasm/modules/parsers/tasm/tests \
732         third_party/yasm/source/patched-yasm/modules/preprocs/nasm/tests \
733         third_party/yasm/source/patched-yasm/modules/preprocs/raw/tests \
734         third_party/yasm/source/patched-yasm/tools/python-yasm/tests \
735         tools/clang/plugins/tests \
736         tools/grit/grit/testdata \
737         tools/gyp/test \
738         tools/gyp/tools/emacs/testdata \
739         tools/page_cycler/webpagereplay/tests \
740         tools/perf_expectations/tests \
741         tools/swarm_client/tests \
742         ui/app_list/test \
743         ui/aura/test \
744         ui/base/test \
745         ui/compositor/test \
746         ui/gfx/test \
747         ui/test \
748         ui/views/test \
749         v8/test \
750         webkit/compositor_bindings/test \
751         webkit/data/layout_tests \
752         webkit/plugins/npapi/test \
753         webkit/tools/test/reference_build \
754         webkit/tools/test_shell/mac \
755         ; do
756                 rm -vfr "$dir"
757         done
758
759         # partial remove (keep .gyp)
760         for dir in \
761                 chrome/browser/nacl_host/test \
762                 chrome/test/data \
763                 testing \
764                 third_party/webrtc/modules/audio_coding/codecs/cng/test \
765                 third_party/webrtc/modules/audio_coding/codecs/g711/test \
766                 third_party/webrtc/modules/audio_coding/codecs/g722/test \
767                 third_party/webrtc/modules/audio_coding/codecs/ilbc/test \
768                 third_party/webrtc/modules/audio_coding/codecs/isac/fix/test \
769                 third_party/webrtc/modules/audio_coding/codecs/isac/main/test \
770                 third_party/webrtc/modules/audio_coding/main/test \
771                 third_party/webrtc/modules/audio_coding/neteq/test \
772                 third_party/webrtc/modules/audio_conference_mixer/test \
773                 third_party/webrtc/modules/audio_device/test \
774                 third_party/webrtc/modules/audio_processing/test \
775                 third_party/webrtc/modules/rtp_rtcp/test \
776                 third_party/webrtc/modules/udp_transport/test \
777                 third_party/webrtc/modules/video_capture/main/test \
778                 third_party/webrtc/modules/video_coding/codecs/test \
779                 third_party/webrtc/modules/video_coding/codecs/vp8/test \
780                 third_party/webrtc/modules/video_coding/main/test \
781                 third_party/webrtc/modules/video_processing/main/test \
782                 third_party/webrtc/modules/video_render/main/test \
783                 third_party/webrtc/video_engine/test \
784                 third_party/webrtc/voice_engine/test \
785                 tools/json_schema_compiler/test \
786                 ; do
787                 find $dir -depth -mindepth 1 '!' '(' -name '*.gyp' -o -name '*.gypi' ')' -print -delete || :
788         done
789
790         # link headers from system dir. too many files to patch, we don't even build tests
791         install -d testing/gtest/include
792         ln -s /usr/include/gtest testing/gtest/include/gtest
793
794         # delete unittest files
795         find . '(' \
796                 -name '*_unittest*.*' \
797                 -o -name '*_unittest.*' \
798                 -o -name '*_unittest' \
799                 -o -name 'test_*.*' \
800                 -o -name '*_test.*' \
801         ')' '!' -name '*.gyp*' \
802                 '!' -name '*.isolate' \
803                 '!' -name '*.grd' \
804                 '!' -path './chrome/browser/diagnostics/diagnostics_test.*' \
805                 '!' -path './chrome/browser/extensions/api/declarative/test_rules_registry.*' \
806                 '!' -path './chrome/browser/extensions/api/test/test_api.*' \
807                 '!' -path './chrome/browser/resources/net_internals/*' \
808                 '!' -path './chrome/browser/ui/webui/test_chrome_web_ui_controller_factory*' \
809                 '!' -path './chrome/common/net/test_server_locations.*' \
810                 '!' -path './chrome/test/base/test_switches.*' \
811                 '!' -path './chrome/test/perf/browser_perf_test.*' \
812                 '!' -path './chrome/test/perf/perf_test.*' \
813                 '!' -path './native_client/src/trusted/fault_injection/test_injection.*' \
814                 '!' -path './native_client/src/trusted/service_runtime/env_cleanser_test.h' \
815                 '!' -path './net/base/test_completion_callback.*' \
816                 '!' -path './net/base/test_data_stream.*' \
817                 '!' -path './net/base/test_root_certs*' \
818                 '!' -path './remoting/base/resources_unittest.*' \
819                 '!' -path './third_party/skia/src/gpu/gr_unittests.*' \
820                 '!' -path './ui/compositor/test_web_graphics_context_3d.*' \
821                 '!' -path './webkit/fileapi/test_mount_point_provider.*' \
822         -print -delete || :
823 }
824
825 remove_nonessential_dirs > REMOVED-nonessential_dirs.txt
826 almost_strip_dirs > REMOVED-stripped.txt
827 remove_bin_only > REMOVED-bin_only.txt
828 remove_tests > REMOVED-tests.txt
829
830 strip_system_dirs \
831         native_client/src/third_party_mod/jsoncpp \
832         third_party/bzip2 \
833         third_party/flac \
834         third_party/icu \
835         third_party/jsoncpp \
836         third_party/libXNVCtrl \
837         third_party/libevent \
838         third_party/libexif \
839         third_party/libjpeg \
840         third_party/libmtp \
841         third_party/libpng \
842         third_party/libsrtp \
843         third_party/libusb \
844         third_party/libvpx \
845         third_party/libwebp \
846         third_party/libxml_ \
847         third_party/libxslt \
848         third_party/opus \
849         third_party/protobuf \
850         third_party/speex \
851         third_party/yasm \
852         third_party/zlib \
853         v8 \
854 > REMOVED-system_dirs.txt
855
856 clean_third_party > REMOVED-third_party.txt
857
858 if [ "${v8:-1}" != "0" ]; then
859         # The implementation files include v8 headers with full path,
860         # like #include "v8/include/v8.h". Make sure the system headers
861         # will be used.
862         rm -rf v8/include
863         ln -s /usr/include v8/include
864 fi
865
866 if [ "${nacl:-1}" != "0" ]; then
867         # NOTE: here is always x86_64
868         rm -rf native_client/toolchain/linux_x86_newlib
869 fi
870
871 if [ "${emptydirs:-0}" != "0" ]; then
872         # cleanup empty dirs
873         find -type d '!' -name '.' -print0 | sort -zr | xargs -0 rmdir --ignore-fail-on-non-empty > REMOVED-dirs.txt
874 fi
875
876 # report what's in them
877 for a in REMOVED-*.txt; do
878         cat $a
879 done
This page took 0.137012 seconds and 3 git commands to generate.