-
Notifications
You must be signed in to change notification settings - Fork 0
/
slurm-build.sh
executable file
·74 lines (57 loc) · 1.26 KB
/
slurm-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
#!/bin/sh
if [ $# -lt 1 ]; then
echo "Usage: $0 <version/git> [git branch]"
exit 1
fi
BG_NAME="BGQ"
DB2_DIR="/opt/ibm/db2/V9.7/lib64"
MAKEOPTS="-j31"
VER="$1"
CANON="slurm-${VER}"
TARBALL="${CANON}.tar.bz2"
LOG_EXTRACT="$CANON-extract.log"
LOG_CONFIGURE="$CANON-configure.log"
LOG_MAKE="$CANON-make.log"
LOG_INSTALL="$CANON-install.log"
if [ $VER != 'git' ]; then
if [ ! -f $TARBALL ]; then
echo "$TARBALL not found!"
exit 1
fi
tar xavf "$TARBALL" 2>&1 | tee "$LOG_EXTRACT"
fi
pushd $CANON > /dev/null
if [ $VER == 'git' ]; then
git reset --hard
git clean -d -f
REV="$2"
FF=`git checkout $REV`
if [ $? -ne 0 ]; then
echo "Error: could not find branch/commit/tag"
popd > /dev/null
exit 1
fi
echo $FF | grep 'fast-forward' > /dev/null
if [ $? -eq 0 ]; then
git merge origin/$REV
fi
fi
#TODO: make this more fine-grained/optional
for f in `ls -1 ../patches/*.patch 2>/dev/null`; do
echo "Applying $f"
patch -p1 < $f
done
if [ $VER == 'git' ]; then
./autogen.sh
fi
./configure --enable-front-end \
--with-munge=/usr \
--with-db2-dir="$DB2_DIR" \
--with-bg-serial="$BG_NAME" \
--prefix=/bgsys/local/slurm 2>&1 | tee "../$LOG_CONFIGURE"
if [ $VER == 'git' ]; then
make clean
fi
make $MAKEOPTS 2>&1 | tee "../$LOG_MAKE"
exit 0
popd > /dev/null