]>
Commit | Line | Data |
---|---|---|
57cb4f83 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without octave # Octave (MATLAB) module | |
634caa8a JB |
4 | %bcond_without python # Python (any) interface |
5 | %bcond_without python2 # Python 2.x interface | |
6 | %bcond_without python3 # Python 3.x interface | |
57cb4f83 | 7 | # |
634caa8a JB |
8 | %if %{without python} |
9 | %undefine with_python2 | |
10 | %undefine with_python3 | |
11 | %endif | |
7a8b61ce JB |
12 | Summary: LIBLINEAR - a Library for Large Linear Classification |
13 | Summary(pl.UTF-8): LIBLINEAR - biblioteka do liniowej klasyfikacji dużych danych | |
14 | Name: liblinear | |
634caa8a | 15 | Version: 2.30 |
5b5bf757 | 16 | Release: 5 |
7a8b61ce JB |
17 | License: BSD |
18 | Group: Libraries | |
634caa8a JB |
19 | Source0: https://www.csie.ntu.edu.tw/~cjlin/liblinear/%{name}-%{version}.tar.gz |
20 | # Source0-md5: 5c807aebd62c3eca72b809d66e1432e8 | |
7a8b61ce JB |
21 | Patch0: %{name}-python.patch |
22 | Patch1: %{name}-make.patch | |
57cb4f83 | 23 | Patch2: %{name}-matlab.patch |
634caa8a | 24 | URL: https://www.csie.ntu.edu.tw/~cjlin/liblinear/ |
7a8b61ce JB |
25 | BuildRequires: blas-devel |
26 | BuildRequires: libstdc++-devel | |
57cb4f83 | 27 | %{?with_octave:BuildRequires: octave-devel} |
634caa8a JB |
28 | %{?with_python2:BuildRequires: python-devel >= 1:2.6} |
29 | %{?with_python3:BuildRequires: python3-devel >= 1:3.2} | |
72dadc9b | 30 | BuildRequires: rpm-pythonprov |
634caa8a | 31 | BuildRequires: rpmbuild(macros) >= 1.507 |
7a8b61ce JB |
32 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
33 | ||
57cb4f83 JB |
34 | %define octave_oct_dir %(octave-config --oct-site-dir) |
35 | ||
7a8b61ce JB |
36 | %description |
37 | LIBLINEAR is a simple package for solving large-scale regularized | |
38 | linear classification and regression. It currently supports: | |
39 | - L2-regularized logistic regression/L2-loss support vector | |
40 | classification/L1-loss support vector classification | |
41 | - L1-regularized L2-loss support vector classification/L1-regularized | |
42 | logistic regression | |
43 | - L2-regularized L2-loss support vector regression/L1-loss support | |
44 | vector regression. | |
45 | ||
46 | %description -l pl.UTF-8 | |
47 | LIBLINEAR to prosty pakiet do rozwiązywania zagadnień regularnej | |
48 | klasyfikacji liniowej i regresji. Obecnie obsługuje: | |
49 | - regresję logistyczną z regularyzacją L2 | |
50 | - regresję logistyczną z regularyzacją L1 | |
51 | - regresję wektorową z regularyzacją L2 | |
52 | ||
53 | %package devel | |
54 | Summary: Header files for LIBLINEAR library | |
55 | Summary(pl.UTF-8): Pliki nagłówkowe biblioteki LIBLINEAR | |
56 | Group: Development/Libraries | |
57 | Requires: %{name} = %{version}-%{release} | |
58 | ||
59 | %description devel | |
60 | Header files for LIBLINEAR library. | |
61 | ||
62 | %description devel -l pl.UTF-8 | |
63 | Pliki nagłówkowe biblioteki LIBLINEAR. | |
64 | ||
57cb4f83 JB |
65 | %package -n octave-liblinear |
66 | Summary: MATLAB/Octave interface for LIBLINEAR library | |
67 | Summary(pl.UTF-8): Interfejs MATLAB-a/Octave do biblioteki LIBLINEAR | |
68 | Group: Libraries | |
69 | Requires: octave | |
70 | ||
71 | %description -n octave-liblinear | |
72 | MATLAB/Octave interface for LIBLINEAR library. | |
73 | ||
74 | %description -n octave-liblinear -l pl.UTF-8 | |
75 | Interfejs MATLAB-a/Octave do biblioteki LIBLINEAR. | |
76 | ||
7a8b61ce | 77 | %package -n python-liblinear |
634caa8a JB |
78 | Summary: Python 2 interface for LIBLINEAR library |
79 | Summary(pl.UTF-8): Interfejs Pythona 2 do biblioteki LIBLINEAR | |
7a8b61ce JB |
80 | Group: Libraries/Python |
81 | Requires: %{name} = %{version}-%{release} | |
72dadc9b | 82 | Requires: python-libs >= 1:2.6 |
85705e92 | 83 | BuildArch: noarch |
7a8b61ce JB |
84 | |
85 | %description -n python-liblinear | |
634caa8a | 86 | Python 2 interface for LIBLINEAR library. |
7a8b61ce JB |
87 | |
88 | %description -n python-liblinear -l pl.UTF-8 | |
634caa8a JB |
89 | Interfejs Pythona 2 do biblioteki LIBLINEAR. |
90 | ||
91 | %package -n python3-liblinear | |
92 | Summary: Python 3 interface for LIBLINEAR library | |
93 | Summary(pl.UTF-8): Interfejs Pythona 3 do biblioteki LIBLINEAR | |
94 | Group: Libraries/Python | |
95 | Requires: %{name} = %{version}-%{release} | |
72dadc9b | 96 | Requires: python3-libs >= 1:3.2 |
85705e92 | 97 | BuildArch: noarch |
634caa8a JB |
98 | |
99 | %description -n python3-liblinear | |
100 | Python 3 interface for LIBLINEAR library. | |
101 | ||
102 | %description -n python3-liblinear -l pl.UTF-8 | |
103 | Interfejs Pythona 3 do biblioteki LIBLINEAR. | |
7a8b61ce JB |
104 | |
105 | %prep | |
106 | %setup -q | |
107 | %patch0 -p1 | |
108 | %patch1 -p1 | |
57cb4f83 | 109 | %patch2 -p1 |
7a8b61ce JB |
110 | |
111 | %build | |
112 | %{__make} \ | |
113 | CC="%{__cc}" \ | |
114 | CXX="%{__cxx}" \ | |
115 | CFLAGS="%{rpmcflags} -fPIC -Wall" \ | |
116 | LIBS="-lblas" | |
117 | ||
57cb4f83 JB |
118 | %if %{with octave} |
119 | %{__make} -C matlab \ | |
120 | CC="%{__cc}" \ | |
121 | CXX="%{__cxx}" \ | |
122 | CFLAGS="%{rpmcflags} -fPIC -I.. -I/usr/include/octave -Wall" \ | |
123 | MEX=mkoctfile \ | |
124 | MEX_OPTION=--mex \ | |
125 | MEX_EXT=mex | |
126 | %endif | |
127 | ||
7a8b61ce JB |
128 | %install |
129 | rm -rf $RPM_BUILD_ROOT | |
634caa8a | 130 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_libdir},%{_includedir}} |
7a8b61ce JB |
131 | |
132 | install liblinear.so.* $RPM_BUILD_ROOT%{_libdir} | |
133 | ln -sf $(basename $RPM_BUILD_ROOT%{_libdir}/liblinear.so.*) $RPM_BUILD_ROOT%{_libdir}/liblinear.so | |
134 | cp -p linear.h tron.h $RPM_BUILD_ROOT%{_includedir} | |
135 | install train $RPM_BUILD_ROOT%{_bindir}/liblinear-train | |
136 | install predict $RPM_BUILD_ROOT%{_bindir}/liblinear-predict | |
7a8b61ce | 137 | |
57cb4f83 JB |
138 | %if %{with octave} |
139 | install -d $RPM_BUILD_ROOT%{octave_oct_dir}/liblinear | |
140 | install matlab/*.mex $RPM_BUILD_ROOT%{octave_oct_dir}/liblinear | |
141 | %endif | |
142 | ||
634caa8a JB |
143 | %if %{with python2} |
144 | install -d $RPM_BUILD_ROOT%{py_sitescriptdir} | |
145 | cp -p python/*.py $RPM_BUILD_ROOT%{py_sitescriptdir} | |
146 | ||
147 | %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
148 | %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
149 | %py_postclean | |
150 | %endif | |
151 | ||
152 | %if %{with python3} | |
153 | install -d $RPM_BUILD_ROOT%{py3_sitescriptdir} | |
154 | cp -p python/*.py $RPM_BUILD_ROOT%{py3_sitescriptdir} | |
155 | ||
156 | %py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir} | |
157 | %py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir} | |
158 | %endif | |
159 | ||
7a8b61ce JB |
160 | %clean |
161 | rm -rf $RPM_BUILD_ROOT | |
162 | ||
163 | %post -p /sbin/ldconfig | |
164 | %postun -p /sbin/ldconfig | |
165 | ||
166 | %files | |
167 | %defattr(644,root,root,755) | |
168 | %doc COPYRIGHT README | |
169 | %attr(755,root,root) %{_bindir}/liblinear-predict | |
170 | %attr(755,root,root) %{_bindir}/liblinear-train | |
171 | %attr(755,root,root) %{_libdir}/liblinear.so.3 | |
172 | ||
173 | %files devel | |
174 | %defattr(644,root,root,755) | |
175 | %attr(755,root,root) %{_libdir}/liblinear.so | |
176 | %{_includedir}/linear.h | |
177 | %{_includedir}/tron.h | |
178 | ||
57cb4f83 JB |
179 | %if %{with octave} |
180 | %files -n octave-liblinear | |
181 | %defattr(644,root,root,755) | |
182 | %dir %{octave_oct_dir}/liblinear | |
183 | %attr(755,root,root) %{octave_oct_dir}/liblinear/libsvmread.mex | |
184 | %attr(755,root,root) %{octave_oct_dir}/liblinear/libsvmwrite.mex | |
185 | %attr(755,root,root) %{octave_oct_dir}/liblinear/predict.mex | |
186 | %attr(755,root,root) %{octave_oct_dir}/liblinear/train.mex | |
187 | %endif | |
188 | ||
634caa8a | 189 | %if %{with python2} |
7a8b61ce JB |
190 | %files -n python-liblinear |
191 | %defattr(644,root,root,755) | |
72dadc9b | 192 | %doc python/README |
634caa8a JB |
193 | %{py_sitescriptdir}/commonutil.py[co] |
194 | %{py_sitescriptdir}/liblinear.py[co] | |
195 | %{py_sitescriptdir}/liblinearutil.py[co] | |
196 | %endif | |
197 | ||
198 | %if %{with python3} | |
199 | %files -n python3-liblinear | |
200 | %defattr(644,root,root,755) | |
72dadc9b | 201 | %doc python/README |
634caa8a JB |
202 | %{py3_sitescriptdir}/commonutil.py |
203 | %{py3_sitescriptdir}/liblinear.py | |
204 | %{py3_sitescriptdir}/liblinearutil.py | |
205 | %{py3_sitescriptdir}/__pycache__/commonutil.cpython-*.py[co] | |
206 | %{py3_sitescriptdir}/__pycache__/liblinear.cpython-*.py[co] | |
207 | %{py3_sitescriptdir}/__pycache__/liblinearutil.cpython-*.py[co] | |
208 | %endif |