-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sh
134 lines (104 loc) · 3.23 KB
/
build.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
#!/bin/bash
set -u
set -e
source ./config.sh
# Clear out INSTALL PREFIX, or create if it does not exist
if [ -d ${INSTALL_PREFIX} ]; then
rm -rf ${INSTALL_PREFIX}/*
else
mkdir ${INSTALL_PREFIX}
fi
mkdir ${KMD_TMP_DIR}
# 1. Clone config files so we have up to date versions
# Only clone the repository if it does not exist on disk
if [ ! -d ${CONFIG_SRC_DIR} ]; then
cd ${KMD_TMP_DIR}
git clone ${CONFIG_URL}
fi
# 2. Download and build glib
# Only download the tarball if it does not exist
if [ ! -f ${GLIB_TARBALL} ]; then
wget ${GLIB_URL} -O ${GLIB_TARBALL}
fi
# Remove the source directory if it exists
if [ -d ${GLIB_SRC_DIR} ]; then
rm -rf ${GLIB_SRC_DIR}
fi
cd ${KMD_TMP_DIR}
tar xf ${GLIB_TARBALL}
# Copy up to date versions of config files
cp ${CONFIG_SRC_DIR}/config.sub ${GLIB_SRC_DIR}/config.sub
cp ${CONFIG_SRC_DIR}/config.guess ${GLIB_SRC_DIR}/config.guess
# Configure and build glib
cd ${GLIB_SRC_DIR}
./configure ${GLIB_CONFIGURE_OPTIONS[*]}
make
make install
# 3. Download and build GTK
# Only download the tarball if it does not exist
if [ ! -f ${GTK_TARBALL} ]; then
wget ${GTK_URL} -O ${GTK_TARBALL}
fi
# Remove the source directory if it exists
if [ -d ${GTK_SRC_DIR} ]; then
rm -rf ${GTK_SRC_DIR}
fi
cd ${KMD_TMP_DIR}
tar xf ${GTK_TARBALL}
# Copy up to date versions of config files
cp ${CONFIG_SRC_DIR}/config.sub ${GTK_SRC_DIR}/config.sub
cp ${CONFIG_SRC_DIR}/config.guess ${GTK_SRC_DIR}/config.guess
# Configure and build GTK
cd ${GTK_SRC_DIR}
./configure ${GTK_CONFIGURE_OPTIONS[*]}
make
make install
# 4. Download and build AASM
# Only download the tarball if it does not exist
if [ ! -f ${AASM_TARBALL} ]; then
wget ${AASM_URL} -O ${AASM_TARBALL}
fi
# Remove the source directory if it exists
if [ -d ${AASM_SRC_DIR} ]; then
rm -rf ${AASM_SRC_DIR}
fi
cd ${KMD_TMP_DIR}
unzip ${AASM_TARBALL}
cd ${AASM_SRC_DIR}
${CC} -O2 -o aasm aasm.c
mv aasm ${INSTALL_PREFIX}
mv mnemonics ${INSTALL_PREFIX}
# 4. Download and build Komodo
# Only download the tarball if it does not exist
if [ ! -f ${KMD_TARBALL} ]; then
wget ${KMD_URL} -O ${KMD_TARBALL}
fi
# Remove the source directory if it exists
if [ -d ${KMD_SRC_DIR} ]; then
rm -rf ${KMD_SRC_DIR}
fi
cd ${KMD_TMP_DIR}
unzip ${KMD_TARBALL}
# Copy up to date versions of config files
cp ${CONFIG_SRC_DIR}/config.sub ${KMD_SRC_DIR}/config.sub
cp ${CONFIG_SRC_DIR}/config.guess ${KMD_SRC_DIR}/config.guess
# Set up PATH so it can find GTK config
export PATH="${PATH}:${KMD_TMP_DIR}/bin:${INSTALL_PREFIX}/bin"
# Configure and build Komodo
cd ${KMD_SRC_DIR}
./configure ${KMD_CONFIGURE_OPTIONS[*]}
make
# Horrible hack to get around the problem of OS X refusing to execute
# a script, even if run via /bin/sh install-sh
chmod 755 ${KMD_SRC_DIR}/install-sh
make install
# Create a script for running Komodo
echo "#!/bin/bash" > ${KMD_RUN_SCRIPT}
echo "export LD_LIBRARY_PATH=${INSTALL_PREFIX}" >> ${KMD_RUN_SCRIPT}
echo "export KMD_HOME=${INSTALL_PREFIX}" >> ${KMD_RUN_SCRIPT}
echo "${INSTALL_PREFIX}/bin/kmd \$@" >> ${KMD_RUN_SCRIPT}
chmod 755 ${KMD_RUN_SCRIPT}
# Create the script for running AASM from Komodo
echo "#!/bin/bash" > ${KMD_COMPILE_SCRIPT}
echo 'FLNME=$(echo $1 | sed s/[.]s$//)' >> ${KMD_COMPILE_SCRIPT}
echo "${AASM_BINARY} -lk \${FLNME}.kmd \$1" >> ${KMD_COMPILE_SCRIPT}