-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·45 lines (40 loc) · 1.36 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
#!/bin/bash -e
. /etc/profile.d/modules.sh
# Build file for proj.4
module add ci
module add cmake
SOURCE_FILE=${NAME}-${VERSION}.tar.gz
echo "REPO_DIR is "
echo $REPO_DIR
echo "SRC_DIR is "
echo $SRC_DIR
echo "WORKSPACE is "
echo $WORKSPACE
echo "SOFT_DIR is"
echo $SOFT_DIR
mkdir -p ${WORKSPACE}/${NAME}-${VERSION}/build-${BUILD_NUMBER}
mkdir -p ${SRC_DIR}
mkdir -p ${SOFT_DIR}
# Download the source file
if [ ! -e ${SRC_DIR}/${SOURCE_FILE}.lock ] && [ ! -s ${SRC_DIR}/${SOURCE_FILE} ] ; then
touch ${SRC_DIR}/${SOURCE_FILE}.lock
echo "seems like this is the first build - let's geet the source"
wget http://download.osgeo.org/${NAME}/${SOURCE_FILE} -O ${SRC_DIR}/${SOURCE_FILE}
echo "releasing lock"
rm -v ${SRC_DIR}/${SOURCE_FILE}.lock
elif [ -e ${SRC_DIR}/${SOURCE_FILE}.lock ] ; then
# Someone else has the file, wait till it's released
while [ -e ${SRC_DIR}/${SOURCE_FILE}.lock ] ; do
echo " There seems to be a download currently under way, will check again in 5 sec"
sleep 5
done
else
echo "continuing from previous builds, using source at " ${SRC_DIR}/${SOURCE_FILE}
fi
tar xzf ${SRC_DIR}/${SOURCE_FILE} -C ${WORKSPACE} --skip-old-files
# We use in-source configuration because we want to be able to run the tests later.
cd ${WORKSPACE}/${NAME}-${VERSION}/build-${BUILD_NUMBER}
cmake ../ \
-G"Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX="${SOFT_DIR}"
make