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