blob: fd458b743dd3e2216c43d8b1cb9642819d3e351b (
plain) (
tree)
|
|
#! /bin/sh
###########################
# start config
PREFIX=`pwd`/usr/
NODE_VERSION=0.3.5
# use full for development
DEV_TOOLS="node-dev jslint"
# end config
###########################
export PATH=${PREFIX}/bin:${PATH}
## Download Helper
# $1 - url
# $2 - destdir
download() {
mkdir -p ${PREFIX}/src
if [ ! -f ${2} ]; then
echo "!! saving source to $1"
curl ${1} | tar -x -z -C ${PREFIX}/src
fi
}
if [ ! -f ${PREFIX}/bin/node ]; then
# fetch and compile nodejs
download http://nodejs.org/dist/node-v${NODE_VERSION}.tar.gz ${PREFIX}/src/node-v${NODE_VERSION}
cd ${PREFIX}/src/node-v${NODE_VERSION}
./configure --prefix=${PREFIX}
make install
cd ${PREFIX}/..
else
echo "!! node already installed"
fi
if [ ! -f ${PREFIX}/bin/npm ];then
# fetch and compile npm
curl http://npmjs.org/install.sh | sh
else
echo "!! npm already installed"
fi
# load development code and compile dependencies
npm link src/nodejs/
for TOOL in $DEV_TOOLS; do
npm install $TOOL
done;
|