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