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