]>
Commit | Line | Data |
---|---|---|
bd7d2349 ER |
1 | # TODO |
2 | # - java bindings | |
c4c0fd5e ER |
3 | # - .Net bindings |
4 | # - vala bindings | |
5 | # - ruby bindings | |
bd7d2349 ER |
6 | # |
7 | # Conditional build: | |
8 | %bcond_with ruby # build Ruby bindings | |
9 | %bcond_without python # build Python2 bindings | |
10 | %bcond_without php # build PHP bindings | |
11 | %bcond_without tests # build without tests | |
12 | ||
abc44f29 AM |
13 | Summary: Library for working with Data Matrix 2D bar-codes |
14 | Name: libdmtx | |
15 | Version: 0.7.2 | |
ac380f8a | 16 | Release: 5 |
abc44f29 AM |
17 | License: LGPL v2+ |
18 | Group: Libraries | |
abc44f29 AM |
19 | Source0: http://downloads.sourceforge.net/libdmtx/%{name}-%{version}.tar.bz2 |
20 | # Source0-md5: 0684cf3857591e777b57248d652444ae | |
bd7d2349 | 21 | URL: http://www.libdmtx.org/ |
abc44f29 | 22 | BuildRequires: ImageMagick-devel |
1aaa332f | 23 | BuildRequires: pkgconfig |
24 | BuildRequires: python-modules | |
25 | BuildRequires: rpm-pythonprov | |
bd7d2349 ER |
26 | BuildRequires: rpmbuild(macros) >= 1.219 |
27 | %if %{with tests} | |
abc44f29 AM |
28 | BuildRequires: OpenGL-GLU-devel |
29 | BuildRequires: SDL_image-devel | |
30 | BuildRequires: libpng-devel | |
bd7d2349 ER |
31 | %endif |
32 | %if %{with php} | |
33 | BuildRequires: %{php_name}-devel | |
34 | %endif | |
35 | %if %{with python} | |
abc44f29 | 36 | BuildRequires: python-devel |
bd7d2349 | 37 | %endif |
abc44f29 AM |
38 | %if %{with ruby} |
39 | BuildRequires: ruby | |
40 | BuildRequires: ruby-devel | |
41 | %endif | |
bd7d2349 | 42 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
abc44f29 AM |
43 | |
44 | %description | |
45 | libdmtx is open source software for reading and writing Data Matrix 2D | |
46 | bar-codes on Linux, Unix, OS X, Windows, and mobile devices. At its | |
47 | core libdmtx is a shared library, allowing C/C++ programs to use its | |
48 | capabilities without restrictions or overhead. | |
49 | ||
50 | The included utility programs, dmtxread and dmtxwrite, provide the | |
51 | official interface to libdmtx from the command line, and also serve as | |
52 | a good reference for programmers who wish to write their own programs | |
bd7d2349 | 53 | that interact with libdmtx. |
abc44f29 | 54 | |
bd7d2349 | 55 | %package devel |
abc44f29 AM |
56 | Summary: Development files for %{name} |
57 | Group: Development/Libraries | |
58 | Requires: %{name} = %{version}-%{release} | |
59 | ||
bd7d2349 | 60 | %description devel |
abc44f29 AM |
61 | The %{name}-devel package contains libraries and header files for |
62 | developing applications that use %{name}. | |
63 | ||
bd7d2349 | 64 | %package utils |
abc44f29 AM |
65 | Summary: Utilities for %{name} |
66 | Group: Applications/System | |
67 | Requires: %{name} = %{version}-%{release} | |
68 | ||
bd7d2349 | 69 | %description utils |
abc44f29 AM |
70 | The %{name}-utils package contains utilities that use %{name}. |
71 | ||
bd7d2349 | 72 | %package -n %{php_name}-dmtx |
abc44f29 AM |
73 | Summary: PHP bindings for %{name} |
74 | License: GPL v2+ | |
bd7d2349 | 75 | Group: Development/Languages/PHP |
abc44f29 | 76 | Requires: %{name} = %{version}-%{release} |
bd7d2349 ER |
77 | %{?requires_php_extension} |
78 | Provides: php(dmtx) = %{version} | |
79 | Obsoletes: php-libdmtx < 0.7.2-4 | |
abc44f29 | 80 | |
bd7d2349 ER |
81 | %description -n %{php_name}-dmtx |
82 | This package contains bindings for using %{name} from PHP. | |
abc44f29 | 83 | |
f498c99a | 84 | %package -n python-pydmtx |
abc44f29 | 85 | Summary: Python bindings for %{name} |
bd7d2349 | 86 | Group: Libraries/Python |
abc44f29 | 87 | Requires: %{name} = %{version}-%{release} |
f498c99a | 88 | Obsoletes: python-libdmtx < 0.7.2-4 |
abc44f29 | 89 | |
f498c99a ER |
90 | %description -n python-pydmtx |
91 | This package contains bindings for using %{name} from Python. | |
abc44f29 | 92 | |
bd7d2349 | 93 | %package -n ruby-libdmtx |
abc44f29 AM |
94 | Summary: Ruby bindings for %{name} |
95 | Group: Libraries | |
96 | Requires: %{name} = %{version}-%{release} | |
97 | Provides: ruby(%{name}) = %{version} | |
98 | ||
99 | %description -n ruby-libdmtx | |
100 | The ruby-%{name} package contains bindings for using %{name} from | |
101 | Ruby. | |
102 | ||
103 | %prep | |
104 | %setup -q | |
105 | ||
106 | # fix permissions | |
107 | chmod a-x wrapper/{php,python}/README | |
108 | ||
109 | %build | |
110 | %configure \ | |
bd7d2349 | 111 | --disable-static |
abc44f29 | 112 | |
bd7d2349 | 113 | %{__make} |
abc44f29 AM |
114 | |
115 | # temporary installation required by the language wrappers | |
116 | install -d tmp | |
117 | %{__make} install \ | |
118 | DESTDIR=$(pwd)/tmp | |
119 | ||
120 | # language wrappers must be built separately | |
bd7d2349 ER |
121 | cd wrapper |
122 | ||
123 | %if %{with php} | |
124 | cd php | |
abc44f29 AM |
125 | phpize |
126 | %configure \ | |
127 | --disable-static \ | |
128 | ||
abc44f29 AM |
129 | %{__make} \ |
130 | EXTRA_CFLAGS="-I$(pwd)/../../tmp%{_includedir}" \ | |
131 | DMTX_SHARED_LIBADD="-L$(pwd)/../../tmp%{_libdir} -ldmtx" | |
132 | cd .. | |
bd7d2349 | 133 | %endif |
abc44f29 | 134 | |
bd7d2349 | 135 | %if %{with python} |
abc44f29 AM |
136 | cd python |
137 | # fix paths | |
138 | sed -i.orig -e "s|%{_prefix}/local/include|$(pwd)/../../tmp%{_includedir}|" -e "s|%{_prefix}/local/lib|$(pwd)/../../tmp%{_libdir}|" setup.py | |
bd7d2349 | 139 | %{__python} setup.py build |
abc44f29 AM |
140 | chmod 0755 build/lib.*/*.so |
141 | cd .. | |
bd7d2349 | 142 | %endif |
abc44f29 AM |
143 | |
144 | %if %{with ruby} | |
145 | cd ruby | |
146 | ruby extconf.rb | |
147 | %{__make} \ | |
148 | CPPFLAGS="-I$(pwd)/../../tmp%{_includedir}" \ | |
149 | LIBPATH="-L$(pwd)/../../tmp%{_libdir} -ldmtx" | |
150 | cd .. | |
151 | %endif | |
152 | ||
153 | #cd java | |
154 | #make LIBDMTX_LA="/tmp%{_libdir}/libdmtx.so" | |
155 | #cd .. | |
156 | cd .. | |
157 | ||
bd7d2349 | 158 | %if %{with tests} |
abc44f29 AM |
159 | %{__make} check |
160 | cd test | |
bd7d2349 | 161 | for t in simple unit; do |
abc44f29 AM |
162 | ./${t}_test/${t}_test |
163 | done | |
164 | %endif | |
165 | ||
166 | %install | |
167 | rm -rf $RPM_BUILD_ROOT | |
abc44f29 AM |
168 | %{__make} install \ |
169 | DESTDIR=$RPM_BUILD_ROOT | |
170 | ||
bd7d2349 | 171 | %{__rm} $RPM_BUILD_ROOT%{_libdir}/libdmtx.la |
abc44f29 AM |
172 | |
173 | cd wrapper | |
bd7d2349 | 174 | %if %{with php} |
abc44f29 AM |
175 | %{__make} -C php install \ |
176 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
177 | ||
bd7d2349 ER |
178 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d |
179 | cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/dmtx.ini | |
180 | ; Enable dmtx extension module | |
181 | extension=dmtx.so | |
182 | EOF | |
183 | %endif | |
184 | ||
185 | %if %{with python} | |
abc44f29 | 186 | cd python |
bd7d2349 ER |
187 | %{__python} setup.py install \ |
188 | --skip-build \ | |
189 | --optimize=2 \ | |
190 | --root=$RPM_BUILD_ROOT | |
abc44f29 | 191 | cd .. |
bd7d2349 ER |
192 | %py_postclean |
193 | %endif | |
abc44f29 AM |
194 | |
195 | %if %{with ruby} | |
196 | %{__make} -C ruby install \ | |
197 | DESTDIR=$RPM_BUILD_ROOT | |
198 | %endif | |
199 | ||
abc44f29 AM |
200 | %clean |
201 | rm -rf $RPM_BUILD_ROOT | |
202 | ||
bd7d2349 ER |
203 | %post -p /sbin/ldconfig |
204 | %postun -p /sbin/ldconfig | |
abc44f29 AM |
205 | |
206 | %files | |
207 | %defattr(644,root,root,755) | |
208 | %doc AUTHORS COPYING.LESSER ChangeLog KNOWNBUG NEWS README README.linux TODO | |
bd7d2349 ER |
209 | %attr(755,root,root) %{_libdir}/libdmtx.so.*.*.* |
210 | %ghost %{_libdir}/libdmtx.so.0 | |
abc44f29 AM |
211 | |
212 | %files devel | |
213 | %defattr(644,root,root,755) | |
abc44f29 | 214 | %attr(755,root,root) %{_libdir}/%{name}.so |
bd7d2349 | 215 | %{_includedir}/dmtx.h |
abc44f29 AM |
216 | %{_pkgconfigdir}/%{name}.pc |
217 | %{_mandir}/man3/%{name}.3* | |
218 | ||
219 | %files utils | |
220 | %defattr(644,root,root,755) | |
bd7d2349 ER |
221 | %attr(755,root,root) %{_bindir}/dmtxquery |
222 | %attr(755,root,root) %{_bindir}/dmtxread | |
223 | %attr(755,root,root) %{_bindir}/dmtxwrite | |
224 | %{_mandir}/man1/dmtxquery.1* | |
225 | %{_mandir}/man1/dmtxread.1* | |
226 | %{_mandir}/man1/dmtxwrite.1* | |
227 | ||
228 | %if %{with php} | |
229 | %files -n %{php_name}-dmtx | |
abc44f29 AM |
230 | %defattr(644,root,root,755) |
231 | %doc COPYING wrapper/php/README | |
bd7d2349 ER |
232 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/dmtx.ini |
233 | %attr(755,root,root) %{php_extensiondir}/dmtx.so | |
234 | %endif | |
abc44f29 | 235 | |
bd7d2349 | 236 | %if %{with python} |
f498c99a | 237 | %files -n python-pydmtx |
abc44f29 AM |
238 | %defattr(644,root,root,755) |
239 | %doc wrapper/python/README | |
bd7d2349 ER |
240 | %{py_sitedir}/pydmtx.py[co] |
241 | %attr(755,root,root) %{py_sitedir}/_pydmtx.so | |
242 | %{py_sitedir}/pydmtx-*.egg-info | |
243 | %endif | |
abc44f29 AM |
244 | |
245 | %if %{with ruby} | |
246 | %files -n ruby-libdmtx | |
247 | %defattr(644,root,root,755) | |
248 | %doc wrapper/ruby/README | |
249 | %attr(755,root,root) %{ruby_sitearchdir}/*.so | |
250 | %endif |