forked from TACC/Lmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rtm
executable file
·156 lines (129 loc) · 3.54 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
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
#!/bin/bash
# -*- shell-script -*-
PKG_VERSION=`(cd src; lua -e "local Version=require('Version'); print(Version.name())") | awk '{print $1}'`
echo Making Version: $PKG_VERSION
make_install()
{
if [ "$BUILD_TYPE" != "EXPERIMENTAL" ]; then
$SUDO $MAKE install $MAKE_EXTRA
else
echo "$SUDO $MAKE pre-install $MAKE_EXTRA"
$SUDO $MAKE pre-install $MAKE_EXTRA
$SUDO rm -f $BASE_DIR/lmod/EXPERIMENTAL
$SUDO ln -s $PKG_VERSION $BASE_DIR/lmod/EXPERIMENTAL
fi
}
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
}
BUILD_TYPE="standard"
if [ "$1" = "-e" ]; then
BUILD_TYPE="EXPERIMENTAL"
echo BUILD_TYPE: $BUILD_TYPE
fi
myhost=$(hostname -f)
myhost=${myhost%.tacc.utexas.edu}
first=${myhost%%.*}
SYSHOST=${myhost#*.}
SUDO=""
if [ -x $HOME/.up/bin/arch.py ]; then
MY_ARCH=$($HOME/.up/bin/arch.py)
MY_ARCH="$MY_ARCH/"
fi
MCLAY=~mclay
cat > /tmp/TACC.build.$$ <<EOF
$MCLAY/l/moduleData/${MY_ARCH}cacheDir:$MCLAY/l/moduleData/${MY_ARCH}system.txt
EOF
if [ -n "$LUA_PATH" ]; then
MAKE_EXTRA="LUA_PATH=$LUA_PATH LUA_CPATH=$LUA_CPATH"
fi
case $SYSHOST in
rios | mijo | jedrik | vato | vmijo | devo | xalt-lmod )
SUDO="sudo"
base="/opt/apps"
ADMIN_DIR=/opt/moduleData
UPDATE_FN=$ADMIN_DIR/system.txt
CACHEDIRS=$ADMIN_DIR/cacheDir
EXTRA="--with-spiderCacheDir=$CACHEDIRS --with-updateSystemFn=$UPDATE_FN"
if [ "$SYSHOST" == "mijo" ]; then
EXTRA="$EXTRA --with-exportedModuleCmd=no"
fi
;;
ls5 | maverick | stampede | wrangler | stampede2 )
base="$HOME/l/pkg"
ADMIN_DIR="$HOME/a/moduleData"
UPDATE_FN=$ADMIN_DIR/system.txt
if [ $SYSHOST == "stampede" ]; then
if [ -x $HOME/.up/bin/arch.py ]; then
base="$base/$($HOME/.up/bin/arch.py)"
else
base="$base/$(uname -m)"
fi
fi
EXTRA="--with-spiderCacheDescript=/tmp/TACC.build.$$ --with-siteName=TACC --with-syshost=$SYSHOST"
SITE_PKG="contrib/TACC/*.lua"
;;
gligar.os)
ADMIN_DIR=/apps/gent/lmodcache/
UPDATE_FN=$ADMIN_DIR/timestamp
CACHEDIRS=$ADMIN_DIR
EXTRA="--with-cachedLoads=yes --with-autoSwap=no --with-disableNameAutoSwap=yes --with-caseIndependentSorting=yes --with-pinVersions=yes"
base="$HOME/l/pkg";;
*)
ADMIN_DIR=$HOME/w/moduleData
UPDATE_FN=$ADMIN_DIR/system.txt
CACHEDIRS=$ADMIN_DIR/cacheDir
EXTRA="--with-spiderCacheDir=$CACHEDIRS --with-updateSystemFn=$UPDATE_FN"
base="$HOME/l/pkg"
;;
esac
BASE_DIR=$base
pkgName=lmod
PKG=$BASE_DIR/$pkgName/$PKG_VERSION
EXTRA_CMD="echo "
if [ -n "$SITE_PKG" ]; then
EXTRA_CMD="$SUDO cp $SITE_PKG $PKG/libexec"
fi
rm -f config.status config.log
MAKE=make
command -v remake 2>&1 > /dev/null
if [ "$?" = 0 ]; then
MAKE=remake
fi
cmdA=("-$MAKE distclean"
"./configure --prefix=$BASE_DIR --with-settarg=full $EXTRA"
"$SUDO rm -rf $BASE_DIR/$pkgName/orig"
"-$SUDO cp -r $BASE_DIR/$pkgName/$PKG_VERSION $BASE_DIR/$pkgName/orig"
"$SUDO rm -f $PKG/../$pkgName"
"-$SUDO ln -s orig $PKG/../$pkgName"
"make_install"
"$EXTRA_CMD"
"$SUDO rm -rf $BASE_DIR/$pkgName/orig"
"$MAKE clobber"
)
runMe "${cmdA[@]}"
rm -rf /tmp/TACC.build.$$