-
Notifications
You must be signed in to change notification settings - Fork 23
/
cross-compiler.sh
executable file
·169 lines (159 loc) · 7.36 KB
/
cross-compiler.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
OLDPATH=${PATH}
UpdateBox()
{
echo "-> Installing apt-get packages"
aptitude update
aptitude -y install build-essential
aptitude -y remove libruby1.8 ruby1.8 ruby1.8-dev rubygems1.8
aptitude -y install ruby1.9.1-full
gem install fpm
}
XtoolsArmv5()
{
if [ ! -d x-tools ]; then
echo "-> Installing Cross Compiler ARMv5"
echo "-> Downloading Cross Compiler ARMv5"
wget -q http://archlinuxarm.org/builder/xtools/x-tools.tar.xz;
echo "-> End of Download Cross Compiler ARMv5"
tar Jxfv x-tools.tar.xz
else
echo "Cross Compiler for ARMv5 already installed ..."
fi
}
XtoolsArmv6()
{
if [ ! -d x-tools6h ]; then
echo "-> Installing Cross Compiler ARMv6"
echo "-> Downloading Cross Compiler ARMv6"
wget -q http://archlinuxarm.org/builder/xtools/x-tools6h.tar.xz;
echo "-> End of Download Cross Compiler ARMv6"
tar Jxfv x-tools6h.tar.xz
else
echo "Cross Compiler for ARMv6 already installed ..."
fi
}
XtoolsArmv7()
{
pwd
if [ ! -d x-tools7h ]; then
echo "-> Installing Cross Compiler ARMv7"
echo "-> Downloading Cross Compiler ARMv7"
wget -q http://archlinuxarm.org/builder/xtools/x-tools7h.tar.xz;
echo "-> End of Download Cross Compiler ARMv7"
tar Jxfv x-tools7h.tar.xz
else
echo "Cross Compiler for ARMv7 already installed ..."
fi
}
DownloadNodeJS()
{
echo "-> Getting latest node.js version"
result=$(wget -qO- http://nodejs.org/dist/latest/ | egrep -o 'node-v[0-9\.]+.tar.gz' | tail -1)
tmp=$(echo $result | egrep -o 'node-v[0-9\.]+')
mm=$(echo $result | egrep -o '[0-9\.]+')
majorminor=${mm:0:${#mm} - 3} # chop 3 last chars
version=${tmp:0:${#tmp} - 1}
if [ ! -e $result ]; then
echo "-> Downloading $result"
wget -q http://nodejs.org/dist/latest/$result
echo "-> End of Download $result"
tar xvzf $result
ln -s $version node
else
echo "You already have the latest node.js version : $version"
fi
}
BuildNodeJSArmv5()
{
export PATH=/home/vagrant/x-tools/arm-unknown-linux-gnueabi/bin:$PATH
export TOOL_PREFIX="arm-unknown-linux-gnueabi"
export CC="${TOOL_PREFIX}-gcc"
export CXX="${TOOL_PREFIX}-g++"
export AR="${TOOL_PREFIX}-ar"
export RANLIB="${TOOL_PREFIX}-ranlib"
export LINK="${CXX}"
export CCFLAGS="-march=armv5t -mfpu=softfp -marm"
export CXXFLAGS="-march=armv5t -mno-unaligned-access"
export OPENSSL_armcap=5
export GYPFLAGS="-Darmeabi=soft -Dv8_can_use_vfp_instructions=false -Dv8_can_use_unaligned_accesses=false -Darmv7=0"
export VFP3=off
export VFP2=off
PREFIX_DIR="/usr"
sudo chown -R vagrant: /home/vagrant/
cd /home/vagrant/node
./configure --without-snapshot --dest-cpu=arm --dest-os=linux --prefix="${PREFIX_DIR}"
make -j 2
sudo chown -R vagrant: /home/vagrant/
make install DESTDIR=/tmp/installARMv5
fpm -s dir -t deb -n nodejs -v "$majorminor-1vr~squeeze1" --category web -m "Vincent RABAH <[email protected]>" --url http://nodejs.org/ \
--description "Node.js event-based server-side javascript engine Node.js is similar in design to and influenced by systems like Ruby's Event Machine or Python's Twisted. It takes the event model a bit further - it presents the event loop as a language construct instead of as a library. Node.js is bundled with several useful libraries to handle server tasks : System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX, HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings." \
-C /tmp/installARMv5 -a armel -p ../cross-compiler/nodejs_$majorminor-1vr~squeeze1_armel.deb usr/
make clean
}
BuildNodeJSArmv6()
{
export PATH=/home/vagrant/x-tools6h/arm-unknown-linux-gnueabi/bin:$PATH
export TOOL_PREFIX="arm-unknown-linux-gnueabi"
export CC="${TOOL_PREFIX}-gcc"
export CXX="${TOOL_PREFIX}-g++"
export AR="${TOOL_PREFIX}-ar"
export RANLIB="${TOOL_PREFIX}-ranlib"
export LINK="${CXX}"
export CCFLAGS="-march=armv6j -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT"
export CXXFLAGS="-march=armv6j -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT"
export OPENSSL_armcap=6
export GYPFLAGS="-Darmeabi=hard -Dv8_use_arm_eabi_hardfloat=true -Dv8_can_use_vfp3_instructions=false -Dv8_can_use_vfp2_instructions=true -Darm7=0 -Darm_vfp=vfp"
export VFP3=off
export VFP2=on
PREFIX_DIR="/usr"
sudo chown -R vagrant: /home/vagrant/
cd /home/vagrant/node
./configure --without-snapshot --dest-cpu=arm --dest-os=linux --prefix="${PREFIX_DIR}"
make -j 2
sudo chown -R vagrant: /home/vagrant/
make install DESTDIR=/tmp/installARMv6
fpm -s dir -t deb -n nodejs -v "$majorminor-1vr~wheeze1" --category web -m "Vincent RABAH <[email protected]>" --url http://nodejs.org/ \
--description "Node.js event-based server-side javascript engine Node.js is similar in design to and influenced by systems like Ruby's Event Machine or Python's Twisted. It takes the event model a bit further - it presents the event loop as a language construct instead of as a library. Node.js is bundled with several useful libraries to handle server tasks : System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX, HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings." \
-C /tmp/installARMv6 -a armhf -p ../cross-compiler/nodejs_$majorminor-1vr~wheezy1_armhf.deb usr/
make clean
}
BuildNodeJSArmv7()
{
export PATH=/home/vagrant/x-tools7h/arm-unknown-linux-gnueabi/bin:$PATH
export TOOL_PREFIX="arm-unknown-linux-gnueabi"
export CC="${TOOL_PREFIX}-gcc"
export CXX="${TOOL_PREFIX}-g++"
export AR="${TOOL_PREFIX}-ar"
export RANLIB="${TOOL_PREFIX}-ranlib"
export LINK="${CXX}"
export CCFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT"
export CXXFLAGS="-march=armv7-a -mtune=cortex-a8 -mfpu=vfp -mfloat-abi=hard -DUSE_EABI_HARDFLOAT"
export OPENSSL_armcap=7
export GYPFLAGS="-Darmeabi=hard -Dv8_use_arm_eabi_hardfloat=true -Dv8_can_use_vfp3_instructions=true -Dv8_can_use_vfp2_instructions=true -Darm7=1"
export VFP3=on
export VFP2=on
PREFIX_DIR="/usr"
sudo chown -R vagrant: /home/vagrant/
cd /home/vagrant/node
./configure --without-snapshot --without-ssl --dest-cpu=arm --dest-os=linux --prefix="${PREFIX_DIR}"
make -j 2
sudo chown -R vagrant: /home/vagrant/
make install DESTDIR=/tmp/installARMv7
fpm -s dir -t deb -n nodejs -v "$majorminor-1vr~ubuntu1" --category web -m "Vincent RABAH <[email protected]>" --url http://nodejs.org/ \
--description "Node.js event-based server-side javascript engine Node.js is similar in design to and influenced by systems like Ruby's Event Machine or Python's Twisted. It takes the event model a bit further - it presents the event loop as a language construct instead of as a library. Node.js is bundled with several useful libraries to handle server tasks : System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX, HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings." \
-C /tmp/installARMv7 -a armhf -p ../cross-compiler/nodejs_$majorminor-1vr~ubuntu1_armhf.deb usr/bin usr/lib usr/include usr/share/man
make clean
}
UpdateBox
DownloadNodeJS
XtoolsArmv5
BuildNodeJSArmv5
cd /home/vagrant/
PATH="$OLDPATH"
XtoolsArmv6
BuildNodeJSArmv6
#cd /home/vagrant/
#PATH="$OLDPATH"
#XtoolsArmv7
#BuildNodeJSArmv7