pack_chromium16_source-vine.sh 4.8 KB

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