diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e9661d2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/topkg-*.tar.gz diff --git a/ocaml-topkg.rpmlintrc b/ocaml-topkg.rpmlintrc new file mode 100644 index 0000000..6c30149 --- /dev/null +++ b/ocaml-topkg.rpmlintrc @@ -0,0 +1,5 @@ +# THIS FILE IS FOR WHITELISTING RPMLINT ERRORS AND WARNINGS IN TASKOTRON +# https://fedoraproject.org/wiki/Taskotron/Tasks/dist.rpmlint#Whitelisting_errors + +# Documentation is in the doc subpackage +addFilter(r'ocaml-topkg-devel\.[^:]+: W: no-documentation') diff --git a/ocaml-topkg.spec b/ocaml-topkg.spec new file mode 100644 index 0000000..a0f4153 --- /dev/null +++ b/ocaml-topkg.spec @@ -0,0 +1,134 @@ +# BOOTSTRAP NOTE: currently we do not build the optional topkg-care part. +# It has dependencies which do not yet exist in Fedora, and which themselves +# depend on the main part of this package. Once the dependencies have been +# added to Fedora, we will build topkg-care in non-bootstrap builds. + +%ifnarch %{ocaml_native_compiler} +%global debug_package %{nil} +%endif + +%global srcname topkg + +Name: ocaml-%{srcname} +Version: 1.0.1 +Release: 1%{?dist} +Summary: The transitory OCaml software packager + +License: ISC +URL: https://erratique.ch/software/topkg/ +Source0: https://github.com/dbuenzli/topkg/archive/v%{version}/%{srcname}-%{version}.tar.gz + +BuildRequires: ocaml >= 4.03.0 +BuildRequires: ocaml-findlib >= 1.6.1 +BuildRequires: ocaml-ocamlbuild +BuildRequires: ocaml-ocamldoc +BuildRequires: ocaml-result-devel + +%description +Topkg is a packager for distributing OCaml software. It provides an +API to describe the files a package installs in a given build +configuration and to specify information about the package's +distribution, creation and publication procedures. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: ocaml-result-devel%{?_isa} + +%description devel +The %{name}-devel package contains libraries and signature files for +developing applications that use %{name}. + +%package doc +Summary: Documentation for %{name} +BuildArch: noarch + +%description doc +Documentation for %{name}. + +%prep +%autosetup -n %{srcname}-%{version} + +# This package can replace "watermarks" in software that it builds. However, +# we are building from scratch, rather than using topkg to build itself, so we +# have to do the job manually. +for fil in $(find . -type f); do + sed -e 's,%%%%NAME%%%%,%{srcname},' \ + -e 's,%%%%PKG_DOC%%%%,%{url}doc/,' \ + -e 's,%%%%PKG_HOMEPAGE%%%%,%{url},' \ + -e 's,%%%%VERSION%%%%,v%{version},' \ + -e 's,%%%%VERSION_NUM%%%%,%{version},' \ + -i.orig $fil + touch -r $fil.orig $fil + rm $fil.orig +done + +%build +# Build the library and the tests +ocaml pkg/pkg.ml build --pkg-name topkg --tests true + +# Build the command line tool +%ifarch %{ocaml_native_compiler} +ocamlbuild topkg.native +%else +ocamlbuild topkg.byte +%endif + +# Build the documentation. It is meant to be built with odoc, but odoc +# transitively depends on this package, so we do it manually for bootstrap +# builds. Once a non-bootstrap build is possible, use odoc instead. +mkdir html +ocamldoc -html -d html -I _build/src _build/src/*.{mli,ml} + +%install +# Install the library +mkdir -p %{buildroot}%{_libdir}/ocaml/topkg +cp -p _build/topkg.opam %{buildroot}%{_libdir}/ocaml/topkg/opam +cp -p _build/pkg/META %{buildroot}%{_libdir}/ocaml/topkg/META +%ifarch %{ocaml_native_compiler} +cp -a _build/src/*.{a,cma,cmi,cmt,cmti,cmx,cmxa,cmxs,mli} \ + %{buildroot}%{_libdir}/ocaml/topkg +%else +cp -a _build/src/*.{cma,cmi,cmt,cmti,mli} %{buildroot}%{_libdir}/ocaml/topkg +%endif + +# Install the command line tool +mkdir -p %{buildroot}%{_bindir} +%ifarch %{ocaml_native_compiler} +cp -p _build/src/topkg.native %{buildroot}%{_bindir}/topkg +%else +cp -p _build/src/topkg.byte %{buildroot}%{_bindir}/topkg +%endif + +%check +ocaml pkg/pkg.ml test + +%files +%doc CHANGES.md README.md +%license LICENSE.md +%{_bindir}/%{srcname} +%dir %{_libdir}/ocaml/%{srcname}/ +%{_libdir}/ocaml/%{srcname}/META +%{_libdir}/ocaml/%{srcname}/%{srcname}.cma +%{_libdir}/ocaml/%{srcname}/%{srcname}*.cmi +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/%{srcname}.cmxs +%endif + +%files devel +%{_libdir}/ocaml/%{srcname}/opam +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/%{srcname}/%{srcname}.a +%{_libdir}/ocaml/%{srcname}/%{srcname}*.cmx +%{_libdir}/ocaml/%{srcname}/%{srcname}.cmxa +%endif +%{_libdir}/ocaml/%{srcname}/%{srcname}*.cmt +%{_libdir}/ocaml/%{srcname}/%{srcname}*.cmti +%{_libdir}/ocaml/%{srcname}/%{srcname}*.mli + +%files doc +%doc html/* + +%changelog +* Thu Jan 9 2020 Jerry James - 1.0.1-1 +- Initial RPM diff --git a/sources b/sources new file mode 100644 index 0000000..83b1cf4 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (topkg-1.0.1.tar.gz) = 8b9afeab487c87a16c3a6b7e066c8d0eaa781977b0991707f22f6ed98bd5db0f7b13f667170e4de4ee9bd48192a8b07293f2e3f15ec436fae05b5df95fe9762c