alex/alex.spec

77 lines
2.0 KiB
RPMSpec

%define ghc_ver %(ghc --numeric-version)
%define pkgname %(echo %name | sed "s|^ghc-||")
%define bootstrap 1
Name: alex
Version: 3.4.0.1
Release: 1mamba
Summary: Lexical analyser generator for Haskell
Group: Development/Libraries
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://hackage.haskell.org/package/%{pkgname}
Source: https://hackage.haskell.org/package/alex-%{version}/alex-%{version}.tar.gz
License: BSD
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libgmp-devel
BuildRequires: libnuma-devel
## AUTOBUILDREQ-END
%if "%{bootstrap}" == "1"
BuildRequires: ghc-bin
%else
BuildRequires: ghc
%endif
Obsoletes: haskell-platform <= 2013.2.0.0
#Requires: ghc = %{ghc_ver}
%description
Lexical analyser generator for Haskell.
%prep
%setup -q
%build
%if "%{bootstrap}" == "1"
export PATH="/opt/ghc/bin:$PATH"
%ifarch aarch64
# ghc-bin 9.0.2 for aarch64 requires llvm 13
export PATH="/var/autodist/clang+llvm-13.0.1-aarch64-linux-gnu/bin:$PATH"
%endif
%endif
runghc Setup.hs configure -v2 \
--prefix=%{_prefix} \
--libdir=%{_libdir} \
--libexecdir=%{_libexecdir} \
--docdir=%{_docdir}/%{name}-%{version}
runghc Setup.hs build
runghc Setup.hs haddock --executable --html-location=URL --hyperlink-source
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%if "%{bootstrap}" == "1"
export PATH="/opt/ghc/bin:$PATH"
%endif
runghc Setup.hs copy --destdir=%{buildroot}
runghc Setup.hs register \
--gen-pkg-config="%{buildroot}%{_libdir}/ghc-%{ghc_ver}/%{pkgname}-%{version}/%{pkgname}-%{version}.conf"
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
%{_bindir}/alex
%dir %{_datadir}/*-linux-ghc-*/alex-%{version}
%{_datadir}/*-linux-ghc-*/alex-%{version}/*.hs
%{_docdir}/%{name}-%{version}/LICENSE
%{_docdir}/%{name}-%{version}/html
%changelog
* Sat Nov 11 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 3.4.0.1-1mamba
- package created using the webbuild interface