various minor backports

- add new names ghc_html_dir, ghc_html_libraries_dir, and ghc_html_pkg_dir
- correct cabal-tweak-flag error message for missing flag (#1184508)
- ghc-deps.sh: support ghc-pkg for ghc builds <= 7.4.2 as well
- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- fix warning in macros.ghc-extra about unused pkgnamever
This commit is contained in:
Jens Petersen 2015-01-22 16:53:13 +09:00
parent 26bbb3510b
commit 579a14565d
5 changed files with 40 additions and 17 deletions

View File

@ -29,7 +29,7 @@ if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
fi
if ! grep -q -i "^flag *$FLAG" $CABALFILE; then
echo "$CABALFILE does have flag $FLAG"
echo "$CABALFILE does not have flag $FLAG"
exit 1
fi

View File

@ -15,11 +15,21 @@ PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
if [ -x "$PKGBASEDIR/bin/ghc-pkg" ]; then
# ghc-7.8
GHC_PKG="$PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
elif [ -x "$PKGBASEDIR/ghc-pkg" ]; then
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
# for a ghc build use the new ghc-pkg
INPLACE_GHCPKG=$PKGBASEDIR/../../bin/ghc-pkg-$GHC_VER
if [ -x "$INPLACE_GHCPKG" ]; then
case $GHC_VER in
7.8.*)
GHC_PKG="$PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
;;
7.6.*)
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
;;
*)
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-conf=$PKGCONFDIR"
;;
esac
else
GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER}"
fi

View File

@ -26,12 +26,21 @@ fi
# install
%cabal_install %cabal copy --destdir=%{buildroot} -v
# root dir for ghc docs
# root dir for ghc docs (used by ghc.spec)
%ghc_html_dir %{_docdir}/ghc/html
# deprecates
%ghcdocbasedir %{_docdir}/ghc/html
# libraries doc dir
# libraries doc dir (internal)
%ghc_html_libraries_dir %{ghc_html_dir}/libraries
# deprecates
%ghclibdocdir %{ghcdocbasedir}/libraries
# pkg doc dir
%ghcpkgdocdir %{ghcdocbasedir}/libraries/%{pkg_name}-%{version}
%ghc_html_pkg_dir %{ghc_html_libraries_dir}/%{pkg_name}-%{version}
# deprecates
%ghcpkgdocdir %{ghclibdocdir}/%{pkg_name}-%{version}
# top library dir
%ghclibdir %{_libdir}/ghc-%{ghc_version}
@ -107,8 +116,8 @@ find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \
# ghc_clear_execstack
%ghc_clear_execstack\
if [ -d "%{buildroot}%{_bindir}" ]; then\
find %{buildroot}%{_bindir} -type f -exec sh -c "file {} | grep -q ' ELF '" \\; -exec execstack -c "{}" \\;\
if [ -d "%{buildroot}%{_bindir}" -a -x "%{_bindir}/execstack" ]; then\
find %{buildroot}%{_bindir} -type f -exec sh -c "file {} | grep -q ' ELF '" \\; -exec %{_bindir}/execstack -c "{}" \\;\
fi
# install bin package
@ -133,18 +142,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\

View File

@ -4,8 +4,7 @@
%ghc_lib_subpackage(c:l:x)\
%define pkgname %{?1}%{!?1:%{pkg_name}}\
%define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\
%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgnamever}}}\
%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgname}-%{pkgver}}}\
%define basepkg ghc-%{pkgname}\
%package -n %{basepkg}\
Summary: Haskell %{pkgname} library\

View File

@ -67,7 +67,6 @@ install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
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:
# turn off shared libs and dynamic linking on secondary archs
%ifnarch %{ix86} x86_64
cat >> %{buildroot}/%{macros_dir}/macros.ghc <<EOF
@ -92,6 +91,13 @@ EOF
%changelog
* Thu Jan 22 2015 Jens Petersen <petersen@redhat.com>
- add new names ghc_html_dir, ghc_html_libraries_dir, and ghc_html_pkg_dir
- correct cabal-tweak-flag error message for missing flag (#1184508)
- ghc-deps.sh: support ghc-pkg for ghc builds <= 7.4.2 as well
- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- fix warning in macros.ghc-extra about unused pkgnamever
* Sat May 17 2014 Jens Petersen <petersen@redhat.com> - 1.0.7.4-1
- do bcond cabal configure --enable-tests also for Bin packages
- enable configure bcond check for tests