-
Notifications
You must be signed in to change notification settings - Fork 16
/
INSTALL
executable file
·213 lines (185 loc) · 6.27 KB
/
INSTALL
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/bin/bash
# Script to install required external packages
# Get the OS
OS=$(uname -s)
# Set location of WFM
WFM_DIR=$(pwd)
# Set location where tarfiles for packages are kept
TAR_DIR=${WFM_DIR}/tarfiles
# Set location where packages are built
BUILD_DIR=${WFM_DIR}/build
# Set the location where libraries are installed
LIB_DIR=${WFM_DIR}/lib
# Process arguments
for arg in $@; do
case $arg in
--with-ruby=*) RUBY=$(echo $arg | cut -f 2 -d "=")/bin/ruby;;
-h|--help) echo
echo "Run this script to install the Workflow Manager"
echo
echo "INSTALL [--with-ruby=/path/to/ruby]"
echo
exit;;
*)
esac
done
# Make sure a ruby is specified
if [ -z "$RUBY" ]; then
RUBY=$(which ruby 2>/dev/null)
if [ $? -ne 0 ]; then
echo "Can not find ruby. Use --with-ruby to specify path where ruby is installed."
exit 1
fi
fi
# Make sure ruby exists
if [ -x $RUBY ]; then
echo "Installing using $RUBY"
else
echo "Installation failed. $RUBY does not exist. Use --with-ruby to specify path where ruby is installed."
exit 1
fi
# Abort if any command returns an error
set -e
# Make sure ruby is at least 2.4.0 or higher
good_ruby=$($RUBY -e "puts RUBY_VERSION >= '2.4.0'")
if [ "$good_ruby" = "false" ]; then
echo "Ruby 2.4.0 or higher is required"
exit 1
fi
# Replace ruby shebangs with path to ruby
for file in $(ls sbin | grep -v '\.sh'); do
# Skip files that are links
if [ -L sbin/$file ]; then
continue
fi
# Replace first line with correct shebang
sed "1s:.*:#!${RUBY}:" sbin/$file > sbin/$file.new
mv sbin/$file.new sbin/$file
# Add path to libxml2 for AIX
if [ "$OS" = "AIX" ]; then
sed "2s%.*%ENV['LIBPATH']=\"${LIB_DIR}/libxml2/lib:#{ENV['LIBPATH']}\"%" sbin/$file > sbin/$file.new
mv sbin/$file.new sbin/$file
fi
# Make sure the new file is executable
chmod ugo+x sbin/$file
done
# Package versions
LIBXML2_VERSION="2.12.6"
LIBXML_RUBY_VERSION="5.0.3"
SYSTEMTIMER_VERSION="1.2.3"
SQLITE3_VERSION="autoconf-3450300"
SQLITE3_RUBY_VERSION="1.7.3"
OPEN4_VERSION="1.3.4"
RUBYSL_DATE_VERSION="2.0.9"
RUBYSL_PARSEDATE_VERSION="1.0.1"
THREAD_VERSION="0.2.2"
# Set AIX_CFLAGS and AIX_LDFLAGS
if [ "$OS" = "AIX" ]; then
AIX_CFLAGS="-maix64 -g0"
AIX_LDFLAGS="-maix64 -g0"
else
AIX_CFLAGS=""
AIX_LDFLAGS=""
fi
# Create the build directory
mkdir -p ${BUILD_DIR}
# Install rubysl-date
echo "==========================================="
echo "= INSTALLING rubysl-date"
echo "==========================================="
cd ${LIB_DIR}
gunzip -c ${TAR_DIR}/rubysl-date-${RUBYSL_DATE_VERSION}.tar.gz | tar -xvf -
rm -rf rubysl-date
mv rubysl-date-${RUBYSL_DATE_VERSION} rubysl-date
# Install rubysl-parsedate
echo "==========================================="
echo "= INSTALLING rubysl-parsedate"
echo "==========================================="
cd ${LIB_DIR}
gunzip -c ${TAR_DIR}/rubysl-parsedate-${RUBYSL_PARSEDATE_VERSION}.tar.gz | tar -xvf -
rm -rf rubysl-parsedate
mv rubysl-parsedate-${RUBYSL_PARSEDATE_VERSION} rubysl-parsedate
# Install Open4
echo "==========================================="
echo "= INSTALLING Open4"
echo "==========================================="
cd ${LIB_DIR}
gunzip -c ${TAR_DIR}/open4-${OPEN4_VERSION}.tar.gz | tar -xvf -
rm -rf open4
mv open4-${OPEN4_VERSION} open4
# Install libxml2
echo "==========================================="
echo "= INSTALLING libxml2 ="
echo "==========================================="
cd ${BUILD_DIR}
unxz -c ${TAR_DIR}/libxml2-${LIBXML2_VERSION}.tar.xz | tar -xvf -
cd libxml2-${LIBXML2_VERSION}
if [ "$LIBXML2_VERSION" = "2.9.0" ]; then # version 2.9.0 requires must be patched
echo "==========================================="
echo "= PATCHING libxml2 ="
echo "==========================================="
patch -p1 -i ${TAR_DIR}/libxml2-2.9.0.patch
fi
export OBJECT_MODE=64
./configure --prefix=${LIB_DIR}/libxml2 CFLAGS="$AIX_CFLAGS" LDFLAGS="$AIX_LDFLAGS" --without-python
make clean
make
rm -rf ${LIB_DIR}/libxml2
make install
# Install libxml-ruby
echo "==========================================="
echo "= INSTALLING libxml-ruby ="
echo "==========================================="
libxml2_opts="--with-xml2-lib=${LIB_DIR}/libxml2/lib --with-xml2-include=${LIB_DIR}/libxml2/include/libxml2"
cd ${BUILD_DIR}
gunzip -c ${TAR_DIR}/libxml-ruby-${LIBXML_RUBY_VERSION}.tar.gz | tar -xvf -
cd libxml-ruby-${LIBXML_RUBY_VERSION}/ext/libxml
echo ${RUBY} extconf.rb $libxml2_opts
${RUBY} extconf.rb $libxml2_opts
if [ "$OS" = "AIX" ]; then
:
else
sed -i "/^ldflags/ s:$: -Wl,-rpath,${LIB_DIR}/libxml2/lib:" Makefile
fi
make clean
make
rm -rf ${LIB_DIR}/libxml-ruby
mkdir ${LIB_DIR}/libxml-ruby
cp -r ${BUILD_DIR}/libxml-ruby-${LIBXML_RUBY_VERSION}/lib/* ${LIB_DIR}/libxml-ruby
cp libxml_ruby.so ${LIB_DIR}/libxml-ruby
# Install sqlite3
echo "==========================================="
echo "= INSTALLING sqlite3 ="
echo "==========================================="
cd ${BUILD_DIR}
unxz -c ${TAR_DIR}/sqlite-${SQLITE3_VERSION}.tar.xz | tar -xvf -
cd sqlite-${SQLITE3_VERSION}
./configure --prefix=${LIB_DIR}/sqlite3 CFLAGS="-Os -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_THREADSAFE=1 $AIX_CFLAGS $AIX_CFLAGS" LD_FLAGS="$AIX_LDFLAGS"
make clean
make
rm -rf ${LIB_DIR}/sqlite3
make install
# Install sqlite3-ruby
echo "==========================================="
echo "= INSTALLING sqlite3-ruby ="
echo "==========================================="
cd ${BUILD_DIR}
gunzip -c ${TAR_DIR}/sqlite3-ruby-${SQLITE3_RUBY_VERSION}.tar.gz | tar -xvf -
cd sqlite3-ruby-${SQLITE3_RUBY_VERSION}/ext/sqlite3
export LD_RUN_PATH=${LIB_DIR}/sqlite3/lib
${RUBY} extconf.rb -- --with-sqlite3-include=${LIB_DIR}/sqlite3/include --with-sqlite3-lib=${LIB_DIR}/sqlite3/lib --enable-system-libraries
make clean
make
rm -rf ${LIB_DIR}/sqlite3-ruby
mkdir ${LIB_DIR}/sqlite3-ruby
cp -r ${BUILD_DIR}/sqlite3-ruby-${SQLITE3_RUBY_VERSION}/lib/* ${LIB_DIR}/sqlite3-ruby
cp sqlite3_native.so ${LIB_DIR}/sqlite3-ruby/sqlite3
unset LDFLAGS
# Insteall thread
echo "==========================================="
echo "= INSTALLING Thread"
echo "==========================================="
cd ${LIB_DIR}
gunzip -c ${TAR_DIR}/thread-${THREAD_VERSION}.tar.gz | tar -xvf -
rm -rf thread
mv thread-${THREAD_VERSION} thread