diff --git a/ocaml-cppo.spec b/ocaml-cppo.spec index 2a096ab..9368307 100644 --- a/ocaml-cppo.spec +++ b/ocaml-cppo.spec @@ -25,11 +25,13 @@ Summary: The C preprocessor written in OCaml Url: http://mjambon.com/cppo.html Group: Development/Libraries/Other Source: http://mjambon.com/releases/cppo/cppo-%{version}.tar.gz -BuildRequires: ocaml -BuildRequires: ocaml-findlib -BuildRequires: ocamlfind(easy-format) +BuildRequires: ocaml +BuildRequires: ocaml-oasis +BuildRequires: ocaml-ocamldoc +BuildRequires: ocaml-rpm-macros >= 4.03 +BuildRequires: ocamlfind(easy-format) BuildRequires: ocamlfind(ocamlbuild) -BuildRequires: ocaml-rpm-macros >= 4.02.1 +BuildRequires: ocamlfind(unix) BuildRoot: %{_tmppath}/%{name}-%{version}-build # ocaml autodep start for pkg: ocaml-cppo # hardcoded rpm dependency for pre 12.1 to compensate for lack of ocaml() provides/requires @@ -63,23 +65,50 @@ developing applications that use %{name}. %setup -qn cppo-%{version} %build -make BEST=byte all ocamlbuild -%if %{ocaml_native_compiler} -make BEST=opt opt ocamlbuild -%endif +echo 'let cppo_version = "%{version}"' > cppo_version.ml +tee _oasis <<_EOF_ +OASISFormat: 0.4 +Name: cppo +Version: %{version} +Synopsis: The C preprocessor written in OCaml +Authors: Martin Jambon +LicenseFile: LICENSE +License: BSD-2-Clause +Plugins: META(`oasis version`) +BuildTools: ocamlbuild + +Library ocamlbuild_cppo + Path: ocamlbuild_plugin + Modules: Ocamlbuild_cppo + Install: true + BuildDepends: ocamlbuild + +Document ocamlbuild_cppo + Title: API reference for ocamlbuild_cppo + Type: ocamlbuild + BuildTools+: ocamldoc + InstallDir: \$htmldir + Install: true + XOCamlbuildPath: . + XOCamlbuildLibraries: ocamlbuild_cppo + +Executable cppo + Path: . + MainIs: cppo_main.ml + CompiledObject: best + BuildDepends: unix +_EOF_ +oasis setup +%ocaml_oasis_configure --enable-docs +%ocaml_oasis_build +%ocaml_oasis_doc %install -export OCAMLFIND_DESTDIR=%{buildroot}$(ocamlfind printconf destdir) -mkdir -p %{buildroot}%{_bindir} $OCAMLFIND_DESTDIR -make BEST=byte install BINDIR="%{buildroot}%{_bindir}" -%if %{ocaml_native_compiler} -find "%{buildroot}" -name META -print -delete -make BEST=opt install BINDIR="%{buildroot}%{_bindir}" -%endif +%ocaml_oasis_findlib_install %files %defattr(-,root,root) -%doc Changes LICENSE README.md +%doc LICENSE README.md %{_bindir}/* %dir %{_libdir}/ocaml %dir %{_libdir}/ocaml/* @@ -89,13 +118,19 @@ make BEST=opt install BINDIR="%{buildroot}%{_bindir}" %files devel %defattr(-,root,root,-) +%{oasis_docdir_html} %dir %{_libdir}/ocaml %dir %{_libdir}/ocaml/* %if %{ocaml_native_compiler} %{_libdir}/ocaml/*/*.a +%{_libdir}/ocaml/*/*.cmx %{_libdir}/ocaml/*/*.cmxa %endif +%{_libdir}/ocaml/*/*.annot %{_libdir}/ocaml/*/*.cma %{_libdir}/ocaml/*/*.cmi +%{_libdir}/ocaml/*/*.cmt +%{_libdir}/ocaml/*/*.cmti +%{_libdir}/ocaml/*/*.mli %{_libdir}/ocaml/*/META