]> git.pld-linux.org Git - packages/chromium-browser.git/blob - clean-source.sh
need chrome/test/data/nacl/nacl_test_data.gyp by chrome/chrome.gyp
[packages/chromium-browser.git] / clean-source.sh
1 #!/bin/sh
2 set -e
3 set -x
4
5 # import options
6 # remove everything unless it's remove has been disabled with "0"
7 # "v8=0" means "do not remove v8"
8 eval "$@"
9
10 # drop bundled libs, from gentoo
11 gyp_clean() {
12         local l lib=$1
13         echo "Removing bundled library $lib ..."
14         l=$(find "$lib" -mindepth 1 ! -iname '*.gyp*' -print -delete | wc -l)
15         if [ $l -eq 0 ]; then
16                 echo >&2 "No files matched when removing bundled library $1"
17                 exit 1
18         fi
19 }
20
21 # https://code.google.com/p/chromium/wiki/LinuxPackaging
22 # initial list from src/tools/export_tarball/export_tarball.py
23 # some scanned with find -name tests -o -name test -o -name test_data
24 remove_nonessential_dirs() {
25         local dir
26         for dir in \
27         chrome/common/extensions/docs \
28         chrome/tools/test/reference_build \
29         courgette/testdata \
30         data \
31         native_client/src/trusted/service_runtime/testdata \
32         o3d/documentation \
33         o3d/samples \
34         o3d/tests \
35         third_party/angle/samples/gles2_book \
36         third_party/hunspell_dictionaries \
37         third_party/hunspell/tests \
38         third_party/lighttpd \
39         third_party/sqlite/test \
40         third_party/vc_80 \
41         third_party/xdg-utils/tests \
42         third_party/yasm/source/patched-yasm/modules/arch/x86/tests \
43         third_party/yasm/source/patched-yasm/modules/dbgfmts/dwarf2/tests \
44         third_party/yasm/source/patched-yasm/modules/objfmts/bin/tests \
45         third_party/yasm/source/patched-yasm/modules/objfmts/coff/tests \
46         third_party/yasm/source/patched-yasm/modules/objfmts/elf/tests \
47         third_party/yasm/source/patched-yasm/modules/objfmts/macho/tests \
48         third_party/yasm/source/patched-yasm/modules/objfmts/rdf/tests \
49         third_party/yasm/source/patched-yasm/modules/objfmts/win32/tests \
50         third_party/yasm/source/patched-yasm/modules/objfmts/win64/tests \
51         third_party/yasm/source/patched-yasm/modules/objfmts/xdf/tests \
52         third_party/WebKit/Source/JavaScriptCore/tests \
53         third_party/WebKit/LayoutTests \
54         \
55         breakpad/src/client/mac/tests \
56         breakpad/src/client/windows/tests \
57         breakpad/src/common/linux/tests \
58         breakpad/src/common/tests \
59         chrome/browser/resources/tracing/tests \
60         chrome/browser/ui/tests \
61         content/test/data/layout_tests/LayoutTests/http/tests \
62         content/test/data/layout_tests/LayoutTests/http/tests/websocket/tests \
63         content/test/data/layout_tests/LayoutTests/platform/chromium-win/http/tests \
64         gpu/command_buffer/tests \
65         native_client/tests \
66         native_client/tools/tests \
67         native_client_sdk/src/build_tools/tests \
68         ppapi/native_client/tests \
69         ppapi/tests \
70         sandbox/tests \
71         seccompsandbox/tests \
72         third_party/WebKit/Source/JavaScriptCore/API/tests \
73         third_party/WebKit/Source/JavaScriptCore/qt/tests \
74         third_party/WebKit/Source/WebKit/chromium/tests \
75         third_party/WebKit/Source/WebKit/gtk/tests \
76         third_party/WebKit/Source/WebKit/qt/tests \
77         third_party/WebKit/Source/WebKit2/UIProcess/API/gtk/tests \
78         third_party/WebKit/Source/WebKit2/UIProcess/API/qt/tests \
79         third_party/angle/tests \
80         third_party/ffmpeg/tests \
81         third_party/harfbuzz/tests \
82         third_party/hyphen/tests \
83         third_party/mesa/MesaLib/src/gallium/tests \
84         third_party/mesa/MesaLib/src/gallium/tests/python/tests \
85         third_party/tcmalloc/chromium/src/tests \
86         third_party/tcmalloc/vendor/src/tests \
87         third_party/yasm/source/patched-yasm/libyasm/tests \
88         third_party/yasm/source/patched-yasm/modules/arch/lc3b/tests \
89         third_party/yasm/source/patched-yasm/modules/dbgfmts/stabs/tests \
90         third_party/yasm/source/patched-yasm/modules/parsers/gas/tests \
91         third_party/yasm/source/patched-yasm/modules/parsers/nasm/tests \
92         third_party/yasm/source/patched-yasm/modules/parsers/tasm/tests \
93         third_party/yasm/source/patched-yasm/modules/preprocs/nasm/tests \
94         third_party/yasm/source/patched-yasm/modules/preprocs/raw/tests \
95         third_party/yasm/source/patched-yasm/tools/python-yasm/tests \
96         tools/clang/plugins/tests \
97         tools/page_cycler/webpagereplay/tests \
98         tools/perf_expectations/tests \
99         \
100         v8/test \
101         webkit/data/layout_tests \
102         webkit/tools/test/reference_build \
103         \
104         tools/site_compare \
105         tools/stats_viewer \
106         tools/symsrc \
107         tools/valgrind \
108         tools/gyp/test \
109         \
110         ash/test \
111         base/android/javatests/src/org/chromium/base/test \
112         base/test \
113         chrome/browser/chromeos/bluetooth/test \
114         chrome/browser/component_updater/test \
115         chrome/browser/printing/cloud_print/test \
116         chrome/browser/resources/gaia_auth/test \
117         chrome/browser/sync/test \
118         chrome/installer/test \
119         chrome/test/webdriver/test \
120         chrome/tools/test \
121         chrome_frame/test \
122         chrome_frame/tools/test \
123         content/browser/worker_host/test \
124         content/public/test \
125         content/test \
126         media/test \
127         media/tools/layout_tests/test_data \
128         native_client_sdk/src/libraries/c_salt/test \
129         net/test \
130         printing/test \
131         rlz/test \
132         sandbox/linux/seccomp-legacy/tests \
133         sandbox/linux/tests \
134         sandbox/win/tests \
135         sync/internal_api/public/test \
136         sync/internal_api/test \
137         sync/test \
138         testing/gmock/scripts/test \
139         testing/gmock/test \
140         testing/gtest/scripts/test \
141         testing/gtest/test \
142         third_party/WebKit/Source/ThirdParty/gtest/scripts/test \
143         third_party/WebKit/Source/ThirdParty/gtest/test \
144         third_party/WebKit/Source/ThirdParty/gyp/test \
145         third_party/WebKit/Source/ThirdParty/qunit/test \
146         third_party/WebKit/Source/WebCore/bindings/scripts/test \
147         third_party/WebKit/Source/WebKit/efl/tests \
148         third_party/WebKit/Source/WebKit2/UIProcess/API/efl/tests \
149         third_party/WebKit/Tools/Scripts/webkitpy/test \
150         third_party/cacheinvalidation/files/src/google/cacheinvalidation/test \
151         third_party/libexif/sources/test \
152         third_party/libjingle/source/talk/app/webrtc/test \
153         third_party/libphonenumber/src/resources/test \
154         third_party/libphonenumber/src/test \
155         third_party/libsrtp/srtp/crypto/test \
156         third_party/libsrtp/srtp/test \
157         third_party/openssl/openssl/crypto/des/t/test \
158         third_party/openssl/openssl/test \
159         third_party/ots/test \
160         third_party/sfntly/cpp/src/test \
161         third_party/sqlite/src/test \
162         third_party/talloc/libreplace/test \
163         third_party/tlslite/test \
164         third_party/trace-viewer/test_data \
165         third_party/v8-i18n/tests \
166         third_party/webdriver/pylib/test \
167         third_party/webdriver/test_data \
168         ui/app_list/test \
169         ui/aura/test \
170         ui/base/test \
171         ui/compositor/test \
172         ui/gfx/test \
173         ui/test \
174         ui/views/test \
175         webkit/plugins/npapi/test \
176         ; do
177                 rm -vfr "$dir"
178         done
179 }
180
181 # Strip tarball from some big directories not needed on the linux platform
182 strip_dirs() {
183         # prefix with _ those that we can't remove (just yet) because of the gclient
184         # hooks (see build/all.gyp) or of some unneeded deps/includes
185
186         local dir
187         for dir in \
188                 chrome/test/data/safe_browsing/old \
189                 chrome/test/data/firefox2_nss_mac \
190                 chrome/third_party/wtl/ \
191                 gears \
192                 google_update \
193                 o3d \
194                 third_party/boost \
195                 third_party/bsdiff \
196                 third_party/bspatch \
197                 third_party/ffmpeg/binaries \
198                 third_party/fuzzymatch \
199                 third_party/gles_book_examples \
200                 third_party/hunspell/dictionaries \
201                 third_party/icu/mac \
202                 third_party/lcov \
203                 third_party/lighttpd \
204                 third_party/nspr \
205                 third_party/nss \
206                 third_party/ocmock \
207                 third_party/pthread \
208                 third_party/pyftpdlib \
209                 third_party/simplejson \
210                 third_party/scons \
211                 _third_party/tcmalloc \
212                 tools/symsrc \
213                 tools/site_compare \
214                 tools/stats_viewer \
215                 tools/valgrind \
216                 tools/wine_valgrind \
217                 v8/test/cctest \
218                 webkit/data/layout_tests \
219         ; do
220                 rm -vfr "$dir"
221         done
222 }
223
224 # parts based on ubuntu debian/rules
225 # http://bazaar.launchpad.net/~chromium-team/chromium-browser/chromium-browser.head/view/head:/debian/rules
226
227 remove_bin_only() {
228         find . -type f \( \
229                 -iname \*.exe -o \
230                 -iname \*.dll -o \
231                 -iname \*.pdb -o \
232                 -name \*.o -o \
233                 -name \*.a -o \
234                 -name \*.dylib \
235         \) -exec rm -fv {} \;
236 }
237
238 # removes dir, if the bcond is not turned off
239 strip_system_dirs() {
240         local dir lib bcond
241         for dir in "$@"; do
242                 lib=${dir##*/}
243                 bcond=$(eval echo \$$lib)
244                 [ "${bcond:-1}" = 0 ] && continue
245
246                 # skip already removed dirs
247                 test -d $dir || continue
248
249                 # here we ignore errors, as some dirs contain README.chromium after removal
250                 find $dir -depth -mindepth 1 \! \( -name \*.gyp -o -name \*.gypi -o -name README.chromium -o -name \*.patch \) -print -delete || :
251         done
252 }
253
254 # There are directories we want to strip, but that are unnecessarily required by the build-system
255 # So we drop everything but the gyp/gypi files and README.chromium (to see what that dir contained)
256 almost_strip_dirs() {
257         local dir
258         for dir in "$@"; do
259                 find $dir -depth -mindepth 1 \! \( -name \*.gyp -o -name \*.gypi -o -name README.chromium \) -print -delete || :
260         done
261 }
262
263 remove_nonessential_dirs | tee -a REMOVED-nonessential_dirs.txt
264 remove_bin_only | tee -a REMOVED-bin_only.txt
265
266 strip_dirs | tee -a REMOVED-stripped.txt
267
268 almost_strip_dirs \
269         courgette \
270         chrome/test/data \
271         third_party/gles2_book \
272 | tee -a REMOVED-stripped.txt
273
274 strip_system_dirs \
275         third_party/bzip2 \
276         third_party/icu \
277         third_party/libevent \
278         third_party/libjpeg \
279         third_party/libpng \
280         _third_party/libxml \
281         third_party/libxslt \
282         _third_party/zlib \
283         third_party/libwebp \
284         _third_party/libvpx \
285         v8 \
286 | tee -a REMOVED-stripped.txt
287
288 # vpx can't be cleaned:
289 #make: *** No rule to make target `out/Release/obj.target/libvpx_asm_offsets/third_party/libvpx/source/libvpx/vp8/common/asm_com_offsets.o',
290 #needed by `out/Release/obj.target/third_party/libvpx/libvpx_asm_offsets.a'.  Stop.
291
292 # third_party/yasm/source/patched-yasm/modules/arch/x86/gen_x86_insn.py', needed by `out/Release/obj/gen/third_party/yasm/x86insns.c'. Stop.
293 #gyp_clean third_party/yasm
294
295 rm -vf third_party/expat/files/lib/expat.h
296
297 if [ "${v8:-1}" != "0" ]; then
298         # The implementation files include v8 headers with full path,
299         # like #include "v8/include/v8.h". Make sure the system headers
300         # will be used.
301         rm -rf v8/include
302         ln -s /usr/include v8/include
303 fi
304
305 if [ "${nacl:-1}" != "0" ]; then
306         # NOTE: here is always x86_64
307         rm -rf native_client/toolchain/linux_x86_newlib
308 fi
This page took 0.076993 seconds and 4 git commands to generate.