templates: updates for python and ocaml-libs

This commit is contained in:
Silvan Calarco 2022-05-23 13:18:31 +02:00
parent d7ecd3c845
commit 8bb5867637
2 changed files with 21 additions and 51 deletions

View File

@ -1,4 +1,3 @@
## this macro only works for packages with name matching the regexp "ocaml-.*"
%define ocamlpck @pck_name_tail@
Name: @pck_name@
@ -15,18 +14,14 @@ License: ...
## AUTOBUILDREQ-BEGIN
## note: run 'autospec -u -a6 @pck_name@' to get the list of build requirements.
## AUTOBUILDREQ-END
BuildRequires: dune
BuildRequires: ocaml
BuildRequires: ocaml-camlp4-devel
BuildRequires: ocaml-findlib
## remove the following build requirement if this package is compiled
## by using the OCaml native-code compiler (ocamlopt)
Requires: ocaml-runtime
%description
...
%{summary}.
@if:pck_devel
## remove the following two blocks if there's no devel files
%package devel
Group: Development/Libraries/OCaml
Summary: Development files for %{name}
@ -36,64 +31,42 @@ Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
This package contains libraries and signature files for developing applications that use %{name}.
@fi:pck_devel
%debug_package
%prep
%setup -q
%build
## remove the unsupported options (no real standard exists...)
./configure \\
\ --prefix %{_prefix} \\
\ --localstatedir %{_localstatedir} \\
\ --sharedstatedir %{_sharedstatedir} \\
\ --sysconfdir %{_sysconfdir} \\
\ --enable-tests \\
\ --enable-docs \\
\ --enable-examples \\
\ --disable-ldconf
## extra arguments that sometimes can be passed to './configure'
## -host %{_host}
## -cc "gcc ${RPM_OPT_FLAGS/-fomit-frame-pointer/}"
## --destdir %{buildroot}
%make all
%make opt
dune build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
export OCAMLFIND_DESTDIR=%{buildroot}$(ocamlfind printconf destdir)
export DLLDIR=$OCAMLFIND_DESTDIR/stublibs
DESTDIR=%{buildroot} dune install --prefix "/usr" --libdir "%{_lib}/ocaml"
install -d $OCAMLFIND_DESTDIR/%{ocamlpck}
install -d $OCAMLFIND_DESTDIR/stublibs
make install
rm -rf %{buildroot}/usr/doc
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%files
%defattr(-,root,root)
## note: this list is just an example; modify as required
# %dir %{_libdir}/ocaml/%{ocamlpck}
# %{_libdir}/ocaml/%{ocamlpck}/META
# %{_libdir}/ocaml/%{ocamlpck}/*.cma
# %{_libdir}/ocaml/%{ocamlpck}/*.cmi
# %{_libdir}/ocaml/%{ocamlpck}/*.cmxs
# %{_libdir}/ocaml/stublibs/*.so*
# %doc COPYING
%dir %{_libdir}/ocaml/%{ocamlpck}
%{_libdir}/ocaml/%{ocamlpck}/*
%exclude %{_libdir}/ocaml/%{ocamlpck}/*.a
%exclude %{_libdir}/ocaml/%{ocamlpck}/*.cmx
%exclude %{_libdir}/ocaml/%{ocamlpck}/*.cmxa
%exclude %{_libdir}/ocaml/%{ocamlpck}/*.mli
%{_libdir}/ocaml/stublibs/*.so*
%doc LICENSE*
@if:pck_devel
## remove this block if there are no devel files
## note: this list is just an example; modify as required
%files devel
%defattr(-,root,root)
# %{_libdir}/ocaml/%{ocamlpck}/*.a
# %{_libdir}/ocaml/%{ocamlpck}/*.cmx
# %{_libdir}/ocaml/%{ocamlpck}/*.cmxa
# %{_libdir}/ocaml/%{ocamlpck}/*.mli
# %doc CHANGES README
# %doc doc/html/
# %doc examples/
%{_libdir}/ocaml/%{ocamlpck}/*.a
%{_libdir}/ocaml/%{ocamlpck}/*.cmx
%{_libdir}/ocaml/%{ocamlpck}/*.cmxa
%{_libdir}/ocaml/%{ocamlpck}/*.mli
%doc CHANGES* README.md
@fi:pck_devel
%changelog

View File

@ -1,4 +1,4 @@
%define pkgname %(echo %name | cut -d- -f2-)
%define pkgname %(echo %name | cut -d- -f2- | tr - _)
Name: @pck_name@
Version: @pck_version@
Release: @spec_first_release@@DISTRO_rpm@
@ -40,12 +40,9 @@ sed -i "\\,\\.egg-info/,d;s,.*/man/.*,&.gz," %{name}.filelist
%files %{?pyappend} -f %{name}.filelist
%defattr(-,root,root)
## note: this list is just an example; modify as required
%dir %{python_sitearch}/%{pkgname}-%{version}-py*.egg-info
%{python_sitearch}/%{pkgname}-%{version}-py*.egg-info/*
@standard_docs@
## note: add extra documentation (if any)
# @standard_docs_devel@
%changelog
* @spec_changelog_date@ @packager_fullname@ <@packager_email@> @pck_version@-@spec_first_release@@DISTRO_rpm@