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