Skip to content

Commit c8b5e30

Browse files
author
Ben Newman
committed
Decompose common dev_bundle build logic and variables.
1 parent b203cc3 commit c8b5e30

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

scripts/build-dev-bundle-common.sh

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
6+
UNAME=$(uname)
7+
ARCH=$(uname -m)
8+
9+
if [ "$UNAME" == "Linux" ] ; then
10+
if [ "$ARCH" != "i686" -a "$ARCH" != "x86_64" ] ; then
11+
echo "Unsupported architecture: $ARCH"
12+
echo "Meteor only supports i686 and x86_64 for now."
13+
exit 1
14+
fi
15+
16+
OS="linux"
17+
18+
stripBinary() {
19+
strip --remove-section=.comment --remove-section=.note $1
20+
}
21+
elif [ "$UNAME" == "Darwin" ] ; then
22+
SYSCTL_64BIT=$(sysctl -n hw.cpu64bit_capable 2>/dev/null || echo 0)
23+
if [ "$ARCH" == "i386" -a "1" != "$SYSCTL_64BIT" ] ; then
24+
# some older macos returns i386 but can run 64 bit binaries.
25+
# Probably should distribute binaries built on these machines,
26+
# but it should be OK for users to run.
27+
ARCH="x86_64"
28+
fi
29+
30+
if [ "$ARCH" != "x86_64" ] ; then
31+
echo "Unsupported architecture: $ARCH"
32+
echo "Meteor only supports x86_64 for now."
33+
exit 1
34+
fi
35+
36+
OS="osx"
37+
38+
# We don't strip on Mac because we don't know a safe command. (Can't strip
39+
# too much because we do need node to be able to load objects like
40+
# fibers.node.)
41+
stripBinary() {
42+
true
43+
}
44+
else
45+
echo "This OS not yet supported"
46+
exit 1
47+
fi
48+
49+
PLATFORM="${UNAME}_${ARCH}"
50+
51+
SCRIPTS_DIR=$(dirname $0)
52+
cd "$SCRIPTS_DIR/.."
53+
CHECKOUT_DIR=$(pwd)
54+
55+
DIR=$(mktemp -d -t generate-dev-bundle-XXXXXXXX)
56+
trap 'rm -rf "$DIR" >/dev/null 2>&1' 0
57+
58+
cd "$DIR"
59+
chmod 755 .
60+
umask 022
61+
mkdir build
62+
cd build

0 commit comments

Comments
 (0)