Force default ldflags for Fedora (bz#1548533)

epel9
sagitter 7 years ago
parent ebb0f8e3f2
commit 6c54b9780d

@ -3,15 +3,15 @@
# Patch version? # Patch version?
%global snaprel %{nil} %global snaprel %{nil}
# NOTE: Try not to release new versions to released versions of Fedora # NOTE: Try not to release new versions to released versions of Fedora
# You need to recompile all users of HDF5 for each version change # You need to recompile all users of HDF5 for each version change
Name: hdf5 Name: hdf5
Version: 1.8.20 Version: 1.8.20
Release: 2%{?dist} Release: 3%{?dist}
Summary: A general purpose library and file format for storing scientific data Summary: A general purpose library and file format for storing scientific data
License: BSD License: BSD
Group: System Environment/Libraries Group: System Environment/Libraries
URL: http://www.hdfgroup.org/HDF5/ URL: https://portal.hdfgroup.org/display/HDF5/HDF5
Source0: https://support.hdfgroup.org/ftp/HDF5/current18/src/hdf5-%{version}%{?snaprel}.tar.bz2 Source0: https://support.hdfgroup.org/ftp/HDF5/current18/src/hdf5-%{version}%{?snaprel}.tar.bz2
Source1: h5comp Source1: h5comp
@ -33,6 +33,7 @@ BuildRequires: libtool
# Needed for mpi tests # Needed for mpi tests
BuildRequires: openssh-clients BuildRequires: openssh-clients
BuildRequires: libaec-devel BuildRequires: libaec-devel
BuildRequires: gcc, gcc-c++
%global with_mpich 1 %global with_mpich 1
%global with_openmpi 1 %global with_openmpi 1
@ -72,6 +73,7 @@ Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: libaec-devel%{?_isa} Requires: libaec-devel%{?_isa}
Requires: zlib-devel%{?_isa} Requires: zlib-devel%{?_isa}
Requires: gcc-gfortran%{?_isa}
%description devel %description devel
HDF5 development headers and libraries. HDF5 development headers and libraries.
@ -162,10 +164,13 @@ HDF5 parallel openmpi static libraries
%patch1 -p1 -b .mpi %patch1 -p1 -b .mpi
%patch2 -p1 -b .implicit %patch2 -p1 -b .implicit
%patch3 -p1 -b .ldouble-ppc64le %patch3 -p1 -b .ldouble-ppc64le
# Force shared by default for compiler wrappers (bug #1266645) # Force shared by default for compiler wrappers (bug #1266645)
sed -i -e '/^STATIC_AVAILABLE=/s/=.*/=no/' */*/h5[cf]*.in sed -i -e '/^STATIC_AVAILABLE=/s/=.*/=no/' */*/h5[cf]*.in
autoreconf -f -i autoreconf -f -i
# Modify low optimization level for gnu compilers
sed -e 's|-O -finline-functions|-O3 -finline-functions|g' -i config/gnu-flags
%build %build
#Do out of tree builds #Do out of tree builds
@ -180,26 +185,29 @@ autoreconf -f -i
--with-szlib \\\ --with-szlib \\\
%{nil} %{nil}
# --enable-cxx and --enable-parallel flags are incompatible # --enable-cxx and --enable-parallel flags are incompatible
# --with-mpe=DIR Use MPE instrumentation [default=no] # --with-mpe=DIR Use MPE instrumentation [default=no]
# --enable-cxx/fortran/parallel and --enable-threadsafe flags are incompatible # --enable-cxx/fortran/parallel and --enable-threadsafe flags are incompatible
#Serial build #Serial build
export CC=gcc export CC=gcc
export CXX=g++ export CXX=g++
export F9X=gfortran export F9X=gfortran
export LDFLAGS="%{__global_ldflags} -fPIC -Wl,-z,now -Wl,--as-needed"
mkdir build mkdir build
pushd build pushd build
ln -s ../configure . ln -s ../configure .
%configure \ %configure \
%{configure_opts} \ %{configure_opts} \
--enable-cxx --enable-cxx
make sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
make LDFLAGS="%{__global_ldflags} -fPIC -Wl,-z,now -Wl,--as-needed"
popd popd
#MPI builds #MPI builds
export CC=mpicc export CC=mpicc
export CXX=mpicxx export CXX=mpicxx
export F9X=mpif90 export F9X=mpif90
export LDFLAGS="%{__global_ldflags} -fPIC -Wl,-z,now -Wl,--as-needed"
for mpi in %{?mpi_list} for mpi in %{?mpi_list}
do do
mkdir $mpi mkdir $mpi
@ -217,7 +225,8 @@ do
--includedir=%{_includedir}/$mpi-%{_arch} \ --includedir=%{_includedir}/$mpi-%{_arch} \
--datarootdir=%{_libdir}/$mpi/share \ --datarootdir=%{_libdir}/$mpi/share \
--mandir=%{_libdir}/$mpi/share/man --mandir=%{_libdir}/$mpi/share/man
make sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
make LDFLAGS="%{__global_ldflags} -fPIC -Wl,-z,now -Wl,--as-needed"
module purge module purge
popd popd
done done
@ -268,7 +277,7 @@ done
mkdir -p ${RPM_BUILD_ROOT}%{macrosdir} mkdir -p ${RPM_BUILD_ROOT}%{macrosdir}
cat > ${RPM_BUILD_ROOT}%{macrosdir}/macros.hdf5 <<EOF cat > ${RPM_BUILD_ROOT}%{macrosdir}/macros.hdf5 <<EOF
# HDF5 version is # HDF5 version is
%%_hdf5_version %{version} %%_hdf5_version %{version}
EOF EOF
# Install man pages from debian # Install man pages from debian
@ -438,6 +447,12 @@ done
%changelog %changelog
* Fri Feb 23 2018 Antonio Trande <sagitter@fedoraproject.com> - 1.8.20-3
- Force default ldflags for Fedora (bz#1548533)
- Switch -shared flag to -Wl,--as-needed
- Modify low optimization level for gnu compilers
- New URL
* Tue Feb 20 2018 Antonio Trande <sagitter@fedoraproject.com> - 1.8.20-2 * Tue Feb 20 2018 Antonio Trande <sagitter@fedoraproject.com> - 1.8.20-2
- Devel package with full versioned dependency - Devel package with full versioned dependency
- Use %%make_install - Use %%make_install

Loading…
Cancel
Save