]>
Commit | Line | Data |
---|---|---|
8d0def07 JR |
1 | # |
2 | # Conditional build: | |
9bf45635 JB |
3 | %bcond_without ocaml_opt # native optimized binaries (bytecode is always built) |
4 | %bcond_without coq # coq menhir library | |
8d0def07 JR |
5 | |
6 | # not yet available on x32 (ocaml 4.02.1), update when upstream will support it | |
9bf45635 | 7 | %ifnarch %{ix86} %{x8664} %{arm} aarch64 ppc sparc sparcv9 |
8d0def07 | 8 | %undefine with_ocaml_opt |
518d9591 JR |
9 | %undefine with_coq |
10 | %endif | |
11 | ||
12 | %if %{without ocaml_opt} | |
13 | %define _enable_debug_packages 0 | |
8d0def07 JR |
14 | %endif |
15 | ||
16 | %define module menhir | |
943c5732 | 17 | Summary: LR(1) parser generator for the OCaml programming language |
8d0def07 | 18 | Name: ocaml-%{module} |
518d9591 | 19 | Version: 20210310 |
a43df5b8 | 20 | Release: 2 |
9bf45635 | 21 | License: GPL v2 (generator), LGPL v2 with linking exception (library) |
8d0def07 | 22 | Group: Libraries |
518d9591 JR |
23 | Source0: https://gitlab.inria.fr/fpottier/menhir/-/archive/%{version}/menhir-%{version}.tar.bz2 |
24 | # Source0-md5: 1a0388baec7a5ba7c931e074d2c322d7 | |
8d0def07 | 25 | URL: http://gallium.inria.fr/~fpottier/menhir/ |
518d9591 | 26 | %{?with_coq:BuildRequires: coq} |
8d0def07 | 27 | BuildRequires: ocaml >= 3.04-7 |
518d9591 | 28 | BuildRequires: ocaml-dune |
8d0def07 JR |
29 | %requires_eq ocaml-runtime |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
31 | ||
8d0def07 | 32 | %description |
943c5732 JR |
33 | Menhir is a LR(1) parser generator for the OCaml programming language. |
34 | That is, Menhir compiles LR(1) grammar specifications down to OCaml | |
35 | code. | |
8d0def07 | 36 | |
943c5732 JR |
37 | Menhir is 90% compatible with ocamlyacc. Legacy ocamlyacc grammar |
38 | specifications are accepted and compiled by Menhir. The resulting | |
39 | parsers run and produce correct parse trees. However, parsers that | |
40 | explicitly invoke functions in module Parsing behave slightly | |
41 | incorrectly. For instance, the functions that provide access to | |
42 | positions return a dummy position when invoked by a Menhir parser. | |
43 | Porting a grammar specification from ocamlyacc to Menhir requires | |
44 | replacing all calls to module Parsing with new Menhir-specific | |
45 | keywords. | |
8d0def07 JR |
46 | |
47 | %package devel | |
943c5732 | 48 | Summary: Menhir development part |
8d0def07 JR |
49 | Group: Development/Libraries |
50 | Requires: %{name} = %{version}-%{release} | |
9bf45635 | 51 | %requires_eq ocaml |
8d0def07 JR |
52 | |
53 | %description devel | |
54 | This package contains files needed to develop OCaml programs using | |
943c5732 | 55 | menhir. |
8d0def07 | 56 | |
518d9591 JR |
57 | %package -n coq-menhirlib |
58 | Summary: Support library for verified Coq parsers produced by Menhir | |
9bf45635 | 59 | License: LGPL v3+ |
518d9591 JR |
60 | Requires: coq |
61 | ||
62 | %description -n coq-menhirlib | |
63 | The Menhir parser generator, in --coq mode, can produce Coq parsers. | |
64 | These parsers must be linked against this library, which provides both | |
65 | an interpreter (which allows running the generated parser) and a | |
66 | validator (which allows verifying, at parser construction time, that | |
67 | the generated parser is correct and complete with respect to the | |
68 | grammar). | |
69 | ||
8d0def07 JR |
70 | %prep |
71 | %setup -q -n %{module}-%{version} | |
72 | ||
73 | %build | |
518d9591 JR |
74 | dune build --verbose %{?_smp_mflags} |
75 | ||
76 | %if %{with coq} | |
9bf45635 JB |
77 | %{__make} -C coq-menhirlib \ |
78 | VERBOSE=1 | |
518d9591 | 79 | %endif |
8d0def07 JR |
80 | |
81 | %install | |
82 | rm -rf $RPM_BUILD_ROOT | |
8d0def07 | 83 | |
518d9591 JR |
84 | dune install \ |
85 | --verbose \ | |
86 | --destdir=$RPM_BUILD_ROOT | |
943c5732 | 87 | |
518d9591 JR |
88 | %if %{with coq} |
89 | %{__make} -C coq-menhirlib install \ | |
90 | DESTDIR=$RPM_BUILD_ROOT | |
91 | %endif | |
8d0def07 | 92 | |
9bf45635 JB |
93 | # sources |
94 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/ocaml/{menhirLib,menhirSdk}/*.ml | |
95 | # packaged as %doc | |
96 | %{__rm} -r $RPM_BUILD_ROOT%{_prefix}/doc/{menhir*,coq-menhirlib} | |
97 | %if %{without coq} | |
98 | %{__rm} -r $RPM_BUILD_ROOT%{_libdir}/ocaml/coq-menhirlib | |
99 | %endif | |
100 | ||
8d0def07 JR |
101 | %clean |
102 | rm -rf $RPM_BUILD_ROOT | |
103 | ||
104 | %files | |
105 | %defattr(644,root,root,755) | |
9bf45635 | 106 | %doc LICENSE doc/manual.pdf |
943c5732 | 107 | %attr(755,root,root) %{_bindir}/menhir |
9bf45635 JB |
108 | %dir %{_libdir}/ocaml/menhir |
109 | %{_libdir}/ocaml/menhir/META | |
110 | %dir %{_libdir}/ocaml/menhirLib | |
111 | %{_libdir}/ocaml/menhirLib/META | |
112 | %{_libdir}/ocaml/menhirLib/*.cma | |
113 | %dir %{_libdir}/ocaml/menhirSdk | |
114 | %{_libdir}/ocaml/menhirSdk/META | |
115 | %{_libdir}/ocaml/menhirSdk/*.cma | |
518d9591 | 116 | %if %{with ocaml_opt} |
9bf45635 JB |
117 | %attr(755,root,root) %{_libdir}/ocaml/menhirLib/*.cmxs |
118 | %attr(755,root,root) %{_libdir}/ocaml/menhirSdk/*.cmxs | |
518d9591 | 119 | %endif |
943c5732 | 120 | %{_mandir}/man1/menhir.1* |
8d0def07 JR |
121 | |
122 | %files devel | |
123 | %defattr(644,root,root,755) | |
9bf45635 JB |
124 | %{_libdir}/ocaml/menhir/dune-package |
125 | %{_libdir}/ocaml/menhirLib/dune-package | |
126 | %{_libdir}/ocaml/menhirLib/*.cmi | |
127 | %{_libdir}/ocaml/menhirLib/*.cmt | |
128 | %{_libdir}/ocaml/menhirLib/*.cmti | |
129 | %{_libdir}/ocaml/menhirLib/*.mli | |
130 | %{_libdir}/ocaml/menhirSdk/dune-package | |
131 | %{_libdir}/ocaml/menhirSdk/*.cmi | |
132 | %{_libdir}/ocaml/menhirSdk/*.cmt | |
133 | %{_libdir}/ocaml/menhirSdk/*.cmti | |
134 | %{_libdir}/ocaml/menhirSdk/*.mli | |
8d0def07 | 135 | %if %{with ocaml_opt} |
9bf45635 JB |
136 | %{_libdir}/ocaml/menhirLib/*.a |
137 | %{_libdir}/ocaml/menhirLib/*.cmx | |
138 | %{_libdir}/ocaml/menhirLib/*.cmxa | |
139 | %{_libdir}/ocaml/menhirSdk/*.a | |
140 | %{_libdir}/ocaml/menhirSdk/*.cmx | |
141 | %{_libdir}/ocaml/menhirSdk/*.cmxa | |
518d9591 | 142 | %endif |
518d9591 JR |
143 | |
144 | %if %{with coq} | |
145 | %files -n coq-menhirlib | |
146 | %defattr(644,root,root,755) | |
9bf45635 | 147 | %doc coq-menhirlib/{CHANGES.md,LICENSE,README.md} |
518d9591 JR |
148 | %dir %{_libdir}/ocaml/coq-menhirlib |
149 | %{_libdir}/ocaml/coq-menhirlib/META | |
150 | %{_libdir}/ocaml/coq-menhirlib/dune-package | |
151 | %{_libdir}/coq/user-contrib/MenhirLib | |
8d0def07 | 152 | %endif |