Skip to content

Instantly share code, notes, and snippets.

@nodekid
Last active August 29, 2015 14:04
Show Gist options
  • Save nodekid/e33106629b28b4ae1a17 to your computer and use it in GitHub Desktop.
Save nodekid/e33106629b28b4ae1a17 to your computer and use it in GitHub Desktop.
#!/bin/sh
[ $# -eq 0 ] && { echo "Usage: ${0} version-string" ; exit 1; }
VERSION=${1}
PREFIX="/usr/local"
SRC_CWD="${PREFIX}/src"
SRC_DIR="${SRC_CWD}/node"
SRC_GIT="git://github.com/joyent/node.git"
CPUS=$( grep processor /proc/cpuinfo | wc -l ) # non-portable :/
JOBS=$(( $CPUS + 1 ))
cd "${SRC_CWD}"
if [ ! -d "${SRC_DIR}" ] ; then
git clone "${SRC_GIT}"
fi
cd "${SRC_DIR}"
echo "[Checking for updates...]"
git checkout master && git pull
git checkout "v${VERSION}"
./configure --prefix="${PREFIX}"
echo "[Compiling using ${JOBS} jobs...]"
make install \
V=1 \
-j $JOBS #\
#CFLAGS+="-mtune=native -march=native" \
#CXXFLAGS+="-mtune=native -march=native"
echo "[Cleaning up...]"
make distclean > /dev/null 2>&1
echo "[Build complete]"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment