diff --git a/SOURCES/ghc-deps.sh b/SOURCES/ghc-deps.sh index ee48af6..3435c7e 100755 --- a/SOURCES/ghc-deps.sh +++ b/SOURCES/ghc-deps.sh @@ -1,9 +1,9 @@ #!/bin/sh # find rpm provides and requires for Haskell GHC libraries -[ $# -lt 2 ] && echo "Usage: $(basename "$0") [--provides|--requires] %{buildroot} %{ghclibdir} [%{?ghc_version}]" && exit 1 +[ $# -lt 3 ] && echo "Usage: $(basename "$0") [--provides|--requires] %{buildroot} %{ghclibdir} [ghc-]" && exit 1 -set +x +set +x -e MODE=$1 BUILDROOT=$2 @@ -35,7 +35,7 @@ for i in $files; do case $i in # exclude rts.conf $BUILDROOT$PKGCONFDIR/*-*.conf) - name=$(grep "^name: " "$i" | sed -e "s/name: //") + name=$(grep "^name: " "$i" | sed -e "s/name: *//") ids=$($GHC_PKG field "$name" "$field" | sed -e "s/\(^\| \)rts\( \|$\)/ /") for d in $ids; do case $d in @@ -45,9 +45,22 @@ for i in $files; do esac done ;; - */libHS*_p.a) - pkgver=$(basename "$(dirname "$i")") - ids=$($GHC_PKG field "$pkgver" "$field" | sed -e "s/\(^\| \)rts\( \|$\)/ /" -e "s/bin-package-db-[^ ]\+//") + $BUILDROOT$PKGBASELIB/*/libHS*_p.a) + pkgverhash=$(basename "$(dirname "$i")") + case $i in + $BUILDROOT$PKGBASELIB/*-linux-ghc-9.8.*) + pkgver=$(echo $pkgverhash | sed -e "s/\(.*\)-.*/\\1/") + ;; + *) pkgver=$pkgverhash + ;; + esac + if [ -e "$BUILDROOT$PKGCONFDIR/$pkgverhash.conf" ]; then + ids=$($GHC_PKG field "$pkgver" "$field" | sed -e "s/\(^\| \)rts\( \|$\)/ /" -e "s/bin-package-db-[^ ]\+//") + else + conf=$(basename "$i" | sed -e "s%libHS%$BUILDROOT$PKGCONFDIR/%" -e 's%_p.a%.conf%') + name=$(grep "^name: " "$conf" | sed -e "s/name: *//") + ids=$($GHC_PKG field "$name" "$field" | sed -e "s/\(^\| \)rts\( \|$\)/ /" -e "s/bin-package-db-[^ ]\+//") + fi for d in $ids; do case $d in *-*-internal) ;; @@ -57,9 +70,12 @@ for i in $files; do echo "$GHCPREFIX-prof($d)" ;; *) - if [ -f "$PKGBASELIB"/*/libHS"${d}"_p.a ] || [ -f "$BUILDROOT$PKGBASELIB"/*/libHS"${d}"_p.a ]; then - echo "$GHCPREFIX-prof($d)" - fi + for f in "$PKGBASELIB"/*/libHS"${d}"_p.a "$BUILDROOT$PKGBASELIB"/*/libHS"${d}"_p.a "$PKGBASELIB"/*/*/libHS"${d}"_p.a "$BUILDROOT$PKGBASELIB"/*/*/libHS"${d}"_p.a; do + if [ -f "$f" ]; then + echo "$GHCPREFIX-prof($d)" + break + fi + done ;; esac ;; diff --git a/SOURCES/ghc-info.sh b/SOURCES/ghc-info.sh new file mode 100755 index 0000000..598faa2 --- /dev/null +++ b/SOURCES/ghc-info.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +[ $# -lt 1 ] && echo "Usage: $(basename "$0") GHCVERSION INFOFIELD" && exit 1 + +GHCVER="$1" +FIELD="$2" + +if [ -z "$FIELD" ]; then + /usr/bin/ghc-${GHCVER} --info | sed -e 's/.*(\(".*"\),\(".*"\).*/\1: \2/' -e '/]/d' +else + /usr/bin/ghc-${GHCVER} --info | grep \""$FIELD"\" | sed -e 's/.*","\(.*\)")/\1/' +fi diff --git a/SOURCES/ghc-pkg-wrapper b/SOURCES/ghc-pkg-wrapper index 98566a8..f9c2332 100755 --- a/SOURCES/ghc-pkg-wrapper +++ b/SOURCES/ghc-pkg-wrapper @@ -1,11 +1,12 @@ #!/bin/sh -[ $# -lt 1 ] && echo "Usage: `basename $0` %{buildroot}%{ghclibdir} ..." && exit 1 +[ $# -lt 1 ] && echo "Usage: $(basename $0) %{buildroot}%{ghclibdir} ..." && exit 1 -set +x +set +x -e PKGBASEDIR=$1 shift + if [ -d $PKGBASEDIR/lib ]; then PKGCONFDIR=$PKGBASEDIR/lib/package.conf.d else PKGCONFDIR=$PKGBASEDIR/package.conf.d diff --git a/SOURCES/ghc.attr b/SOURCES/ghc.attr index 560c331..55b7308 100644 --- a/SOURCES/ghc.attr +++ b/SOURCES/ghc.attr @@ -1,3 +1,3 @@ %__ghc_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot} %{ghclibdir} %{?ghc_name:ghc-%{ghc_version}} %__ghc_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot} %{ghclibdir} %{?ghc_name:ghc-%{ghc_version}} -%__ghc_path ^(%{ghcliblib}/package.conf.d/.*\.conf|%{ghclibplatform}/.*/libHS.*_p\.a)$ +%__ghc_path ^(%{ghcliblib}/(lib/)?package.conf.d/.*\.conf|%{ghclibplatform}/.*/libHS.*\_p.a)$ diff --git a/SOURCES/macros.ghc b/SOURCES/macros.ghc index 77d226b..767dbab 100644 --- a/SOURCES/macros.ghc +++ b/SOURCES/macros.ghc @@ -7,41 +7,109 @@ LANG=C.utf8\ ./Setup # compiler version -%ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override} +%ghc_version %{?ghc_version_override}%{!?ghc_version_override:%(rpm -q --qf %%{version} %{?ghc_name}%{!?ghc_name:ghc}-compiler)} +%ghc_major_version %(echo %{ghc_version} | sed -e "s/\\(.*\\)\\.[0-9]\\+/\\1/") + +# ghc_bin_build: -W: use default ghc (ie ignore ghc_name) +%ghc_bin_build(W)\ +%ghc_fix_doc_perms\ +%{?!ghc_debuginfo:%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\ +%{?!ghc_debuginfo:%global debug_package %{nil}}\ +%if 0%{?rhel} && 0%{?rhel} < 8\ +licensedirversion=%{?2:-%2}\ +%endif\ +%cabal_configure %{?with_ghc_prof:--enable-library-profiling} %{!?ghc_without_shared:--enable-shared} %{?ghc_without_shared:--disable-shared} %{!?1:%{?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}\ +%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}\ +fi\ +%endif\ +%{nil} + +# install bin package +%ghc_bin_install()\ +%cabal_install\ +%ghc_delete_rpaths\ +%{nil} + +# ghc_lib_install [name] [version] +%ghc_lib_install(m)\ +%cabal_install\ +%cabal_pkg_conf %{?1} %{?2}\ +%ghc_gen_filelists %{-m} %{?1} %{?2}\ +%ghc_delete_rpaths\ +%{nil} + +# create and install package.conf file +# cabal_pkg_conf [name] [version] +%cabal_pkg_conf()\ +%define pkgname %{?1}%{!?1:%{pkg_name}}\ +%define pkgver %{?2}%{!?2:%{version}}\ +%define pkgnamever %{pkgname}-%{pkgver}\ +%cabal register --gen-pkg-config\ +if [ -d "%{ghclibdir}/lib" ]; then\ +subsubdir=/lib\ +fi\ +if [ -d %{pkgnamever}.conf ]; then\ +for i in $(ls "%{pkgnamever}.conf/"); do\ +sub=$(echo $i | sed -e "s/^[0-9]\\+-//")\ +install -D --mode=0644 %{pkgnamever}.conf/${i} %{buildroot}%{ghcliblib}${subsubdir}/package.conf.d/${sub}.conf\ +done\ +else\ +install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghcliblib}${subsubdir}/package.conf.d/%{pkgnamever}.conf\ +fi\ +%{nil} %ghc_set_gcc_flags\ %global _lto_cflags %{nil}\ %global __brp_strip_lto %{nil}\ -# -Wunused-label is extremely noisy\ %ifarch s390x\ +%if %[v"%{ghc_version}" < v"9.2"]\ +# -Wunused-label is extremely noisy\ CFLAGS="$(echo ${CFLAGS:-%optflags} | sed -e 's/-Wall //' -e 's/-Werror=format-security //')"\ -%else\ -CFLAGS="${CFLAGS:-%optflags}"\ %endif\ -export CFLAGS\ +%endif\ %undefine _package_note_flags\ %global _hardened_ldflags %{nil}\ -export LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"\ %{nil} # configure %cabal_configure\ +%define pkgname %{?1}%{!?1:%{pkg_name}}\ +%define pkgver %{?2}%{!?2:%{version}}\ +%define pkgnamever %{pkgname}-%{pkgver}\ +echo -e "\\n==== Build %{pkgnamever} ===="\ %ghc_set_gcc_flags\ if ! [ -f Setup.hs -o -f Setup.lhs ]; then\ -cp %{_datadir}/ghc-rpm-macros/Setup.hs .\ +# datadir hardcoded for flatpaks\ +cp /usr/share/ghc-rpm-macros/Setup.hs .\ fi\ -%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')} -fhide-source-paths" %{?cabal_configure_options} $cabal_configure_extra_options +if [ -d "%{ghclibdir}/lib" ]; then\ +subsubdir=/lib\ +fi\ +# bindir hardcoded for flatpaks\ +%cabal configure %{!-W:%{?ghc_name:--with-compiler=/usr/bin/ghc-%{ghc_version}}} --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_ghcdocdir} --libsubdir='$compiler'${subsubdir}/'$pkgid' --datasubdir='$pkgid' --libexecsubdir='$pkgid' --ghc --dynlibdir=%{?_ghcdynlibdir}%{?!_ghcdynlibdir:%{_libdir}/ghc-%{ghc_version}${subsubdir}} %{!?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')} -fhide-source-paths" %{?flatpak:--extra-lib-dirs=%{_libdir}} %{?cabal_configure_options} $cabal_configure_extra_options # install %cabal_install %cabal copy --destdir=%{buildroot} %{?cabal_install_options} # tests -%cabal_test\ -%if %{with tests}\ -%cabal test %{?cabal_test_options}\ -%endif +%cabal_test %cabal test %{?cabal_test_options} # no _pkgdocdir in EPEL <= 7 %ghc_pkgdocdir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} @@ -74,19 +142,26 @@ fi\ %_ghclicensedir %{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir} +%ghclibplatform %{ghcliblib}%{?with_hadrian:/%{ghcplatform}} + # Cabal has specific arch names -%ghclibplatform %{ghcliblib}%{?with_hadrian:/%(echo %{_arch} | sed -e "s/ppc64le/ppc64/")-linux-ghc-%{ghc_version}} +%ghcplatform %(echo %{_arch} | sed -e "s/ppc64le/ppc64/")-linux-ghc-%{ghc_version} -# ghc_gen_filelists [name] [version] -%ghc_gen_filelists()\ +# ghc_gen_filelists [-m] [name] [version] +%ghc_gen_filelists(m)\ %define pkgname %{?1}%{!?1:%{pkg_name}}\ %define pkgver %{?2}%{!?2:%{version}}\ %define pkgnamever %{pkgname}-%{pkgver}\ -%define basepkg %{ghc_prefix}-%{pkgname}\ -if [ -z "$(ls %{buildroot}%{ghcliblib}/package.conf.d/%{pkgnamever}*.conf)" ]; then\ -echo '%{buildroot}%{ghcliblib}/package.conf.d/%{pkgnamever}*.conf not found'\ +%if %{without hadrian}\ +if [ -d "%{ghclibdir}/lib" ]; then\ +subsubdir=/lib\ +fi\ +%endif\ +if [ ! -f %{buildroot}%{ghcliblib}${subsubdir}/package.conf.d/%{pkgnamever}*.conf ]; then\ +echo "%{buildroot}%{ghcliblib}${subsubdir}/package.conf.d/%{pkgnamever}*.conf not found"\ exit 1\ fi\ +%define basepkg %{ghc_prefix}-%{pkgname}\ rm -f %{basepkg}.files %{basepkg}-doc.files\ touch %{basepkg}.files %{basepkg}-doc.files\ %if 0%{?1:1}\ @@ -96,21 +171,29 @@ echo "%%license %{pkgnamever}/$i" >> %{basepkg}.files\ done\ fi\ %endif\ -for i in %{buildroot}%{?_ghcdynlibdir}%{!?_ghcdynlibdir:%{ghclibplatform}}/libHS%{pkgnamever}-*ghc%{ghc_version}.so; do\ +for i in %{buildroot}%{?_ghcdynlibdir}%{!?_ghcdynlibdir:%{ghcliblib}${subsubdir}%{?with_hadrian:/%{ghcplatform}}%{!?with_hadrian:%{?base_ver:/%{pkgnamever}}}}/libHS%{pkgnamever}-*ghc%{ghc_version}.so; do\ if [ -x "$i" ]; then\ echo $i >> %{basepkg}.files\ else\ -echo 'Warning: %{buildroot}%{?_ghcdynlibdir}%{!?_ghcdynlibdir:%{ghclibplatform}}/libHS%{pkgnamever}-*ghc%{ghc_version}.so not found'\ +echo "$i: not found"\ +%if 0%{!-m:1}\ +exit 1\ +%endif\ fi\ done\ -pkgdir="%{ghclibplatform}/%{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\ +pkgdir="%{buildroot}%{ghcliblib}${subsubdir}%{?with_hadrian:/%{ghcplatform}}/%{pkgnamever}"\ +%if %[v"%{ghc_version}" > v"9.8"]\ +if [ ! -d ${pkgdir} ]; then\ +pkgdir="${pkgdir}-*"\ +fi\ +%endif\ +if [ -d ${pkgdir} ]; then\ +find ${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}%{ghcliblib}/package.conf.d/%{pkgnamever}*.conf >> %{basepkg}-devel.files\ +ls %{buildroot}%{ghcliblib}${subsubdir}/package.conf.d/%{pkgnamever}*.conf >> %{basepkg}-devel.files\ %if %{with haddock}\ haddock_dir=%{ghc_html_libraries_dir}/%{pkgnamever}\ if [ -d %{buildroot}$haddock_dir ]; then\ @@ -132,20 +215,19 @@ fi\ done\ %{nil} -# create and install package.conf file -# cabal_pkg_conf [name] [version] -%cabal_pkg_conf()\ -%define pkgname %{?1}%{!?1:%{pkg_name}}\ -%define pkgver %{?2}%{!?2:%{version}}\ -%define pkgnamever %{pkgname}-%{pkgver}\ -%cabal register --gen-pkg-config\ -if [ -d %{pkgnamever}.conf ]; then\ -for i in $(ls "%{pkgnamever}.conf/"); do\ -sub=$(echo $i | sed -e "s/^[0-9]\\+-//")\ -install -D --mode=0644 %{pkgnamever}.conf/${i} %{buildroot}%{ghcliblib}/package.conf.d/${sub}.conf\ -done\ -else\ -install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghcliblib}/package.conf.d/%{pkgnamever}.conf\ +# from ghc.spec merge_filelist +%ghc_merge_filelist()\ +cat %{name}-%1.files >> %{name}-%2.files\ +cat %{name}-%1-devel.files >> %{name}-%2-devel.files\ +%if %{with haddock}\ +cat %{name}-%1-doc.files >> %{name}-%2-doc.files\ +%endif\ +%if %{with ghc_prof}\ +cat %{name}-%1-prof.files >> %{name}-%2-prof.files\ +%endif\ +if [ "%1" != "rts" ]; then\ +cp -p libraries/%1/LICENSE libraries/LICENSE.%1\ +echo "%%license libraries/LICENSE.%1" >> %{name}-%2.files\ fi\ %{nil} @@ -156,62 +238,23 @@ if [ -f $f -a -x $f ]; then chmod a-x $f; fi\ done\ %{nil} -# ghc_bin_build -%ghc_bin_build\ -%ghc_fix_doc_perms\ -%{?!ghc_debuginfo:%undefine _enable_debug_packages}\ -%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\ -%{?!ghc_debuginfo:%undefine _enable_debug_packages}\ -%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 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}\ -%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}\ -fi\ -%endif\ -%{nil} - -# install bin package -%ghc_bin_install()\ -%cabal_install\ -%ghc_delete_rpaths\ -%{nil} - -# ghc_lib_install [name] [version] -%ghc_lib_install()\ -%cabal_install\ -%cabal_pkg_conf %{?1} %{?2}\ -%ghc_gen_filelists %{?1} %{?2}\ -%ghc_delete_rpaths\ -%{nil} - # ghc_delete_rpaths %ghc_delete_rpaths\ %if %{undefined disable_ghc_delete_rpaths}\ -echo "running ghc_delete_rpaths:"\ +echo "deleting rpaths:"\ if ! type chrpath > /dev/null; then exit 1; fi\ for i in $(find %{buildroot} -type f -executable -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print); do\ - if [ -x "$i" ]; then\ - chrpath -d $i\ - else\ - echo "%%ghc_delete_rpath: no $i executable"\ - exit 1\ - fi\ +%if %{defined _ghcdynlibdir}\ + chrpath -d $i\ +%else\ + rpath=$(chrpath $i | sed -e "s@^$i: R.*PATH=@@")\ + case "$rpath" in\ + *$PWD/*) chrpath -r "%{ghclibdir}/lib:%{ghclibdir}/lib/%{ghcplatform}" $i ;;\ + *:%{_libdir}) chrpath -r $(echo "$rpath" | sed -e 's!:%{_libdir}$!!') $i ;;\ + %{_libdir}:*) chrpath -r $(echo "$rpath" | sed -e 's!^%{_libdir}:!!') $i ;;\ + *) ;;\ + esac\ +%endif\ done\ %endif @@ -219,7 +262,7 @@ done\ %ghc_fix_rpath()\ %if %{undefined disable_ghc_fix_rpath}\ if ! type chrpath > /dev/null; then exit 1; fi\ -echo "ghc_fix_rpath %*"\ +echo "%0 %*"\ for i in $(find %{buildroot} -type f -executable -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print); do\ for lib in %*; do\ if [ -x "$i" ]; then\ @@ -248,14 +291,15 @@ for lib in %*; do\ ;;\ esac\ else\ - echo "%%ghc_fix_rpath: no $i executable"\ + echo "%0: no $i executable"\ exit 1\ fi\ done\ done\ %endif -%ghc_pkg_recache %{_bindir}/ghc-pkg-%{ghc_version} recache --no-user-package-db || : +# bindir hardcoded for flatpaks +%ghc_pkg_recache /usr/bin/ghc-pkg-%{ghc_version} recache --no-user-package-db || : # skip prof libs and documentation %ghc_quick_build\ diff --git a/SOURCES/macros.ghc-extra b/SOURCES/macros.ghc-extra index ae447d7..33dd305 100644 --- a/SOURCES/macros.ghc-extra +++ b/SOURCES/macros.ghc-extra @@ -22,6 +22,7 @@ Summary: Haskell %{pkgname} library\ %{-l:License: %{-l*}}\ Url: https://hackage.haskell.org/package/%{pkgname}\ %{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(%{ghc_prefix}-[^, ]*\\)-devel/\\1/g")}\ +%{?ghc_obsoletes_name:Obsoletes: %{ghc_obsoletes_name}-%{pkgname} < %{pkgver}-%{release}}\ \ %description -n %{basepkg}\ This package provides the Haskell %{pkgname} library.\ @@ -39,6 +40,7 @@ Requires: %{ghc_prefix}-%{pkgname}%{?_isa} = %{pkgver}-%{release}\ %endif\ %{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}\ %{-c:Requires: %{-c*}}\ +%{?ghc_obsoletes_name:Obsoletes: %{ghc_obsoletes_name}-%{pkgname}-devel < %{pkgver}-%{release}}\ %{?ghc_pkg_obsoletes:Obsoletes: %{ghc_pkg_obsoletes}}\ \ %description -n %{basepkg}-devel\ @@ -52,6 +54,7 @@ Summary: Haskell %{pkgname} library documentation\ %{-l:License: %{-l*}}\ BuildArch: noarch\ Requires: %{ghc_prefix}-filesystem\ +%{?ghc_obsoletes_name:Obsoletes: %{ghc_obsoletes_name}-%{pkgname}-doc < %{pkgver}-%{release}}\ Supplements: (%{basepkg}-devel and %{ghc_prefix}-doc)\ \ %description -n %{basepkg}-doc\ @@ -64,6 +67,7 @@ Summary: Haskell %{pkgname} profiling library\ %{?1:Version: %{pkgver}}\ %{-l:License: %{-l*}}\ Requires: %{ghc_prefix}-%{pkgname}-devel%{?_isa} = %{pkgver}-%{release}\ +%{?ghc_obsoletes_name:Obsoletes: %{ghc_obsoletes_name}-%{pkgname}-prof < %{pkgver}-%{release}}\ Supplements: (%{basepkg}-devel and %{ghc_prefix}-prof)\ \ %description -n %{basepkg}-prof\ @@ -119,3 +123,19 @@ ver=$(echo $i | sed -e "s/.*-\\(.*\\)/\\1/")\ cd ..\ done\ %{nil} + +# ghc_merge_filelist lib base +%ghc_merge_filelist()\ +cat %{name}-%1.files >> %{name}-%2.files\ +cat %{name}-%1-devel.files >> %{name}-%2-devel.files\ +%if %{with haddock}\ +cat %{name}-%1-doc.files >> %{name}-%2-doc.files\ +%endif\ +%if %{with ghc_prof}\ +cat %{name}-%1-prof.files >> %{name}-%2-prof.files\ +%endif\ +if [ "%1" != "rts" ]; then\ +cp -p libraries/%1/LICENSE libraries/LICENSE.%1\ +echo "%%license libraries/LICENSE.%1" >> %{name}-%2.files\ +fi\ +%{nil} diff --git a/SOURCES/macros.ghc-os b/SOURCES/macros.ghc-os index 246a916..9956a2c 100644 --- a/SOURCES/macros.ghc-os +++ b/SOURCES/macros.ghc-os @@ -2,12 +2,13 @@ %_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 +# enable library documentation in doc subpkgs (deprecated) %with_haddock 1 + +%ghc_haddocks\ +%bcond haddock 1 + +# %%{?_smp_ncpus_max:--jobs=%%{?_smp_ncpus_max}} +%ghc_smp_mflags %{?_smp_mflags} diff --git a/SOURCES/macros.ghc-srpm-quick b/SOURCES/macros.ghc-srpm-quick new file mode 100644 index 0000000..623fb26 --- /dev/null +++ b/SOURCES/macros.ghc-srpm-quick @@ -0,0 +1,6 @@ +# disable profiling libraries and prof subpkgs +%ghc_profiling\ +%bcond ghc_prof 0 + +%ghc_haddocks\ +%bcond haddock 0 diff --git a/SPECS/ghc-rpm-macros.spec b/SPECS/ghc-rpm-macros.spec index b47db98..ed61480 100644 --- a/SPECS/ghc-rpm-macros.spec +++ b/SPECS/ghc-rpm-macros.spec @@ -7,11 +7,11 @@ %endif Name: ghc-rpm-macros -Version: 2.4.4 +Version: 2.7.2 Release: 1%{?dist} Summary: RPM macros for building Haskell packages for GHC -License: GPLv3+ +License: GPL-3.0-or-later # Currently source is only in pkg git but tarballs could be made if it helps URL: https://src.fedoraproject.org/rpms/ghc-rpm-macros/ Source0: macros.ghc @@ -27,6 +27,8 @@ Source9: macros.ghc-os Source10: Setup.hs Source11: cabal-tweak-drop-dep Source12: cabal-tweak-remove-upperbound +Source13: ghc-info.sh +Source14: macros.ghc-srpm-quick Requires: redhat-rpm-config # ghc_version needs ghc-compiler or ghcX.Y-compiler-default Requires: chrpath @@ -46,6 +48,20 @@ Extra macros used for subpackaging of Haskell libraries, for example in ghc and haskell-platform. +%package quick +Summary: Disables building of ghc prof and doc subpackages +Requires: %{name} = %{version}-%{release} +# added during F40 cycle +Obsoletes: %{name}-no-prof < %{version}-%{release} +Provides: %{name}-no-prof = %{version}-%{release} + +%description quick +Overrides ghc-srpm-macros to disable building ghc prof and doc subpackages +locally. + +This should not be used in official Fedora builds. + + %if 0%{?fedora} < 37 %package -n ghc-filesystem Summary: Shared directories for Haskell documentation @@ -60,34 +76,10 @@ Haskell libraries documentation. # 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} >= 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 -# 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-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 +Obsoletes: ghc-iwlib < 0.1.0-16, ghc-iwlib-devel < 0.1.0-16, ghc-iwlib-prof < 0.1.0-16 %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, @@ -95,7 +87,6 @@ Obsoletes: ghc-EdisonAPI < 1.3.1-23, ghc-EdisonAPI-devel < 1.3.1-23, ghc-Ed 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 %if 0%{?fedora} >= 35 Obsoletes: pandoc-citeproc < 0.18, ghc-pandoc-citeproc < 0.18, ghc-pandoc-citeproc-devel < 0.18, ghc-pandoc-citeproc-doc < 0.18, ghc-pandoc-citeproc-prof < 0.18, pandoc-citeproc-common < 0.18 Obsoletes: ghc-base-noprelude < 4.13.0.1, ghc-base-noprelude-devel < 4.13.0.1, ghc-base-noprelude-doc < 4.13.0.1, ghc-base-noprelude-prof < 4.13.0.1 @@ -106,6 +97,26 @@ Obsoletes: ghc-cpio-conduit < 0.7.1, ghc-cpio-conduit-devel < 0.7.1, ghc-cp Obsoletes: ghc-failure < 0.2.0.4, ghc-failure-devel < 0.2.0.4, ghc-failure-doc < 0.2.0.4, ghc-failure-prof < 0.2.0.4 Obsoletes: ghc-attempt < 0.4.0.2, ghc-attempt-devel < 0.4.0.2, ghc-attempt-doc < 0.4.0.2, ghc-attempt-prof < 0.4.0.2 %endif +%if 0%{?fedora} >= 36 +Obsoletes: ghc-regex-applicative-text < 0.1.0.1-16, ghc-regex-applicative-text-devel < 0.1.0.1-16, ghc-regex-applicative-text-doc < 0.1.0.1-16, ghc-regex-applicative-text-prof < 0.1.0.1-16 +%endif +%if 0%{?fedora} >= 38 +Obsoletes: ghc-bytestring-show < 0.3.5.7, ghc-bytestring-show-devel < 0.3.5.7, ghc-bytestring-show-doc < 0.3.5.7, ghc-bytestring-show-prof < 0.3.5.7 +Obsoletes: ghc-djinn-ghc < 0.1, ghc-djinn-ghc-devel < 0.1, ghc-djinn-ghc-doc < 0.1, ghc-djinn-ghc-prof < 0.1 +Obsoletes: ghc-ghc-mtl < 1.2.2, ghc-ghc-mtl-devel < 1.2.2, ghc-ghc-mtl-doc < 1.2.2, ghc-ghc-mtl-prof < 1.2.2 +Obsoletes: ghc-ghc-syb-utils < 0.3.1, ghc-ghc-syb-utils-devel < 0.3.1, ghc-ghc-syb-utils-doc < 0.3.1, ghc-ghc-syb-utils-prof < 0.3.1 +Obsoletes: ghc-cabal-helper < 1.2, ghc-cabal-helper-devel < 1.2, ghc-cabal-helper-doc < 1.2, ghc-cabal-helper-prof < 1.2 +Obsoletes: ghc-cabal-plan < 0.8, ghc-cabal-plan-devel < 0.8, ghc-cabal-plan-doc < 0.8, ghc-cabal-plan-prof < 0.8 +Obsoletes: ghc-optics-core < 0.4, ghc-optics-core-devel < 0.4, ghc-optics-core-doc < 0.4, ghc-optics-core-prof < 0.4 +Obsoletes: ghc-semialign < 1.2, ghc-semialign-devel < 1.2, ghc-semialign-doc < 1.2, ghc-semialign-prof < 1.2 +Obsoletes: ghc-topograph < 1.0.0.2, ghc-topograph-devel < 1.0.0.2, ghc-topograph-doc < 1.0.0.2, ghc-topograph-prof < 1.0.0.2 +Obsoletes: ghc-indexed-profunctors < 0.1.1-18, ghc-indexed-profunctors-devel < 0.1.1-18, ghc-indexed-profunctors-doc < 0.1.1-18, ghc-indexed-profunctors-prof < 0.1.1-18 +Obsoletes: ghc-regex-compat-tdfa < 0.95.1.4-38, ghc-regex-compat-tdfa-devel < 0.95.1.4-38, ghc-regex-compat-tdfa-doc < 0.95.1.4-38, ghc-regex-compat-tdfa-prof < 0.95.1.4-38 +%endif +%if 0%{?fedora} >= 39 +Obsoletes: ghc-geniplate-mirror < 0.7.9-39, ghc-geniplate-mirror-devel < 0.95.1.4-38, ghc-geniplate-mirror-doc < 0.95.1.4-38, ghc-geniplate-mirror-prof < 0.95.1.4-38 +Obsoletes: ghc-data-array-byte < 0.1.0.1-3, ghc-data-array-byte-devel < 0.1.0.1-3, ghc-data-array-byte-doc < 0.1.0.1-3, ghc-data-array-byte-prof < 0.1.0.1-3 +%endif %description -n ghc-obsoletes Meta package for obsoleting deprecated Haskell packages. @@ -126,8 +137,14 @@ echo no build stage 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 0644 %{SOURCE9} %{buildroot}%{macros_dir}/macros.ghc-os +install -p -D -m 0644 %{SOURCE14} %{buildroot}%{macros_dir}/macros.ghc-srpm-quick + +%if 0%{?fedora} < 38 +echo -e "\n%%_ghcdynlibdir %%{_libdir}" >> %{buildroot}%{macros_dir}/macros.ghc-os +%endif install -p -D -m 0755 %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/ghc-deps.sh +install -p -D -m 0755 %{SOURCE13} %{buildroot}%{_prefix}/lib/rpm/ghc-info.sh %if 0%{?fedora} || 0%{?rhel} >= 7 install -p -D -m 0644 %{SOURCE7} %{buildroot}%{_prefix}/lib/rpm/fileattrs/ghc.attr @@ -145,13 +162,6 @@ install -p -D -m 0755 %{SOURCE8} %{buildroot}%{_prefix}/lib/rpm/ghc-pkg-wrapper mkdir -p %{buildroot}%{_docdir}/ghc/html/libraries %endif -%if 0%{?rhel} && 0%{?rhel} < 7 -cat >> %{buildroot}%{_prefix}/lib/rpm/ghc-deps.sh <= 29 +%if 0%{?fedora} %files -n ghc-obsoletes %endif %changelog -* Fri Aug 18 2023 Alexey Lyubimov - 2.4.4-1 +* Mon Jul 29 2024 Jens Petersen - 2.7.2-1 +- improve ghc_delete_rpaths to delete trailing :_libdir +- extra: add ghc_merge_filelist from ghc.spec + +* Thu Jul 18 2024 Fedora Release Engineering - 2.7.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Sat Jun 15 2024 Jens Petersen - 2.7.1-1 +- build macros now undefine debug_package rather than _enable_debug_packages + +* Mon Mar 18 2024 Jens Petersen - 2.7.0-1 +- rename no-prof subpackage to quick +- quick: add ghc_haddocks override + +* Thu Feb 29 2024 Jens Petersen - 2.6.8-1 +- fixup cabal_configure: when subpackaging print subpackage header +- ghc_set_gcc_flags: no need to redefine/re-export CFLAGS and LDFLAGS +- cabal_configure: drop cabal --version +- os: define ghc_haddocks for haskell_setup +- no-prof: add a ghc_profiling override + +* Tue Feb 27 2024 Jens Petersen - 2.6.7-1 +- fix no-prof subpackage to undefine with_ghc_prof properly +- cabal_configure: when subpackaging print subpackage header +- cabal_configure: use --enable-library-profiling instead of -p + +* Mon Feb 19 2024 Jens Petersen - 2.6.6-1 +- new no-prof subpackage to disable building prof subpackages locally +- cabal_test: drop conditional since it is in cabal-rpm + +* Wed Jan 24 2024 Fedora Release Engineering - 2.6.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Fri Jan 19 2024 Fedora Release Engineering - 2.6.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Nov 12 2023 Jens Petersen - 2.6.5-1 +- ghc-deps.sh: ghc-9.8 prof fixes adapted from mimi1vx (opensuse) +- improve ghc-info.sh with a show mode + +* Thu Nov 9 2023 Jens Petersen - 2.6.4-1 +- fix my flatpak comments + +* Mon Oct 30 2023 Yaakov Selkowitz - 2.6.3-1 +- Fix flatpak builds + +* Tue Oct 24 2023 Jens Petersen - 2.6.1-1 +- ghc_gen_filelists: tweak pkgdir for ghc-9.8 short hash suffices + +* Mon Sep 18 2023 Jens Petersen - 2.6.0-1 +- add ghc-info.sh to read fields from ghc --info + +* Mon Sep 18 2023 Jens Petersen - 2.5.3-2 +- obsolete ghc-data-array-byte +- migrate to SPDX license tag + +* Fri Aug 18 2023 Alexey Lyubimov - 2.5.3-1 - Rebuilt for MSVSphere 9.2 +* Fri Aug 4 2023 Jens Petersen - 2.5.3-1 +- ghc-deps.sh: correctly map internal library id to internal package .conf +- tweak cabal_configure to only set --htmldir once for subpackaging +- add ghc_major_version +- F39: obsolete geniplate-mirror + +* Wed Jul 19 2023 Fedora Release Engineering - 2.5.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Mon Mar 27 2023 Jens Petersen - 2.5.2-3 +- f38: also obsolete regex-compat-tdfa + +* Sun Mar 26 2023 Jens Petersen - 2.5.2-2 +- add obsoletes for F38 + +* Wed Feb 15 2023 Jens Petersen - 2.5.2-1 +- ghc-dep.sh: check for *_p.a under Hadrian platform subdir as well +- ghc.attr: include Hadrian lib/ subdir in .conf regex + +* Sat Feb 11 2023 Jens Petersen - 2.5.1-1 +- add ghc_merge_filelist + +* Sun Jan 29 2023 Jens Petersen - 2.5.0-1 +- define ghc_smp_mflags to speed up package builds +- ghc_configure and ghc_version now respect ghc_name for ghcX.Y (via rpmquery) +- base ghc_version on compiler subpackage +- ghc_gen_filelists: error if no .so file and not -m metapkg +- use ghc upstream paths for libHS*.so unless using _ghcdynlibdir +- F38: disable _ghcdynlibdir as default +- ghc_bin_build -W to ignore ghc_name version in cabal_configure +- ghc_lib_subpackage: with ghc_obsoletes_name obsolete ghc{ghc_major}-* +- handle hadrian lib/ subdir consistently for packages +- move with_ghc_prof to ghc-srpm-macros +- cabal_configure: non-core shared libs go to ghcliblib +- ghc_delete_rpaths: need to remove local RPATH for subpackaged libs + +* Sat Aug 6 2022 Jens Petersen - 2.4.4-2 +- F36 obsoletes regex-applicative-text + * Tue Jul 26 2022 Jens Petersen - 2.4.4-1 - ghc_gen_filelists: check pkg licensedir exists - in 9.4.1 Hadrian html docdirs are versioned again (breaks older Hadrian)