-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·76 lines (69 loc) · 1.53 KB
/
setup.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Script for download, building and installing mozjs
URL=https://people.mozilla.org/~sstangl/mozjs-31.5.0.tar.bz2
TEMP=temp
CWD=`pwd`
INSTALL_PATH=`realpath $CWD/$TEMP/build`
function download () {
echo ">> Download"
mkdir -p $TEMP
cd $TEMP
wget -N $URL -O mozjs.tar.bz2 --verbose
}
function extract () {
echo ">> Extract"
mkdir -p $1
tar -xf mozjs.tar.bz2 -C $1 --strip-components=1 && cd ..
}
function build () {
echo ">> Configure"
cd $TEMP/js/js/src/
./configure --prefix=$INSTALL_PATH --enable-debug
if [ $? -ne 0 ]; then
exit 1;
fi
# related issues
# https://bugzilla.mozilla.org/show_bug.cgi?id=1006275
#jobs=`cat /proc/cpuinfo | grep 'processor' | wc | awk '{print $1}'`
#jobs=$(($jobs+1))
#make -j$jobs
echo ">> Make"
make -j1
cd $CWD
}
function install () {
echo ">> Install"
cd $TEMP/js/js/src
make install
cd $CWD
}
for i in $@; do
case $i in
--travis)
if [ ! -d $INSTALL_PATH ]; then
bash setup.sh --download
bash setup.sh --build
bash setup.sh --install
fi
exit 0
;;
--install)
install
exit 0
;;
--build)
build
exit 0
;;
--download)
download
extract js
exit 0
;;
--path)
echo $INSTALL_PATH
exit 0
;;
*)
;;
esac
done;