aboutsummaryrefslogtreecommitdiffstats
path: root/bootstrap.sh
blob: fd458b743dd3e2216c43d8b1cb9642819d3e351b (plain) (blame)
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
#! /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;