# HG changeset patch # User Michael Goffioul # Date 1374374476 14400 # Node ID 591b3d68b43ef8bf0cf163d01d289283a1d58ea5 # Parent 36ac78f420b488ccef8a5beb4831be37c8e72abc Add netcdf module (and MSVC-specific patch) diff -r 36ac78f420b4 -r 591b3d68b43e dist-files.mk --- a/dist-files.mk Sat Jul 20 15:23:11 2013 -0400 +++ b/dist-files.mk Sat Jul 20 22:41:16 2013 -0400 @@ -302,6 +302,7 @@ msvc-libxml2-1.patch \ msvc-msitools-1.patch \ msvc-msitools-2-tests.patch \ + msvc-netcdf-1.patch \ msvc-nettle-1.patch \ msvc-ncurses-1.patch \ msvc-pstoedit-1.patch \ @@ -338,6 +339,7 @@ native-gcc-1-float.patch \ native-gcc.mk \ ncurses.mk \ + netcdf.mk \ nettle.mk \ npp.mk \ nsis-1-fixes.patch \ diff -r 36ac78f420b4 -r 591b3d68b43e index.html --- a/index.html Sat Jul 20 15:23:11 2013 -0400 +++ b/index.html Sat Jul 20 22:41:16 2013 -0400 @@ -1844,6 +1844,11 @@ Ncurses + netcdf + 4.3.0 + NetCDF + + nettle 2.5 nettle diff -r 36ac78f420b4 -r 591b3d68b43e src/msvc-netcdf-1.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/msvc-netcdf-1.patch Sat Jul 20 22:41:16 2013 -0400 @@ -0,0 +1,178 @@ +diff -ur netcdf-4.3.0-orig/Makefile.am netcdf-4.3.0-new/Makefile.am +--- netcdf-4.3.0-orig/Makefile.am 2013-05-09 12:15:22 -0400 ++++ netcdf-4.3.0-new/Makefile.am 2013-07-20 15:18:07 -0400 +@@ -139,7 +139,9 @@ + + install-data-hook: + if BUILD_DLL +- cp liblib/netcdfdll.def ${prefix}/lib ++ if test -f liblib/netcdfdll.def; then \ ++ cp liblib/netcdfdll.def ${prefix}/lib; \ ++ fi + endif # BUILD_DLL + @echo '' + @echo '+-------------------------------------------------------------+' +diff -ur netcdf-4.3.0-orig/configure.ac netcdf-4.3.0-new/configure.ac +--- netcdf-4.3.0-orig/configure.ac 2013-05-09 12:15:14 -0400 ++++ netcdf-4.3.0-new/configure.ac 2013-07-20 13:38:00 -0400 +@@ -652,9 +652,9 @@ + opendap with --disable-netcdf-4 --disable-dap, or see config.log for errors.])]) + fi + +-# We need the math library +-AC_CHECK_LIB([m], [floor], [], +-[AC_MSG_ERROR([Can't find or link to the math library.])]) ++## We need the math library ++#AC_CHECK_LIB([m], [floor], [], ++#[AC_MSG_ERROR([Can't find or link to the math library.])]) + + if test "x$enable_netcdf_4" = xyes; then + +diff -ur netcdf-4.3.0-orig/lib_flags.am netcdf-4.3.0-new/lib_flags.am +--- netcdf-4.3.0-orig/lib_flags.am 2013-05-09 12:15:24 -0400 ++++ netcdf-4.3.0-new/lib_flags.am 2013-07-20 13:38:47 -0400 +@@ -15,7 +15,7 @@ + + # This turns on declspec magic in netcdf.h for windows DLLs. + if BUILD_DLL +-AM_CPPFLAGS += -DDLL_NETCDF ++AM_CPPFLAGS += -DDLL_NETCDF -D_HDF5USEDLL_ + endif + + +diff -ur netcdf-4.3.0-orig/libdap2/dcelex.c netcdf-4.3.0-new/libdap2/dcelex.c +--- netcdf-4.3.0-orig/libdap2/dcelex.c 2013-05-09 12:15:24 -0400 ++++ netcdf-4.3.0-new/libdap2/dcelex.c 2013-07-20 14:25:14 -0400 +@@ -14,6 +14,10 @@ + #include "dceconstraints.h" + #include "dceparselex.h" + ++#ifdef _MSC_VER ++#define strtoll _strtoi64 ++#endif ++ + /* Forward */ + static void dumptoken(DCElexstate* lexstate); + static int tohex(int c); +diff -ur netcdf-4.3.0-orig/libdap2/dceparse.c netcdf-4.3.0-new/libdap2/dceparse.c +--- netcdf-4.3.0-orig/libdap2/dceparse.c 2013-05-09 12:15:24 -0400 ++++ netcdf-4.3.0-new/libdap2/dceparse.c 2013-07-20 14:25:35 -0400 +@@ -20,6 +20,10 @@ + #include "dceconstraints.h" + #include "dceparselex.h" + ++#ifdef _MSC_VER ++#define strtoll _strtoi64 ++#endif ++ + static Object collectlist(Object list0, Object decl); + + void +diff -ur netcdf-4.3.0-orig/ncdump/Makefile.am netcdf-4.3.0-new/ncdump/Makefile.am +--- netcdf-4.3.0-orig/ncdump/Makefile.am 2013-05-09 12:15:21 -0400 ++++ netcdf-4.3.0-new/ncdump/Makefile.am 2013-07-20 15:04:56 -0400 +@@ -6,7 +6,7 @@ + + # Put together AM_CPPFLAGS and AM_LDFLAGS. + include $(top_srcdir)/lib_flags.am +-LDADD = ${top_builddir}/liblib/libnetcdf.la ++LDADD = ${top_builddir}/liblib/libnetcdf.la -lgetopt + + TESTS_ENVIRONMENT=CC=${CC} + +diff -ur netcdf-4.3.0-orig/ncdump/nccopy.c netcdf-4.3.0-new/ncdump/nccopy.c +--- netcdf-4.3.0-orig/ncdump/nccopy.c 2013-05-09 12:15:21 -0400 ++++ netcdf-4.3.0-new/ncdump/nccopy.c 2013-07-20 15:06:36 -0400 +@@ -23,11 +23,13 @@ + #include "nccomps.h" + + #ifdef _MSC_VER ++#ifndef HAVE_GETOPT_H + #include "XGetopt.h" +-#define snprintf _snprintf + int opterr; + int optind; + #endif ++#define snprintf _snprintf ++#endif + + /* default bytes of memory we are willing to allocate for variable + * values during copy */ +diff -ur netcdf-4.3.0-orig/ncdump/ncdump.c netcdf-4.3.0-new/ncdump/ncdump.c +--- netcdf-4.3.0-orig/ncdump/ncdump.c 2013-05-09 12:15:21 -0400 ++++ netcdf-4.3.0-new/ncdump/ncdump.c 2013-07-20 15:04:28 -0400 +@@ -13,11 +13,13 @@ + #endif + + #ifdef _MSC_VER +-#define snprintf _snprintf ++#ifndef HAVE_GETOPT_H + #include "XGetopt.h" + int opterr; + int optind; + #endif ++#define snprintf _snprintf ++#endif + + #include + #include +diff -ur netcdf-4.3.0-orig/ncgen/Makefile.am netcdf-4.3.0-new/ncgen/Makefile.am +--- netcdf-4.3.0-orig/ncgen/Makefile.am 2013-05-09 12:15:07 -0400 ++++ netcdf-4.3.0-new/ncgen/Makefile.am 2013-07-20 15:01:43 -0400 +@@ -4,7 +4,7 @@ + + # Put together AM_CPPFLAGS and AM_LDFLAGS. + include $(top_srcdir)/lib_flags.am +-LDADD = ${top_builddir}/liblib/libnetcdf.la ++LDADD = ${top_builddir}/liblib/libnetcdf.la -lgetopt + + # Build ncgen from the listed sources. + bin_PROGRAMS = ncgen +diff -ur netcdf-4.3.0-orig/ncgen/main.c netcdf-4.3.0-new/ncgen/main.c +--- netcdf-4.3.0-orig/ncgen/main.c 2013-05-09 12:15:07 -0400 ++++ netcdf-4.3.0-new/ncgen/main.c 2013-07-20 15:02:12 -0400 +@@ -12,11 +12,13 @@ + #endif + + #ifdef _MSC_VER ++#ifndef HAVE_GETOPT_H + #include "XGetopt.h" +-#define snprintf _snprintf + int opterr; + int optind; + #endif ++#define snprintf _snprintf ++#endif + + /* Default is netcdf-3 mode 1 */ + #define DFALTCMODE 0 +diff -ur netcdf-4.3.0-orig/ncgen3/Makefile.am netcdf-4.3.0-new/ncgen3/Makefile.am +--- netcdf-4.3.0-orig/ncgen3/Makefile.am 2013-05-09 12:15:15 -0400 ++++ netcdf-4.3.0-new/ncgen3/Makefile.am 2013-07-20 15:00:09 -0400 +@@ -6,7 +6,7 @@ + include $(top_srcdir)/lib_flags.am + + # Link to the netCDF library. +-ncgen3_LDADD = ${top_builddir}/liblib/libnetcdf.la ++ncgen3_LDADD = ${top_builddir}/liblib/libnetcdf.la -lgetopt + + # Build ncgen from the listed sources. + bin_PROGRAMS = ncgen3 +diff -ur netcdf-4.3.0-orig/ncgen3/main.c netcdf-4.3.0-new/ncgen3/main.c +--- netcdf-4.3.0-orig/ncgen3/main.c 2013-05-09 12:15:15 -0400 ++++ netcdf-4.3.0-new/ncgen3/main.c 2013-07-20 14:59:25 -0400 +@@ -15,11 +15,13 @@ + #endif + + #ifdef _MSC_VER ++#ifndef HAVE_GETOPT_H + #include "XGetopt.h" +-#define snprintf _snprintf + int opterr; + int optind; + #endif ++#define snprintf _snprintf ++#endif + + #ifdef __hpux + #include diff -r 36ac78f420b4 -r 591b3d68b43e src/netcdf.mk --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/netcdf.mk Sat Jul 20 22:41:16 2013 -0400 @@ -0,0 +1,35 @@ +# This file is part of MXE. +# See index.html for further information. + +PKG := netcdf +$(PKG)_IGNORE := +$(PKG)_CHECKSUM := 31b4b3b17146cc8c14a8c7be3fe5f28e5a8a5deb +$(PKG)_SUBDIR := netcdf-$($(PKG)_VERSION) +$(PKG)_FILE := netcdf-$($(PKG)_VERSION).tar.gz +$(PKG)_URL := http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-$($(PKG)_VERSION).tar.gz +$(PKG)_DEPS := curl hdf5 + +define $(PKG)_UPDATE + $(WGET) -q -O- 'http://www.unidata.ucar.edu/downloads/netcdf/current/index.jsp' | \ + $(SED) -n 's,.*netcdf-\([0-9][^>]*\)\.tar.*,\1,p' | \ + head -1 +endef + +$(PKG)_CONFIGURE_POST_HOOK := $(CONFIGURE_POST_HOOK) +ifeq ($(MXE_SYSTEM),msvc) + $(PKG)_CONFIGURE_POST_HOOK += -x +endif + +define $(PKG)_BUILD + if [ $(MXE_SYSTEM) = msvc ]; then \ + cd '$(1)' && autoreconf -f -i -v; \ + fi + cd '$(1)' && ./configure \ + $(HOST_AND_BUILD_CONFIGURE_OPTIONS) \ + $(ENABLE_SHARED_OR_STATIC) \ + --prefix='$(HOST_PREFIX)' \ + --enable-dll \ + && $($(PKG)_CONFIGURE_POST_HOOK) + $(MAKE) -C '$(1)' -j '$(JOBS)' + $(MAKE) -C '$(1)' -j 1 install +endef