From d61466a1d6a1d1c4331e8d0bea6eb8c283533369 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Feb 24 2020 05:12:14 +0000 Subject: Make netcdf-fortran report module directory (bz#1738541) Fix FTBFS (bz#1799681) --- diff --git a/netcdf-fortran-fmoddir.patch b/netcdf-fortran-fmoddir.patch new file mode 100644 index 0000000..6178e93 --- /dev/null +++ b/netcdf-fortran-fmoddir.patch @@ -0,0 +1,120 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74e7e24..b3770be 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -88,6 +88,9 @@ ENDIF() + # For CMAKE_INSTALL_LIBDIR + INCLUDE(GNUInstallDirs) + ++# By default install Fortran modules into include directory ++OPTION(Fortran_INSTALL_MODDIR "Fortran module install directory" "${CMAKE_INSTALL_INCLUDEDIR}") ++ + IF(MSVC) + SET(GLOBAL PROPERTY USE_FOLDERS ON) + ENDIF() +diff --git a/configure.ac b/configure.ac +index f613828..9e9960b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -323,6 +323,13 @@ TEMP_LARGE=${TEMP_LARGE-.} + AC_MSG_RESULT($TEMP_LARGE) + AC_DEFINE_UNQUOTED([TEMP_LARGE], ["$TEMP_LARGE"], [Place to put very large netCDF test files.]) + ++# Allow setting the fortran module install dir ++AC_ARG_WITH([fmoddir], ++ [AS_HELP_STRING([--with-fmoddir=DIR], [Fortran module install directory])], ++ [fmoddir=$withval], ++ [fmoddir="\${includedir}"]) ++AC_SUBST([fmoddir], [$fmoddir]) ++ + # Set up libtool. + AC_MSG_NOTICE([setting up libtool]) + LT_PREREQ([2.2]) +diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt +index 4a269ca..252b389 100644 +--- a/fortran/CMakeLists.txt ++++ b/fortran/CMakeLists.txt +@@ -176,6 +176,6 @@ INSTALL(TARGETS netcdff + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib + ) + INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ +- DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ++ DESTINATION "${Fortran_INSTALL_MODDIR}" + FILES_MATCHING PATTERN "*.mod" PATTERN "netcdf.inc" + ) +diff --git a/fortran/Makefile.am b/fortran/Makefile.am +index e1a6f14..8b03b64 100644 +--- a/fortran/Makefile.am ++++ b/fortran/Makefile.am +@@ -146,13 +146,13 @@ MODFILES += netcdf.mod + # Mod files are build sources. + BUILT_SOURCES = $(MODFILES) + +-# Mod files are installed as headers, but not distrubuted. +-nodist_include_HEADERS = $(MODFILES) ++# Mod files are installed, but not distrubuted. ++nodist_fmod_DATA = $(MODFILES) + + # The netcdf.inc file is built on the user machine, and installed as + # a header. + BUILT_SOURCES += netcdf.inc +-nodist_include_HEADERS += netcdf.inc ++nodist_include_HEADERS = netcdf.inc + + # Build netcdf.inc file from netcdf2, netcdf3 and netcdf4 files + netcdf.inc: netcdf2.inc netcdf3.inc netcdf4.inc +diff --git a/netcdf-fortran.pc.in b/netcdf-fortran.pc.in +index fb48a42..f6bded2 100644 +--- a/netcdf-fortran.pc.in ++++ b/netcdf-fortran.pc.in +@@ -2,6 +2,7 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ + includedir=@includedir@ ++fmoddir=@fmoddir@ + ccompiler=@CC@ + fcompiler=@FC@ + +@@ -12,4 +13,4 @@ Version: @PACKAGE_VERSION@ + Requires.private: netcdf > 4.1.1 + Libs: -L${libdir} -lnetcdff + Libs.private: -L${libdir} -lnetcdff -lnetcdf +-Cflags: -I${includedir} ++Cflags: -I${includedir} -I${fmoddir} +diff --git a/nf-config.cmake.in b/nf-config.cmake.in +index cc5dc96..f8e51cb 100644 +--- a/nf-config.cmake.in ++++ b/nf-config.cmake.in +@@ -8,11 +8,12 @@ prefix=@CMAKE_INSTALL_PREFIX@ + exec_prefix=@CMAKE_INSTALL_PREFIX@ + libdir=@CMAKE_INSTALL_PREFIX@/lib + includedir=@CMAKE_INSTALL_PREFIX@/include ++fmoddir=@CMAKE_INSTALL_PREFIX@/@Fortran_INSTALL_MODDIR@ + # + cc="@CMAKE_C_COMPILER@" + fc="@CMAKE_Fortran_COMPILER@" + cflags="-I@CMAKE_INSTALL_PREFIX@/include @CMAKE_C_FLAGS@ @CMAKE_CPP_FLAGS@" +-fflags="@MOD_FLAG@${includedir}" ++fflags="-I${includedir} @MOD_FLAG@${fmoddir}" + # + has_dap="@HAS_DAP@" + has_nc2="@HAS_NC2@" +diff --git a/nf-config.in b/nf-config.in +index 31a0f3a..db18c83 100644 +--- a/nf-config.in ++++ b/nf-config.in +@@ -7,11 +7,12 @@ prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ + includedir=@includedir@ ++fmoddir=@fmoddir@ + + cc="@CC@" + fc="@FC@" +-cflags=" -I${includedir} @CPPFLAGS@" +-fflags="@MOD_FLAG@${includedir}" ++cflags="-I${includedir} @CPPFLAGS@" ++fflags="-I${includedir} @MOD_FLAG@${fmoddir}" + has_dap="@HAS_DAP@" + has_nc2="@HAS_NC2@" + has_nc4="@HAS_NC4@" diff --git a/netcdf-fortran-pkgconfig.patch b/netcdf-fortran-pkgconfig.patch index ed06b18..7ad8797 100644 --- a/netcdf-fortran-pkgconfig.patch +++ b/netcdf-fortran-pkgconfig.patch @@ -1,7 +1,21 @@ -diff -up netcdf-fortran-4.5.1/nf-config.in.pkgconfig netcdf-fortran-4.5.1/nf-config.in ---- netcdf-fortran-4.5.1/nf-config.in.pkgconfig 2019-09-04 10:35:17.000000000 -0600 -+++ netcdf-fortran-4.5.1/nf-config.in 2019-09-13 21:33:19.209823384 -0600 -@@ -17,7 +17,7 @@ has_nc2="@HAS_NC2@" +diff -up netcdf-fortran-4.5.2/nf-config.in.pkgconfig netcdf-fortran-4.5.2/nf-config.in +--- netcdf-fortran-4.5.2/nf-config.in.pkgconfig 2020-02-23 17:12:57.278057384 -0700 ++++ netcdf-fortran-4.5.2/nf-config.in 2020-02-23 17:14:11.419048337 -0700 +@@ -5,20 +5,18 @@ + + prefix=@prefix@ + exec_prefix=@exec_prefix@ +-libdir=@libdir@ + includedir=@includedir@ +-fmoddir=@fmoddir@ + + cc="@CC@" + fc="@FC@" + cflags="-I${includedir} @CPPFLAGS@" +-fflags="-I${includedir} @MOD_FLAG@${fmoddir}" ++fflags=`pkg-config netcdf-fortran --cflags` + has_dap="@HAS_DAP@" + has_nc2="@HAS_NC2@" has_nc4="@HAS_NC4@" has_f90="@HAS_F90@" has_f03="@HAS_F03@" diff --git a/netcdf-fortran.spec b/netcdf-fortran.spec index 544e021..e55d19e 100644 --- a/netcdf-fortran.spec +++ b/netcdf-fortran.spec @@ -1,13 +1,16 @@ Name: netcdf-fortran Version: 4.5.2 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Fortran libraries for NetCDF-4 License: NetCDF and ASL 2.0 URL: http://www.unidata.ucar.edu/software/netcdf/ Source0: https://github.com/Unidata/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -#Use pkgconfig in nf-config to avoid multi-lib issues and remove FFLAGS -Patch0: netcdf-fortran-pkgconfig.patch +# Define fmoddir - https://github.com/Unidata/netcdf-fortran/pull/224 +# and make nf-config report it - https://bugzilla.redhat.com/show_bug.cgi?id=1738541 +Patch0: netcdf-fortran-fmoddir.patch +# Use pkgconfig in nf-config to avoid multi-lib issues and remove FFLAGS +Patch1: netcdf-fortran-pkgconfig.patch BuildRequires: gcc-gfortran BuildRequires: netcdf-devel >= 4.6.0 @@ -128,7 +131,8 @@ NetCDF Fortran parallel openmpi static libraries %prep %setup -q -%patch0 -p1 -b .pkgconfig +%patch0 -p1 -b .fmoddir +%patch1 -p1 -b .pkgconfig autoreconf sed -i -e '1i#!/bin/sh' examples/F90/run_f90_par_examples.sh @@ -145,8 +149,11 @@ pushd build ln -s ../configure . export F77="gfortran" export FC="gfortran" -export FCFLAGS="$RPM_OPT_FLAGS" -%configure --enable-extra-example-tests +# Temporary fix for FTBFS due to gcc 10 - reported upstream: +# https://github.com/Unidata/netcdf-fortran/issues/212 +export FCFLAGS="$RPM_OPT_FLAGS -fallow-argument-mismatch" +export FFLAGS="$RPM_OPT_FLAGS -fallow-argument-mismatch" +%configure --enable-extra-example-tests --with-fmoddir=%{_fmoddir} # Seeing failures with highly parallel builds, e.g. -j12 on ppc64le make #{?_smp_mflags} popd @@ -171,6 +178,7 @@ do --includedir=%{_includedir}/$mpi-%{_arch} \ --datarootdir=%{_libdir}/$mpi/share \ --mandir=%{_libdir}/$mpi/share/man \ + --with-fmoddir=%{_fmoddir}/${mpi} \ --enable-parallel \ --enable-parallel-tests make #{?_smp_mflags} @@ -180,18 +188,12 @@ done %install -make -C build install DESTDIR=${RPM_BUILD_ROOT} -mkdir -p ${RPM_BUILD_ROOT}%{_fmoddir} -/bin/mv ${RPM_BUILD_ROOT}%{_includedir}/*.mod \ - ${RPM_BUILD_ROOT}%{_fmoddir}/ +%make_install -C build /bin/rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la for mpi in %{mpi_list} do module load mpi/$mpi-%{_arch} - make -C $mpi install DESTDIR=${RPM_BUILD_ROOT} - mkdir -p ${RPM_BUILD_ROOT}%{_fmoddir}/${mpi} - /bin/mv ${RPM_BUILD_ROOT}%{_includedir}/${mpi}-%{_arch}/*.mod \ - ${RPM_BUILD_ROOT}%{_fmoddir}/${mpi}/ + %make_install -C $mpi rm $RPM_BUILD_ROOT/%{_libdir}/$mpi/lib/*.la gzip $RPM_BUILD_ROOT/%{_libdir}/$mpi/share/man/man3/*.3 module purge @@ -271,6 +273,10 @@ done %changelog +* Mon Feb 24 2020 Orion Poplawski - 4.5.2-3 +- Make netcdf-fortran report module directory (bz#1738541) +- Fix FTBFS (bz#1799681) + * Wed Jan 29 2020 Fedora Release Engineering - 4.5.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild