3 %bcond_without ocaml_opt # native optimized binaries (bytecode is always built)
4 %bcond_with dune # build with dune, this is off due to circular deps
6 # not yet available on x32 (ocaml 4.02.1), update when upstream will support it
7 %ifnarch %{ix86} %{x8664} %{arm} aarch64 ppc sparc sparcv9
8 %undefine with_ocaml_opt
11 %if %{without ocaml_opt}
12 %define _enable_debug_packages 0
16 Summary: Parsing and printing of S-expressions in canonical form
17 Summary(pl.UTF-8): Analiza i wypisywanie S-wyrażeń w postaci kanonicznej
23 #Source0Download: https://github.com/ocaml-dune/csexp/releases
24 Source0: https://github.com/ocaml-dune/csexp/releases/download/%{version}/%{module}-%{version}.tbz
25 # Source0-md5: 11cf8377dc963ecaf2226df117911676
26 URL: https://github.com/ocaml-dune/csexp
27 BuildRequires: ocaml >= 1:4.03.0
29 BuildRequires: ocaml-dune >= 1.11
30 BuildRequires: ocaml-odoc
32 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35 This project provides minimal support for parsing and printing
36 S-expressions in canonical form, which is a very simple and canonical
37 binary encoding of S-expressions.
39 %description -l pl.UTF-8
40 Ten projekt zapewnia minimalną obsługę analizy i wypisywania S-wyrażeń
41 w postaci kanonicznej, będącej bardzo prostym i kanonicznym kodowaniem
45 Summary: Development files for csexp library
46 Summary(pl.UTF-8): Pliki programistyczne biblioteki csexp
47 Group: Development/Libraries
48 Requires: %{name} = %{version}-%{release}
51 This package contains libraries and signature files for developing
52 applications that use OCaml csexp library.
54 %description devel -l pl.UTF-8
55 Ten pakiet zawiera biblioteki i pliki sygnatur do tworzenia aplikacji
56 wykorzystujących bibliotekę OCamla csexp.
59 %setup -q -n %{module}-%{version}
63 dune build %{?_smp_mflags} --display=verbose @install
64 dune build %{?_smp_mflags} @doc
66 OFLAGS="-strict-sequence -strict-formats -short-paths -keep-locs -g -opaque"
67 OCFLAGS="$OFLAGS -bin-annot"
69 ocamlc $OCFLAGS -output-obj csexp.mli
70 ocamlc $OCFLAGS -a -o csexp.cma csexp.ml
72 ocamlopt $OFLAGS -ccopt "%{rpmcflags}" -cclib "%{rpmldflags}" -a \
73 -o csexp.cmxa csexp.ml
74 ocamlopt $OFLAGS -ccopt "%{rpmcflags}" -cclib "%{rpmldflags}" -shared \
75 -o csexp.cmxs csexp.ml
80 rm -rf $RPM_BUILD_ROOT
82 dune install --destdir=$RPM_BUILD_ROOT
84 # We do not want the dune markers
85 find _build/default/_doc/_html -name .dune-keep -delete
87 # We do not want the ml files
88 find $RPM_BUILD_ROOT%{_libdir}/ocaml -name \*.ml -delete
90 # We install the documentation with the doc macro
91 rm -fr $RPM_BUILD_ROOT%{_prefix}/doc
93 # Install without dune. See comment at the top.
94 install -d $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}
95 cp -p src/csexp.{cma,cmi,cmt,cmti,mli} $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}
97 cp -p src/csexp.{a,cmx,cmxa,cmxs} $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}
100 cp -p csexp.opam $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}/opam
102 cat >> $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}/META << EOF
103 version = "%{version}"
104 description = "Parsing and printing of S-expressions in canonical form"
105 archive(byte) = "csexp.cma"
106 %ifarch %{ocaml_native_compiler}
107 archive(native) = "csexp.cmxa"
109 plugin(byte) = "csexp.cma"
110 %ifarch %{ocaml_native_compiler}
111 plugin(native) = "csexp.cmxs"
115 cat >> $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}/dune-package << EOF
122 %if %{with ocaml_opt}
123 (archives (byte csexp.cma) (native csexp.cmxa))
124 (plugins (byte csexp.cma) (native csexp.cmxs))
125 (native_archives csexp.a)
127 (archives (byte csexp.cma))
128 (plugins (byte csexp.cma))
130 (main_module_name Csexp)
131 %if %{with ocaml_opt}
137 (singleton (name Csexp) (obj_name csexp) (visibility public) (impl) (intf))))
142 rm -rf $RPM_BUILD_ROOT
145 %defattr(644,root,root,755)
146 %doc LICENSE.md README.md
147 %dir %{_libdir}/ocaml/%{module}
148 %{_libdir}/ocaml/%{module}/META
149 %{_libdir}/ocaml/%{module}/*.cma
150 %{_libdir}/ocaml/%{module}/*.cmi
151 %if %{with ocaml_opt}
152 %{_libdir}/ocaml/%{module}/*.cmxs
156 %defattr(644,root,root,755)
157 %{_libdir}/ocaml/%{module}/dune-package
158 %{_libdir}/ocaml/%{module}/opam
159 %if %{with ocaml_opt}
160 %{_libdir}/ocaml/%{module}/*.a
161 %{_libdir}/ocaml/%{module}/*.cmx
162 %{_libdir}/ocaml/%{module}/*.cmxa
164 %{_libdir}/ocaml/%{module}/*.cmt
165 %{_libdir}/ocaml/%{module}/*.cmti
166 %{_libdir}/ocaml/%{module}/*.mli