pack_chromium_source-vine.sh 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.xz ] && \
  17. echo "Found $chromium_svn_dir.tar.xz" && \
  18. echo "Decompressing $chromium_svn_dir.tar.xz" && \
  19. tar -xf ${chromium_svn_dir}.tar.xz
  20. mkdir -p ${chromium_tgt_dir}
  21. name=chromium
  22. #version="`cat $chromium_svn_dir/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. #xz="`which pxz 2>/dev/null`"
  29. #lzma="`which lzma 2>/dev/null`"
  30. if [ -z $chromium_svn_dir ]
  31. then
  32. echo "Usage: `basename $0` [SVN_SOURCE_DIR]"
  33. exit 1
  34. fi
  35. if [ -f $xz ]
  36. then
  37. compress=$xz
  38. #compress_opts='-9 -F lzma' #xz compresses MUCH faster, so why not make it compress more? We have the RAM...
  39. compress_opts='-9'
  40. echo "using xz"
  41. else
  42. exit 1
  43. compress=$lzma
  44. compress_opts="-7"
  45. echo "using lzma"
  46. fi
  47. echo
  48. echo "Moving source in staging area"
  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/ chromium/binaries/
  54. rm -rf doc ffpresets mt-work tools tests
  55. find -type f -name "*.c" | grep -v xcode_hack.c | xargs rm -f
  56. #echo "Removing courgette sources"
  57. #cd $chromium_tgt_dir/src/
  58. #rm -rf courgette/
  59. echo "Removing o3d plugin sources (Not yet buildable)"
  60. cd $chromium_tgt_dir/src/
  61. rm -rf o3d/
  62. echo "Removing unnecessary sources"
  63. rm -rf third_party/WebKit/WebKitTools/Scripts/webkitpy/layout_tests/
  64. rm -rf webkit/data/layout_tests/
  65. #rm -rf third_party/hunspell/dictionaries/
  66. rm -rf src/third_party/WebKit/LayoutTests/
  67. rm -rf chrome/test/data/
  68. rm -rf third_party/icu/icudt42.dll
  69. #rm -rf third_party/icu/linux/
  70. rm -rf third_party/icu/mac/
  71. #rm -rf third_party/icu/source/
  72. rm -rf native_client/tests/
  73. #rm -rf third_party/libvpx/
  74. #rm -rf third_party/speex/
  75. # Remove other directories (untested)
  76. cd $chromium_tgt_dir/src/third_party
  77. # First, just take out the sources for the items which have already been conditionalized so we're sure we're not using them.
  78. # We need to leave the .gyp files since this is how it finds the system libs.
  79. # bzip2
  80. #rm -rf bzip2/*.c bzip2/*.h bzip2/LICENSE
  81. # libjpeg
  82. #rm -rf libjpeg/*.c libjpeg/README*
  83. # libpng
  84. #rm -rf libpng/*.c libpng/*.h libpng/README* libpng/LICENSE
  85. # libevent
  86. #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
  87. # libxml
  88. #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
  89. # libxslt
  90. #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
  91. # Next, nuke the whole directories for things not yet conditionalized:
  92. #rm -rf nss/ nspr/
  93. # expat is only built on windows
  94. #rm -rf expat/files
  95. # Another copy of zlib? Unpossible!
  96. #rm -rf src/third_party/WebKit/WebCore/platform/image-decoders/zlib/
  97. # #Remove v8 as that we build against the system one
  98. # rm -rf src/v8/include src/v8/src/
  99. echo
  100. echo "Recompressing and excluding svn data"
  101. echo " this takes a while, sorry"
  102. echo " Compressing with $compress"
  103. cd $chromium_tgt_dir/
  104. cd ..
  105. tar --exclude=\.svn -cf - ${name}-${version} | $compress ${compress_opts} > ${pwd}/${name}-${version}-vine.tar.xz
  106. #rm -rf $chromium_tgt_dir
  107. exit