From 99f399956ca2c9a764fd4205731dad7ab9607566 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Tue, 27 Dec 2011 20:22:26 +0000 Subject: [PATCH] - merge in cleanups from ubuntu's debian/rules file Changed files: clean-source.sh -> 1.4 --- clean-source.sh | 127 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 112 insertions(+), 15 deletions(-) diff --git a/clean-source.sh b/clean-source.sh index 6a35d68..ad05e50 100644 --- a/clean-source.sh +++ b/clean-source.sh @@ -7,7 +7,6 @@ eval "$@" # drop bundled libs, from gentoo gyp_clean() { - set +x local l lib=$1 echo "Removing bundled library $lib ..." l=$(find "$lib" -mindepth 1 ! -iname '*.gyp*' -print -delete | wc -l) @@ -18,7 +17,7 @@ gyp_clean() { } # https://code.google.com/p/chromium/wiki/LinuxPackaging -# list from src/tools/export_tarball/export_tarball.py +# initial list from src/tools/export_tarball/export_tarball.py remove_nonessential_dirs() { local dir for dir in \ @@ -54,32 +53,130 @@ remove_nonessential_dirs() { v8/test \ webkit/data/layout_tests \ webkit/tools/test/reference_build \ + \ + tools/site_compare \ + tools/stats_viewer \ + tools/symsrc \ + tools/valgrind \ ; do rm -vfr "$dir" done } -remove_nonessential_dirs | tee REMOVED-nonessential_dirs.txt +# Strip tarball from some big directories not needed on the linux platform +strip_dirs() { + # prefix with _ those that we can't remove (just yet) because of the gclient + # hooks (see build/all.gyp) or of some unneeded deps/includes -rm -v third_party/expat/files/lib/expat.h + local dir + for dir in \ + chrome/test/data/safe_browsing/old \ + chrome/test/data/firefox2_nss_mac \ + chrome/third_party/wtl/ \ + gears \ + google_update \ + o3d \ + third_party/boost \ + third_party/bsdiff \ + third_party/bspatch \ + third_party/ffmpeg/binaries \ + third_party/fuzzymatch \ + third_party/gles_book_examples \ + third_party/hunspell/dictionaries \ + third_party/icu/mac \ + third_party/lcov \ + third_party/lighttpd \ + third_party/nspr \ + third_party/nss \ + third_party/ocmock \ + third_party/pthread \ + third_party/pyftpdlib \ + third_party/simplejson \ + third_party/scons \ + _third_party/tcmalloc \ + tools/symsrc \ + tools/site_compare \ + tools/stats_viewer \ + tools/valgrind \ + tools/wine_valgrind \ + v8/test/cctest \ + webkit/data/layout_tests \ + ; do + rm -vfr "$dir" + done +} + +# parts based on ubuntu debian/rules +# http://bazaar.launchpad.net/~chromium-team/chromium-browser/chromium-browser.head/view/head:/debian/rules + +remove_bin_only() { + find . -type f \( \ + -iname \*.exe -o \ + -iname \*.dll -o \ + -iname \*.pdb -o \ + -name \*.o -o \ + -name \*.a -o \ + -name \*.dylib \ + \) -exec rm -fv {} \; +} + +# removes dir, if the bcond is not turned off +strip_system_dirs() { + local dir lib bcond + for dir in "$@"; do + lib=${dir##*/} + bcond=$(eval echo \$$lib) + [ "$bcond" = 0 ] && continue + + # skip already removed dirs + test -d $dir || continue + + # here we ignore errors, as some dirs contain README.chromium after removal + find $dir -depth -mindepth 1 \! \( -name \*.gyp -o -name \*.gypi -o -name README.chromium -o -name \*.patch \) -print -delete || : + done +} + +# There are directories we want to strip, but that are unnecessarily required by the build-system +# So we drop everything but the gyp/gypi files and README.chromium (to see what that dir contained) +almost_strip_dirs() { + local dir + for dir in "$@"; do + echo >&2 "almost strip dir: $dir" + find $dir -depth -mindepth 1 \! \( -name \*.gyp -o -name \*.gypi -o -name README.chromium \) -print -delete || : + done +} + +remove_nonessential_dirs | tee -a REMOVED-nonessential_dirs.txt +remove_bin_only | tee -a REMOVED-bin_only.txt + +strip_dirs | tee -a REMOVED-stripped.txt + +almost_strip_dirs \ + courgette \ + third_party/gles2_book \ +| tee -a REMOVED-stripped.txt + +strip_system_dirs \ + third_party/bzip2 \ + third_party/icu \ + third_party/libevent \ + third_party/libjpeg \ + third_party/libpng \ + third_party/libxml \ + third_party/libxslt \ + third_party/zlib \ + third_party/libwebp \ + v8 \ +| tee -a REMOVED-stripped.txt -gyp_clean third_party/bzip2 -gyp_clean third_party/icu -gyp_clean third_party/libevent -gyp_clean third_party/libjpeg -gyp_clean third_party/libpng # third_party/libvpx/libvpx.h should be kept #gyp_clean third_party/libvpx -gyp_clean third_party/libxml -gyp_clean third_party/libxslt -gyp_clean third_party/zlib # 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. #gyp_clean third_party/yasm -if [ $v8 = 1 ]; then - # Remove bundled v8. - gyp_clean v8 +rm -vf third_party/expat/files/lib/expat.h +if [ "$v8" = 1 ]; then # The implementation files include v8 headers with full path, # like #include "v8/include/v8.h". Make sure the system headers # will be used. -- 2.44.0