ocaml-cppo/ocaml-cppo.spec

145 lines
4.1 KiB
RPMSpec

#
# spec file for package ocaml-cppo
#
# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 LISA GmbH, Bingen, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: ocaml-cppo
Version: 1.0.0
Release: 0
%{ocaml_preserve_bytecode}
License: BSD-2-Clause
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-oasis
BuildRequires: ocaml-ocamldoc
BuildRequires: ocaml-rpm-macros >= 4.03
BuildRequires: ocamlfind(easy-format)
BuildRequires: ocamlfind(ocamlbuild)
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
%if 0%{?suse_version} < 1210
Requires: ocaml-ocamlbuild ocaml-runtime
%endif
# ocaml autodep end for pkg: ocaml-cppo
%description
Cppo is an equivalent of the C preprocessor targeted at the OCaml language and
its variants.
The main purpose of cppo is to provide a lightweight tool for simple macro
substitution (#define) and file inclusion (#include) for the occasional case
when this is useful in OCaml. Processing specific sections of files by calling
external programs is also possible via #ext directives.
The implementation of cppo relies on the standard library of OCaml and on the
standard parsing tools Ocamllex and Ocamlyacc, which contribute to the
robustness of cppo across OCaml versions.
%package devel
Summary: Development files for %{name}
Group: Development/Libraries/Other
Requires: %{name} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.
%prep
%setup -qn cppo-%{version}
%build
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
Test cppo
Type: Custom (0.0.1)
Command: ln -sfvbn \$cppo cppo ; make -C test all
Run: true
_EOF_
oasis setup
%ocaml_oasis_configure --enable-docs --enable-tests
%ocaml_oasis_build
%ocaml_oasis_doc
%install
%ocaml_oasis_findlib_install
%check
%ocaml_oasis_test
%files
%defattr(-,root,root)
%doc LICENSE README.md
%{_bindir}/*
%dir %{_libdir}/ocaml
%dir %{_libdir}/ocaml/*
%if %{ocaml_native_compiler}
%{_libdir}/ocaml/*/*.cmxs
%endif
%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