]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without python # Python(3) binding | |
4 | %bcond_without static_libs # static library | |
5 | ||
6 | Summary: VISL CG-3 constraint grammar system | |
7 | Summary(pl.UTF-8): VISL CG-3 - system ograniczonej gramatyki | |
8 | Name: vislcg3 | |
9 | Version: 1.4.5 | |
10 | Release: 1 | |
11 | License: GPL v3+ | |
12 | Group: Applications/Text | |
13 | #Source0Download: https://github.com/TinoDidriksen/cg3/releases | |
14 | Source0: https://github.com/TinoDidriksen/cg3/archive/v%{version}/cg3-%{version}.tar.gz | |
15 | # Source0-md5: cbb7cbe0776596f59c5672a3a30219d9 | |
16 | Patch0: %{name}-static.patch | |
17 | URL: http://beta.visl.sdu.dk/cg3.html | |
18 | BuildRequires: cmake >= 3.0 | |
19 | BuildRequires: boost-devel >= 1.63.0-4 | |
20 | BuildRequires: libicu-devel >= 50.0 | |
21 | # -std=c++17 is minimum | |
22 | BuildRequires: libstdc++-devel >= 6:7 | |
23 | BuildRequires: rpmbuild(macros) >= 1.714 | |
24 | BuildRequires: sed >= 4.0 | |
25 | %if %{with python} | |
26 | BuildRequires: python3-devel >= 1:3.5 | |
27 | BuildRequires: swig-python >= 3.0 | |
28 | %endif | |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
30 | ||
31 | %description | |
32 | VISL CG-3 constraint grammar system. | |
33 | ||
34 | %description -l pl.UTF-8 | |
35 | VISL CG-3 - system ograniczonej gramatyki. | |
36 | ||
37 | %package devel | |
38 | Summary: Header file for VISL CG-3 library | |
39 | Summary(pl.UTF-8): Plik nagłówkowy biblioteki VISL CG-3 | |
40 | Group: Development/Libraries | |
41 | Requires: %{name} = %{version}-%{release} | |
42 | ||
43 | %description devel | |
44 | Header file for VISL CG-3 library. | |
45 | ||
46 | %description devel -l pl.UTF-8 | |
47 | Plik nagłówkowy biblioteki VISL CG-3. | |
48 | ||
49 | %package static | |
50 | Summary: Static VISL CG-3 library | |
51 | Summary(pl.UTF-8): Statyczna biblioteka VISL CG-3 | |
52 | Group: Development/Libraries | |
53 | Requires: %{name}-devel = %{version}-%{release} | |
54 | ||
55 | %description static | |
56 | Static VISL CG-3 library. | |
57 | ||
58 | %description static -l pl.UTF-8 | |
59 | Statyczna biblioteka VISL CG-3. | |
60 | ||
61 | %package -n python3-constraint_grammar | |
62 | Summary: Python 3 bindings for CG-3 library | |
63 | Summary(pl.UTF-8): Wiązania Pythona 3 do biblioteki CG-3 | |
64 | Group: Libraries/Python | |
65 | Requires: %{name} = %{version}-%{release} | |
66 | Requires: python3-libs >= 1:3.5 | |
67 | ||
68 | %description -n python3-constraint_grammar | |
69 | Python 3 bindings for CG-3 library. | |
70 | ||
71 | %description -n python3-constraint_grammar -l pl.UTF-8 | |
72 | Wiązania Pythona 3 do biblioteki CG-3. | |
73 | ||
74 | %package -n emacs-cg-mode | |
75 | Summary: CG-3 mode for Emacs | |
76 | Summary(pl.UTF-8): Tryb CG-3 dla Emacsa | |
77 | Group: Applications/Editors/Emacs | |
78 | Requires: emacs-common | |
79 | BuildArch: noarch | |
80 | ||
81 | %description -n emacs-cg-mode | |
82 | CG-3 mode for Emacs. | |
83 | ||
84 | %description -n emacs-cg-mode -l pl.UTF-8 | |
85 | Tryb CG-3 dla Emacsa. | |
86 | ||
87 | %prep | |
88 | %setup -q -n cg3-%{version} | |
89 | %patch0 -p1 | |
90 | ||
91 | # not executable | |
92 | %{__sed} -i -e '1s,.*/usr/bin/env perl,,' scripts/CG3_External.pm | |
93 | # invoke directly | |
94 | %{__sed} -i -e '1s,/usr/bin/env perl,%{__perl},' scripts/{cg-sort,cg-strictify,cg-untrace,cg3-autobin.pl.in} | |
95 | ||
96 | %build | |
97 | # it expectls only relative CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR (see cg.pc) | |
98 | %if %{with static_libs} | |
99 | install -d build-static | |
100 | cd build-static | |
101 | %cmake .. \ | |
102 | -DBUILD_SHARED_LIBS=OFF \ | |
103 | -DCMAKE_INSTALL_INCLUDEDIR=include \ | |
104 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ | |
105 | -DUSE_TCMALLOC=OFF | |
106 | ||
107 | %{__make} | |
108 | cd .. | |
109 | %endif | |
110 | ||
111 | install -d build | |
112 | cd build | |
113 | %cmake .. \ | |
114 | -DCMAKE_INSTALL_INCLUDEDIR=include \ | |
115 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ | |
116 | %{?with_python:-DENABLE_PYTHON_BINDINGS=ON} \ | |
117 | -DPYTHON_INSTALL_PARAMS="--prefix=%{_prefix} --root=$RPM_BUILD_ROOT --optimize=2" \ | |
118 | -DUSE_TCMALLOC=OFF | |
119 | ||
120 | %{__make} | |
121 | ||
122 | %install | |
123 | rm -rf $RPM_BUILD_ROOT | |
124 | ||
125 | %if %{with static_libs} | |
126 | %{__make} -C build-static/src install \ | |
127 | DESTDIR=$RPM_BUILD_ROOT | |
128 | %endif | |
129 | ||
130 | %{__make} -C build install \ | |
131 | DESTDIR=$RPM_BUILD_ROOT | |
132 | ||
133 | %clean | |
134 | rm -rf $RPM_BUILD_ROOT | |
135 | ||
136 | %post -p /sbin/ldconfig | |
137 | %postun -p /sbin/ldconfig | |
138 | ||
139 | %files | |
140 | %defattr(644,root,root,755) | |
141 | %doc AUTHORS ChangeLog README.md TODO | |
142 | %attr(755,root,root) %{_bindir}/cg-annotate | |
143 | %attr(755,root,root) %{_bindir}/cg-comp | |
144 | %attr(755,root,root) %{_bindir}/cg-conv | |
145 | %attr(755,root,root) %{_bindir}/cg-merge-annotations | |
146 | %attr(755,root,root) %{_bindir}/cg-mwesplit | |
147 | %attr(755,root,root) %{_bindir}/cg-proc | |
148 | %attr(755,root,root) %{_bindir}/cg-relabel | |
149 | %attr(755,root,root) %{_bindir}/cg-sort | |
150 | %attr(755,root,root) %{_bindir}/cg-strictify | |
151 | %attr(755,root,root) %{_bindir}/cg-untrace | |
152 | %attr(755,root,root) %{_bindir}/cg3-autobin.pl | |
153 | %attr(755,root,root) %{_bindir}/vislcg3 | |
154 | %attr(755,root,root) %{_libdir}/libcg3.so.1 | |
155 | %{_mandir}/man1/cg-comp.1* | |
156 | %{_mandir}/man1/cg-conv.1* | |
157 | %{_mandir}/man1/cg-proc.1* | |
158 | %{_mandir}/man1/cg-sort.1* | |
159 | %{_mandir}/man1/cg-untrace.1* | |
160 | %{_mandir}/man1/cg3-autobin.pl.1* | |
161 | %{_mandir}/man1/vislcg3.1* | |
162 | ||
163 | %files devel | |
164 | %defattr(644,root,root,755) | |
165 | %attr(755,root,root) %{_libdir}/libcg3.so | |
166 | %{_includedir}/cg3.h | |
167 | %{_pkgconfigdir}/cg3.pc | |
168 | ||
169 | %if %{with static_libs} | |
170 | %files static | |
171 | %defattr(644,root,root,755) | |
172 | %{_libdir}/libcg3.a | |
173 | %endif | |
174 | ||
175 | %if %{with python} | |
176 | %files -n python3-constraint_grammar | |
177 | %defattr(644,root,root,755) | |
178 | %attr(755,root,root) %{py3_sitedir}/_constraint_grammar.cpython-*.so | |
179 | %{py3_sitedir}/cg3.py | |
180 | %{py3_sitedir}/constraint_grammar.py | |
181 | %{py3_sitedir}/__pycache__/cg3.cpython-*.py[co] | |
182 | %{py3_sitedir}/__pycache__/constraint_grammar.cpython-*.py[co] | |
183 | %{py3_sitedir}/constraint_grammar-%{version}.*-py*.egg-info | |
184 | %endif | |
185 | ||
186 | %files -n emacs-cg-mode | |
187 | %defattr(644,root,root,755) | |
188 | %{_datadir}/emacs/site-lisp/cg.el |