]>
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.3.1 | |
10 | Release: 2 | |
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: a5b608f4ee7e5d7427b360ef22d58348 | |
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++14 | |
22 | BuildRequires: libstdc++-devel >= 6:5.0 | |
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 | %if "%{_rpmversion}" >= "5" | |
80 | BuildArch: noarch | |
81 | %endif | |
82 | ||
83 | %description -n emacs-cg-mode | |
84 | CG-3 mode for Emacs. | |
85 | ||
86 | %description -n emacs-cg-mode -l pl.UTF-8 | |
87 | Tryb CG-3 dla Emacsa. | |
88 | ||
89 | %prep | |
90 | %setup -q -n cg3-%{version} | |
91 | %patch0 -p1 | |
92 | ||
93 | # not executable | |
94 | %{__sed} -i -e '1s,.*/usr/bin/env perl,,' scripts/CG3_External.pm | |
95 | # invoke directly | |
96 | %{__sed} -i -e '1s,/usr/bin/env perl,%{__perl},' scripts/{cg-sort,cg-strictify,cg-untrace,cg3-autobin.pl.in} | |
97 | ||
98 | %build | |
99 | # it expectls only relative CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR (see cg.pc) | |
100 | %if %{with static_libs} | |
101 | install -d build-static | |
102 | cd build-static | |
103 | %cmake .. \ | |
104 | -DBUILD_SHARED_LIBS=OFF \ | |
105 | -DCMAKE_INSTALL_INCLUDEDIR=include \ | |
106 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ | |
107 | -DUSE_TCMALLOC=OFF | |
108 | ||
109 | %{__make} | |
110 | cd .. | |
111 | %endif | |
112 | ||
113 | install -d build | |
114 | cd build | |
115 | %cmake .. \ | |
116 | -DCMAKE_INSTALL_INCLUDEDIR=include \ | |
117 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ | |
118 | %{?with_python:-DENABLE_PYTHON_BINDINGS=ON} \ | |
119 | -DPYTHON_INSTALL_PARAMS="--prefix=%{_prefix} --root=$RPM_BUILD_ROOT --optimize=2" \ | |
120 | -DUSE_TCMALLOC=OFF | |
121 | ||
122 | %{__make} | |
123 | ||
124 | %install | |
125 | rm -rf $RPM_BUILD_ROOT | |
126 | ||
127 | %if %{with static_libs} | |
128 | %{__make} -C build-static/src install \ | |
129 | DESTDIR=$RPM_BUILD_ROOT | |
130 | %endif | |
131 | ||
132 | %{__make} -C build install \ | |
133 | DESTDIR=$RPM_BUILD_ROOT | |
134 | ||
135 | %clean | |
136 | rm -rf $RPM_BUILD_ROOT | |
137 | ||
138 | %post -p /sbin/ldconfig | |
139 | %postun -p /sbin/ldconfig | |
140 | ||
141 | %files | |
142 | %defattr(644,root,root,755) | |
143 | %doc AUTHORS ChangeLog README.md TODO | |
144 | %attr(755,root,root) %{_bindir}/cg-comp | |
145 | %attr(755,root,root) %{_bindir}/cg-conv | |
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/cg3-autobin.pl.1* | |
159 | %{_mandir}/man1/vislcg3.1* | |
160 | ||
161 | %files devel | |
162 | %defattr(644,root,root,755) | |
163 | %attr(755,root,root) %{_libdir}/libcg3.so | |
164 | %{_includedir}/cg3.h | |
165 | %{_pkgconfigdir}/cg3.pc | |
166 | ||
167 | %if %{with static_libs} | |
168 | %files static | |
169 | %defattr(644,root,root,755) | |
170 | %{_libdir}/libcg3.a | |
171 | %endif | |
172 | ||
173 | %if %{with python} | |
174 | %files -n python3-constraint_grammar | |
175 | %defattr(644,root,root,755) | |
176 | %attr(755,root,root) %{py3_sitedir}/_constraint_grammar.cpython-*.so | |
177 | %{py3_sitedir}/cg3.py | |
178 | %{py3_sitedir}/constraint_grammar.py | |
179 | %{py3_sitedir}/__pycache__/cg3.cpython-*.py[co] | |
180 | %{py3_sitedir}/__pycache__/constraint_grammar.cpython-*.py[co] | |
181 | %{py3_sitedir}/constraint_grammar-%{version}.*-py*.egg-info | |
182 | %endif | |
183 | ||
184 | %files -n emacs-cg-mode | |
185 | %defattr(644,root,root,755) | |
186 | %{_datadir}/emacs/site-lisp/cg.el |