#!/bin/bash set -e BUNDLE_VERSION=0.1.5 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 MONGO_NAME="mongodb-linux-${ARCH}-2.0.2" MONGO_URL="http://fastdl.mongodb.org/linux/${MONGO_NAME}.tgz" 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 MONGO_NAME="mongodb-osx-${ARCH}-2.0.2" MONGO_URL="http://fastdl.mongodb.org/osx/${MONGO_NAME}.tgz" else echo "This OS not yet supported" exit 1 fi # save off meteor checkout dir as final target cd `dirname $0`/.. TARGET_DIR=`pwd` DIR=`mktemp -d -t generate-dev-bundle-XXXXXXXX` trap 'rm -rf "$DIR" >/dev/null 2>&1' 0 echo BUILDING IN "$DIR" cd "$DIR" chmod 755 . umask 022 mkdir build cd build git clone git://github.com/joyent/node.git cd node git checkout v0.6.17 # use newer v8. This fixes an issue with node-fibers: # https://github.com/laverdet/node-fibers/issues/28 echo checking out v8 rm -rf deps/v8 git clone http://github.com/v8/v8.git deps/v8 (cd deps/v8 && git checkout 3.9.24) # on linux, build a static openssl to link against. Everything else we # dynamically link against is pretty stable. # # This is pretty hacky, but there doesn't seem to be any other way to do # this in the node 0.6 build system. The build system is all different # in 0.7, so this will have to change when we upgrade if [ "$UNAME" == "Linux" ] ; then curl http://www.openssl.org/source/openssl-1.0.0i.tar.gz | tar -xz cd openssl-1.0.0i ./config --prefix="$DIR/build/openssl-out" no-shared make install NODE_CONFIG_FLAGS=( "--openssl-includes=$DIR/build/openssl-out/include" "--openssl-libpath=$DIR/build/openssl-out/lib" ) cd "$DIR/build/node" patch -p1 < fibers/fibers.js < .bundle_version.txt rm -rf build tar czf "${TARGET_DIR}/dev_bundle_${UNAME}_${ARCH}_${BUNDLE_VERSION}.tar.gz" . echo DONE