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