forked from soot-oss/soot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local-nightly-build
executable file
·160 lines (124 loc) · 3.81 KB
/
local-nightly-build
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
#!/bin/bash
#
# Soot nightly self-contained building script
#
# adapted from: https://raw.githubusercontent.com/Sable/soot/develop/nightly
# latest update: 20150101
# Author(s):
# - Wei "pw" Peng <[email protected]>
#
# build deps:
# - Ant: https://ant.apache.org/
# - wget: https://www.gnu.org/software/wget/
# - JDK: http://www.oracle.com/technetwork/java/javase/downloads/index.html
# http://stackoverflow.com/a/246128
CUR_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
HOME_AB=${HOME_AB:-${HOME}/autobuild}
TMP_AB=${TMP_AB:-/tmp/autobuild}
HOME_AB_TMP=${HOME_AB_TMP:-${HOME_AB}/tmp}
HOME_AB_SET=${HOME_AB_SET:-${HOME_AB}/settings}
HOME_AB_RES=${HOME_AB_RES:-${HOME_AB}/resources}
HOME_AB_REL=${HOME_AB_REL:-${HOME_AB}/releases}
HOME_AB_TMP_LIB=${HOME_AB_TMP_LIB:-${HOME_AB_TMP}/libs}
## create $HOME_AB_TMP as a symlink to tmpfs if not already existed
[[ -d ${HOME_AB_TMP} ]] || ( mkdir -p ${TMP_AB} && ln -sf ${TMP_AB} ${HOME_AB_TMP} )
## create directories if not existed
mkdir -p ${HOME_AB_SET} ${HOME_AB_REL} ${HOME_AB_RES} ${HOME_AB_TMP_LIB}
## set up settings
BASE_SETTING=${HOME_AB_SET}/jasmin
[[ -f ${BASE_SETTING} ]] || wget https://raw.githubusercontent.com/Sable/jasmin/develop/ant.settings.template -O ${BASE_SETTING}
BASE_SETTING=${HOME_AB_SET}/soot
[[ -f ${BASE_SETTING} ]] || wget https://raw.githubusercontent.com/Sable/soot/develop/ant.settings.template -O ${BASE_SETTING}
unset BASE_SETTING
## set up resources
ln -sf ${CUR_DIR}/nightly.html ${HOME_AB_RES}
# ready to start
cd ${HOME_AB_TMP}
polyglotrev=1.3.5
rev=2.5.0
## Sable sources: Jasmin, Heros, Soot
function getSableSrc() { (
cd ${HOME_AB_TMP}
for name in jasmin soot heros; do
[[ -d ${name} ]] || git clone https://github.com/Sable/${name}.git || return
( cd ${name}; git pull; git clean -dfx ) || return
done
) }
## Polyglot
function getSrcPolyglot() { (
cd ${HOME_AB_RES}
POLYGLOT_NAME=polyglot-${polyglotrev}-src
POLYGLOT_TB=${POLYGLOT_NAME}.tar.gz
POLYGLOT_URL="http://www.cs.cornell.edu/Projects/polyglot/src/${POLYGLOT_TB}"
[[ -d ${POLYGLOT_NAME} ]] || wget -nv -nc -nd ${POLYGLOT_URL} && tar xvfz ${POLYGLOT_TB} || return
cp -r ${POLYGLOT_NAME} ${HOME_AB_TMP}/polyglot || return
) }
function buildPolyglot() { (
TARGET_DIR=${HOME_AB_TMP}/polyglot
# source packages
cd ${HOME_AB_TMP}
jar -cf ${HOME_AB_REL}/polyglotsrc-$polyglotrev.jar polyglot || return
tar -czf ${HOME_AB_REL}/polyglotsrc-$polyglotrev.tar.gz polyglot || return
# generate jars
cd ${TARGET_DIR}
if ant; then
cd ${TARGET_DIR}/classes && jar -cf ${HOME_AB_REL}/polyglotclasses-$polyglotrev.jar * || return
cd ${TARGET_DIR}/cup-classes && jar -uf ${HOME_AB_REL}/polyglotclasses-$polyglotrev.jar * || return
fi
) }
## Jasmin
function buildJasmin() { (
TARGET_DIR=${HOME_AB_TMP}/jasmin
# build
cd ${TARGET_DIR}
cp ant.settings.template ant.settings
ant barebones
ant jasmin-jar
# install
cp libs/java_cup.jar ${HOME_AB_TMP_LIB}/java_cup.jar || return
cp lib/jasminclasses-*.jar ${HOME_AB_TMP_LIB}/jasminclasses-custom.jar || return
) }
## Heros
function buildHeros() { (
TARGET_DIR=${HOME_AB_TMP}/heros
# build
cd ${TARGET_DIR}
cp ant.settings.template ant.settings
ant || return
# install
) }
## Soot
function buildSoot(){ (
TARGET_DIR=${HOME_AB_TMP}/soot
# patch
cd ${TARGET_DIR}
cp ${HOME_AB_SET}/soot ant.settings || return
sed -i 's/jastaddfrontend/#jastaddfrontend/g' ant.settings || return
# build
cd ${TARGET_DIR}
ant barebones || return
ant fulljar || return
ant javadoc || return
# release
cp -r javadoc lib/* ${HOME_AB_REL}/ || return
) }
function getExternalSrc() {
: || return
}
function getExternalJar() {
: || return
}
function buildDeps() {
# buildPolyglot || return
buildJasmin || return
buildHeros || return
}
function makeNightly() {
# get sources
getSableSrc || exit
getExternalSrc || exit
getExternalJar || exit
buildDeps || exit
buildSoot || exit
}
makeNightly