]>
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 |
7e271514 | 18 | Summary(pl.UTF-8): Generator parserów LR(1) dla języka programowania OCaml |
8d0def07 | 19 | Name: ocaml-%{module} |
aaa6cc55 JB |
20 | Version: 20211230 |
21 | Release: 1 | |
9bf45635 | 22 | License: GPL v2 (generator), LGPL v2 with linking exception (library) |
8d0def07 | 23 | Group: Libraries |
518d9591 | 24 | Source0: https://gitlab.inria.fr/fpottier/menhir/-/archive/%{version}/menhir-%{version}.tar.bz2 |
aaa6cc55 | 25 | # Source0-md5: 2fb5afcef095199275a988c61f06de08 |
8d0def07 | 26 | URL: http://gallium.inria.fr/~fpottier/menhir/ |
518d9591 | 27 | %{?with_coq:BuildRequires: coq} |
8d0def07 | 28 | BuildRequires: ocaml >= 3.04-7 |
aaa6cc55 | 29 | BuildRequires: ocaml-dune >= 2.0 |
8d0def07 JR |
30 | %requires_eq ocaml-runtime |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
32 | ||
8d0def07 | 33 | %description |
943c5732 JR |
34 | Menhir is a LR(1) parser generator for the OCaml programming language. |
35 | That is, Menhir compiles LR(1) grammar specifications down to OCaml | |
36 | code. | |
8d0def07 | 37 | |
943c5732 JR |
38 | Menhir is 90% compatible with ocamlyacc. Legacy ocamlyacc grammar |
39 | specifications are accepted and compiled by Menhir. The resulting | |
40 | parsers run and produce correct parse trees. However, parsers that | |
41 | explicitly invoke functions in module Parsing behave slightly | |
42 | incorrectly. For instance, the functions that provide access to | |
43 | positions return a dummy position when invoked by a Menhir parser. | |
44 | Porting a grammar specification from ocamlyacc to Menhir requires | |
45 | replacing all calls to module Parsing with new Menhir-specific | |
46 | keywords. | |
8d0def07 | 47 | |
7e271514 JB |
48 | %description -l pl.UTF-8 |
49 | Menhir to generator parserów LR(1) dla języka programownia OCaml. | |
50 | Oznacza to, że Menhir kompiluje specyfikacje gramatyk LR(1) do kodu w | |
51 | OCamlu. | |
52 | ||
53 | Menhir jest w 90% zgodny z ocamlyacc. Tradycyjne specyfikacje gramatyk | |
54 | ocamlyacca są akceptowane i kompilowane przez Menhira. Wynikowe | |
55 | parsery działają i tworzą poprawne drzewa analizy - jednak parsery | |
56 | jawnie wywołujące funkcje z modułu Parsing zachowują się nie do końca | |
57 | popeawnie. Na przykład funkcje dające dostęp do pozycji w przypadku | |
58 | wywołania z parsera Menhir zwracają pozycję pustą. Przekładanie | |
59 | specyfikacji gramatyki z ocamlyacca na Menhira wymaga zastąpienia | |
60 | wszystkich wywołań modułu Parsing nowymi słowami kluczowymi | |
61 | specyficznymi dla modułu Menhir. | |
62 | ||
8d0def07 | 63 | %package devel |
7e271514 JB |
64 | Summary: Development part of OCaml Menhir library |
65 | Summary(pl.UTF-8): Programistyczna część biblioteki OCamla Menhir | |
8d0def07 JR |
66 | Group: Development/Libraries |
67 | Requires: %{name} = %{version}-%{release} | |
9bf45635 | 68 | %requires_eq ocaml |
8d0def07 JR |
69 | |
70 | %description devel | |
71 | This package contains files needed to develop OCaml programs using | |
7e271514 JB |
72 | menhir library. |
73 | ||
74 | %description devel | |
75 | Ten pakiet zawiera pliki potrzebne do tworzenia programów w OCamlu | |
76 | używających biblioteki menhir. | |
8d0def07 | 77 | |
518d9591 JR |
78 | %package -n coq-menhirlib |
79 | Summary: Support library for verified Coq parsers produced by Menhir | |
7e271514 | 80 | Summary(pl.UTF-8): Biblioteka wspierająca dla wygenerowanych przez Menhira parserów weryfikowanych przez Coq |
9bf45635 | 81 | License: LGPL v3+ |
518d9591 JR |
82 | Requires: coq |
83 | ||
84 | %description -n coq-menhirlib | |
85 | The Menhir parser generator, in --coq mode, can produce Coq parsers. | |
86 | These parsers must be linked against this library, which provides both | |
87 | an interpreter (which allows running the generated parser) and a | |
88 | validator (which allows verifying, at parser construction time, that | |
89 | the generated parser is correct and complete with respect to the | |
90 | grammar). | |
91 | ||
7e271514 JB |
92 | %description -n coq-menhirlib -l pl.UTF-8 |
93 | Generator parserów Menhir w trybie --coq potrafi tworzyć parsery Coq. | |
94 | Parsery te muszą być konsolidowane z tą biblioteką, zapewniającą | |
95 | zarówno interpreter (pozwalający uruchamiać wygenerowane parsery), jak | |
96 | i walidator (pozwalający na weryfikowanie w trakcie konstruowania | |
97 | parsera, czy wygenerowany parser jest poprawny i kompletny względem | |
98 | gramatyki). | |
99 | ||
8d0def07 JR |
100 | %prep |
101 | %setup -q -n %{module}-%{version} | |
102 | ||
103 | %build | |
518d9591 JR |
104 | dune build --verbose %{?_smp_mflags} |
105 | ||
106 | %if %{with coq} | |
9bf45635 JB |
107 | %{__make} -C coq-menhirlib \ |
108 | VERBOSE=1 | |
518d9591 | 109 | %endif |
8d0def07 JR |
110 | |
111 | %install | |
112 | rm -rf $RPM_BUILD_ROOT | |
8d0def07 | 113 | |
518d9591 JR |
114 | dune install \ |
115 | --verbose \ | |
116 | --destdir=$RPM_BUILD_ROOT | |
943c5732 | 117 | |
518d9591 JR |
118 | %if %{with coq} |
119 | %{__make} -C coq-menhirlib install \ | |
120 | DESTDIR=$RPM_BUILD_ROOT | |
121 | %endif | |
8d0def07 | 122 | |
9bf45635 JB |
123 | # sources |
124 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/ocaml/{menhirLib,menhirSdk}/*.ml | |
125 | # packaged as %doc | |
126 | %{__rm} -r $RPM_BUILD_ROOT%{_prefix}/doc/{menhir*,coq-menhirlib} | |
127 | %if %{without coq} | |
128 | %{__rm} -r $RPM_BUILD_ROOT%{_libdir}/ocaml/coq-menhirlib | |
129 | %endif | |
130 | ||
8d0def07 JR |
131 | %clean |
132 | rm -rf $RPM_BUILD_ROOT | |
133 | ||
134 | %files | |
135 | %defattr(644,root,root,755) | |
9bf45635 | 136 | %doc LICENSE doc/manual.pdf |
943c5732 | 137 | %attr(755,root,root) %{_bindir}/menhir |
9bf45635 JB |
138 | %dir %{_libdir}/ocaml/menhir |
139 | %{_libdir}/ocaml/menhir/META | |
140 | %dir %{_libdir}/ocaml/menhirLib | |
141 | %{_libdir}/ocaml/menhirLib/META | |
142 | %{_libdir}/ocaml/menhirLib/*.cma | |
143 | %dir %{_libdir}/ocaml/menhirSdk | |
144 | %{_libdir}/ocaml/menhirSdk/META | |
145 | %{_libdir}/ocaml/menhirSdk/*.cma | |
518d9591 | 146 | %if %{with ocaml_opt} |
9bf45635 JB |
147 | %attr(755,root,root) %{_libdir}/ocaml/menhirLib/*.cmxs |
148 | %attr(755,root,root) %{_libdir}/ocaml/menhirSdk/*.cmxs | |
518d9591 | 149 | %endif |
943c5732 | 150 | %{_mandir}/man1/menhir.1* |
8d0def07 JR |
151 | |
152 | %files devel | |
153 | %defattr(644,root,root,755) | |
9bf45635 JB |
154 | %{_libdir}/ocaml/menhir/dune-package |
155 | %{_libdir}/ocaml/menhirLib/dune-package | |
156 | %{_libdir}/ocaml/menhirLib/*.cmi | |
157 | %{_libdir}/ocaml/menhirLib/*.cmt | |
158 | %{_libdir}/ocaml/menhirLib/*.cmti | |
159 | %{_libdir}/ocaml/menhirLib/*.mli | |
160 | %{_libdir}/ocaml/menhirSdk/dune-package | |
161 | %{_libdir}/ocaml/menhirSdk/*.cmi | |
162 | %{_libdir}/ocaml/menhirSdk/*.cmt | |
163 | %{_libdir}/ocaml/menhirSdk/*.cmti | |
164 | %{_libdir}/ocaml/menhirSdk/*.mli | |
8d0def07 | 165 | %if %{with ocaml_opt} |
9bf45635 JB |
166 | %{_libdir}/ocaml/menhirLib/*.a |
167 | %{_libdir}/ocaml/menhirLib/*.cmx | |
168 | %{_libdir}/ocaml/menhirLib/*.cmxa | |
169 | %{_libdir}/ocaml/menhirSdk/*.a | |
170 | %{_libdir}/ocaml/menhirSdk/*.cmx | |
171 | %{_libdir}/ocaml/menhirSdk/*.cmxa | |
518d9591 | 172 | %endif |
518d9591 JR |
173 | |
174 | %if %{with coq} | |
175 | %files -n coq-menhirlib | |
176 | %defattr(644,root,root,755) | |
9bf45635 | 177 | %doc coq-menhirlib/{CHANGES.md,LICENSE,README.md} |
518d9591 JR |
178 | %dir %{_libdir}/ocaml/coq-menhirlib |
179 | %{_libdir}/ocaml/coq-menhirlib/META | |
180 | %{_libdir}/ocaml/coq-menhirlib/dune-package | |
181 | %{_libdir}/coq/user-contrib/MenhirLib | |
8d0def07 | 182 | %endif |