handle hadrian lib/ subdir consistently for packages

- deprecate %ghclibplatform and introduce %ghcplatform
This commit is contained in:
Jens Petersen 2023-01-21 13:30:48 +08:00
parent dfacabb0d6
commit 8400579198
1 changed files with 24 additions and 13 deletions

View File

@ -30,11 +30,11 @@ export LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"\
if ! [ -f Setup.hs -o -f Setup.lhs ]; then\
cp %{_datadir}/ghc-rpm-macros/Setup.hs .\
fi\
%if %{with hadrian}\
subsubdir=lib/\
%endif\
if [ -d "%{ghclibdir}/lib" ]; then\
subsubdir=/lib\
fi\
%cabal --version\
%cabal configure %{!-W:%{?ghc_name:--with-compiler=%{_bindir}/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}} %{!?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
%cabal configure %{!-W:%{?ghc_name:--with-compiler=%{_bindir}/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}/'$pkgid'} %{!?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
# install
%cabal_install %cabal copy --destdir=%{buildroot} %{?cabal_install_options}
@ -76,16 +76,24 @@ subsubdir=lib/\
%_ghclicensedir %{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir}
# deprecated
%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 [-m] [name] [version]
%ghc_gen_filelists(m)\
%define pkgname %{?1}%{!?1:%{pkg_name}}\
%define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\
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 [ -z "$(ls %{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}\
@ -98,24 +106,24 @@ echo "%%license %{pkgnamever}/$i" >> %{basepkg}.files\
done\
fi\
%endif\
for i in %{buildroot}%{?_ghcdynlibdir}%{!?_ghcdynlibdir:%ghclibplatform%{!?with_hadrian:/%{pkgnamever}}}/libHS%{pkgnamever}-*ghc%{ghc_version}.so; do\
for i in %{buildroot}%{?_ghcdynlibdir}%{!?_ghcdynlibdir:%{ghcliblib}${subsubdir}%{?with_hadrian:/%{ghcplatform}}%{!?with_hadrian:/%{pkgnamever}}}/libHS%{pkgnamever}-*ghc%{ghc_version}.so; do\
if [ -x "$i" ]; then\
echo $i >> %{basepkg}.files\
else\
echo %{buildroot}%{?_ghcdynlibdir}%{!?_ghcdynlibdir:$pkgdir}/libHS%{pkgnamever}-*ghc%{ghc_version}.so not found\
echo $i: not found\
%if 0%{!-m:1}\
exit 1\
%endif\
fi\
done\
pkgdir="%{ghclibplatform}/%{pkgnamever}"\
pkgdir="%{ghcliblib}${subsubdir}%{?with_hadrian:/%{ghcplatform}}/%{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}%{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\
@ -144,13 +152,16 @@ done\
%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}/package.conf.d/${sub}.conf\
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}/package.conf.d/%{pkgnamever}.conf\
install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghcliblib}${subsubdir}/package.conf.d/%{pkgnamever}.conf\
fi\
%{nil}