File bluez.spec of Package bluez

#
# spec file for package bluez
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2010-2012 B1 Systems GmbH, Vohburg, Germany
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           bluez
BuildRequires:  dbus-1-devel
BuildRequires:  flex
%if 0%{?suse_version} > 1120
BuildRequires:  libcap-ng-devel
%define with_libcapng --enable-capng
%endif
%if 0%{?suse_version} > 1140
BuildRequires:  systemd
%{?systemd_requires}
%define has_systemd 1
%endif
BuildRequires:  alsa-devel
BuildRequires:  automake
BuildRequires:  check-devel
BuildRequires:  glib2-devel >= 2.16
BuildRequires:  libsndfile-devel
BuildRequires:  libtool
BuildRequires:  libudev-devel
BuildRequires:  libusb-devel
BuildRequires:  pkg-config
BuildRequires:  readline-devel
BuildRequires:  udev
BuildRequires:  pkgconfig(libnl-1)
Url:            http://www.bluez.org
Version:        4.99
Release:        0
Summary:        Bluetooth Stack for Linux
License:        GPL-2.0+
Group:          Hardware/Mobile
Source:         bluez-%{version}.tar.bz2
Source2:        bluez-coldplug.init
Source3:        bluetooth.sysconfig
Source4:        bluetooth.sh
Source5:        baselibs.conf
Source6:        README.SUSE
Source7:        bluetooth.modprobe
Patch1:         bluez-4.75-udev-use-helperscript.diff
Patch2:         001-remove-rule-dell-mouse.patch
# needed until next upstream release --seife
Patch3:         libsbc-make-it-installable
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       bluez-utils = 3.36
Obsoletes:      bluez-utils <= 3.36
Provides:       bluez-audio = 3.36
Obsoletes:      bluez-audio <= 3.36
Requires:       libbluetooth3 = %{version}
%if %( echo `rpm -q --queryformat %%{version} udev` ) < 144
%define OLD_UDEV 1
%else
%define OLD_UDEV 0
%endif

# In openSUSE 11.3 there is upstream compliant CUPS 1.4
# which means to have a fixed "/usr/lib/cups/" directory
# on all platforms (see Novell/Suse Bugzilla bnc#575544):
%if 0%{?suse_version} > 1120
%define cups_lib_dir %{_prefix}/lib/cups
%else
%define cups_lib_dir %{_libdir}/cups
%endif

%description
The Bluetooth stack for Linux.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS

%package devel
Summary:        Files needed for BlueZ development
License:        GPL-2.0+
Group:          Development/Sources
Requires:       libbluetooth3 = %{version}

%description devel
Files needed to develop applications for the BlueZ Bluetooth protocol
stack.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS

%package -n libbluetooth3
Summary:        Bluetooth Libraries
License:        GPL-2.0+
Group:          Hardware/Mobile
Provides:       bluez-libs = 3.36
Obsoletes:      bluez-libs <= 3.36

%description -n libbluetooth3
Bluetooth protocol stack libraries.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS in the documentation of the "bluez" package.

%package cups
Summary:        CUPS Driver for Bluetooth Printers
License:        GPL-2.0+
Group:          Hardware/Printing
Requires:       libbluetooth3 = %{version}

%description cups
Contains the files required by CUPS for printing to Bluetooth-connected
printers.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS in the documentation of the "bluez" package.

%package test
Summary:        Tools for testing of various Bluetooth-functions
License:        GPL-2.0+ ; MIT
Group:          Development/Tools/Debuggers
Requires:       dbus-1-python
Requires:       libbluetooth3 = %{version}
Requires:       python-gobject2

%description test
Contains a few tools for testing various bluetooth functions. The
BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., U.S.A.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS in the documentation of the "bluez" package.

%package sbc
Summary:        Bluetooth Low-Complexity, Sub-Band Codec Utilities
License:        GPL-2.0+
Group:          Hardware/Mobile
Requires:       libbluetooth3 = %{version}
Requires:       libsbc0 = %{version}

%description sbc
The package contains utilities for using the SBC codec.

The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., USA.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS in the documentation of the "bluez" package.

%package -n libsbc0
Summary:        Bluetooth Low-Complexity, Sub-Band Codec Library
License:        GPL-2.0+
Group:          Hardware/Mobile
Requires:       libbluetooth3 = %{version}

%description -n libsbc0
The package contains libraries for using the SBC codec.

The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., USA.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS in the documentation of the "bluez" package.

%package alsa
Summary:        Bluetooth Sound Support
License:        GPL-2.0+
Group:          Productivity/Multimedia/Sound/Utilities
Requires:       libbluetooth3 = %{version}
Provides:       bluez-audio:%_libdir/alsa-lib/libasound_module_pcm_bluetooth.so

%description alsa
The package contains libraries for using bluetooth audio services.

The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., USA.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS in the documentation of the "bluez" package.

%package compat
Summary:        Bluetooth Stack for Linux
License:        GPL-2.0+
Group:          Hardware/Mobile
Requires:       libbluetooth3 = %{version}

%description compat
The Bluetooth stack for Linux. This package contains older and partly
deprecated binaries that might still be needed for compatibility.



Authors:
--------
    Marcel Holtmann <marcel@holtmann.org>
    and others, see AUTHORS

%prep
%setup -q
%patch1 -p1
%patch3 -p1
# disabled the patch because it does no longer cleanly apply and the rule has
# changed significantly anyway. I'll keep it until i get confirmation in bugzilla.
##%%patch2 -p1
cp %{S:6} .
mkdir dbus-apis
cp -a doc/*.txt dbus-apis/

%build
autoreconf -fiv
%configure  --with-pic \
			--libexecdir=/lib \
			--enable-gstreamer	\
			--enable-alsa		\
			--enable-usb		\
			--enable-tools		\
			--enable-bccmd		\
			--enable-hid2hci	\
			--enable-dfutool	\
			--enable-cups		\
			--enable-test		\
			--enable-pand		\
			--enable-dund		\
			--enable-proximity	\
			--enable-wiimote	\
			--enable-thermometer	\
			--enable-datafiles	\
			--enable-pcmcia \
            %if 0%{?has_systemd}
            --with-systemdunitdir=%{_unitdir} \
            %endif
			%{?with_libcapng}
make %{?_smp_mflags} all V=1

%install
make DESTDIR=$RPM_BUILD_ROOT install
# bluez-test
cd test
install --mode=0755	\
	apitest		\
	simple-agent	\
	simple-service	\
	list-devices	\
	test-audio	\
	test-adapter	\
	test-device	\
	test-discovery	\
	test-input	\
	test-manager	\
	test-network	\
	test-serial	\
	test-service	\
	test-telephony	\
	$RPM_BUILD_ROOT/%{_bindir}/
cd ..
rm -v $RPM_BUILD_ROOT/%{_libdir}/*.la
rm -rvf $RPM_BUILD_ROOT/%{_libdir}/gstreamer-*
rm -v $RPM_BUILD_ROOT/%{_libdir}/alsa-lib/*.la
install --mode=0755 -D %{S:2} $RPM_BUILD_ROOT/%{_sysconfdir}/init.d/bluez-coldplug
install --mode=0644 -D %{S:3} $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.bluetooth
install --mode=0755 -D %{S:4} $RPM_BUILD_ROOT/lib/udev/bluetooth.sh
install --mode=0644 -D %{S:7} $RPM_BUILD_ROOT/%{_sysconfdir}/modprobe.d/50-bluetooth.conf
# In openSUSE 11.3 there is upstream compliant CUPS 1.4
# which means to have a fixed "/usr/lib/cups/" directory
# on all platforms (see Novell/Suse Bugzilla bnc#575544):
if ! test -e %{buildroot}%{cups_lib_dir}/backend/bluetooth
then if test -e %{buildroot}%{_libdir}/cups/backend/bluetooth
     then mkdir -p %{buildroot}%{cups_lib_dir}/backend
          mv %{buildroot}%{_libdir}/cups/backend/bluetooth %{buildroot}%{cups_lib_dir}/backend/bluetooth
     fi
fi
# no idea why this is suddenly necessary...
install --mode 0755 -d $RPM_BUILD_ROOT/var/lib/bluetooth

%check
make check

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%if 0%{?has_systemd}
%service_add_pre bluetooth.service
%endif

%post
%{fillup_only -n bluetooth}
%{insserv_force_if_yast bluez-coldplug}
%if 0%{?has_systemd}
%service_add_post bluetooth.service
%endif

%preun
%stop_on_removal bluez-coldplug
%if 0%{?has_systemd}
%service_del_preun bluetooth.service
%endif

%postun
%{insserv_cleanup}
%if 0%{?has_systemd}
%service_del_postun bluetooth.service
%endif

%post -n libsbc0 -p /sbin/ldconfig

%postun -n libsbc0 -p /sbin/ldconfig

%post -n libbluetooth3 -p /sbin/ldconfig

%postun -n libbluetooth3 -p /sbin/ldconfig

%files
%defattr(-, root, root)
%doc AUTHORS COPYING ChangeLog README README.SUSE dbus-apis
%{_bindir}/hcitool
%{_bindir}/l2ping
%{_bindir}/rfcomm
%{_bindir}/sdptool
%{_bindir}/ciptool
%{_bindir}/dfutool
%{_bindir}/gatttool
%{_sbindir}/hciattach
%{_sbindir}/hciconfig
%{_sbindir}/bluetoothd
#%{_sbindir}/hid2hci
%{_sbindir}/bccmd
%dir /lib/udev
/lib/udev/*
%if 0%{OLD_UDEV}
%dir %{_sysconfdir}/udev/rules.d
%config %{_sysconfdir}/udev/rules.d/*
%endif
%{_sysconfdir}/init.d/bluez-coldplug
%doc %{_mandir}/man8/hciattach.8.gz
%doc %{_mandir}/man8/hciconfig.8.gz
%doc %{_mandir}/man8/bluetoothd.8.gz
%doc %{_mandir}/man8/hid2hci.8.gz
%doc %{_mandir}/man8/bccmd.8.gz
%doc %{_mandir}/man8/l2ping.8.gz
%doc %{_mandir}/man1/hcitool.1.gz
%doc %{_mandir}/man1/sdptool.1.gz
%doc %{_mandir}/man1/ciptool.1.gz
%doc %{_mandir}/man1/rfcomm.1.gz
%doc %{_mandir}/man1/dfutool.1.gz
%doc %{_mandir}/man1/hciemu.1.gz
%doc %{_mandir}/man1/rctest.1.gz
%dir %{_sysconfdir}/bluetooth
%config(noreplace) %{_sysconfdir}/bluetooth/main.conf
%config(noreplace) %{_sysconfdir}/bluetooth/rfcomm.conf
/var/adm/fillup-templates/sysconfig.bluetooth
%config %{_sysconfdir}/dbus-1/system.d/bluetooth.conf
%dir /var/lib/bluetooth
%dir %{_sysconfdir}/modprobe.d
%config(noreplace) %{_sysconfdir}/modprobe.d/50-bluetooth.conf
%if 0%{?has_systemd}
%{_unitdir}/bluetooth.service
%endif

%files devel
%defattr(-, root, root)
/usr/include/bluetooth
%{_libdir}/libbluetooth.so
%{_libdir}/pkgconfig/bluez.pc
%{_libdir}/libsbc.so
%{_libdir}/pkgconfig/libsbc.pc

%files -n libbluetooth3
%defattr(-, root, root)
%{_libdir}/libbluetooth.so.*
%doc AUTHORS COPYING ChangeLog README

%files cups
%defattr(-,root,root)
%dir %{cups_lib_dir}
%dir %{cups_lib_dir}/backend
%{cups_lib_dir}/backend/bluetooth

%files test
%defattr(-,root,root)
%{_sbindir}/hciemu
%{_bindir}/l2test
%{_bindir}/rctest
%{_bindir}/apitest
%{_bindir}/list-devices
%{_bindir}/simple-agent
%{_bindir}/simple-service
%{_bindir}/test-adapter
%{_bindir}/test-audio
%{_bindir}/test-device
%{_bindir}/test-discovery
%{_bindir}/test-input
%{_bindir}/test-manager
%{_bindir}/test-network
%{_bindir}/test-serial
%{_bindir}/test-service
%{_bindir}/test-telephony

%files alsa
%defattr(-,root,root)
%dir /usr/share/alsa
%config /usr/share/alsa/bluetooth.conf
%{_libdir}/alsa-lib/*.so

%files sbc
%defattr(-, root, root)
%{_bindir}/sbcdec
%{_bindir}/sbcenc
%{_bindir}/sbcinfo

%files -n libsbc0
%defattr(-,root,root)
%{_libdir}/libsbc.so.*

%files compat
%defattr(-,root,root)
%{_bindir}/dund
%{_bindir}/pand
%doc %{_mandir}/man1/pand.1.gz
%doc %{_mandir}/man1/dund.1.gz

%changelog
openSUSE Build Service is sponsored by