forked from meteor/meteor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-dev-bundle-common.sh
62 lines (50 loc) · 1.43 KB
/
build-dev-bundle-common.sh
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
#!/usr/bin/env bash
set -e
set -u
UNAME=$(uname)
ARCH=$(uname -m)
if [ "$UNAME" == "Linux" ] ; then
if [ "$ARCH" != "i686" -a "$ARCH" != "x86_64" ] ; then
echo "Unsupported architecture: $ARCH"
echo "Meteor only supports i686 and x86_64 for now."
exit 1
fi
OS="linux"
stripBinary() {
strip --remove-section=.comment --remove-section=.note $1
}
elif [ "$UNAME" == "Darwin" ] ; then
SYSCTL_64BIT=$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)
if [ "$ARCH" == "i386" -a "1" != "$SYSCTL_64BIT" ] ; then
# some older macos returns i386 but can run 64 bit binaries.
# Probably should distribute binaries built on these machines,
# but it should be OK for users to run.
ARCH="x86_64"
fi
if [ "$ARCH" != "x86_64" ] ; then
echo "Unsupported architecture: $ARCH"
echo "Meteor only supports x86_64 for now."
exit 1
fi
OS="osx"
# We don't strip on Mac because we don't know a safe command. (Can't strip
# too much because we do need node to be able to load objects like
# fibers.node.)
stripBinary() {
true
}
else
echo "This OS not yet supported"
exit 1
fi
PLATFORM="${UNAME}_${ARCH}"
SCRIPTS_DIR=$(dirname $0)
cd "$SCRIPTS_DIR/.."
CHECKOUT_DIR=$(pwd)
DIR=$(mktemp -d -t generate-dev-bundle-XXXXXXXX)
trap 'rm -rf "$DIR" >/dev/null 2>&1' 0
cd "$DIR"
chmod 755 .
umask 022
mkdir build
cd build