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

View File

@ -30,11 +30,11 @@ export LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"\
if ! [ -f Setup.hs -o -f Setup.lhs ]; then\ if ! [ -f Setup.hs -o -f Setup.lhs ]; then\
cp %{_datadir}/ghc-rpm-macros/Setup.hs .\ cp %{_datadir}/ghc-rpm-macros/Setup.hs .\
fi\ fi\
%if %{with hadrian}\ if [ -d "%{ghclibdir}/lib" ]; then\
subsubdir=lib/\ subsubdir=/lib\
%endif\ fi\
%cabal --version\ %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 # install
%cabal_install %cabal copy --destdir=%{buildroot} %{?cabal_install_options} %cabal_install %cabal copy --destdir=%{buildroot} %{?cabal_install_options}
@ -76,16 +76,24 @@ subsubdir=lib/\
%_ghclicensedir %{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir} %_ghclicensedir %{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir}
# deprecated
%ghclibplatform %{ghcliblib}%{?with_hadrian:/%{ghcplatform}}
# Cabal has specific arch names # 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] [name] [version]
%ghc_gen_filelists(m)\ %ghc_gen_filelists(m)\
%define pkgname %{?1}%{!?1:%{pkg_name}}\ %define pkgname %{?1}%{!?1:%{pkg_name}}\
%define pkgver %{?2}%{!?2:%{version}}\ %define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\ %define pkgnamever %{pkgname}-%{pkgver}\
if [ -z "$(ls %{buildroot}%{ghcliblib}/package.conf.d/%{pkgnamever}*.conf)" ]; then\ %if %{without hadrian}\
echo "%{buildroot}%{ghcliblib}/package.conf.d/%{pkgnamever}*.conf not found"\ 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\ exit 1\
fi\ fi\
%define basepkg %{ghc_prefix}-%{pkgname}\ %define basepkg %{ghc_prefix}-%{pkgname}\
@ -98,24 +106,24 @@ echo "%%license %{pkgnamever}/$i" >> %{basepkg}.files\
done\ done\
fi\ fi\
%endif\ %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\ if [ -x "$i" ]; then\
echo $i >> %{basepkg}.files\ echo $i >> %{basepkg}.files\
else\ else\
echo %{buildroot}%{?_ghcdynlibdir}%{!?_ghcdynlibdir:$pkgdir}/libHS%{pkgnamever}-*ghc%{ghc_version}.so not found\ echo $i: not found\
%if 0%{!-m:1}\ %if 0%{!-m:1}\
exit 1\ exit 1\
%endif\ %endif\
fi\ fi\
done\ done\
pkgdir="%{ghclibplatform}/%{pkgnamever}"\ pkgdir="%{ghcliblib}${subsubdir}%{?with_hadrian:/%{ghcplatform}}/%{pkgnamever}"\
if [ -d "%{buildroot}${pkgdir}" ]; then\ 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\ 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\ else\
rm -f %{basepkg}-devel.files %{basepkg}-prof.files\ rm -f %{basepkg}-devel.files %{basepkg}-prof.files\
touch %{basepkg}-devel.files %{basepkg}-prof.files\ touch %{basepkg}-devel.files %{basepkg}-prof.files\
fi\ 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}\ %if %{with haddock}\
haddock_dir=%{ghc_html_libraries_dir}/%{pkgnamever}\ haddock_dir=%{ghc_html_libraries_dir}/%{pkgnamever}\
if [ -d %{buildroot}$haddock_dir ]; then\ if [ -d %{buildroot}$haddock_dir ]; then\
@ -144,13 +152,16 @@ done\
%define pkgver %{?2}%{!?2:%{version}}\ %define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\ %define pkgnamever %{pkgname}-%{pkgver}\
%cabal register --gen-pkg-config\ %cabal register --gen-pkg-config\
if [ -d "%{ghclibdir}/lib" ]; then\
subsubdir=/lib\
fi\
if [ -d %{pkgnamever}.conf ]; then\ if [ -d %{pkgnamever}.conf ]; then\
for i in $(ls "%{pkgnamever}.conf/"); do\ for i in $(ls "%{pkgnamever}.conf/"); do\
sub=$(echo $i | sed -e "s/^[0-9]\\+-//")\ 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\ done\
else\ 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\ fi\
%{nil} %{nil}