]> git.pld-linux.org Git - packages/ocaml-csexp.git/blob - ocaml-csexp.spec
- updated to 1.5.1
[packages/ocaml-csexp.git] / ocaml-csexp.spec
1 #
2 # Conditional build:
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
5
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
9 %endif
10
11 %if %{without ocaml_opt}
12 %define         _enable_debug_packages  0
13 %endif
14
15 %define         module  csexp
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
18 Name:           ocaml-%{module}
19 Version:        1.5.1
20 Release:        1
21 License:        MIT
22 Group:          Libraries
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
28 %if %{with dune}
29 BuildRequires:  ocaml-dune >= 1.11
30 BuildRequires:  ocaml-odoc
31 %endif
32 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
33
34 %description
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.
38
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
42 binarnym S-wyrażeń.
43
44 %package devel
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}
49
50 %description devel
51 This package contains libraries and signature files for developing
52 applications that use OCaml csexp library.
53
54 %description devel -l pl.UTF-8
55 Ten pakiet zawiera biblioteki i pliki sygnatur do tworzenia aplikacji
56 wykorzystujących bibliotekę OCamla csexp.
57
58 %prep
59 %setup -q -n %{module}-%{version}
60
61 %build
62 %if %{with dune}
63 dune build %{?_smp_mflags} --display=verbose @install
64 dune build %{?_smp_mflags} @doc
65 %else
66 OFLAGS="-strict-sequence -strict-formats -short-paths -keep-locs -g -opaque"
67 OCFLAGS="$OFLAGS -bin-annot"
68 cd src
69 ocamlc $OCFLAGS -output-obj csexp.mli
70 ocamlc $OCFLAGS -a -o csexp.cma csexp.ml
71 %if %{with ocaml_opt}
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
76 %endif
77 %endif
78
79 %install
80 rm -rf $RPM_BUILD_ROOT
81 %if %{with dune}
82 dune install --destdir=$RPM_BUILD_ROOT
83
84 # We do not want the dune markers
85 find _build/default/_doc/_html -name .dune-keep -delete
86
87 # We do not want the ml files
88 find $RPM_BUILD_ROOT%{_libdir}/ocaml -name \*.ml -delete
89
90 # We install the documentation with the doc macro
91 rm -fr $RPM_BUILD_ROOT%{_prefix}/doc
92 %else
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}
96 %if %{with ocaml_opt}
97 cp -p src/csexp.{a,cmx,cmxa,cmxs} $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}
98 %endif
99
100 cp -p csexp.opam $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}/opam
101
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"
108 %endif
109 plugin(byte) = "csexp.cma"
110 %ifarch %{ocaml_native_compiler}
111 plugin(native) = "csexp.cmxs"
112 %endif
113 EOF
114
115 cat >> $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}/dune-package << EOF
116 (lang dune 2.8)
117 (name csexp)
118 (version %{version})
119 (library
120  (name csexp)
121  (kind normal)
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)
126 %else
127  (archives (byte csexp.cma))
128  (plugins (byte csexp.cma))
129 %endif
130  (main_module_name Csexp)
131 %if %{with ocaml_opt}
132  (modes byte native)
133 %else
134  (modes byte)
135 %endif
136  (modules
137   (singleton (name Csexp) (obj_name csexp) (visibility public) (impl) (intf))))
138 EOF
139 %endif
140
141 %clean
142 rm -rf $RPM_BUILD_ROOT
143
144 %files
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
153 %endif
154
155 %files devel
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
163 %endif
164 %{_libdir}/ocaml/%{module}/*.cmt
165 %{_libdir}/ocaml/%{module}/*.cmti
166 %{_libdir}/ocaml/%{module}/*.mli
This page took 0.067117 seconds and 3 git commands to generate.