make-release-tarball.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. # Makes a release tarball. We include our dependencies/submodules,
  3. # but we heavily prune their file lists to avoid including lots of
  4. # extraneous baggage. We also leave out Bloaty's tests, especially
  5. # because some of the test data is large.
  6. set -e
  7. if [ "$#" -ne 1 ]; then
  8. echo "Usage: make-release.tarball.sh VERSION"
  9. exit 1
  10. fi
  11. VERSION=$1
  12. FILES=$(git ls-files --exclude-standard --recurse-submodules |
  13. grep -v googletest |
  14. grep -v ^tests |
  15. grep -v third_party/protobuf |
  16. grep -v 'third_party/capstone/\(suite\|bindings\|xcode\|msvc\|contrib\)' |
  17. grep -v third_party/abseil-cpp/absl/time/internal/cctz/testdata |
  18. grep -v ^.git)
  19. FILES="$FILES $(git ls-files --exclude-standard --recurse-submodules |
  20. grep 'third_party/protobuf/\(src\|cmake\|configure.ac\)')"
  21. # Unfortunately tar on Mac doesn't support --transform, so we have to
  22. # actually move our files to a different directory to get the prefix.
  23. DIR=/tmp/bloaty-$VERSION
  24. rm -rf $DIR
  25. mkdir $DIR
  26. rsync -R $FILES $DIR
  27. BASE=$PWD
  28. cd /tmp
  29. OUT=bloaty-$VERSION.tar.bz2
  30. tar cjf $BASE/$OUT bloaty-$VERSION
  31. echo "Created $OUT"