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 | |
---|
36 | xz="`which xz 2>/dev/null`" |
---|
37 | lzma="`which lzma 2>/dev/null`" |
---|
38 | |
---|
39 | |
---|
40 | if [ -z $chromium_svn_dir ] |
---|
41 | then |
---|
42 | echo "Usage: `basename $0` [SVN_SOURCE_DIR]" |
---|
43 | exit 1 |
---|
44 | fi |
---|
45 | |
---|
46 | if [ -f $xz ] |
---|
47 | then |
---|
48 | compress=$xz |
---|
49 | #compress_opts='-9 -F lzma' #xz compresses MUCH faster, so why not make it compress more? We have the RAM... |
---|
50 | compress_opts='-9' |
---|
51 | echo "using xz" |
---|
52 | else |
---|
53 | exit 1 |
---|
54 | compress=$lzma |
---|
55 | compress_opts="-7" |
---|
56 | echo "using lzma" |
---|
57 | fi |
---|
58 | |
---|
59 | echo |
---|
60 | echo "Moving source in staging area" |
---|
61 | #cp -R $chromium_svn_dir $chromium_tgt_dir |
---|
62 | cp -ra $chromium_svn_dir ${chromium_tgt_dir}/src |
---|
63 | |
---|
64 | # remove big bad ffmpeg binaries. |
---|
65 | echo "Removing ffmpeg binaries/sources" |
---|
66 | cd $chromium_tgt_dir/src/third_party/ffmpeg/ |
---|
67 | rm -rf binaries/ |
---|
68 | rm -rf patched-ffmpeg-mt/*.c patched-ffmpeg-mt/*.h patched-ffmpeg-mt/doc patched-ffmpeg-mt/ffpresets patched-ffmpeg-mt/mt-work |
---|
69 | rm -rf patched-ffmpeg-mt/libavformat/*.c patched-ffmpeg-mt/libavcodec/*.c patched-ffmpeg-mt/tools patched-ffmpeg-mt/tests |
---|
70 | rm -rf patched-ffmpeg-mt/libavutil/*.c patched-ffmpeg-mt/libavfilter/*.c patched-ffmpeg-mt/libavdevice/*.c patched-ffmpeg-mt/libpostproc/*.c patched-ffmpeg-mt/libswscale/*.c |
---|
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/ |
---|
89 | #rm -rf third_party/speex/ |
---|
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 |
---|
98 | rm -rf libjpeg/*.c libjpeg/README* |
---|
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: |
---|
113 | #rm -rf nss/ nspr/ |
---|
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 |
---|