forked from hhoeflin/hdf5r
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.win
64 lines (57 loc) · 2.08 KB
/
configure.win
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
#!/bin/sh
# config file to download pre-compiled windows libraries and headers
# Adapted from Cairo package:
echo " checking hdf5 headers and libraries"
allok=yes
# Makevars file used for CRAN release
HDF5_VERSION_USE="1_8_14"
# Get environment variable through R as workaround
HDF5R_CPPFLAGS=""
DEFINE_H5FREE_MEMORY="0"
if [ ! -e "${LIB_HDF5}" ]; then
echo "Environment variable LIB_HDF5 is not set. Attempting to download HDF5 files from repository."
echo 'download.file("https://github.com/mannau/h5-libwin/archive/master.zip", destfile = "h5-libwin.zip")' | R --vanilla --slave
if [ ! -e h5-libwin.zip ]; then
allok=no
else
WINC="../inst/include"
WLIB="lib${R_ARCH}"
echo " unpacking current hdf5"
unzip h5-libwin.zip
cp -rf h5-libwin-master/include inst
cp -rf h5-libwin-master/lib src
rm h5-libwin.zip
rm -rf h5-libwin-master
echo "src/lib/${R_ARCH}/libhdf5_cpp.a"
if [ ! -e src/lib/${R_ARCH}/libhdf5_cpp.a ]; then
allok=no
fi
echo "inst/include/hdf5_cpp/H5Cpp.h"
if [ ! -e inst/include/hdf5_cpp/H5Cpp.h ]; then
allok=no
fi
fi
else
WINC="${LIB_HDF5}/include"
WLIB="${LIB_HDF5}/lib${R_ARCH}"
fi
if [ ${allok} != yes ]; then
echo ""
echo " *** ERROR: unable to find HDF5 files"
echo ""
echo " They must be in src/lib and inst/include"
echo ""
echo " You can get the latest binary ball from"
echo " https://github.com/mannau/h5-libwin"
echo ""
exit 1
fi
HDF5R_LIBS="-L${WLIB} -lhdf5 -lhdf5_hl -lz -lm"
HDF5R_CFLAGS="-I${WINC}/hdf5 -I${WINC}/hdf5_hl -I${WINC}/cmakeconf -I${HDF5_VERSION_USE} -I."
# replace all in Makevars.win
sed -e "s#@HDF5_VERSION_USE@#${HDF5_VERSION_USE}#g" -e "s#@HDF5R_CFLAGS@#${HDF5R_CFLAGS}#g" \
-e "s#@HDF5R_CPPFLAGS@#${HDF5R_CPPFLAGS}#g" -e "s#@HDF5R_LIBS@#${HDF5R_LIBS}#g" \
-e "s#@DEFINE_H5FREE_MEMORY@#${DEFINE_H5FREE_MEMORY}#g" \
src/Makevars.in > src/Makevars.win
echo " seems ok, ready to go"
exit 0