]> git.pld-linux.org Git - packages/dmtx-utils.git/blob - libdmtx.spec
rename python subpackage to python-pydmtx
[packages/dmtx-utils.git] / libdmtx.spec
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
10 Summary:        Library for working with Data Matrix 2D bar-codes
11 Name:           libdmtx
12 Version:        0.7.2
13 Release:        4
14 License:        LGPL v2+
15 Group:          Libraries
16 Source0:        http://downloads.sourceforge.net/libdmtx/%{name}-%{version}.tar.bz2
17 # Source0-md5:  0684cf3857591e777b57248d652444ae
18 URL:            http://www.libdmtx.org/
19 BuildRequires:  ImageMagick-devel
20 BuildRequires:  pkgconfig
21 BuildRequires:  python-modules
22 BuildRequires:  rpm-pythonprov
23 BuildRequires:  rpmbuild(macros) >= 1.219
24 %if %{with tests}
25 BuildRequires:  OpenGL-GLU-devel
26 BuildRequires:  SDL_image-devel
27 BuildRequires:  libpng-devel
28 %endif
29 %if %{with php}
30 BuildRequires:  %{php_name}-devel
31 %endif
32 %if %{with python}
33 BuildRequires:  python-devel
34 %endif
35 %if %{with ruby}
36 BuildRequires:  ruby
37 BuildRequires:  ruby-devel
38 %endif
39 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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
50 that interact with libdmtx.
51
52 %package devel
53 Summary:        Development files for %{name}
54 Group:          Development/Libraries
55 Requires:       %{name} = %{version}-%{release}
56
57 %description devel
58 The %{name}-devel package contains libraries and header files for
59 developing applications that use %{name}.
60
61 %package utils
62 Summary:        Utilities for %{name}
63 Group:          Applications/System
64 Requires:       %{name} = %{version}-%{release}
65
66 %description utils
67 The %{name}-utils package contains utilities that use %{name}.
68
69 %package -n %{php_name}-dmtx
70 Summary:        PHP bindings for %{name}
71 License:        GPL v2+
72 Group:          Development/Languages/PHP
73 Requires:       %{name} = %{version}-%{release}
74 %{?requires_php_extension}
75 Provides:       php(dmtx) = %{version}
76 Obsoletes:      php-libdmtx < 0.7.2-4
77
78 %description -n %{php_name}-dmtx
79 This package contains bindings for using %{name} from PHP.
80
81 %package -n python-pydmtx
82 Summary:        Python bindings for %{name}
83 Group:          Libraries/Python
84 Requires:       %{name} = %{version}-%{release}
85 Obsoletes:      python-libdmtx < 0.7.2-4
86
87 %description -n python-pydmtx
88 This package contains bindings for using %{name} from Python.
89
90 %package -n ruby-libdmtx
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 \
108         --disable-static
109
110 %{__make}
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
118 cd wrapper
119
120 %if %{with php}
121 cd php
122 phpize
123 %configure \
124         --disable-static \
125
126 %{__make} \
127         EXTRA_CFLAGS="-I$(pwd)/../../tmp%{_includedir}" \
128         DMTX_SHARED_LIBADD="-L$(pwd)/../../tmp%{_libdir} -ldmtx"
129 cd ..
130 %endif
131
132 %if %{with python}
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
136 %{__python} setup.py build
137 chmod 0755 build/lib.*/*.so
138 cd ..
139 %endif
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
155 %if %{with tests}
156 %{__make} check
157 cd test
158 for t in simple unit; do
159         ./${t}_test/${t}_test
160 done
161 %endif
162
163 %install
164 rm -rf $RPM_BUILD_ROOT
165 %{__make} install \
166         DESTDIR=$RPM_BUILD_ROOT
167
168 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libdmtx.la
169
170 cd wrapper
171 %if %{with php}
172 %{__make} -C php install \
173         INSTALL_ROOT=$RPM_BUILD_ROOT
174
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}
183 cd python
184 %{__python} setup.py install \
185         --skip-build \
186         --optimize=2 \
187         --root=$RPM_BUILD_ROOT
188 cd ..
189 %py_postclean
190 %endif
191
192 %if %{with ruby}
193 %{__make} -C ruby install \
194         DESTDIR=$RPM_BUILD_ROOT
195 %endif
196
197 %clean
198 rm -rf $RPM_BUILD_ROOT
199
200 %post   -p /sbin/ldconfig
201 %postun -p /sbin/ldconfig
202
203 %files
204 %defattr(644,root,root,755)
205 %doc AUTHORS COPYING.LESSER ChangeLog KNOWNBUG NEWS README README.linux TODO
206 %attr(755,root,root) %{_libdir}/libdmtx.so.*.*.*
207 %ghost %{_libdir}/libdmtx.so.0
208
209 %files devel
210 %defattr(644,root,root,755)
211 %attr(755,root,root) %{_libdir}/%{name}.so
212 %{_includedir}/dmtx.h
213 %{_pkgconfigdir}/%{name}.pc
214 %{_mandir}/man3/%{name}.3*
215
216 %files utils
217 %defattr(644,root,root,755)
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
227 %defattr(644,root,root,755)
228 %doc COPYING wrapper/php/README
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
232
233 %if %{with python}
234 %files -n python-pydmtx
235 %defattr(644,root,root,755)
236 %doc wrapper/python/README
237 %{py_sitedir}/pydmtx.py[co]
238 %attr(755,root,root) %{py_sitedir}/_pydmtx.so
239 %{py_sitedir}/pydmtx-*.egg-info
240 %endif
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
This page took 0.154736 seconds and 3 git commands to generate.