Compare commits

...

No commits in common. "72d725f3f8acb3f7a67e02fccabab9772c07a10c" and "c8" have entirely different histories.

20 changed files with 187 additions and 606 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
/ghc-rpm-macros-*/

View File

@ -2,15 +2,11 @@
set -e +x
function fail {
echo "$0: $1" >&2
exit 1
}
USAGE="Usage: $0 dep old new"
if [ $# -ne 3 ]; then
fail "$USAGE"
echo "$USAGE"
exit 1
fi
DEP=$1
@ -20,13 +16,15 @@ NEW=$3
CABALFILE=$(ls *.cabal)
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
fail "There needs to be one .cabal file in the current dir!"
echo "There needs to be one .cabal file in the current dir!"
exit 1
fi
BREAK=[^[:alnum:]-]
if ! grep -q "$BREAK$DEP$BREAK[^,]*$OLD" $CABALFILE; then
fail "$CABALFILE does not match: $DEP $OLD"
echo "$CABALFILE does not match: $DEP $OLD"
exit 1
fi
if [ ! -f $CABALFILE.orig ]; then

View File

@ -2,15 +2,11 @@
set -e +x
function fail {
echo "$0: $1" >&2
exit 1
}
USAGE="Usage: $0 dep"
if [ $# -ne 1 ]; then
fail "$USAGE"
echo "$USAGE"
exit 1
fi
DEP=$1
@ -18,7 +14,8 @@ DEP=$1
CABALFILE=$(ls *.cabal)
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
fail "There needs to be one .cabal file in the current dir!"
echo "There needs to be one .cabal file in the current dir!"
exit 1
fi
if [ ! -f $CABALFILE.orig ]; then
@ -26,7 +23,8 @@ if [ ! -f $CABALFILE.orig ]; then
fi
if grep "$DEP" $CABALFILE | sed -e "s/$DEP//" | grep -q -e "[A-Za-z]"; then
fail "$0: deleting whole $DEP lines not safe - try more precise pattern"
echo "$0: deleting whole $DEP lines not safe - try more precise pattern"
exit 1
fi
sed -i$BACKUP -e "/$DEP/d" $CABALFILE

View File

@ -5,15 +5,11 @@
set -e +x
function fail {
echo "$0: $1" >&2
exit 1
}
USAGE="Usage: $0 FLAG [True|False]"
if [ $# -ne 2 ]; then
fail "$USAGE"
echo "$USAGE"
exit 1
fi
FLAG=$1
@ -28,19 +24,23 @@ esac
CABALFILE=$(ls *.cabal)
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
fail "There needs to be one .cabal file in the current dir!"
echo "There needs to be one .cabal file in the current dir!"
exit 1
fi
if ! grep -q -i "^flag *$FLAG" $CABALFILE; then
fail "$CABALFILE does not have flag $FLAG"
echo "$CABALFILE does not have flag $FLAG"
exit 1
fi
if ! grep -A3 -i "^flag *$FLAG" $CABALFILE | grep -q -i "default:"; then
fail "$CABALFILE: $FLAG flag might not have a default"
echo "$CABALFILE: $FLAG flag might not have a default"
exit 1
fi
if ! grep -A3 -i "^flag *$FLAG" $CABALFILE | grep -q -i "default: *$OLD"; then
fail "$CABALFILE: $FLAG flag already defaults to $NEW"
echo "$CABALFILE: $FLAG flag already defaults to $NEW"
exit 1
fi
if [ ! -f $CABALFILE.orig ]; then

43
SOURCES/ghc-deps.sh Executable file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# find rpm provides and requires for Haskell GHC libraries
[ $# -ne 2 ] && echo "Usage: $(basename $0) [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
mode=$1
pkgbasedir=$2
pkgconfdir=$pkgbasedir/package.conf.d
ghc_pkg="/usr/lib/rpm/ghc-pkg-wrapper $pkgbasedir"
case $mode in
--provides) field=id ;;
--requires) field=depends ;;
*) echo "$(basename $0): Need --provides or --requires"
exit 1
;;
esac
ghc_ver=$(basename $pkgbasedir | sed -e s/ghc-//)
files=$(cat)
for i in $files; do
case $i in
# exclude builtin_rts.conf
$pkgconfdir/*-*.conf)
name=$(grep "^name: " $i | sed -e "s/name: //")
ids=$($ghc_pkg field $name $field | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
for d in $ids; do
case $d in
*-*) echo "ghc-devel($d)" ;;
*) ;;
esac
done
;;
*)
;;
esac
done

View File

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

View File

@ -2,33 +2,28 @@
# see https://fedoraproject.org/wiki/Packaging:Haskell for more details
# "cabal"
%cabal [ -x Setup ] || ghc --make -package Cabal -no-user-package-db %{!?ghc_static_setup:-dynamic} Setup\
LANG=C.utf8\
%cabal [ -x Setup ] || ghc --make %{!?ghc_user_conf:-no-user-package-db} %{!?ghc_without_dynamic:-dynamic} Setup\
LANG=en_US.utf8\
./Setup
# compiler version
%ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
%ghc_set_gcc_flags\
%ghc_set_cflags\
# -Wunused-label is extremely noisy\
%ifarch s390x\
%define _lto_cflags %{nil}\
CFLAGS="${CFLAGS:-$(echo %optflags | sed -e 's/-Wall //' -e 's/-Werror=format-security //')}"\
%ifarch aarch64 s390x\
CFLAGS="${CFLAGS:-$(echo %optflags | sed -e 's/-Wall -Werror=format-security //')}"\
%else\
CFLAGS="${CFLAGS:-%optflags}"\
%endif\
export CFLAGS\
%global _hardened_ldflags %{nil}\
export LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"\
%{nil}
# configure
%cabal_configure\
%ghc_set_gcc_flags\
if ! [ -f Setup.hs -o -f Setup.lhs ]; then\
cp %{_datadir}/ghc-rpm-macros/Setup.hs .\
fi\
%ghc_set_cflags\
%global _hardened_ldflags %{nil}\
LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"; export LDFLAGS\
%cabal --version\
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_ghcdocdir} --libsubdir='$compiler/$pkgid' --datasubdir='$pkgid' --libexecsubdir='$pkgid' --ghc %{?_ghcdynlibdir:--dynlibdir=%{_ghcdynlibdir}} %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} %{?ghc_subpackaging:--user}%{!?ghc_subpackaging:--global} --ghc-options="${CFLAGS:+$(echo ' '$CFLAGS | sed -e 's/ / -optc/g')} ${LDFLAGS:+$(echo ' '$LDFLAGS | sed -e 's/ / -optl/g')}" %{?cabal_configure_options} $cabal_configure_extra_options
@ -70,41 +65,34 @@ fi\
%define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\
%define basepkg %{?ghc_name}%{!?ghc_name:ghc}-%{pkgname}\
if [ -z "$(ls %{buildroot}%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf)" ]; then\
echo '%{buildroot}%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf not found'\
%define docdir %{ghclibdocdir}/%{pkgnamever}\
if [ -z "$(ls %{buildroot}%{ghclibdir}/package.conf.d/)" ]; then\
echo "%{buildroot}%{ghclibdir}/package.conf.d/*.conf not found"\
exit 1\
fi\
rm -f %{basepkg}.files %{basepkg}-doc.files\
touch %{basepkg}.files %{basepkg}-doc.files\
%if 0%{?1:1}\
for i in $(ls %{buildroot}%{_ghclicensedir}/%{basepkg}); do\
echo "%%license %{pkgnamever}/$i" >> %{basepkg}.files\
done\
%endif\
for i in %{buildroot}%{_ghcdynlibdir}/libHS%{pkgnamever}-*ghc%{ghc_version}.so; do\
if [ -x "$i" ]; then\
echo $i >> %{basepkg}.files\
else\
echo 'Warning: %{buildroot}%{_ghcdynlibdir}/libHS%{pkgnamever}-*ghc%{ghc_version}.so not found'\
fi\
done\
rm -f %{basepkg}.files %{basepkg}-devel.files\
touch %{basepkg}.files %{basepkg}-devel.files\
ls %{buildroot}%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf >> %{basepkg}-devel.files\
pkgdir="%{ghclibdir}/%{pkgnamever}"\
if [ -d "%{buildroot}${pkgdir}" ]; then\
find %{buildroot}${pkgdir} -type d -fprintf %{basepkg}-devel.files '%%%%dir %p\\n' -o \\( -name '*.p_hi' -o -name 'libHS*_p.a' \\) -fprint %{basepkg}-prof.files -o -fprint %{basepkg}-devel.files\
else\
rm -f %{basepkg}-devel.files %{basepkg}-prof.files\
touch %{basepkg}-devel.files %{basepkg}-prof.files\
fi\
ls %{buildroot}%{ghclibdir}/package.conf.d/%{pkgnamever}*.conf >> %{basepkg}-devel.files\
%if %{with haddock}\
if [ -d %{buildroot}%{ghc_html_libraries_dir}/%{pkgnamever} ]; then\
echo %dir %{_docdir}/ghc >> %{basepkg}-doc.files\
echo %dir %{ghc_html_dir} >> %{basepkg}-doc.files\
echo %dir %{ghc_html_libraries_dir} >> %{basepkg}-doc.files\
echo %{ghc_html_libraries_dir}/%{pkgnamever} >> %{basepkg}-doc.files\
fi\
%if %{defined _ghcdynlibdir}\
echo "${pkgdir}" >> %{basepkg}-devel.files\
%else\
echo "%%dir ${pkgdir}" >> %{basepkg}.files\
find %{buildroot}${pkgdir} -mindepth 1 -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
find %{buildroot}${pkgdir} ! \\( -type d -o -name "libHS*.so" \\) >> %{basepkg}-devel.files\
%endif\
for i in %{basepkg}.files %{basepkg}-devel.files %{basepkg}-doc.files %{basepkg}-prof.files; do\
echo "%%attr(755,root,root) %{?_ghcdynlibdir}%{!?_ghcdynlibdir:${pkgdir}}/libHS%{pkgnamever}-*ghc%{ghc_version}.so" >> %{basepkg}.files\
fi\
if [ -d "%{buildroot}%{docdir}" ]; then\
echo "%{docdir}" >> %{basepkg}-devel.files\
fi\
%if 0%{?1:1}\
for i in $(ls %{buildroot}%{_ghclicensedir}/%{!?1:%{name}}%{?1:%{basepkg}}); do\
echo "%%license %{?1:%{pkgnamever}/}$i" >> %{basepkg}.files\
done\
%endif\
for i in %{basepkg}.files %{basepkg}-devel.files; do\
if [ -f "$i" ]; then\
sed -i -e "s!%{buildroot}!!g" $i\
fi\
@ -128,48 +116,46 @@ install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.
fi\
%{nil}
# workaround Cabal bug causing executable extra-source-files
%ghc_fix_doc_perms\
for f in $(ls | grep -i -e "^\(ANNOUNCE\|AUTHORS\|CHANGELOG\|CHANGES\|CONTRIBUTORS\|README\|TODO\)"); do\
if [ -x $f ]; then chmod a-x $f; fi\
done\
%{nil}
# ghc_bin_build
%ghc_bin_build\
%ghc_fix_doc_perms\
%undefine _enable_debug_packages\
%global debug_package %{nil}\
%cabal_configure\
%cabal build %{?ghc_smp_mflags} %{?cabal_build_options}
# ghc_lib_build_without_haddock [name] [version]
%ghc_lib_build_without_haddock()\
%ghc_fix_doc_perms\
%undefine _enable_debug_packages\
%global debug_package %{nil}\
%if 0%{?rhel} && 0%{?rhel} < 8\
licensedirversion=%{?2:-%2}\
%endif\
%cabal_configure %{?with_ghc_prof:-p} %{!?ghc_without_shared:--enable-shared} %{?ghc_without_shared:--disable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_ghclicensedir}/ghc-%1${licensedirversion} --htmldir=%{ghclibdocdir}/%1-%2} %{?ghc_subpackaging:--user}%{!?ghc_subpackaging:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
%cabal_configure %{!?without_prof:-p} --enable-shared %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_ghclicensedir}/ghc-%1${licensedirversion} --htmldir=%{ghclibdocdir}/%1-%2} %{?ghc_subpackaging:--user}%{!?ghc_subpackaging:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
%cabal build %{?ghc_smp_mflags} %{?cabal_build_options}\
%{nil}
# ghc_lib_build [name] [version]
%ghc_lib_build()\
%ghc_lib_build_without_haddock %{?1} %{?2}\
%if %{with haddock}\
%if %{undefined without_haddock}\
%define pkgname %{?1}%{!?1:%{pkg_name}}\
%define pkgver %{?2}%{!?2:%{version}}\
if [ -n dist/build/libHS%{pkgname}-%{pkgver}*.so ]; then\
%cabal haddock --html --hyperlink-source --hoogle %{?cabal_haddock_options}\
%cabal haddock --html %{!?without_hscolour:%(if [ -x %{_bindir}/HsColour ]; then echo --hyperlink-source; fi)} --hoogle %{?cabal_haddock_options}\
fi\
%endif\
%{nil}
# ghc_strip_dynlinked
%ghc_strip_dynlinked\
%if %{undefined __debug_package}\
find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -exec strip "{}" \\;\
%endif
# install bin package
%ghc_bin_install()\
%{!?_fileattrsdir:%global _use_internal_dependency_generator 0}\
%{!?_fileattrsdir:%global __find_requires %{_rpmconfigdir}/ghc-deps.sh %{buildroot}%{ghclibdir}}\
%cabal_install\
%{!?1:%ghc_strip_dynlinked}\
%{?ghc_subpackaging:%ghc_fix_rpath %{subpkgs}}\
%{nil}
@ -181,15 +167,15 @@ fi\
%cabal_install\
%cabal_pkg_conf %{?1} %{?2}\
%ghc_gen_filelists %{?1} %{?2}\
%{!?1:%ghc_strip_dynlinked}\
%{?ghc_subpackaging:%ghc_fix_rpath %{subpkgs}}\
%{nil}
# ghc_fix_rpath lib-ver ...
%ghc_fix_rpath()\
%if %{undefined disable_ghc_fix_rpath}\
%if %{undefined ghc_without_dynamic}\
if ! type chrpath > /dev/null; then exit 1; fi\
echo "ghc_fix_rpath %*"\
for i in $(find %{buildroot} -type f -executable -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print); do\
for i in $(find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print); do\
for lib in %*; do\
if [ -x "$i" ]; then\
rpath=$(chrpath $i | sed -e "s@^$i: R.*PATH=@@")\
@ -206,14 +192,7 @@ for lib in %*; do\
syspath="" ;;\
esac\
newrpath=$(echo $rpath | sed -e "s@$PWD/$lib/dist/build@${syspath}@g" -e "s/::/:/" -e "s/^://" -e "s/:$//")\
if [ "$newrpath" = "%{_libdir}" ]; then\
chrpath -d $i\
else\
chrpath -r $newrpath $i\
fi\
;;\
%{_libdir})\
chrpath -d $i\
chrpath -r $newrpath $i\
;;\
esac\
else\
@ -222,12 +201,45 @@ for lib in %*; do\
fi\
done\
done\
%endif
%endif\
%{nil}
# Deprecated by ghc_fix_rpath:
# ghc_fix_dynamic_rpath prog ...
%ghc_fix_dynamic_rpath()\
%if %{undefined ghc_without_dynamic}\
if ! type chrpath > /dev/null; then exit 1; fi\
pdir=$(pwd)\
for i in %*; do\
case $i in\
/*) prog=%{buildroot}$i ;;\
*) prog=%{buildroot}%{_bindir}/$i ;;\
esac\
if [ -x "$prog" ]; then\
rpath=$(chrpath $prog | sed -e "s@^$prog: R.*PATH=@@")\
case $rpath in\
*$pdir*)\
newrpath=$(echo $rpath | sed -e "s@$pdir/dist/build@%{ghclibdir}/%{pkg_name}-%{version}@g")\
chrpath -r $newrpath $prog\
;;\
esac\
else\
echo "%%ghc_fix_dynamic_rpath: no such file $prog"\
exit 1\
fi\
done\
%endif\
%{nil}
# deprecated for f31
%ghc_pkg_recache %{_bindir}/ghc-pkg-%{ghc_version} recache --no-user-package-db || :
# deprecated
%ghc_bootstrap\
%global without_prof 1\
%global without_haddock 1\
%global without_manual 1
# skip prof libs and documentation
%ghc_quick_build\
%undefine with_ghc_prof\
%undefine with_haddock
%global without_prof 1\
%global without_haddock 1

View File

@ -1,8 +1,8 @@
# RPM Macros for packaging Haskell packages with multiple libs -*-rpm-spec-*-
# ghc_lib_subpackage [-c cdepslist] [-d] [-l licensetag] [-m] [-x] [name-version]
# ghc_lib_subpackage [-c cdepslist] [-d] [-l licensetag] [-x] [name-version]
# for backward compat also support: ghc_lib_subpackage name version
%ghc_lib_subpackage(c:dl:mx)\
%ghc_lib_subpackage(c:dl:x)\
%define pkgname %{?2:%{1}}%{!?2:%{lua:\
local pv = rpm.expand("%1")\
local _, _, name = string.find(pv, "^([%a%d-]+)-")\
@ -12,13 +12,14 @@ print(name)\
local pv = rpm.expand("%1")\
print(string.sub(pv, string.find(pv, "[%d.]+$")))\
}}\
%global ghc_subpackages_list %{?ghc_subpackages_list} %{pkgname}-%{pkgver}\
%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgname}-%{pkgver}}}\
%define ghc_prefix %{?ghc_name}%{!?ghc_name:ghc}\
%define basepkg %{ghc_prefix}-%{pkgname}\
%if 0%{!-m:1}\
%package -n %{basepkg}\
Summary: Haskell %{pkgname} library\
%if 0%{?rhel} && 0%{?rhel} < 6\
Group: System/Libraries\
%endif\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
Url: http://hackage.haskell.org/package/%{pkgname}\
@ -27,17 +28,16 @@ Url: http://hackage.haskell.org/package/%{pkgname}\
%description -n %{basepkg}\
This package provides the Haskell %{pkgname} library.\
\
%endif\
%package -n %{basepkg}-devel\
Summary: Haskell %{pkgname} library development files\
%if 0%{?rhel} && 0%{?rhel} < 6\
Group: Development/Languages/Other\
%endif\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
Provides: %{basepkg}-static = %{pkgver}-%{release}\
Provides: %{basepkg}-static%{?_isa} = %{pkgver}-%{release}\
Requires: %{ghc_prefix}-compiler = %{ghc_version}%{?ghc_version_override:-%{release}}\
%if 0%{!-m:1}\
Requires(post): %{ghc_prefix}-compiler = %{ghc_version}\
Requires(postun): %{ghc_prefix}-compiler = %{ghc_version}\
Requires: %{ghc_prefix}-%{pkgname}%{?_isa} = %{pkgver}-%{release}\
%endif\
%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}\
%{-c:Requires: %{-c*}}\
%{?ghc_pkg_obsoletes:Obsoletes: %{ghc_pkg_obsoletes}}\
@ -45,45 +45,23 @@ Requires: %{ghc_prefix}-%{pkgname}%{?_isa} = %{pkgver}-%{release}\
%description -n %{basepkg}-devel\
This package provides the Haskell %{pkgname} library development files.\
\
%if 0%{!-m:1}\
%if %{with haddock}\
%package -n %{basepkg}-doc\
Summary: Haskell %{pkgname} library documentation\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
BuildArch: noarch\
Supplements: (%{basepkg}-devel and ghc-doc)\
%post -n %{basepkg}-devel\
%ghc_pkg_recache\
\
%description -n %{basepkg}-doc\
This package provides the Haskell %{pkgname} library documentation.\
%endif\
\
%if %{with ghc_prof}\
%package -n %{basepkg}-prof\
Summary: Haskell %{pkgname} profiling library\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
Requires: %{ghc_prefix}-%{pkgname}-devel%{?_isa} = %{pkgver}-%{release}\
Supplements: (%{basepkg}-devel and ghc-prof)\
\
%description -n %{basepkg}-prof\
This package provides the Haskell %{pkgname} profiling library.\
%endif\
%postun -n %{basepkg}-devel\
%ghc_pkg_recache\
\
%files -n %{basepkg} -f %{!-d:%{pkgname}-%{pkgver}/}%{basepkg}.files\
\
%if 0%{?rhel} && 0%{?rhel} < 6\
%defattr(-,root,root,-)\
%endif\
%{?base_doc_files:%doc %base_doc_files}\
\
%files -n %{basepkg}-devel -f %{!-d:%{pkgname}-%{pkgver}/}%{basepkg}-devel.files\
%if 0%{!-m:1}\
\
%if %{with haddock}\
%files -n %{basepkg}-doc -f %{!-d:%{pkgname}-%{pkgver}/}%{basepkg}-doc.files\
%endif\
\
%if %{with ghc_prof}\
%files -n %{basepkg}-prof -f %{!-d:%{pkgname}-%{pkgver}/}%{basepkg}-prof.files\
%endif\
%if 0%{?rhel} && 0%{?rhel} < 6\
%defattr(-,root,root,-)\
%endif\
%{?devel_doc_files:%doc %devel_doc_files}\
%{nil}
# ghc_libs_build [name-version] ...

7
SOURCES/macros.ghc-os Normal file
View File

@ -0,0 +1,7 @@
# OS specific settings
%_ghcdocdir %{_ghclicensedir}/%{name}
%_ghcdynlibdir %{_libdir}
%cabal_install_options -v

View File

@ -10,13 +10,13 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 2.0.15
Release: 2%{?dist}
Version: 1.9.0
Release: 1.1%{?dist}
Summary: RPM macros for building Haskell packages for GHC
License: GPLv3+
URL: https://github.com/fedora-haskell/ghc-rpm-macros
# Currently source is only in pkg git but tarballs could be made if it helps
# Currently source is only in git but tarballs could be made if it helps
Source0: macros.ghc
Source1: COPYING
Source2: AUTHORS
@ -27,9 +27,7 @@ Source6: macros.ghc-extra
Source7: ghc.attr
Source8: ghc-pkg-wrapper
Source9: macros.ghc-os
Source10: Setup.hs
Source11: cabal-tweak-drop-dep
Source12: cabal-tweak-remove-upperbound
Requires: redhat-rpm-config
# for ghc_version
Requires: ghc-compiler
@ -42,7 +40,8 @@ BuildArch: noarch
%description
A set of macros for building GHC packages following the Haskell Guidelines
of the Fedora Haskell SIG.
of the Fedora Haskell SIG. ghc needs to be installed in order to make use of
these macros.
%package extra
@ -55,113 +54,13 @@ Extra macros used for subpackaging of Haskell libraries,
for example in ghc and haskell-platform.
# ideally packages should be obsoleted by some relevant package
# this is a last resort when there is no such appropriate package
%package -n ghc-obsoletes
Summary: Dummy package to obsolete deprecated Haskell packages
%if 0%{?fedora} >= 22
# these 3 no longer build with ghc-7.8
Obsoletes: ghc-ForSyDe < 3.1.2, ghc-ForSyDe-devel < 3.1.2
Obsoletes: ghc-parameterized-data < 0.1.6
Obsoletes: ghc-parameterized-data-devel < 0.1.6
Obsoletes: ghc-type-level < 0.2.5, ghc-type-level-devel < 0.2.5
Obsoletes: leksah < 0.14, ghc-leksah < 0.14, ghc-leksah-devel < 0.14
# dropped from HP 2014.2
Obsoletes: ghc-cgi < 3001.1.8, ghc-cgi-devel < 3001.1.8
%endif
%if 0%{?fedora} >= 24
Obsoletes: ghc-citeproc-hs < 0.3.10-3, ghc-citeproc-hs-devel < 0.3.10-3
Obsoletes: ghc-hakyll < 4.5.4.0-6, ghc-hakyll-devel < 4.5.4.0-6
Obsoletes: ghc-leksah-server < 0.14.3.1-4, ghc-leksah-server-devel < 0.14.3.1-4
%endif
%if 0%{?fedora} >= 25
Obsoletes: ghc-cmdtheline <= 0.2.3, ghc-cmdtheline-devel <= 0.2.3
Obsoletes: ghc-concrete-typerep <= 0.1.0.2, ghc-concrete-typerep-devel <= 0.1.0.2
Obsoletes: ghc-glade <= 0.12.5.0, ghc-glade-devel <= 0.12.5.0
Obsoletes: bluetile <= 0.6, bluetile-core <= 0.6
Obsoletes: ghc-lambdabot-utils <= 4.2.2, ghc-lambdabot-utils-devel <= 4.2.2
Obsoletes: haddock <= 2.14.3, ghc-haddock <= 2.14.3, ghc-haddock-devel <= 2.14.3
Obsoletes: ghc-monad-unify <= 0.2.2, ghc-monad-unify-devel <= 0.2.2
Obsoletes: idris <= 0.9.9.1
Obsoletes: ghc-editline < 0.2.1.1-13, ghc-editline-devel < 0.2.1.1-13
Obsoletes: ghc-hashed-storage < 0.5.11-4, ghc-hashed-storage-devel < 0.5.11-4
Obsoletes: ghc-nats <= 0.2, ghc-nats-devel <= 0.2
Obsoletes: ghc-primes <= 0.2.1.0-11, ghc-primes-devel <= 0.2.1.0-11
%endif
%if 0%{?fedora} >= 26
Obsoletes: ghc-geniplate <= 0.6.0.5, ghc-geniplate-devel <= 0.6.0.5
Obsoletes: ghc-sized-types <= 0.3.4.0, ghc-sized-types-devel <= 0.3.4.0
# dropped from HP 8.0.2
Obsoletes: ghc-cgi < 3001.2.2.2-5, ghc-cgi-devel < 3001.2.2.2-5
Obsoletes: ghc-multipart < 0.1.2-5, ghc-multipart-devel < 0.1.2-5
%endif
%if 0%{?fedora} >= 27
Obsoletes: ghc-webkit <= 0.14.2.1, ghc-webkit-devel <= 0.14.2.1
%endif
%if 0%{?fedora} >= 28
Obsoletes: ghc-fail < 4.9.0.0-2, ghc-fail-devel < 4.9.0.0-2
Obsoletes: ghc-ltk < 0.16, ghc-ltk-devel < 0.16
%endif
%if 0%{?fedora} >= 29
Obsoletes: ghc-content-store < 0.2.1-3, ghc-content-store-devel < 0.2.1-3
Obsoletes: ghc-bdcs < 0.6.1-3, ghc-bdcs-devel < 0.6.1-3
Obsoletes: ghc-bdcs-api < 0.1.3-3, ghc-bdcs-api-devel < 0.1.3-3
%endif
%if 0%{?fedora} >= 30
# ghc
Obsoletes: ghc-hoopl < 3.10.2.2-74, ghc-hoopl-devel < 3.10.2.2-74
# language-ecmascript
Obsoletes: ghc-tagshare < 0.0-10, ghc-tagshare-devel < 0.0-10
Obsoletes: ghc-testing-feat < 0.4.0.3-10, ghc-testing-feat-devel < 0.4.0.3-10
# haskell-platform
Obsoletes : ghc-fixed < 0.2.1.1-16, ghc-fixed-devel < 0.2.1.1-16
Obsoletes : ghc-GLURaw < 2.0.0.4, ghc-GLURaw-devel < 2.0.0.4
Obsoletes : ghc-GLUT < 2.7.0.13, ghc-GLUT-devel < 2.7.0.13
Obsoletes : ghc-half < 0.3, ghc-half-devel < 0.3
Obsoletes : ghc-haskell-src < 1.0.3.0, ghc-haskell-src-devel < 1.0.3.0
Obsoletes : ghc-ObjectName < 1.1.0.1-16, ghc-ObjectName-devel < 1.1.0.1-16
Obsoletes : ghc-OpenGL < 3.0.2.1, ghc-OpenGL-devel < 3.0.2.1
Obsoletes : ghc-OpenGLRaw < 3.2.6.0, ghc-OpenGLRaw-devel < 3.2.6.0
# enumerator
Obsoletes: ghc-enumerator < 0.4.20-12, ghc-enumerator-devel < 0.4.20-12
Obsoletes: ghc-attoparsec-enumerator < 0.3.4-10, ghc-attoparsec-enumerator-devel < 0.3.4-10
Obsoletes: ghc-blaze-builder-enumerator < 0.2.1.0-8, ghc-blaze-builder-enumerator-devel < 0.2.1.0-8
Obsoletes: ghc-zlib-enum < 0.2.3.1-12, ghc-zlib-enum-devel < 0.2.3.1-12
# Agda
Obsoletes: ghc-monadplus < 1.4.2-17, ghc-monadplus-devel < 1.4.2-17
# conduit-combinators
Obsoletes: ghc-conduit-combinators < 1.3.1
%endif
%if 0%{?fedora} >= 31
# base package obsoleted above in f30
Obsoletes: ghc-conduit-combinators-devel < 1.3.1
%endif
%if 0%{?fedora} >= 32
Obsoletes: ghc-cabal-plan < 0.4.0.0-5, ghc-cabal-plan-devel < 0.4.0.0-5, ghc-cabal-plan-prof < 0.4.0.0-5
Obsoletes: ghc-derive < 2.6.5-5, ghc-derive-devel < 2.6.5-5, ghc-derive-prof < 2.6.5-5
Obsoletes: ghc-here < 1.2.13-17, ghc-here-devel < 1.2.13-17, ghc-here-prof < 1.2.13-17
%endif
%if 0%{?fedora} >= 33
Obsoletes: ghc-easytest < 0.2.1-4, ghc-easytest-devel < 0.2.1-4, ghc-easytest-prof < 0.2.1-4,
Obsoletes: ghc-EdisonAPI < 1.3.1-23, ghc-EdisonAPI-devel < 1.3.1-23, ghc-EdisonAPI-prof < 1.3.1-23
Obsoletes: ghc-EdisonCore < 1.3.2.1-23, ghc-EdisonCore-devel < 1.3.2.1-23, ghc-EdisonCore-prof < 1.3.2.1-23
Obsoletes: ghc-gtksourceview2 < 0.13.3.1-14, ghc-gtksourceview2-devel < 0.13.3.1-14, ghc-gtksourceview2-prof < 0.13.3.1-14
%endif
Obsoletes: ghc-iwlib < 0.1.0-16, ghc-iwlib-devel < 0.1.0-16, ghc-iwlib-prof < 0.1.0-16
%description -n ghc-obsoletes
Meta package for obsoleting deprecated Haskell packages.
This package can safely be removed.
%prep
%setup -c -T
cp %{SOURCE1} %{SOURCE2} .
%build
echo no build stage
echo no build stage needed
%install
@ -175,12 +74,9 @@ 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
%endif
install -p -D -m 0644 %{SOURCE10} %{buildroot}/%{_datadir}/%{name}/Setup.hs
install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver
install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
install -p -D -m 0755 %{SOURCE11} %{buildroot}/%{_bindir}/cabal-tweak-drop-dep
install -p -D -m 0755 %{SOURCE12} %{buildroot}/%{_bindir}/cabal-tweak-remove-upperbound
install -p -D -m 0755 %{SOURCE8} %{buildroot}/%{_prefix}/lib/rpm/ghc-pkg-wrapper
%if 0%{?rhel} && 0%{?rhel} < 7
@ -204,172 +100,15 @@ EOF
%{_bindir}/cabal-tweak-dep-ver
%{_bindir}/cabal-tweak-drop-dep
%{_bindir}/cabal-tweak-flag
%{_bindir}/cabal-tweak-remove-upperbound
%{_datadir}/%{name}/Setup.hs
%files extra
%{macros_dir}/macros.ghc-extra
%if 0%{?fedora} >= 22
%files -n ghc-obsoletes
%endif
%changelog
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.15-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Sat Jan 30 2021 Jens Petersen <petersen@redhat.com> - 2.0.15-1
- add ghc_fix_doc_perms and use it in ghc_bin_build and ghc_lib_build
- ghc_lib_subpackage: define ghc_subpackages_list
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Aug 29 2020 Jens Petersen <petersen@redhat.com> - 2.0.14-1
- ghc-deps.sh: be careful when filtering out rts (#1873687)
* Wed Aug 26 2020 Jens Petersen <petersen@redhat.com> - 2.0.13-2
- obsolete ghc-iwlib (xmobar)
* Tue Aug 4 2020 Jens Petersen <petersen@redhat.com> - 2.0.13-1
- disable LTO on (unregisterised) s390x (#1863601)
to prevent linker warning flood for prof libraries
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 22 2020 Jens Petersen <petersen@redhat.com> - 2.0.12-2
- obsoletes for ghc-EdisonAPI, ghc-EdisonCore, ghc-easytest
* Tue Jul 21 2020 Jens Petersen <petersen@redhat.com> - 2.0.12-1
- make doc packages noarch for subpackaging
- obsoletes for ghc-gtksourceview2
* Wed Jun 24 2020 Jens Petersen <petersen@redhat.com> - 2.0.11-1
- handle meta subpackages:
- ghc_lib_subpackage -m
- only add dynlib to file-list if it exists
* Thu Jun 18 2020 Jens Petersen <petersen@redhat.com> - 2.0.10-1
- cabal-tweak script now output errors to stderr
* Thu Jun 4 2020 Jens Petersen <petersen@redhat.com> - 2.0.9-1
- doc subpackages should own /usr/share/doc/ghc/, /usr/share/doc/ghc/html/,
and /usr/share/doc/ghc/html/libraries/ (#1795526)
* Sun May 10 2020 Jens Petersen <petersen@redhat.com> - 2.0.8-1
- ghc-deps.sh: ignore internal libraries (#1822444)
* Fri May 8 2020 Jens Petersen <petersen@redhat.com> - 2.0.7-2
- obsolete ghc-here (dropped from hledger)
* Mon Apr 27 2020 Jens Petersen <petersen@redhat.com> - 2.0.7-1
- use -package Cabal to build Setup
* Tue Mar 3 2020 Jens Petersen <petersen@redhat.com> - 2.0.6-2
- obsolete ghc-cabal-helper, ghc-cabal-plan, ghc-derive
- unobsolete ghc-hgettext
* Mon Feb 10 2020 Jens Petersen <petersen@redhat.com> - 2.0.6-1
- ghc-deps.sh: fix prof deps for subpackages
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Jan 27 2020 Jens Petersen <petersen@redhat.com> - 2.0.5-4
- obsolete ghc-hgettext
* Fri Sep 27 2019 Jens Petersen <petersen@redhat.com> - 2.0.5-3
- ghc_devel_prof macro not available early enough in koji
* Fri Sep 27 2019 Jens Petersen <petersen@redhat.com> - 2.0.5-2
- define ghc_devel_prof
* Tue Aug 27 2019 Jens Petersen <petersen@redhat.com> - 2.0.5-1
- ghc-deps.sh: fix generation of prof deps
* Tue Aug 13 2019 Jens Petersen <petersen@redhat.com> - 2.0.4-1
- add cabal-tweak-remove-upperbound script
* Sat Aug 10 2019 Jens Petersen <petersen@redhat.com> - 2.0.3-1
- only depend on ghc-prof(pkgid) if libHSpkgid_p.a exists
* Tue Aug 6 2019 Jens Petersen <petersen@redhat.com> - 2.0.2-1
- check if doc haddock dir exists
* Mon Aug 5 2019 Jens Petersen <petersen@redhat.com> - 2.0.1-1
- ghc_lib_subpackage: provide static with isa suffix
* Wed Jul 31 2019 Jens Petersen <petersen@redhat.com> - 2.0-1
- bring back doc and prof subpackages
- ghc_lib_subpackage: provide static
* Fri Jul 26 2019 Jens Petersen <petersen@redhat.com> - 1.10.0-1
- drop devel subpackage scriplets (replaced by ghc-compiler triggers)
- remove deprecated ghc_fix_dynamic_rpath
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.9-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat May 18 2019 Jens Petersen <petersen@redhat.com> - 1.9.9-3
- ghc-conduit-combinators base package obsoleted in f30
* Fri May 10 2019 Jens Petersen <petersen@redhat.com> - 1.9.9-2
- obsoletes for f30 deprecated packages
(including haskell-platform subpackaged libraries and enumerator)
* Mon Apr 15 2019 Jens Petersen <petersen@redhat.com> - 1.9.9-1
- cabal_configure: re-enable stripping by Cabal
(remove --disable-executable-stripping --disable-library-stripping)
- obsolete hoopl
* Tue Apr 9 2019 Jens Petersen <petersen@redhat.com> - 1.9.8-1
- re-instate ghc_without_shared since useful for standalone builds
* Sun Feb 24 2019 Jens Petersen <petersen@redhat.com> - 1.9.7-1
- ghc_fix_rpath was a noop when ghc_without_dynamic
* Fri Feb 1 2019 Jens Petersen <petersen@redhat.com> - 1.9.6-1
- disable debuginfo by undefining _enable_debug_packages
- leave stripping to generic rpm macros
- use C.utf8 locale for building instead of en_US.utf8
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Oct 25 2018 Jens Petersen <petersen@redhat.com> - 1.9.5-5
- need to disable -Werror=format-security too on s390x
* Wed Oct 24 2018 Jens Petersen <petersen@redhat.com> - 1.9.5-4
- silence C compiler Wunused-label warnings flood on s390x again
* Tue Oct 23 2018 Jens Petersen <petersen@redhat.com> - 1.9.5-3
- f29: obsolete content-store, bdcs, and bdcs-api
* Sat Oct 6 2018 Jens Petersen <petersen@redhat.com> - 1.9.5-2
- fix ghc_set_gcc_flags name
* Sat Oct 6 2018 Jens Petersen <petersen@redhat.com> - 1.9.5-1
- disable hardened ldflags again
* Fri Oct 5 2018 Jens Petersen <petersen@redhat.com> - 1.9.4-1
- cabal_configure now uses ghc_set_gcc_flags
* Fri Oct 5 2018 Jens Petersen <petersen@redhat.com> - 1.9.3-1
- disable dynamic linking of executables for better portability
- replace ghc_set_cflags with simplified ghc_set_gcc_flags
* Tue Jul 31 2018 Jens Petersen <petersen@redhat.com> - 1.9.2-1
- inject a Setup.hs if none shipped
* Tue Jul 24 2018 Jens Petersen <petersen@redhat.com> - 1.9.1-1
- remove -Wall and -Werror=format-security separately (on aarch64 and s390x)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu May 31 2018 Jens Petersen <petersen@redhat.com> - 1.9.0-1.1
- drop Fedora obsoletes
* Thu May 24 2018 Jens Petersen <petersen@redhat.com> - 1.9.0-1
- support Cabal bundled internal libraries (yuck)
@ -1340,3 +1079,4 @@ EOF
* Mon May 4 2009 Yaakov M. Nemoy <ghc@hexago.nl> - 0.1-1
- creation of package

View File

@ -1,3 +0,0 @@
import Distribution.Simple
main = defaultMain

View File

@ -1,39 +0,0 @@
#!/bin/sh
set -e +x
function fail {
echo "$0: $1" >&2
exit 1
}
USAGE="Usage: $0 dep"
if [ $# -ne 1 ]; then
fail "$USAGE"
fi
DEP=$1
CABALFILE=$(ls *.cabal)
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
fail "There needs to be one .cabal file in the current dir!"
fi
BREAK=[^[:alnum:]-]
if ! grep -q "$BREAK$DEP$BREAK[^,]*" $CABALFILE; then
fail "$CABALFILE does not match: $DEP"
fi
if [ ! -f $CABALFILE.orig ]; then
BACKUP=.orig
fi
if grep -q "$BREAK$DEP$BREAK[^,]*&&" $CABALFILE; then
sed -i$BACKUP -e "s/\($BREAK$DEP$BREAK[^&,]*[^ ]\+\) *&&[^,]*/\1/g" $CABALFILE
fi
if grep -q "$BREAK$DEP$BREAK[^,]*==" $CABALFILE; then
sed -i$BACKUP -e "s/\($BREAK$DEP$BREAK[^=,]*\)==\([^,*]*\)\.\*/\1>=\2/g" $CABALFILE
fi

View File

@ -1 +0,0 @@
ghc-rpm-macros package is retired on c9s for CS-611

View File

@ -1,61 +0,0 @@
#!/bin/sh
# find rpm provides and requires for Haskell GHC libraries
[ $# -ne 2 ] && echo "Usage: $(basename $0) [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
MODE=$1
PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $PKGBASEDIR"
case $MODE in
--provides) field=id ;;
--requires) field=depends ;;
*) echo "$(basename $0): Need --provides or --requires"
exit 1
;;
esac
files=$(cat)
for i in $files; do
meta=""
case $i in
# exclude rts.conf
$pkgconfdir/*-*.conf)
name=$(grep "^name: " $i | sed -e "s/name: //")
ids=$($GHC_PKG field $name $field | sed -e "s/ rts\b//" -e "s/bin-package-db-[^ ]\+//")
for d in $ids; do
case $d in
*-*-internal) ;;
*-*) echo "ghc-devel($d)" ;;
*) ;;
esac
done
;;
*/libHS*_p.a)
pkgver=$(basename $(dirname $i))
ids=$($GHC_PKG field $pkgver $field | sed -e "s/ rts\b//" -e "s/bin-package-db-[^ ]\+//")
for d in $ids; do
case $d in
*-*-internal) ;;
*-*)
case $field in
id)
echo "ghc-prof($d)"
;;
*)
if [ -f /usr/lib*/ghc-*/*/libHS${d}_p.a -o -f $PKGBASEDIR/*/libHS${d}_p.a ]; then
echo "ghc-prof($d)"
fi
;;
esac
;;
esac
done
;;
esac
done

View File

@ -1,13 +0,0 @@
# OS specific settings
%_ghcdocdir %{_ghclicensedir}/%{name}
%_ghcdynlibdir %{_libdir}
%ghc_without_dynamic 1
# enable profiling libraries in prof subpkgs
%with_ghc_prof 1
# enable library documentation in doc subpkgs
%with_haddock 1

View File

@ -1,77 +0,0 @@
#!/bin/sh
# for testing updates to ghc-rpm-macros etc
# In a pkg dir run
# $ ./test-rebuild.sh
# or clone a pkg branch:
# $ ./test-rebuild.sh [pkg]
set -e
PKG=${1:-$(fedpkg gimmespec | sed -e "s/.spec//")}
[ -d "$PKG" -o -f "$PKG.spec" ] || fedpkg clone -a $PKG
[ -d "$PKG" ] && cd $PKG
ARCH=$(arch)
#if [ -d $ARCH ]; then
# echo Please move existing $ARCH/
# exit 1
#fi
if [ -f /etc/os-release ]; then
eval $(grep VERSION_ID /etc/os-release)
if git branch -a | grep -q f$VERSION_ID; then
BRANCH=f$VERSION_ID
else
case $VERSION_ID in
7.*) BRANCH=epel7 ;;
*) BRANCH=master ;;
esac
fi
else
# assume RHEL6
BRANCH=el6
fi
if [ "* $BRANCH" != "$(git branch | grep '^*')" ]; then
fedpkg switch-branch $BRANCH
fi
if [ "* $BRANCH" != "$(git branch | grep '^*')" ]; then
echo "Git branch does not match Fedora installation!"
exit 1
fi
git pull
if [ "$UID" != "0" ]; then
SUDO="sudo"
else
SUDO=""
fi
echo Running dnf builddep:
$SUDO dnf builddep $PKG.spec
fedpkg local
VERREL=$(fedpkg verrel | sed -e "s/^$PKG-//")
TMP=test-tmp
mkdir -p $TMP/
PKGS=$(cd $ARCH; rpm -qp $(ls *-$VERREL*.rpm))
for i in $PKGS; do
# FIXME: should check NVR is same before building
rpm -q --quiet $i || $SUDO dnf install -q $i
for k in list requires provides scripts; do
rpm -qp --$k $ARCH/$i.rpm | grep -v rpmlib > $TMP/$i.$k.test || :
rpm -q --$k $i | grep -v rpmlib > $TMP/$i.$k.installed || :
diff -u $TMP/$i.$k.installed $TMP/$i.$k.test -I /usr/lib/.build-id || :
done
done