]>
Commit | Line | Data |
---|---|---|
21d1527a JB |
1 | # |
2 | # Conditional build: | |
83e4822d | 3 | %bcond_without python # Python(3) binding |
21d1527a JB |
4 | %bcond_without static_libs # static library |
5 | ||
be300adb JB |
6 | Summary: VISL CG-3 constraint grammar system |
7 | Summary(pl.UTF-8): VISL CG-3 - system ograniczonej gramatyki | |
8 | Name: vislcg3 | |
0d4db9fe | 9 | Version: 1.3.1 |
1a66a384 | 10 | Release: 2 |
be300adb JB |
11 | License: GPL v3+ |
12 | Group: Applications/Text | |
21d1527a JB |
13 | #Source0Download: https://github.com/TinoDidriksen/cg3/releases |
14 | Source0: https://github.com/TinoDidriksen/cg3/archive/v%{version}/cg3-%{version}.tar.gz | |
0d4db9fe | 15 | # Source0-md5: a5b608f4ee7e5d7427b360ef22d58348 |
83e4822d | 16 | Patch0: %{name}-static.patch |
be300adb | 17 | URL: http://beta.visl.sdu.dk/cg3.html |
83e4822d | 18 | BuildRequires: cmake >= 3.0 |
38b1de1f | 19 | BuildRequires: boost-devel >= 1.63.0-4 |
21d1527a JB |
20 | BuildRequires: libicu-devel >= 50.0 |
21 | # -std=c++14 | |
22 | BuildRequires: libstdc++-devel >= 6:5.0 | |
83e4822d | 23 | BuildRequires: rpmbuild(macros) >= 1.714 |
bc4b9588 | 24 | BuildRequires: sed >= 4.0 |
83e4822d JB |
25 | %if %{with python} |
26 | BuildRequires: python3-devel >= 1:3.5 | |
27 | BuildRequires: swig-python >= 3.0 | |
28 | %endif | |
be300adb JB |
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 | ||
bc4b9588 JB |
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 | ||
83e4822d JB |
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 | ||
21d1527a JB |
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 | ||
be300adb | 89 | %prep |
21d1527a | 90 | %setup -q -n cg3-%{version} |
83e4822d | 91 | %patch0 -p1 |
21d1527a JB |
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} | |
de8d4947 | 97 | |
be300adb | 98 | %build |
0d4db9fe | 99 | # it expectls only relative CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR (see cg.pc) |
83e4822d JB |
100 | %if %{with static_libs} |
101 | install -d build-static | |
102 | cd build-static | |
103 | %cmake .. \ | |
104 | -DBUILD_SHARED_LIBS=OFF \ | |
0d4db9fe | 105 | -DCMAKE_INSTALL_INCLUDEDIR=include \ |
83e4822d JB |
106 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ |
107 | -DUSE_TCMALLOC=OFF | |
108 | ||
109 | %{__make} | |
110 | cd .. | |
111 | %endif | |
112 | ||
21d1527a JB |
113 | install -d build |
114 | cd build | |
21d1527a | 115 | %cmake .. \ |
0d4db9fe | 116 | -DCMAKE_INSTALL_INCLUDEDIR=include \ |
bc4b9588 | 117 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ |
83e4822d JB |
118 | %{?with_python:-DENABLE_PYTHON_BINDINGS=ON} \ |
119 | -DPYTHON_INSTALL_PARAMS="--prefix=%{_prefix} --root=$RPM_BUILD_ROOT --optimize=2" \ | |
21d1527a | 120 | -DUSE_TCMALLOC=OFF |
be300adb JB |
121 | |
122 | %{__make} | |
123 | ||
124 | %install | |
125 | rm -rf $RPM_BUILD_ROOT | |
126 | ||
83e4822d JB |
127 | %if %{with static_libs} |
128 | %{__make} -C build-static/src install \ | |
129 | DESTDIR=$RPM_BUILD_ROOT | |
130 | %endif | |
131 | ||
21d1527a | 132 | %{__make} -C build install \ |
be300adb JB |
133 | DESTDIR=$RPM_BUILD_ROOT |
134 | ||
135 | %clean | |
136 | rm -rf $RPM_BUILD_ROOT | |
137 | ||
bc4b9588 JB |
138 | %post -p /sbin/ldconfig |
139 | %postun -p /sbin/ldconfig | |
140 | ||
be300adb JB |
141 | %files |
142 | %defattr(644,root,root,755) | |
21d1527a | 143 | %doc AUTHORS ChangeLog README.md TODO |
be300adb JB |
144 | %attr(755,root,root) %{_bindir}/cg-comp |
145 | %attr(755,root,root) %{_bindir}/cg-conv | |
21d1527a | 146 | %attr(755,root,root) %{_bindir}/cg-mwesplit |
be300adb | 147 | %attr(755,root,root) %{_bindir}/cg-proc |
21d1527a JB |
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 | |
adc38418 | 152 | %attr(755,root,root) %{_bindir}/cg3-autobin.pl |
be300adb | 153 | %attr(755,root,root) %{_bindir}/vislcg3 |
21d1527a | 154 | %attr(755,root,root) %{_libdir}/libcg3.so.1 |
be300adb | 155 | %{_mandir}/man1/cg-comp.1* |
e16225c3 | 156 | %{_mandir}/man1/cg-conv.1* |
be300adb | 157 | %{_mandir}/man1/cg-proc.1* |
e16225c3 | 158 | %{_mandir}/man1/cg3-autobin.pl.1* |
be300adb | 159 | %{_mandir}/man1/vislcg3.1* |
bc4b9588 JB |
160 | |
161 | %files devel | |
162 | %defattr(644,root,root,755) | |
e16225c3 | 163 | %attr(755,root,root) %{_libdir}/libcg3.so |
bc4b9588 JB |
164 | %{_includedir}/cg3.h |
165 | %{_pkgconfigdir}/cg3.pc | |
166 | ||
21d1527a | 167 | %if %{with static_libs} |
bc4b9588 JB |
168 | %files static |
169 | %defattr(644,root,root,755) | |
170 | %{_libdir}/libcg3.a | |
21d1527a JB |
171 | %endif |
172 | ||
83e4822d JB |
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 | |
0d4db9fe | 177 | %{py3_sitedir}/cg3.py |
83e4822d | 178 | %{py3_sitedir}/constraint_grammar.py |
0d4db9fe | 179 | %{py3_sitedir}/__pycache__/cg3.cpython-*.py[co] |
83e4822d JB |
180 | %{py3_sitedir}/__pycache__/constraint_grammar.cpython-*.py[co] |
181 | %{py3_sitedir}/constraint_grammar-%{version}.*-py*.egg-info | |
182 | %endif | |
183 | ||
21d1527a JB |
184 | %files -n emacs-cg-mode |
185 | %defattr(644,root,root,755) | |
186 | %{_datadir}/emacs/site-lisp/cg.el |