[4819] | 1 | #!/bin/bash |
---|
| 2 | # |
---|
| 3 | # forgive me for the state of this script |
---|
| 4 | |
---|
| 5 | set -e |
---|
| 6 | |
---|
| 7 | tmp=$(mktemp -d) |
---|
| 8 | pwd=$(pwd) |
---|
| 9 | |
---|
| 10 | trap cleanup EXIT |
---|
| 11 | cleanup() { |
---|
| 12 | set +e |
---|
| 13 | [ -z "$tmp" -o ! -d "$tmp" ] || rm -rf "$tmp" |
---|
| 14 | } |
---|
| 15 | |
---|
| 16 | chromium_svn_dir=$1 |
---|
| 17 | chromium_tgt_dir=${tmp}/${chromium_svn_dir} |
---|
| 18 | |
---|
| 19 | [ ! -d $chromium_svn_dir ] && \ |
---|
| 20 | echo "No such directories: $chromium_svn_dir" && \ |
---|
| 21 | [ -f ${chromium_svn_dir}.tar.bz2 ] && \ |
---|
| 22 | echo "Found $chromium_svn_dir.tar.bz2" && \ |
---|
| 23 | echo "Decompressing $chromium_svn_dir.tar.bz2" && \ |
---|
| 24 | tar jxf ${chromium_svn_dir}.tar.bz2 |
---|
| 25 | |
---|
| 26 | mkdir -p ${chromium_tgt_dir} |
---|
| 27 | |
---|
| 28 | name=chromium |
---|
| 29 | #version="`cat $chromium_svn_dir/src/chrome/VERSION | cut -f2 -d= |while read i; do echo -n $i\. ; done`" |
---|
| 30 | version="`cat $chromium_svn_dir/chrome/VERSION | cut -f2 -d= |while read i; do echo -n $i\. ; done`" && version=$(echo $version | sed s/\.$//) |
---|
| 31 | #revision="svn`cat $chromium_svn_dir/src/.svn/entries | grep -m1 -A1 'dir' | tr '\n\r' '-' | cut -f2 -d-`" |
---|
| 32 | |
---|
| 33 | echo "Version: $version" |
---|
| 34 | #echo "Revision: $revision" |
---|
| 35 | |
---|
[6212] | 36 | #xz="`which xz 2>/dev/null`" |
---|
| 37 | xz="`which pxz 2>/dev/null`" |
---|
[4819] | 38 | lzma="`which lzma 2>/dev/null`" |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | if [ -z $chromium_svn_dir ] |
---|
| 42 | then |
---|
| 43 | echo "Usage: `basename $0` [SVN_SOURCE_DIR]" |
---|
| 44 | exit 1 |
---|
| 45 | fi |
---|
| 46 | |
---|
| 47 | if [ -f $xz ] |
---|
| 48 | then |
---|
| 49 | compress=$xz |
---|
| 50 | #compress_opts='-9 -F lzma' #xz compresses MUCH faster, so why not make it compress more? We have the RAM... |
---|
| 51 | compress_opts='-9' |
---|
| 52 | echo "using xz" |
---|
| 53 | else |
---|
| 54 | exit 1 |
---|
| 55 | compress=$lzma |
---|
| 56 | compress_opts="-7" |
---|
| 57 | echo "using lzma" |
---|
| 58 | fi |
---|
| 59 | |
---|
| 60 | echo |
---|
| 61 | echo "Moving source in staging area" |
---|
| 62 | #cp -R $chromium_svn_dir $chromium_tgt_dir |
---|
| 63 | cp -ra $chromium_svn_dir ${chromium_tgt_dir}/src |
---|
| 64 | |
---|
| 65 | # remove big bad ffmpeg binaries. |
---|
| 66 | echo "Removing ffmpeg binaries/sources" |
---|
| 67 | cd $chromium_tgt_dir/src/third_party/ffmpeg/ |
---|
[6212] | 68 | rm -rf binaries/ chromium/binaries/ |
---|
| 69 | rm -rf doc ffpresets mt-work tools tests |
---|
| 70 | find -type f -name "*.c" | xargs rm -f |
---|
[4819] | 71 | echo "Removing courgette sources" |
---|
| 72 | cd $chromium_tgt_dir/src/ |
---|
| 73 | rm -rf courgette/ |
---|
| 74 | echo "Removing o3d plugin sources (Not yet buildable)" |
---|
| 75 | cd $chromium_tgt_dir/src/ |
---|
| 76 | rm -rf o3d/ |
---|
| 77 | echo "Removing unnecessary sources" |
---|
| 78 | rm -rf third_party/WebKit/WebKitTools/Scripts/webkitpy/layout_tests/ |
---|
| 79 | rm -rf webkit/data/layout_tests/ |
---|
| 80 | rm -rf third_party/hunspell/dictionaries/ |
---|
| 81 | rm -rf src/third_party/WebKit/LayoutTests/ |
---|
| 82 | rm -rf chrome/test/data/ |
---|
| 83 | #rm -rf third_party/icu/icudt42.dll |
---|
| 84 | #rm -rf third_party/icu/linux/ |
---|
| 85 | #rm -rf third_party/icu/mac/ |
---|
| 86 | #rm -rf third_party/icu/source/ |
---|
| 87 | rm -rf native_client/tests/ |
---|
| 88 | #rm -rf third_party/libvpx/ |
---|
[5624] | 89 | rm -rf third_party/speex/ |
---|
[4819] | 90 | # Remove other directories (untested) |
---|
| 91 | cd $chromium_tgt_dir/src/third_party |
---|
| 92 | # First, just take out the sources for the items which have already been conditionalized so we're sure we're not using them. |
---|
| 93 | # We need to leave the .gyp files since this is how it finds the system libs. |
---|
| 94 | # bzip2 |
---|
| 95 | rm -rf bzip2/*.c bzip2/*.h bzip2/LICENSE |
---|
| 96 | |
---|
| 97 | # libjpeg |
---|
[5624] | 98 | #rm -rf libjpeg/*.c libjpeg/README* |
---|
[4819] | 99 | |
---|
| 100 | # libpng |
---|
| 101 | rm -rf libpng/*.c libpng/*.h libpng/README* libpng/LICENSE |
---|
| 102 | |
---|
| 103 | # libevent |
---|
| 104 | rm -rf libevent/*.c libevent/*.h libevent/*sh libevent/config* libevent/*.3 libevent/README libevent/compat libevent/linux libevent/mac libevent/sample libevent/test libevent/ChangeLog libevent/Makefile.* libevent/aclocal.m4 libevent/*.py libevent/mising libevent/mkinstalldirs |
---|
| 105 | |
---|
| 106 | # libxml |
---|
| 107 | rm -rf libxml/*c libxml/*.h libxml/*.in libxml/*sh libxml/*.m4 libxml/*.py libxml/*.xml libxml/missing libxml/mkinstalldirs libxml/*.1 libxml/build libxml/include libxml/linux libxml/mac libxml/win32 libxml/AUTHORS libxml/COPYING libxml/ChangeLog libxml/Copyright libxml/INSTALL libxml/NEWS libxml/README libxml/README.tests libxml/TODO* libxml/config* libxml/*.pl |
---|
| 108 | |
---|
| 109 | # libxslt |
---|
| 110 | rm -rf libxslt/build libxslt/libexslt libxslt/libxslt libxslt/linux libxslt/mac libxslt/win32 libxslt/AUTHORS libxslt/COPYING libxslt/ChangeLog libxslt/FEATURES libxslt/INSTALL libxslt/NEWS libxslt/README libxslt/TODO libxslt/*.h libxslt/*.m4 libxslt/compile libxslt/config* libxslt/depcomp libxslt/*sh libxslt/*.in libxslt/*.spec libxslt/missing |
---|
| 111 | |
---|
| 112 | # Next, nuke the whole directories for things not yet conditionalized: |
---|
[5624] | 113 | rm -rf nss/ nspr/ |
---|
[4819] | 114 | |
---|
| 115 | # expat is only built on windows |
---|
| 116 | rm -rf expat/files |
---|
| 117 | |
---|
| 118 | # Another copy of zlib? Unpossible! |
---|
| 119 | rm -rf src/third_party/WebKit/WebCore/platform/image-decoders/zlib/ |
---|
| 120 | |
---|
| 121 | # #Remove v8 as that we build against the system one |
---|
| 122 | # rm -rf src/v8/include src/v8/src/ |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | echo |
---|
| 126 | echo "Recompressing and excluding svn data" |
---|
| 127 | echo " this takes a while, sorry" |
---|
| 128 | echo " Compressing with $compress" |
---|
| 129 | |
---|
| 130 | cd $chromium_tgt_dir/ |
---|
| 131 | cd .. |
---|
| 132 | |
---|
| 133 | #tar --exclude=\.svn -cf - $name/ | $compress ${compress_opts} > "chromium"."$version""$revision".tar.lzma |
---|
| 134 | tar --exclude=\.svn -cf - ${name}-${version} | $compress ${compress_opts} > ${pwd}/${name}-${version}.tar.xz |
---|
| 135 | |
---|
| 136 | #rm -rf $chromium_tgt_dir |
---|
| 137 | |
---|
| 138 | exit |
---|