Merge remote-tracking branch 'pootle/master'
[gammu.git] / gammu.spec
blob0898dc19fbc19b71ca1f2ba1a984d538806abcd3
1 Name: gammu
2 Version: 1.30.90
3 Release: 1
4 # Set to 0 to disable bluetooth support
5 %if 0%{?opensuse_bs} && 0%{?sles_version} == 9
6 %define bluetooth 0
7 %else
8 %define bluetooth 1
9 %endif
10 # Set to 0 to disable PostgreSQL support
11 %define pqsql 1
12 # Set to 0 to disable MySQL support
13 %define mysql 1
14 # Set to 0 to disable DBI support
15 %define dbi 1
16 # Set to 0 to disable ODBC support
17 %define odbc 1
18 # Set to 0 to disable USB support
19 %define usb 1
20 # Change if using tar.gz sources
21 %define extension bz2
23 # Python name
24 %{!?__python: %define __python python}
25 %define g_python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
26 %define g_python_major_version %(%{__python} -c 'import sys; print sys.version.split(" ")[0][:3]')
28 %if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel}
29 %define gammu_docdir %_docdir/%{name}-%{version}
30 %else
31 %define gammu_docdir %_docdir/%{name}
32 %endif
34 Summary: Mobile phone management utility
35 License: GPLv2
36 %if 0%{?suse_version}
37 Group: Hardware/Mobile
38 %else
39 Group: Applications/Communications
40 %endif
41 Vendor: Michal Čihař <michal@cihar.com>
43 # Detect build requires, I really hate this crap
45 # SUSE
46 %if 0%{?suse_version}
48 %define dist_usb_libs libusb-1_0-devel
49 %define dist_dbi_libs libdbi-devel libdbi-drivers-dbd-sqlite3 sqlite
51 # 11.1 changed name of devel package for Bluetooth
52 %if 0%{?suse_version} >= 1110
53 %define dist_bluez_libs bluez-devel
54 %else
55 %define dist_bluez_libs bluez-libs >= 2.0
56 %endif
58 %define dist_postgres_libs postgresql-devel
60 %else
62 # Mandriva
63 %if 0%{?mandriva_version}
65 %define dist_usb_libs libusb-1.0-devel
66 %define dist_dbi_libs libdbi-devel libdbi-drivers-dbd-sqlite3 sqlite3-tools
68 # 64-bit Mandriva has 64 in package name
69 %ifarch x86_64
70 %define mandriva_hack 64
71 %endif
73 # Bluetooth things got renamed several times
74 %if 0%{?mandriva_version} > 2007
75 %define dist_bluez_libs lib%{?mandriva_hack}bluez-devel
76 %else
77 %if 0%{?mandriva_version} > 2006
78 %define dist_bluez_libs lib%{?mandriva_hack}bluez2-devel
79 %else
80 %define dist_bluez_libs libbluez1-devel >= 2.0
81 %endif
82 %endif
84 # postgresql-devel does not work for whatever reason in buildservice
85 %if 0%{?mandriva_version} == 2009
86 %define dist_postgres_libs postgresql8.3-devel
87 %else
88 %define dist_postgres_libs postgresql-devel
89 %endif
91 %else
93 # Fedora / Redhat / Centos
94 %if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel}
96 %define dist_usb_libs libusb1-devel
97 %define dist_dbi_libs libdbi-devel libdbi-dbd-sqlite sqlite
98 %define dist_bluez_libs bluez-libs-devel >= 2.0
99 %define dist_postgres_libs postgresql-devel
101 %else
103 #Defaults for not know distributions
104 %define dist_usb_libs libusb1-devel
105 %define dist_dbi_libs libdbi-devel libdbi-dbd-sqlite sqlite
106 %define dist_bluez_libs bluez-libs-devel >= 2.0
107 %define dist_postgres_libs postgresql-devel
109 %endif
110 %endif
111 %endif
113 %if %bluetooth
114 BuildRequires: %{dist_bluez_libs}
115 %endif
117 %if pqsql
118 BuildRequires: %{dist_postgres_libs}
119 %endif
121 %if %mysql
122 BuildRequires: mysql-devel
123 %endif
125 %if %dbi
126 BuildRequires: %{dist_dbi_libs}
127 %endif
129 %if %odbc
130 BuildRequires: unixODBC-devel
131 %endif
133 BuildRequires: libgudev-1_0-devel glib2-devel
135 BuildRequires: python-devel
137 %if 0%{?centos_version} || 0%{?rhel_version} || 0%{?rhel} || 0%{?suse_version} < 1100
138 BuildRequires: curl-devel
139 %else
140 BuildRequires: libcurl-devel
141 %endif
143 %if %usb
144 BuildRequires: %{dist_usb_libs}
145 %endif
147 BuildRequires: gettext cmake pkgconfig gcc
149 Source: http://dl.cihar.com/gammu/releases/gammu-%{version}.tar.%{extension}
150 URL: http://wammu.eu/gammu/
151 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
153 %description
154 Gammu is command line utility and library to work with mobile phones
155 from many vendors. Support for different models differs, but basic
156 functions should work with majority of them. Program can work with
157 contacts, messages (SMS, EMS and MMS), calendar, todos, filesystem,
158 integrated radio, camera, etc. It also supports daemon mode to send and
159 receive SMSes.
161 Currently supported phones include:
163 * Many Nokia models.
164 * Alcatel BE5 (501/701), BF5 (715), BH4 (535/735).
165 * AT capable phones (Siemens, Nokia, Alcatel, IPAQ).
166 * OBEX and IrMC capable phones (Sony-Ericsson, Motorola).
167 * Symbian phones through gnapplet.
169 This package contains Gammu binary as well as some examples.
171 %package devel
172 License: GPL v2
173 Summary: Development files for Gammu
174 %if 0%{?suse_version}
175 Group: Development/Libraries/C and C++
176 %else
177 Group: Development/Libraries
178 %endif
179 Requires: %{name} = %{version}-%{release} pkgconfig
181 %description devel
182 Gammu is command line utility and library to work with mobile phones
183 from many vendors. Support for different models differs, but basic
184 functions should work with majority of them. Program can work with
185 contacts, messages (SMS, EMS and MMS), calendar, todos, filesystem,
186 integrated radio, camera, etc. It also supports daemon mode to send and
187 receive SMSes.
189 Currently supported phones include:
191 * Many Nokia models.
192 * Alcatel BE5 (501/701), BF5 (715), BH4 (535/735).
193 * AT capable phones (Siemens, Nokia, Alcatel, IPAQ).
194 * OBEX and IrMC capable phones (Sony-Ericsson, Motorola).
195 * Symbian phones through gnapplet.
197 This package contain files needed for development.
199 %package -n python-gammu
200 License: GPL v2
201 Summary: Python module to communicate with mobile phones
202 %if 0%{?suse_version}
203 Group: Development/Libraries/Python
204 %else
205 Group: Development/Languages
206 %endif
207 Requires: python >= %{g_python_major_version}, python < %{g_python_major_version}.99
208 %{?py_requires}
210 %description -n python-gammu
211 This provides gammu module, that can work with any phone Gammu
212 supports - many Nokias, Siemens, Alcatel, ...
214 %package smsd
215 Summary: SMS message daemon
216 %if 0%{?suse_version}
217 PreReq: %insserv_prereq %fillup_prereq
218 %endif
219 %if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel}
220 Requires(post): chkconfig
221 Requires(preun): chkconfig
222 Requires(preun): initscripts
223 %endif
224 %if 0%{?suse_version}
225 Group: Hardware/Mobile
226 %else
227 Group: Applications/Communications
228 %endif
230 %description smsd
231 Gammu is command line utility and library to work with mobile phones
232 from many vendors. Support for different models differs, but basic
233 functions should work with majority of them. Program can work with
234 contacts, messages (SMS, EMS and MMS), calendar, todos, filesystem,
235 integrated radio, camera, etc. It also supports daemon mode to send and
236 receive SMSes.
238 Currently supported phones include:
240 * Many Nokia models.
241 * Alcatel BE5 (501/701), BF5 (715), BH4 (535/735).
242 * AT capable phones (Siemens, Nokia, Alcatel, IPAQ).
243 * OBEX and IrMC capable phones (Sony-Ericsson, Motorola).
244 * Symbian phones through gnapplet.
246 This package contains Gammu SMS Daemon and tool to inject messages
247 into the queue.
249 %package -n libGammu7
250 Summary: Mobile phone management library
251 Group: System/Libraries
253 %description -n libGammu7
254 Gammu is command line utility and library to work with mobile phones
255 from many vendors. Support for different models differs, but basic
256 functions should work with majority of them. Program can work with
257 contacts, messages (SMS, EMS and MMS), calendar, todos, filesystem,
258 integrated radio, camera, etc. It also supports daemon mode to send and
259 receive SMSes.
261 Currently supported phones include:
263 * Many Nokia models.
264 * Alcatel BE5 (501/701), BF5 (715), BH4 (535/735).
265 * AT capable phones (Siemens, Nokia, Alcatel, IPAQ).
266 * OBEX and IrMC capable phones (Sony-Ericsson, Motorola).
267 * Symbian phones through gnapplet.
269 This package contains Gammu shared library.
271 %package -n libgsmsd7
272 Summary: SMS daemon helper library
273 Group: System/Libraries
275 %description -n libgsmsd7
276 Gammu is command line utility and library to work with mobile phones
277 from many vendors. Support for different models differs, but basic
278 functions should work with majority of them. Program can work with
279 contacts, messages (SMS, EMS and MMS), calendar, todos, filesystem,
280 integrated radio, camera, etc. It also supports daemon mode to send and
281 receive SMSes.
283 Currently supported phones include:
285 * Many Nokia models.
286 * Alcatel BE5 (501/701), BF5 (715), BH4 (535/735).
287 * AT capable phones (Siemens, Nokia, Alcatel, IPAQ).
288 * OBEX and IrMC capable phones (Sony-Ericsson, Motorola).
289 * Symbian phones through gnapplet.
291 This package contains Gammu SMS daemon shared library.
293 %prep
294 %setup -q
296 %build
297 mkdir build-dir
298 cd build-dir
299 cmake ../ \
300 -DBUILD_SHARED_LIBS=ON \
301 -DINSTALL_LSB_INIT=ON \
302 -DBUILD_PYTHON=/usr/bin/python \
303 -DCMAKE_INSTALL_PREFIX=%_prefix \
304 -DINSTALL_DOC_DIR=%gammu_docdir \
305 -DINSTALL_LIB_DIR=%_lib \
306 -DINSTALL_LIBDATA_DIR=%_lib
307 make %{?_smp_mflags} %{!?_smp_mflags:%{?jobs:-j %jobs}}
309 %check
310 cd build-dir
311 ctest -V
313 %install
314 %if 0%{?suse_version} == 0
315 rm -rf %buildroot
316 mkdir %buildroot
317 %endif
318 make -C build-dir install DESTDIR=%buildroot
319 %find_lang %{name}
320 %find_lang libgammu
321 cat libgammu.lang >> %{name}.lang
322 install -m644 docs/config/smsdrc %buildroot/etc/gammu-smsdrc
324 %post -n libGammu7 -p /sbin/ldconfig
326 %post -n libgsmsd7 -p /sbin/ldconfig
328 %postun -n libGammu7 -p /sbin/ldconfig
330 %postun -n libgsmsd7 -p /sbin/ldconfig
332 %post smsd
333 %if 0%{?mandriva_version}
334 %_post_service gammu-smsd
335 %endif
336 %if 0%{?suse_version}
337 %fillup_and_insserv gammu-smsd
338 %endif
339 %if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel}
340 /sbin/chkconfig --add gammu-smsd
341 %endif
343 %preun smsd
344 %if 0%{?suse_version}
345 %stop_on_removal gammu-smsd
346 %endif
347 %if 0%{?mandriva_version}
348 %_preun_service gammu-smsd
349 %endif
350 %if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version} || 0%{?fedora} || 0%{?rhel}
351 if [ $1 = 0 ] ; then
352 /sbin/service gammu-smsd stop >/dev/null 2>&1
353 /sbin/chkconfig --del <script>
355 %endif
358 %postun smsd
359 %if 0%{?suse_version}
360 %restart_on_update gammu-smsd
361 %insserv_cleanup
362 %endif
365 %files -f %name.lang
366 %defattr(-,root,root)
367 %doc %gammu_docdir
368 %config /etc/bash_completion.d/gammu
369 %_bindir/gammu
370 %_bindir/gammu-config
371 %_bindir/gammu-detect
372 %_bindir/jadmaker
373 %_mandir/man1/gammu.1*
374 %_mandir/man1/gammu-config.1*
375 %_mandir/man1/gammu-detect.1*
376 %_mandir/man1/jadmaker.1*
377 %_mandir/man5/gammurc.5*
378 %_mandir/man5/gammu-backup.5*
379 %_mandir/man5/gammu-smsbackup.5*
381 %files smsd
382 %defattr(-,root,root)
383 %_bindir/gammu-smsd
384 %_bindir/gammu-smsd-inject
385 %_bindir/gammu-smsd-monitor
386 %_mandir/man1/gammu-smsd*
387 %_mandir/man7/gammu-smsd*
388 %_mandir/man5/gammu-smsd*
389 %attr(755,root,root) %config /etc/init.d/gammu-smsd
390 %config /etc/gammu-smsdrc
392 %files -n libGammu7
393 %defattr(-,root,root)
394 %_libdir/libGammu*.so.*
395 %_datadir/gammu/
397 %files -n libgsmsd7
398 %defattr(-,root,root)
399 %_libdir/libgsmsd*.so.*
401 %files devel
402 %defattr(-,root,root)
403 %_includedir/%name
404 %_libdir/pkgconfig/%name.pc
405 %_libdir/pkgconfig/%name-smsd.pc
406 %_libdir/*.so
408 %files -n python-gammu
409 %defattr(-,root,root)
410 %doc README.Python python/examples
411 %g_python_sitearch/*
413 %clean
414 rm -rf %buildroot
416 %changelog
417 * Fri Apr 3 2009 Michal Čihař <michal@cihar.com> - 1.23.93-1
418 - do not define own %%version, %%name, %%rel
419 - always use pkgconfig, pkg-config provides it
420 - do not delete build root on SUSE
421 - fix some package names (DBI and libusb) for Fedora
422 - drop support for Fedora 8
424 * Thu Jan 22 2009 Michal Čihař <michal@cihar.com> - 1.21.91-1
425 - merged python-gammu packaging as upstream merged the code
427 * Fri Oct 24 2008 Michal Čihař <michal@cihar.com> - 1.21.0-1
428 - fixed according to Fedora policy
430 * Wed Oct 8 2008 Michal Cihar <michal@cihar.com>
431 - do not remove build root in %%install
432 - move make test to %%check
434 * Tue Oct 7 2008 Michal Cihar <michal@cihar.com>
435 - use find_lang macro
437 * Thu Mar 28 2007 Michal Cihar <michal@cihar.com>
438 - update to current code status
440 * Thu Jan 6 2005 Michal Cihar <michal@cihar.com>
441 - add support for Mandrake, thanks to Olivier BERTEN <Olivier.Berten@advalvas.be> for testing
442 - use new disable-bluetooth
444 * Wed Nov 12 2003 Michal Cihar <michal@cihar.com>
445 - distiguish between packaging on SUSE and Redhat
446 - build depends on bluez if wanted
448 * Mon Nov 10 2003 Peter Soos <sp@osb.hu>
449 - using rpm macros where is possible
450 - added ldconfig to post/postun
452 * Mon Nov 03 2003 Michal Cihar <michal@cihar.com>
453 - split devel package
455 * Thu Jan 02 2003 Michal Cihar <michal@cihar.com>
456 - made it install in directories that are defined in rpm
458 * Sun Nov 10 2002 Marcin Wiacek <marcin@mwiacek.com>
459 - topnet.pl email no more available
461 * Sun Sep 30 2002 Marcin Wiacek <marcin-wiacek@topnet.pl>
462 - build system is now really working OK
464 * Sat Sep 15 2002 R P Herrold <herrold@owlriver.com>
465 - initial packaging