Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed to work with latest netcdf

  • Loading branch information...
commit feeef908e6f943f32fa07ae77aebaedc67134cca 1 parent 7324db5
@jystic authored
View
2  .gitignore
@@ -1,2 +1,4 @@
*.swp
*~
+netcdf-*
+bin/
View
6 config.h.patch
@@ -1,8 +1,8 @@
--- a/config.h
+++ b/config.h
@@ -365,7 +365,13 @@
- #define SIZEOF_LONG 4
-
+ #define SIZEOF_LONG_LONG 8
+
/* The size of `off_t', as computed by sizeof. */
-#define SIZEOF_OFF_T 4
+#include <io.h>
@@ -12,6 +12,6 @@
+#define off_t __int64
+#define _off_t __int64
+#define _OFF_T_DEFINED
-
+
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
View
6 lib.bat
@@ -0,0 +1,6 @@
+@echo off
+set VISUAL_STUDIO=C:\Program Files (x86)\Microsoft Visual Studio 10.0
+set SETUP_ENV="%VISUAL_STUDIO%\VC\bin\vcvars32.bat"
+
+call %SETUP_ENV%
+lib.exe %*
View
2  liblib-Makefile.am.patch
@@ -1,5 +1,3 @@
-diff --git a/liblib/Makefile.am b/liblib/Makefile.am
-index c6ab07f..0f4d7bf 100755
--- a/liblib/Makefile.am
+++ b/liblib/Makefile.am
@@ -19,7 +19,7 @@ libnetcdf_la_LIBADD =
View
51 rebuild-netcdf
@@ -2,18 +2,20 @@
set -e
-NETCDF=netcdf-4.2.1.1
-NETCDF_WIN="$( cd "$( dirname "$0" )" && pwd )"
-BINARIES=$NETCDF_WIN/bin
+NETCDF_VERSION=netcdf-4.2.1.1
+
+BASE="$( cd "$( dirname "$0" )" && pwd )"
+BIN=$BASE/bin
+SRC=$BASE/$NETCDF_VERSION
# Reset to known state
echo "# Resetting NetCDF sources to clean state"
-cd $NETCDF_WIN
-rm -rf $NETCDF
-tar -zxvf $NETCDF.tar.gz
-cd $NETCDF
+cd $BASE
+rm -rf $SRC
+tar -zxvf $NETCDF_VERSION.tar.gz
+cd $SRC
# Generate stdcall wrappers
@@ -21,12 +23,12 @@ cd $NETCDF
echo
echo "# Generating stdcall wrappers"
-runghc $NETCDF_WIN/mkstdcall.hs \
- --exclude=$NETCDF_WIN/netcdf.ignore \
- include/netcdf.h > \
- liblib/stdcall.c
+runghc $BASE/mkstdcall.hs \
+ --exclude=$BASE/netcdf.ignore \
+ $SRC/include/netcdf.h > \
+ $SRC/liblib/stdcall.c
-patch liblib/Makefile.am $NETCDF_WIN/liblib-Makefile.am.patch
+patch $SRC/liblib/Makefile.am $BASE/liblib-Makefile.am.patch
# Configure NetCDF
@@ -36,7 +38,10 @@ echo "# Configuring NetCDF"
autoreconf -i
./configure --enable-dll --disable-netcdf-4
-patch config.h $NETCDF_WIN/config.h.patch
+make config.h
+
+echo patch $SRC/config.h $BASE/config.h.patch
+patch $SRC/config.h $BASE/config.h.patch
# Build NetCDF
@@ -51,12 +56,16 @@ make
echo
echo "# Harvesting Binaries"
-rm -rf $BINARIES
-mkdir $BINARIES
+rm -rf $BIN
+mkdir $BIN
+
+cp $SRC/include/netcdf.h $BIN/netcdf.h
+cp $SRC/liblib/.libs/libnetcdf-7.dll $BIN/netcdf.dll
+pexports $BIN/netcdf.dll | sed -e 's/libnetcdf-7/netcdf/' >$BIN/netcdf.def
+
+cd $BIN
+cmd //c $BASE/lib.bat //machine:i386 //def:netcdf.def //out:netcdf.lib
-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
+#dlltool --input-def=$BIN/netcdf.def \
+# --dllname=netcdf.dll \
+# --output-lib=$BIN/netcdf.lib
Please sign in to comment.
Something went wrong with that request. Please try again.