forked from Fahey-McLay/xalt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rtm
executable file
·127 lines (110 loc) · 2.83 KB
/
build.rtm
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
#!/bin/bash
# -*- shell-script -*-
#-----------------------------------------------------------------------
# XALT: A tool that tracks users jobs and environments on a cluster.
# Copyright (C) 2013-2014 University of Texas at Austin
# Copyright (C) 2013-2014 University of Tennessee
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
#-----------------------------------------------------------------------
PKG_VERSION=`cat .version`
echo Making Version: $PKG_VERSION
removeList()
{
local pkg=$1
shift;
for i in "$@"; do
rm -f $pkg/bin/$i
done
}
ld_repair()
{
$SUDO perl -pi -e "s|/$SYSHOST/|/\\\$SYSHOST/|" $PKG/bin/ld
}
runMe()
{
local cmdA=("$@")
local j
local jj
local i
local ignoreError
local j=0
for i in "${cmdA[@]}" ; do
ignoreError=
if [ "x${i:0:1}" = x- ]; then
i=${i:1}
ignoreError=1
fi
j=$((j+1))
jj=$(printf "%02d" $j)
echo
echo "%%---------------------------------%%"
echo " " $jj: $i
echo "%%---------------------------------%%"
echo
eval $i
if [ -z "$ignoreError" -a $? != 0 ]; then
break
fi
done
}
if [ -z "$SYSHOST" ]; then
myhost=$(hostname -f)
myhost=${myhost%.tacc.utexas.edu}
first=${myhost%%.*}
export SYSHOST=${myhost#*.}
fi
case $SYSHOST in
rios | mijo | jedrik | vato | vmijo | devo | lmod-test | xalt-lmod)
SUDO="sudo"
base="/opt/apps"
;;
ls4 | stampede | maverick)
base="$HOME/l/pkg"
if [ $SYSHOST == "stampede" ]; then
base="$base/$(uname -m)"
fi
REMOVE="mpirun srun aprun mpiexec"
;;
kfs|xc30)
base="$HOME/l/pkg"
EXTRA="/$SYSHOST"
REMOVE="srun ibrun"
;;
*)
base="$HOME/l/pkg"
;;
esac
BASE_DIR=$base
pkgName=xalt
PKG=$BASE_DIR/$pkgName/${PKG_VERSION}${EXTRA}
$SUDO rm -rf $PKG
MAKE=make
command -v remake 2>&1 > /dev/null
if [ "$?" = 0 ]; then
MAKE=remake
fi
cmdA=("-$MAKE distclean"
"-rm -rf $PKG"
"./configure --prefix=$PKG $CONF_OPTS"
"$SUDO $MAKE install"
"$SUDO $MAKE Inst_TACC"
"rm -f config.log"
"cd $BASE_DIR/$pkgName; $SUDO rm -f xalt; $SUDO ln -s $PKG_VERSION xalt"
"removeList $PKG $REMOVE"
"ld_repair"
)
runMe "${cmdA[@]}"