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