forked from dealii/candi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp4est.package
118 lines (100 loc) · 3.96 KB
/
p4est.package
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
#VERSION=1.1;CHECKSUM=37ba7f4410958cfb38a2140339dbf64f
#VERSION=2.0;CHECKSUM=1b7440a78a28ebf713361acfea70ee78
VERSION=2.2;CHECKSUM=6943949a6678589ebf1686ee7bad7ea1
NAME=p4est-$VERSION
EXTRACTSTO=p4est-${VERSION}
SOURCE=https://p4est.github.io/release/
PACKING=.tar.gz
BUILDCHAIN=custom
INSTALL_PATH=${INSTALL_PATH}/${NAME}
package_specific_setup () {
function bdie () {
echo "Error: $@"
exit 1
}
# export zlib if we installed it ourselves
if [ ! -z "${ZLIB_DIR}" ]; then
if [ -z "${ZLIB_LIBPATH}" ]; then
ZLIB_LIBPATH=${ZLIB_DIR}/lib
fi
LIBS="-L${ZLIB_LIBPATH}"
if [ -z "${ZLIB_INCLUDE}" ]; then
ZLIB_INCLUDE=${ZLIB_DIR}/include
fi
CFLAGS="$CFLAGS -I${ZLIB_INCLUDE}"
fi
if test -z "$CFLAGS" -a -z "$P4EST_CFLAGS_FAST" ; then
export CFLAGS_FAST="-O2"
else
export CFLAGS_FAST="$CFLAGS $P4EST_CFLAGS_FAST"
fi
echo "CFLAGS_FAST: $CFLAGS_FAST"
if test -z "$CFLAGS" -a -z "$P4EST_CFLAGS_DEBUG" ; then
export CFLAGS_DEBUG="-O0 -g"
else
export CFLAGS_DEBUG="$CFLAGS $P4EST_CFLAGS_DEBUG"
fi
echo "CFLAGS_DEBUG: $CFLAGS_DEBUG"
# choose names for fast and debug build directories
BUILD_FAST="${BUILD_PATH}/${NAME}/FAST"
BUILD_DEBUG="${BUILD_PATH}/${NAME}/DEBUG"
# choose names for fast and debug installation directories
INSTALL_FAST="${INSTALL_PATH}/FAST"
INSTALL_DEBUG="${INSTALL_PATH}/DEBUG"
echo
echo "This script tries configure and build the p4est library."
echo "Build FAST: $BUILD_FAST"
echo "Build DEBUG: $BUILD_DEBUG"
echo "Install FAST: $INSTALL_FAST"
echo "Install DEBUG: $INSTALL_DEBUG"
echo "Checking environment: CFLAGS P4EST_CFLAGS_FAST P4EST_CFLAGS_DEBUG"
test -f "${UNPACK_PATH}/${EXTRACTSTO}/src/p4est.h" || bdie "Main header file missing"
test -f "${UNPACK_PATH}/${EXTRACTSTO}/configure" || bdie "Configure script missing"
echo "See output in files .../config.output and .../make.output"
echo
# remove old versions
if test -d "${BUILD_PATH}/${NAME}"; then
rm -rf "${BUILD_PATH}/${NAME}"
quit_if_fail "p4est: rm -rf ${BUILD_PATH}/${NAME} failed"
fi
echo "Build FAST version in $BUILD_FAST"
mkdir -p "$BUILD_FAST"
cd "$BUILD_FAST"
"${UNPACK_PATH}/${EXTRACTSTO}/configure" --enable-mpi --enable-shared \
--disable-vtk-binary --without-blas \
--prefix="$INSTALL_FAST" CFLAGS="$CFLAGS_FAST" \
CPPFLAGS="-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL" F77="$FF" \
"$@" > config.output || bdie "Error in configure"
make -C sc -j${PROCS} > make.output || bdie "Error in make sc"
make -j${PROCS} >> make.output || bdie "Error in make p4est"
make install >> make.output || bdie "Error in make install"
echo "FAST version installed in $INSTALL_FAST"
echo
echo "Build DEBUG version in $BUILD_DEBUG"
mkdir -p "$BUILD_DEBUG"
cd "$BUILD_DEBUG"
"${UNPACK_PATH}/${EXTRACTSTO}/configure" --enable-debug --enable-mpi --enable-shared \
--disable-vtk-binary --without-blas \
--prefix="$INSTALL_DEBUG" CFLAGS="$CFLAGS_DEBUG" \
CPPFLAGS="-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL" F77="$FF" \
"$@" > config.output || bdie "Error in configure"
make -C sc -j${PROCS} > make.output || bdie "Error in make sc"
make -j${PROCS} >> make.output || bdie "Error in make p4est"
make install >> make.output || bdie "Error in make install"
grep -q "#define P4EST_HAVE_ZLIB" $INSTALL_DEBUG/include/p4est_config.h || bdie "Error: p4est couldn't find zlib"
echo "DEBUG version installed in $INSTALL_DEBUG"
echo
cd "${BUILD_PATH}/${NAME}"
touch candi_successful_build
}
package_specific_register () {
export P4EST_DIR=${INSTALL_PATH}
}
package_specific_conf () {
# Generate configuration file
CONFIG_FILE=${CONFIGURATION_PATH}/${NAME}
rm -f $CONFIG_FILE
echo "
export P4EST_DIR=${INSTALL_PATH}
" >> $CONFIG_FILE
}