]>
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 | |
ff6a498d JB |
9 | Version: 1.4.5 |
10 | Release: 1 | |
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 | |
ff6a498d | 15 | # Source0-md5: cbb7cbe0776596f59c5672a3a30219d9 |
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 | 20 | BuildRequires: libicu-devel >= 50.0 |
ff6a498d JB |
21 | # -std=c++17 is minimum |
22 | BuildRequires: libstdc++-devel >= 6:7 | |
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 | |
21d1527a | 79 | BuildArch: noarch |
21d1527a JB |
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 | ||
be300adb | 87 | %prep |
21d1527a | 88 | %setup -q -n cg3-%{version} |
83e4822d | 89 | %patch0 -p1 |
21d1527a JB |
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} | |
de8d4947 | 95 | |
be300adb | 96 | %build |
0d4db9fe | 97 | # it expectls only relative CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_INCLUDEDIR (see cg.pc) |
83e4822d JB |
98 | %if %{with static_libs} |
99 | install -d build-static | |
100 | cd build-static | |
101 | %cmake .. \ | |
102 | -DBUILD_SHARED_LIBS=OFF \ | |
0d4db9fe | 103 | -DCMAKE_INSTALL_INCLUDEDIR=include \ |
83e4822d JB |
104 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ |
105 | -DUSE_TCMALLOC=OFF | |
106 | ||
107 | %{__make} | |
108 | cd .. | |
109 | %endif | |
110 | ||
21d1527a JB |
111 | install -d build |
112 | cd build | |
21d1527a | 113 | %cmake .. \ |
0d4db9fe | 114 | -DCMAKE_INSTALL_INCLUDEDIR=include \ |
bc4b9588 | 115 | -DCMAKE_INSTALL_LIBDIR=%{_lib} \ |
83e4822d JB |
116 | %{?with_python:-DENABLE_PYTHON_BINDINGS=ON} \ |
117 | -DPYTHON_INSTALL_PARAMS="--prefix=%{_prefix} --root=$RPM_BUILD_ROOT --optimize=2" \ | |
21d1527a | 118 | -DUSE_TCMALLOC=OFF |
be300adb JB |
119 | |
120 | %{__make} | |
121 | ||
122 | %install | |
123 | rm -rf $RPM_BUILD_ROOT | |
124 | ||
83e4822d JB |
125 | %if %{with static_libs} |
126 | %{__make} -C build-static/src install \ | |
127 | DESTDIR=$RPM_BUILD_ROOT | |
128 | %endif | |
129 | ||
21d1527a | 130 | %{__make} -C build install \ |
be300adb JB |
131 | DESTDIR=$RPM_BUILD_ROOT |
132 | ||
133 | %clean | |
134 | rm -rf $RPM_BUILD_ROOT | |
135 | ||
bc4b9588 JB |
136 | %post -p /sbin/ldconfig |
137 | %postun -p /sbin/ldconfig | |
138 | ||
be300adb JB |
139 | %files |
140 | %defattr(644,root,root,755) | |
21d1527a | 141 | %doc AUTHORS ChangeLog README.md TODO |
ff6a498d | 142 | %attr(755,root,root) %{_bindir}/cg-annotate |
be300adb JB |
143 | %attr(755,root,root) %{_bindir}/cg-comp |
144 | %attr(755,root,root) %{_bindir}/cg-conv | |
ff6a498d | 145 | %attr(755,root,root) %{_bindir}/cg-merge-annotations |
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* |
b33da769 JB |
158 | %{_mandir}/man1/cg-sort.1* |
159 | %{_mandir}/man1/cg-untrace.1* | |
e16225c3 | 160 | %{_mandir}/man1/cg3-autobin.pl.1* |
be300adb | 161 | %{_mandir}/man1/vislcg3.1* |
bc4b9588 JB |
162 | |
163 | %files devel | |
164 | %defattr(644,root,root,755) | |
e16225c3 | 165 | %attr(755,root,root) %{_libdir}/libcg3.so |
bc4b9588 JB |
166 | %{_includedir}/cg3.h |
167 | %{_pkgconfigdir}/cg3.pc | |
168 | ||
21d1527a | 169 | %if %{with static_libs} |
bc4b9588 JB |
170 | %files static |
171 | %defattr(644,root,root,755) | |
172 | %{_libdir}/libcg3.a | |
21d1527a JB |
173 | %endif |
174 | ||
83e4822d JB |
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 | |
0d4db9fe | 179 | %{py3_sitedir}/cg3.py |
83e4822d | 180 | %{py3_sitedir}/constraint_grammar.py |
0d4db9fe | 181 | %{py3_sitedir}/__pycache__/cg3.cpython-*.py[co] |
83e4822d JB |
182 | %{py3_sitedir}/__pycache__/constraint_grammar.cpython-*.py[co] |
183 | %{py3_sitedir}/constraint_grammar-%{version}.*-py*.egg-info | |
184 | %endif | |
185 | ||
21d1527a JB |
186 | %files -n emacs-cg-mode |
187 | %defattr(644,root,root,755) | |
188 | %{_datadir}/emacs/site-lisp/cg.el |