blob: fb4e067b24fffd68115f85d5e2c89cf987231a07 (
plain)
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
|
#! /bin/bash
################################################################################
# Prepare
################################################################################
# Set up shell
set -x # Output commands
set -e # Abort on errors
################################################################################
# Search
################################################################################
if [ -z "${LAPACK_DIR}" ]; then
echo "BEGIN MESSAGE"
echo "LAPACK selected, but LAPACK_DIR not set. Checking some places..."
echo "END MESSAGE"
FILES="liblapack.a liblapack.so"
DIRS="/usr/lib /usr/local/lib ${HOME}"
for file in $FILES; do
for dir in $DIRS; do
if test -r "$dir/$file"; then
LAPACK_DIR="$dir"
break
fi
done
done
if [ -z "$LAPACK_DIR" ]; then
echo "BEGIN MESSAGE"
echo "LAPACK not found"
echo "END MESSAGE"
else
echo "BEGIN MESSAGE"
echo "Found LAPACK in ${LAPACK_DIR}"
echo "END MESSAGE"
fi
fi
################################################################################
# Build
################################################################################
if [ -z "${LAPACK_DIR}" ]; then
echo "BEGIN MESSAGE"
echo "Building LAPACK..."
echo "END MESSAGE"
# Set locations
NAME=lapack-3.2.1
SRCDIR=$(dirname $0)
INSTALL_DIR=${SCRATCH_BUILD}
LAPACK_DIR=${INSTALL_DIR}/${NAME}
# Clean up environment
unset LIBS
unset MAKEFLAGS
(
exec >&2 # Redirect stdout to stderr
set -x # Output commands
set -e # Abort on errors
cd ${INSTALL_DIR}
if [ -e done-${NAME} -a done-${NAME} -nt ${SRCDIR}/dist/${NAME}.tgz \
-a done-${NAME} -nt ${SRCDIR}/LAPACK.sh ]
then
echo "LAPACK: The enclosed LAPACK library has already been built; doing nothing"
else
echo "LAPACK: Building enclosed LAPACK library"
echo "LAPACK: Unpacking archive..."
rm -rf build-${NAME}
mkdir build-${NAME}
pushd build-${NAME}
# Should we use gtar or tar?
TAR=$(gtar --help > /dev/null 2> /dev/null && echo gtar || echo tar)
${TAR} xzf ${SRCDIR}/dist/${NAME}.tgz
popd
echo "LAPACK: Configuring..."
rm -rf ${NAME}
mkdir ${NAME}
pushd build-${NAME}/${NAME}/SRC
echo "LAPACK: Building..."
${F77} ${F77FLAGS} -c *.f
${AR} ${ARFLAGS} lapack.a *.o
${RANLIB} ${RANLIBFLAGS} lapack.a
echo "LAPACK: Installing..."
cp lapack.a ${LAPACK_DIR}
popd
echo 'done' > done-${NAME}
echo "LAPACK: Done."
fi
)
if (( $? )); then
echo 'BEGIN ERROR'
echo 'Error while building LAPACK. Aborting.'
echo 'END ERROR'
exit 1
fi
fi
################################################################################
# Configure Cactus
################################################################################
# Set options
if [ "${LAPACK_DIR}" != '/usr' -a "${LAPACK_DIR}" != '/usr/local' ]; then
LAPACK_INC_DIRS=
LAPACK_LIB_DIRS="${LAPACK_DIR}"
fi
LAPACK_LIBS='lapack'
# Pass options to Cactus
echo "BEGIN MAKE_DEFINITION"
echo "HAVE_LAPACK = 1"
echo "LAPACK_DIR = ${LAPACK_DIR}"
echo "LAPACK_INC_DIRS = ${LAPACK_INC_DIRS}"
echo "LAPACK_LIB_DIRS = ${LAPACK_LIB_DIRS}"
echo "LAPACK_LIBS = ${LAPACK_LIBS}"
echo "END MAKE_DEFINITION"
echo 'INCLUDE_DIRECTORY $(LAPACK_INC_DIRS)'
echo 'LIBRARY_DIRECTORY $(LAPACK_LIB_DIRS)'
echo 'LIBRARY $(LAPACK_LIBS)'
|