backport some recent changes from f22

- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- drop -O2: it often uses too much build mem
- add an rpm .attr file for ghc-deps.sh rather than running it
  as an external dep generator (#1132275)
This commit is contained in:
Jens Petersen 2014-09-10 17:19:16 +09:00
parent 3e2085dbb6
commit 1d69007d72
4 changed files with 18 additions and 13 deletions

View File

@ -80,5 +80,3 @@ for i in $files; do
fi
fi
done
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE

View File

@ -6,7 +6,7 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 1.2.14
Version: 1.2.15
Release: 1%{?dist}
Summary: RPM macros for building packages for GHC
@ -24,6 +24,7 @@ Source3: ghc-deps.sh
Source4: cabal-tweak-dep-ver
Source5: cabal-tweak-flag
Source6: macros.ghc-extra
Source7: ghc.attr
Requires: ghc-srpm-macros
# macros.ghc-srpm moved out from redhat-rpm-config-21
Requires: redhat-rpm-config > 20-1.fc21
@ -66,11 +67,12 @@ install -p -D -m 0644 %{SOURCE0} %{buildroot}/%{macros_dir}/macros.ghc
install -p -D -m 0644 %{SOURCE6} %{buildroot}/%{macros_dir}/macros.ghc-extra
install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
install -p -D -m 0644 %{SOURCE7} %{buildroot}/%{_prefix}/lib/rpm/fileattrs/ghc.attr
install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver
install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
# this is why this package is now arch-dependent:
# this is why this package is arch-dependent:
# turn off shared libs and dynamic linking on secondary archs
%ifnarch %{ix86} x86_64
cat >> %{buildroot}/%{macros_dir}/macros.ghc <<EOF
@ -85,6 +87,7 @@ EOF
%files
%doc COPYING AUTHORS
%{macros_dir}/macros.ghc
%{_prefix}/lib/rpm/fileattrs/ghc.attr
%{_prefix}/lib/rpm/ghc-deps.sh
%{_bindir}/cabal-tweak-dep-ver
%{_bindir}/cabal-tweak-flag
@ -95,6 +98,13 @@ EOF
%changelog
* Wed Sep 10 2014 Jens Petersen <petersen@redhat.com> - 1.2.15-1
- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- drop -O2: it often uses too much build mem
- add an rpm .attr file for ghc-deps.sh rather than running it
as an external dep generator (#1132275)
(see http://rpm.org/wiki/PackagerDocs/DependencyGenerator)
* Wed Aug 20 2014 Jens Petersen <petersen@redhat.com> - 1.2.14-1
- fix warning in macros.ghc-extra about unused pkgnamever

3
ghc.attr Normal file
View File

@ -0,0 +1,3 @@
%__ghc_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir}
%__ghc_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}
%__ghc_path ^%{ghclibdir}/.*/libHS.*\\.(so|a)

View File

@ -21,7 +21,7 @@ fi
# configure
%cabal_configure\
%ghc_check_bootstrap\
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} --libsubdir='$compiler/$pkgid' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} --ghc-option=-O2 %{?with_tests:--enable-tests} %{?cabal_configure_options} $cabal_configure_extra_options
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} --libsubdir='$compiler/$pkgid' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} %{?cabal_configure_options} $cabal_configure_extra_options
# install
%cabal_install %cabal copy --destdir=%{buildroot} -v
@ -113,8 +113,6 @@ fi
# install bin package
%ghc_bin_install()\
%global _use_internal_dependency_generator 0\
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
%cabal_install\
%{!?1:%ghc_strip_dynlinked}\
%{!?1:%ghc_clear_execstack}\
@ -122,9 +120,6 @@ fi
# ghc_lib_install [name] [version]
%ghc_lib_install()\
%global _use_internal_dependency_generator 0\
%global __find_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir}\
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
%cabal_install\
%cabal_pkg_conf\
%ghc_gen_filelists\
@ -133,18 +128,17 @@ fi
%{nil}
# ghc_fix_dynamic_rpath prog ...
# (assumes cwd = pkg_name!)
%ghc_fix_dynamic_rpath()\
%if %{undefined ghc_without_dynamic}\
if ! type chrpath > /dev/null; then exit 1; fi\
PDIR=$(cd ..; pwd)\
PDIR=$(pwd)\
for i in %*; do\
PROG=%{buildroot}%{_bindir}/$i\
if [ -x "$PROG" ]; then\
RPATH=$(chrpath $PROG | sed -e "s@^$PROG: RPATH=@@")\
case $RPATH in\
*$PDIR*)\
NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR@%{ghclibdir}@g" -e "s@/dist/build@@g")\
NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR/dist/build@%{ghclibdir}/%{pkg_name}-%{version}@g")\
chrpath -r $NEWRPATH $PROG\
;;\
esac\