-
Notifications
You must be signed in to change notification settings - Fork 0
/
rebuild-netcdf
62 lines (40 loc) · 1.05 KB
/
rebuild-netcdf
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
#!/bin/sh
set -e
NETCDF=netcdf-4.2.1.1
NETCDF_WIN="$( cd "$( dirname "$0" )" && pwd )"
BINARIES=$NETCDF_WIN/bin
# Reset to known state
echo "# Resetting NetCDF sources to clean state"
cd $NETCDF_WIN
rm -rf $NETCDF
tar -zxvf $NETCDF.tar.gz
cd $NETCDF
# Generate stdcall wrappers
echo
echo "# Generating stdcall wrappers"
runghc $NETCDF_WIN/mkstdcall.hs \
--exclude=$NETCDF_WIN/netcdf.ignore \
include/netcdf.h > \
liblib/stdcall.c
patch liblib/Makefile.am $NETCDF_WIN/liblib-Makefile.am.patch
# Configure NetCDF
echo
echo "# Configuring NetCDF"
autoreconf -i
./configure --enable-dll --disable-netcdf-4
patch config.h $NETCDF_WIN/config.h.patch
# Build NetCDF
echo
echo "# Building NetCDF"
make
# Harvest Binaries
echo
echo "# Harvesting Binaries"
rm -rf $BINARIES
mkdir $BINARIES
cp include/netcdf.h $BINARIES/netcdf.h
cp liblib/netcdfdll.def $BINARIES/netcdf.def
cp liblib/.libs/libnetcdf-7.dll $BINARIES/netcdf.dll
dlltool --input-def=$BINARIES/netcdf.def \
--dllname=netcdf.dll \
--output-lib=$BINARIES/netcdf.lib