diff src/hdf5.mk @ 5430:98bcc037fad7

* src/hdf5.mk: Update version to 1.12.0. Use cmake for Windows cross targets. * src/hdf5-1-fixes.patch: Remove patch. * src/mingw-hdf5-1.patch: Update patch. * dist-files.mk: Remove file from list. * src/of-communictaions.mk: Use pkg-config for linking in hdf5.
author Markus Mützel <markus.muetzel@gmx.de>
date Mon, 25 May 2020 18:14:52 +0200
parents 5a6cc59b7186
children 71761e1b5e83
line wrap: on
line diff
--- a/src/hdf5.mk	Wed May 27 14:14:50 2020 -0400
+++ b/src/hdf5.mk	Mon May 25 18:14:52 2020 +0200
@@ -3,97 +3,29 @@
 
 PKG             := hdf5
 $(PKG)_IGNORE   :=
-$(PKG)_VERSION  := 1.8.14
-$(PKG)_CHECKSUM := 3c48bcb0d5fb21a3aa425ed035c08d8da3d5483a
+$(PKG)_VERSION  := 1.12.0
+$(PKG)_CHECKSUM := 6020131b6e18e6866816b1fe68980512c696c2bf
 $(PKG)_SUBDIR   := $(PKG)-$($(PKG)_VERSION)
 $(PKG)_FILE     := $(PKG)-$($(PKG)_VERSION).tar.bz2
-$(PKG)_URL      := https://www.hdfgroup.org/ftp/HDF5/releases/$(PKG)-$(call SHORT_PKG_VERSION,$(PKG))/$(PKG)-$($(PKG)_VERSION)/src/$($(PKG)_FILE)
+$(PKG)_URL      := https://support.hdfgroup.org/ftp/HDF5/releases/$(PKG)-$(call SHORT_PKG_VERSION,$(PKG))/$(PKG)-$($(PKG)_VERSION)/src/$($(PKG)_FILE)
 $(PKG)_DEPS     :=
-ifeq ($(MXE_SYSTEM),mingw)
-  ifneq ($(MXE_NATIVE_BUILD),yes)
-    $(PKG)_CROSS_CONFIG_OPTIONS := \
-      --disable-largefile \
-      LIBS=-lws2_32 \
-      hdf5_cv_gettimeofday_tz=no \
-      hdf5_cv_vsnprintf_works=yes \
-      hdf5_cv_ldouble_to_integer_works=yes \
-      hdf5_cv_ulong_to_float_accurate=yes \
-      hdf5_cv_fp_to_ullong_accurate=yes \
-      hdf5_cv_fp_to_ullong_right_maximum=no \
-      hdf5_cv_ldouble_to_uint_accurate=yes \
-      hdf5_cv_ullong_to_ldouble_precision=yes \
-      hdf5_cv_fp_to_integer_overflow_works=yes \
-      hdf5_cv_ldouble_to_long_special=no \
-      hdf5_cv_long_to_ldouble_special=no \
-      hdf5_cv_ldouble_to_llong_accurate=yes \
-      hdf5_cv_llong_to_ldouble_correct=yes
-    ifeq ($(TARGET),x86_64-w64-mingw32)
-      $(PKG)_CROSS_CONFIG_OPTIONS += \
-        hdf5_cv_printf_ll=ll \
-        hdf5_cv_system_scope_threads=no \
-        hdf5_cv_ldouble_to_integer_accurate=yes \
-        hdf5_cv_ulong_to_fp_bottom_bit_accurate=yes \
-        ac_cv_sizeof_long=4 \
-        ac_cv_sizeof_long_double=16 \
-        ac_cv_sizeof_long_long=8 \
-        ac_cv_sizeof_off_t=8 \
-        ac_cv_sys_file_offset_bits=64
-    else
-      $(PKG)_CROSS_CONFIG_OPTIONS += \
-        hdf5_cv_printf_ll=l \
-        hdf5_cv_system_scope_threads=yes \
-        hdf5_cv_ulong_to_fp_bottom_bit_accurate=no
-    endif
-  endif
-endif
-
-ifeq ($(MXE_NATIVE_BUILD),yes)
-  $(PKG)_CONFIGURE_ENV := LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)
-endif
 
 define $(PKG)_UPDATE
     echo 'Warning: Updates are temporarily disabled for package hdf5.' >&2;
     echo $(hdf5_VERSION)
 endef
 
-define $(PKG)_BUILD
-    case '$(TARGET)' in \
-      x86_64-w64-mingw32) \
-        cp '$(1)/src/H5Tinit.c.mingw64' '$(1)/src/H5Tinit.c.mingw' \
-      ;; \
-      i686-w64-mingw32) \
-        cp '$(1)/src/H5Tinit.c.mingw32' '$(1)/src/H5Tinit.c.mingw' \
-      ;; \
-      i686-pc-mingw32) \
-        cp '$(1)/src/H5Tinit.c.mingw32' '$(1)/src/H5Tinit.c.mingw' \
-      ;; \
-    esac
-
-    # build GCC and support libraries
+ifeq ($(MXE_NATIVE_BUILD),yes)
+  define $(PKG)_BUILD
+    # build GCC and support libraries using autotools
     cd '$(1)' && aclocal && libtoolize && autoreconf
     mkdir '$(1)/.build'
-    cd '$(1)/.build' && $($(PKG)_CONFIGURE_ENV) '$(1)/configure' \
+    cd '$(1)/.build' && LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) '$(1)/configure' \
         $(CONFIGURE_CPPFLAGS) $(CONFIGURE_LDFLAGS) \
         $(HOST_AND_BUILD_CONFIGURE_OPTIONS) \
         $(ENABLE_SHARED_OR_STATIC) \
         --prefix='$(HOST_PREFIX)' \
-        --disable-direct-vfd \
-        $($(PKG)_CROSS_CONFIG_OPTIONS) && $(CONFIGURE_POST_HOOK)
-
-    case '$(MXE_SYSTEM)' in \
-      *mingw*) \
-        echo "#define H5_HAVE_WIN32_API 1" >> $(1)/.build/src/H5pubconf.h; \
-        echo "#define H5_HAVE_MINGW 1" >> $(1)/.build/src/H5pubconf.h; \
-        echo "#define HAVE_WINDOWS_PATH 1" >> $(1)/.build/src/H5pubconf.h; \
-      ;; \
-      *msvc*) \
-        sed -i -e 's/^\(#define H5_SIZEOF_SSIZE_T\) .*/\1 0/' \
-	    '$(1)/.build/src/H5pubconf.h'; \
-        echo "#define H5_HAVE_WIN32_API 1" >> $(1)/.build/src/H5pubconf.h; \
-        echo "#define H5_HAVE_VISUAL_STUDIO 1" >> $(1)/.build/src/H5pubconf.h; \
-        echo "#define HAVE_WINDOWS_PATH 1" >> $(1)/.build/src/H5pubconf.h; \
-      ;; \
-    esac
+        --disable-direct-vfd && $(CONFIGURE_POST_HOOK)
 
     # libtool is somehow created to effectively disallow shared builds
     $(SED) -i 's,allow_undefined_flag="unsupported",allow_undefined_flag="",g' '$(1)/.build/libtool'
@@ -104,5 +36,79 @@
     if [ "$(ENABLE_DEP_DOCS)" == "no" ]; then \
       rm -rf '$(3)$(HOST_PREFIX)/share/hdf5_examples'; \
     fi
-    rm -f '$(3)$(HOST_BINPREFIX)/h5*.exe'
-endef
+  endef
+else
+  define $(PKG)_BUILD
+    # build rules for windows target using cmake
+
+    mkdir '$(1)/pregen'
+    case '$(TARGET)' in \
+      x86_64-w64-mingw32) \
+        cp '$(1)/src/H5Tinit.c.mingw64' '$(1)/pregen/H5Tinit.c' & \
+        cp '$(1)/src/H5lib_settings.c.mingw64' '$(1)/pregen/H5lib_settings.c' \
+      ;; \
+      i686-w64-mingw32) \
+        cp '$(1)/src/H5Tinit.c.mingw32' '$(1)/pregen/H5Tinit.c' & \
+        cp '$(1)/src/H5lib_settings.c.mingw32' '$(1)/pregen/H5lib_settings.c' \
+      ;; \
+      i686-pc-mingw32) \
+        cp '$(1)/src/H5Tinit.c.mingw32' '$(1)/pregen/H5Tinit.c' & \
+        cp '$(1)/src/H5lib_settings.c.mingw32' '$(1)/pregen/H5lib_settings.c' \
+      ;; \
+    esac
+
+    mkdir '$(1)/.build'
+
+    # platform specific settings using https://github.com/steven-varga/HDFGroup-mailinglist/tree/master/crosscompile-2020-mar-25
+    cd '$(1)/.build' && cmake .. -G "Unix Makefiles" \
+      -DCMAKE_INSTALL_PREFIX=${prefix} \
+       $($(PKG)_CMAKE_FLAGS) \
+      -DBUILD_SHARED_LIBS=$(if $(findstring yes,$(BUILD_SHARED)),ON,OFF) \
+      -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \
+      -DHDF5_INSTALL_BIN_DIR='$(HOST_BINDIR)' \
+      -DHDF5_INSTALL_LIB_DIR='$(HOST_LIBDIR)' \
+      -DHDF5_INSTALL_INCLUDE_DIR='$(HOST_INCDIR)' \
+      -DHDF5_INSTALL_DATA_DIR='$(HOST_PREFIX)/share' \
+      -DHDF5_BUILD_CPP_LIB=OFF \
+      -DHDF5_BUILD_HL_LIB=ON \
+      -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \
+      -DHDF5_ENABLE_SZIP_SUPPORT=OFF \
+      -DHDF5_ENABLE_SZIP_ENCODING=OFF \
+      -DBUILD_TESTING=OFF \
+      -DHDF5_USE_PREGEN=ON \
+      -DHDF5_USE_PREGEN_DIR='$(1)/pregen' \
+      $($(PKG)_CCACHE_OPTIONS) \
+      -DHAVE_IOEO_EXITCODE=0 \
+      -DH5_LDOUBLE_TO_LONG_SPECIAL_RUN=1 \
+      -DH5_LDOUBLE_TO_LONG_SPECIAL_RUN__TRYRUN_OUTPUT="" \
+      -DH5_LONG_TO_LDOUBLE_SPECIAL_RUN=1 \
+      -DH5_LONG_TO_LDOUBLE_SPECIAL_RUN__TRYRUN_OUTPUT="" \
+      -DH5_LDOUBLE_TO_LLONG_ACCURATE_RUN=0 \
+      -DH5_LDOUBLE_TO_LLONG_ACCURATE_RUN__TRYRUN_OUTPUT="" \
+      -DH5_LLONG_TO_LDOUBLE_CORRECT_RUN=0 \
+      -DH5_LLONG_TO_LDOUBLE_CORRECT_RUN__TRYRUN_OUTPUT="" \
+      -DH5_DISABLE_SOME_LDOUBLE_CONV_RUN=1 \
+      -DH5_DISABLE_SOME_LDOUBLE_CONV_RUN__TRYRUN_OUTPUT="" \
+      -DH5_NO_ALIGNMENT_RESTRICTIONS_RUN=0 \
+      -DH5_NO_ALIGNMENT_RESTRICTIONS_RUN__TRYRUN_OUTPUT="" \
+      -DH5_PRINTF_LL_TEST_RUN=1 \
+      -DH5_PRINTF_LL_TEST_RUN__TRYRUN_OUTPUT="" \
+      -DTEST_LFS_WORKS_RUN=0
+
+    $(MAKE) -C '$(1)/.build' -j '$(JOBS)' 
+    $(MAKE) -C '$(1)/.build' -j 1 install DESTDIR=$(3)
+    
+    # FIXME: Change the build rule to create the shared libs with the prefix
+    mv '$(3)/$(HOST_LIBDIR)/hdf5.lib' '$(3)/$(HOST_LIBDIR)/libhdf5.lib'
+    mv '$(3)/$(HOST_LIBDIR)/hdf5_tools.lib' '$(3)/$(HOST_LIBDIR)/libhdf5_tools.lib'
+    mv '$(3)/$(HOST_LIBDIR)/hdf5_hl.lib' '$(3)/$(HOST_LIBDIR)/libhdf5_hl.lib'
+    # Remove version suffix from pkg-config files
+    mv '$(3)/$(HOST_LIBDIR)/pkgconfig/hdf5-$($(PKG)_VERSION).pc' '$(3)/$(HOST_LIBDIR)/pkgconfig/hdf5.pc'
+    mv '$(3)/$(HOST_LIBDIR)/pkgconfig/hdf5_hl-$($(PKG)_VERSION).pc' '$(3)/$(HOST_LIBDIR)/pkgconfig/hdf5_hl.pc'
+
+    if [ "$(ENABLE_DEP_DOCS)" == "no" ]; then \
+      rm -rf '$(HOST_PREFIX)/share/hdf5_examples'; \
+    fi
+  endef
+endif
+