summaryrefslogtreecommitdiff
path: root/mach
blob: efc366a4fd15d45bf5aa9099745c88a1ccce5332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh

MCP_MACH=./platform/mach
MCP_GIT=`which git 2>/dev/null`

if [ ! -f "$MCP_MACH" ]; then
  printf "Error: There is no platform codebase.\n"
  exit 1
fi

MCP_APP=browser
MCP_APP_NAME=palemoon
MCP_VERSION=`cat ./$MCP_APP/config/version.txt`

MCP_XZ=`which xz 2>/dev/null`
MCP_TAR_BASEDIR="s/^./$MCP_APP_NAME-source/"
MCP_TAR_FILENAME="$MCP_APP_NAME-$MCP_VERSION.source.tar.xz"
MCP_TAR_COMMAND="tar cfJv ../$MCP_TAR_FILENAME . --transform $MCP_TAR_BASEDIR --exclude-vcs --warning=no-file-changed"
MCP_TAR_EXCLUDES=(
  "$MCP_APP/branding/beta"
  "$MCP_APP/branding/unstable"
  "platform/db/mork"
  "platform/docs"
  "platform/ldap"
  "platform/libs/gmp-clearkey"
  "platform/mailnews"
  "platform/python/psutil/*.so"
  "platform/python/psutil/*.pyd"
  "platform/python/psutil/build"
  "platform/xulrunner"
  ".mozconfig"
  ".gitattributes"
  ".gitignore"
  ".gitmodules"
  "*.pyc"
  "*.pyo"
  "*.rej"
  "*.orig"
  "*.source.tar.xz"
)

if [ "$1" == "source" ]; then
  if [ -z "$MCP_XZ" ]; then
    printf "Error: XZ was not found on the system. NOTE: This won't work on Windows.\n"
    exit 1
  fi

  for _value in "${MCP_TAR_EXCLUDES[@]}"; do
    MCP_TAR_COMMAND+=" --exclude=${_value}"
  done

  if [[ -n "$MCP_GIT" && -d "./.git" && -d "./platform/.git" ]]; then
    printf "COMM SHA1: `"${MCP_GIT}" rev-parse --short HEAD 2>/dev/null`\n"
    printf "GRE SHA1: `cd ./platform && "${MCP_GIT}" rev-parse --short HEAD 2>/dev/null`\n"
  fi

  printf "Source Filename: $MCP_TAR_FILENAME\n\n"
  read -r -s -p $'Press enter to continue...\n'
  env XZ_OPTS=-9e ${MCP_TAR_COMMAND}
else
  # We don't know what the command is but real-mach might so just pass
  # all the args to it
  $MCP_MACH $@
fi