From 48393863d39c6a92868a244b481fc1111108960f Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Tue, 9 Apr 2019 22:16:17 -0600 Subject: [PATCH] Update to 4.2.14 Build shared libraries Enable java --- hdf-build.patch | 52 ++++++++++++++++++++++ hdf.spec | 112 ++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 146 insertions(+), 18 deletions(-) create mode 100644 hdf-build.patch diff --git a/hdf-build.patch b/hdf-build.patch new file mode 100644 index 0000000..bea93c5 --- /dev/null +++ b/hdf-build.patch @@ -0,0 +1,52 @@ +diff -up hdf-4.2.14/java/examples/Makefile.am.build hdf-4.2.14/java/examples/Makefile.am +--- hdf-4.2.14/java/examples/Makefile.am.build 2018-06-26 22:42:58.000000000 -0600 ++++ hdf-4.2.14/java/examples/Makefile.am 2019-04-09 20:51:31.031211605 -0600 +@@ -12,8 +12,8 @@ classes: + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) + + pkgpath = examples +-hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +-jarfile = jar$(PACKAGE_TARNAME)examples.jar ++hdfjarfile = $(PACKAGE_TARNAME).jar ++jarfile = $(PACKAGE_TARNAME)examples.jar + + CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + AM_JAVACFLAGS = $(H4_JAVACFLAGS) -deprecation +diff -up hdf-4.2.14/java/src/Makefile.am.build hdf-4.2.14/java/src/Makefile.am +--- hdf-4.2.14/java/src/Makefile.am.build 2018-06-26 22:42:58.000000000 -0600 ++++ hdf-4.2.14/java/src/Makefile.am 2019-04-09 21:20:56.625579495 -0600 +@@ -13,8 +13,8 @@ JAVAROOT = .classes + classes: + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) + +-jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +-hdf_javadir = $(libdir) ++jarfile = $(PACKAGE_TARNAME).jar ++hdf_javadir = $(prefix)/lib/java + + pkgpath = hdf/hdflib + CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$$CLASSPATH +diff -up hdf-4.2.14/java/test/junit.sh.in.build hdf-4.2.14/java/test/junit.sh.in +--- hdf-4.2.14/java/test/junit.sh.in.build 2018-06-26 22:42:58.000000000 -0600 ++++ hdf-4.2.14/java/test/junit.sh.in 2019-04-09 20:51:31.032211610 -0600 +@@ -40,7 +40,7 @@ HDFLIB_HOME="$top_srcdir/java/lib" + BLDLIBDIR="$top_builddir/java/lib" + BLDDIR="." + HDFTEST_HOME="$top_srcdir/java/test" +-JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar ++JARFILE=@PACKAGE_TARNAME@.jar + TESTJARFILE=jar@PACKAGE_TARNAME@test.jar + test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +diff -up hdf-4.2.14/java/test/Makefile.am.build hdf-4.2.14/java/test/Makefile.am +--- hdf-4.2.14/java/test/Makefile.am.build 2018-06-26 22:42:58.000000000 -0600 ++++ hdf-4.2.14/java/test/Makefile.am 2019-04-09 20:51:31.033211614 -0600 +@@ -12,7 +12,7 @@ classes: + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) + + pkgpath = test +-hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar ++hdfjarfile = $(PACKAGE_TARNAME).jar + CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + + jarfile = jar$(PACKAGE_TARNAME)test.jar diff --git a/hdf.spec b/hdf.spec index f0aeb51..7c350d8 100644 --- a/hdf.spec +++ b/hdf.spec @@ -4,7 +4,7 @@ Name: hdf Version: 4.2.14 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A general purpose library and file format for storing scientific data License: BSD URL: https://portal.hdfgroup.org/ @@ -28,23 +28,34 @@ Patch9: hdf-ppc64le.patch # Use only if java is disabled Patch10: hdf-avoid_syntax_error_el6.patch +# Fix java build +Patch11: hdf-build.patch + # For destdir/examplesdir patches BuildRequires: automake, libtool, gcc, gcc-c++ +BuildRequires: chrpath BuildRequires: flex byacc libjpeg-devel zlib-devel %{!?el6:libaec-devel} BuildRequires: libtirpc-devel BuildRequires: gcc-gfortran, gcc +BuildRequires: java-devel +BuildRequires: javapackages-tools +BuildRequires: hamcrest +BuildRequires: junit +BuildRequires: slf4j + %description -HDF is a general purpose library and file format for storing scientific data. -HDF can store two primary objects: datasets and groups. A dataset is -essentially a multidimensional array of data elements, and a group is a -structure for organizing objects in an HDF file. Using these two basic -objects, one can create and store almost any kind of scientific data -structure, such as images, arrays of vectors, and structured and unstructured -grids. You can also mix and match them in HDF files according to your needs. +HDF4 is a general purpose library and file format for storing scientific data. +HDF4 can store two primary objects: datasets and groups. A dataset is +essentially a multidimensional array of data elements, and a group is a +structure for organizing objects in an HDF4 file. Using these two basic +objects, one can create and store almost any kind of scientific data +structure, such as images, arrays of vectors, and structured and unstructured +grids. You can also mix and match them in HDF4 files according to your needs. + %package devel -Summary: HDF development files +Summary: HDF4 development files Provides: %{name}-static = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release} Requires: libjpeg-devel%{?_isa} @@ -52,7 +63,25 @@ Requires: libtirpc-devel%{?_isa} Requires: zlib-devel%{?_isa} %description devel -HDF development headers and libraries. +HDF4 development headers and libraries. + + +%package static +Summary: HDF4 static libraries +Requires: %{name}-devel = %{version}-%{release} + +%description static +HDF4 static libraries. + + +%package -n java-hdf +Summary: HDF4 java library +Requires: slf4j +Obsoletes: jhdf < 3.3.1-2 + +%description -n java-hdf +HDF4 java library + %prep %setup -q @@ -66,6 +95,19 @@ HDF development headers and libraries. %patch6 -p1 -b .examplesdir %patch8 -p1 -b .aarch64 %patch9 -p1 -b .ppc64le +%patch11 -p1 -b .build + +# Replace jars with system versions +find -name \*.jar -delete +ln -s %{_javadir}/hamcrest/core.jar java/lib/hamcrest-core.jar +ln -s %{_javadir}/junit.jar java/lib/junit.jar +ln -s %{_javadir}/slf4j/api.jar java/lib/slf4j-api-1.7.5.jar +ln -s %{_javadir}/slf4j/nop.jar java/lib/ext/slf4j-nop-1.7.5.jar +ln -s %{_javadir}/slf4j/simple.jar java/lib/ext/slf4j-simple-1.7.5.jar + +# Fix test output +junit_ver=$(sed -n '//{s/^.*>\([0-9]\.[0-9]*\)<.*/\1/;p;q}' /usr/share/maven-poms/junit.pom) +sed -i -e "s/JUnit version .*/JUnit version $junit_ver/" java/test/testfiles/JUnit-*.txt ## Fix syntax error bacause 'CLASSPATH_ENV=$H4_CLASSPATH' line on epel6 builds # Use only if java is disabled @@ -79,6 +121,7 @@ find . -type f -name "*.c" -exec chmod 0644 '{}' \; # restore include file timestamps modified by patching touch -c -r ./hdf/src/hdfi.h.ppc ./hdf/src/hdfi.h + %build # For destdir/examplesdir patches @@ -86,15 +129,27 @@ autoreconf -vif # avoid upstream compiler flags settings rm config/*linux-gnu # TODO: upstream fix -# Shared libraries disabled: libmfhdf.so is not correctly compiled -# for missing link to libdf.so -export CFLAGS="%{optflags} -fPIC -I%{_includedir}/tirpc" +# libmfhdf.so is link to libdf.so +export CFLAGS="%{optflags} -I%{_includedir}/tirpc" export LIBS="-ltirpc" -export FFLAGS="%{optflags} -fPIC -ffixed-line-length-none" +%global _configure ../configure +# Java test needs this but doesn't create it +mkdir -p build-shared/java/lib +cd build-shared +# Java requires shared libraries, fortran requires static +%configure --disable-production --enable-java --disable-netcdf \ + --enable-shared=yes --enable-static=no --disable-fortran %{!?el6:--with-szlib} \ + --includedir=%{_includedir}/%{name} --libdir=%{_libdir}/%{name} +%make_build +cd - +mkdir build-static +cd build-static +# Java requires shared libraries, fortran requires static %configure --disable-production --disable-java --disable-netcdf \ --enable-shared=no --enable-static=yes --enable-fortran %{!?el6:--with-szlib} \ --includedir=%{_includedir}/%{name} --libdir=%{_libdir}/%{name} %make_build +cd - # correct the timestamps based on files used to generate the header files touch -c -r hdf/src/hdf.inc hdf/src/hdf.f90 @@ -102,8 +157,11 @@ touch -c -r hdf/src/dffunc.inc hdf/src/dffunc.f90 touch -c -r mfhdf/fortran/mffunc.inc mfhdf/fortran/mffunc.f90 # netcdf fortran include need same treatement, but they are not shipped + %install -%make_install +%make_install -C build-static +%make_install -C build-shared +chrpath --delete --keepgoing %{buildroot}%{_bindir}/* %{buildroot}%{_libdir}/%{name}/*.so.* || : install -pm 644 MANIFEST README.txt release_notes/*.txt %{buildroot}%{_pkgdocdir}/ @@ -128,22 +186,40 @@ touch -c -r h4config.h h4config.h.tmp mv h4config.h.tmp h4config.h popd + %check -make -j1 check +make -j1 -C build-shared check +make -j1 -C build-static check + %files %license COPYING %{_pkgdocdir}/ %exclude %{_pkgdocdir}/examples %{_bindir}/* +%dir %{_libdir}/%{name} +%{_libdir}/%{name}/*.so.0* %{_mandir}/man1/*.gz %files devel %{_includedir}/%{name}/ -%{_libdir}/%{name}/ +%{_libdir}/%{name}/*.so +%{_libdir}/%{name}/*.settings %{_pkgdocdir}/examples/ +%files static +%{_libdir}/%{name}/*.a + +%files -n java-hdf +%{_jnidir}/hdf.jar +%{_libdir}/%{name}/libhdf_java.so + + %changelog +* Tue Apr 9 2019 Orion Poplawski - 4.2.14-3 +- Build shared libraries +- Enable java + * Fri Feb 01 2019 Fedora Release Engineering - 4.2.14-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild @@ -169,7 +245,7 @@ make -j1 check - Rebuild for gcc 8.0 * Sat Jan 20 2018 Antonio Trande 4.2.13-5 -- Enable szlib support +- Enable szlib support * Wed Jan 17 2018 Pavel Raiskup - 4.2.13-4 - rpc api moved from glibc to libtirpc: