mach 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. MCP_MACH=./platform/mach
  3. MCP_GIT=`which git 2>/dev/null`
  4. if [ ! -f "$MCP_MACH" ]; then
  5. printf "Error: There is no platform codebase.\n"
  6. exit 1
  7. fi
  8. MCP_APP=palemoon
  9. MCP_VERSION=`cat ./$MCP_APP/config/version.txt`
  10. MCP_XZ=`which xz 2>/dev/null`
  11. MCP_TAR_BASEDIR="s/^./$MCP_APP-source/"
  12. MCP_TAR_FILENAME="$MCP_APP-$MCP_VERSION.source.tar.xz"
  13. MCP_TAR_COMMAND="tar cfJv ../$MCP_TAR_FILENAME . --transform $MCP_TAR_BASEDIR --exclude-vcs --warning=no-file-changed"
  14. MCP_TAR_EXCLUDES=(
  15. "$MCP_APP/branding/beta"
  16. "$MCP_APP/branding/unstable"
  17. "platform/db/mork"
  18. "platform/docs"
  19. "platform/ldap"
  20. "platform/libs/gmp-clearkey"
  21. "platform/mailnews"
  22. "platform/python/psutil/*.so"
  23. "platform/python/psutil/*.pyd"
  24. "platform/python/psutil/build"
  25. "platform/xulrunner"
  26. ".mozconfig"
  27. ".gitattributes"
  28. ".gitignore"
  29. ".gitmodules"
  30. "*.pyc"
  31. "*.pyo"
  32. "*.rej"
  33. "*.orig"
  34. "*.source.tar.xz"
  35. )
  36. if [ "$1" == "source" ]; then
  37. if [ -z "$MCP_XZ" ]; then
  38. printf "Error: XZ was not found on the system. NOTE: This won't work on Windows.\n"
  39. exit 1
  40. fi
  41. for _value in "${MCP_TAR_EXCLUDES[@]}"; do
  42. MCP_TAR_COMMAND+=" --exclude=${_value}"
  43. done
  44. if [[ -n "$MCP_GIT" && -d "./.git" && -d "./platform/.git" ]]; then
  45. printf "COMM SHA1: `"${MCP_GIT}" rev-parse --short HEAD 2>/dev/null`\n"
  46. printf "GRE SHA1: `cd ./platform && "${MCP_GIT}" rev-parse --short HEAD 2>/dev/null`\n"
  47. fi
  48. printf "Source Filename: $MCP_TAR_FILENAME\n\n"
  49. read -r -s -p $'Press enter to continue...\n'
  50. env XZ_OPTS=-9e ${MCP_TAR_COMMAND}
  51. else
  52. # We don't know what the command is but real-mach might so just pass
  53. # all the args to it
  54. $MCP_MACH $@
  55. fi