forked from xsdk-project/installxSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installxSDK.sh
executable file
·98 lines (89 loc) · 2.32 KB
/
installxSDK.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh
PREFIX="notset"
WITHGIT="git"
PACKAGEDIR="0"
PETSC_COMMIT="origin/maint"
unset PETSC_ARCH
for i in "$@"
do
case $i in
-h|--help)
echo "xSDK Installer help:"
echo "--prefix=\"installation directory\" [--download-ideas] [other standard configure options such as mpicc= etc]"
PREFIX="dummy"
;;
--prefix=*)
PREFIX="${i#*=}"
if [ "${PREFIX}" = "/usr" ]; then
echo "Do not use /usr as your --prefix install location"
exit
fi
if [ "${PREFIX}" = "/usr/local" ]; then
echo "Do not use /usr/local as your --prefix install location"
exit
fi
;;
--with-git=*)
WITHGIT="${i#*=}"
;;
--with-packages-dir=*)
PACKAGEDIR="${i#*=}"
;;
--download-petsc-commit=*)
PETSC_COMMIT="${i#*=}"
;;
*)
# unknown option
;;
esac
done
if [ "${PREFIX}" = "notset" ]; then
echo "You must provide a --prefix=\"installation directory\" option"
exit
fi
# make directory where builds will occur
if [ ! -d xsdk ]; then
mkdir xsdk
printf "Creating work directory xsdk for all temporary files\n"
fi
cd xsdk
XSDK_DIR=`pwd`
if [ ! -d petsc ]; then
if [ "${PACKAGEDIR}" != "0" ]; then
if [ ! -f ${PACKAGEDIR}/petsc.tar.gz ]; then
echo " "
echo "Running in firewall mode"
echo " "
echo "Obtain the tarball https://bitbucket.org/petsc/petsc/get/${PETSC_COMMIT}.tar.gz"
echo "put it in the directory ${PACKAGEDIR} with the name petsc.tar.gz"
echo "Do not uncompress or untar it. Then run the script again"
echo " "
exit
else
dir=`tar -tzf ${PACKAGEDIR}/petsc.tar.gz | head -1`
tar zxf ${PACKAGEDIR}/petsc.tar.gz
mv -f ${dir} petsc
cd petsc
fi
elif [ "${WITHGIT}" != "0" ]; then
printf "Using git to obtain the packages\n"
${WITHGIT} clone https://bitbucket.org/petsc/petsc.git petsc
cd petsc
git checkout $PETSC_COMMIT
else
curl https://bitbucket.org/petsc/petsc/get/${PETSC_COMMIT}.tar.gz > petsc.tar.gz
dir=`tar -tzf petsc.tar.gz | head -1`
tar zxf petsc.tar.gz
mv -f ${dir} petsc
cd petsc
fi
else
if [ "${WITHGIT}" != "0" ]; then
cd petsc
git fetch
git checkout $PETSC_COMMIT
fi
fi
# Install the packages
export PETSC_DIR=`pwd`
./configure --download-xsdk --with-external-packages-dir=${XSDK_DIR} "$@"