From a1983b1b201cd7696e7026e05d386cb2a05cf2b4 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Tue, 30 Oct 2012 12:54:53 -0700 Subject: [PATCH] add packaging --- packaging/baselibs.conf | 4 + packaging/bluetooth.modprobe | 3 + packaging/bluetooth.sh | 9 ++ packaging/bluetooth.sysconfig | 7 + packaging/bluez-coldplug.init | 42 ++++++ packaging/bluez.spec | 288 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 353 insertions(+) create mode 100644 packaging/baselibs.conf create mode 100644 packaging/bluetooth.modprobe create mode 100644 packaging/bluetooth.sh create mode 100644 packaging/bluetooth.sysconfig create mode 100644 packaging/bluez-coldplug.init create mode 100644 packaging/bluez.spec diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf new file mode 100644 index 0000000..ec97a81 --- /dev/null +++ b/packaging/baselibs.conf @@ -0,0 +1,4 @@ +libbluetooth +bluez-devel + requires -bluez- + requires "libbluetooth- = " diff --git a/packaging/bluetooth.modprobe b/packaging/bluetooth.modprobe new file mode 100644 index 0000000..3072d78 --- /dev/null +++ b/packaging/bluetooth.modprobe @@ -0,0 +1,3 @@ +# use "reset=1" as default, since it should be safe for recent devices and +# solves all kind of problems. +options btusb reset=1 diff --git a/packaging/bluetooth.sh b/packaging/bluetooth.sh new file mode 100644 index 0000000..8cec636 --- /dev/null +++ b/packaging/bluetooth.sh @@ -0,0 +1,9 @@ +#!/bin/sh +BLUETOOTH_CONFIG=/etc/sysconfig/bluetooth +test -r $BLUETOOTH_CONFIG && . $BLUETOOTH_CONFIG + +if [ "$START_BLUETOOTHD" = "no" ]; then + exit 0 +fi + +exec /usr/sbin/bluetoothd --udev diff --git a/packaging/bluetooth.sysconfig b/packaging/bluetooth.sysconfig new file mode 100644 index 0000000..d2bfec6 --- /dev/null +++ b/packaging/bluetooth.sysconfig @@ -0,0 +1,7 @@ +############ general +## Path: Hardware/Bluetooth +## Description: General settings for the Bluetooth device, if set to 'yes' bluetooth is started when udev reports 'added bluetooth device' +## Type: yesno +## Default: yes + +START_BLUETOOTHD=yes diff --git a/packaging/bluez-coldplug.init b/packaging/bluez-coldplug.init new file mode 100644 index 0000000..bf370b8 --- /dev/null +++ b/packaging/bluez-coldplug.init @@ -0,0 +1,42 @@ +#! /bin/sh +# +# /etc/init.d/bluez-coldplug +# +# Copyright (c) 2009, SUSE Linux Products GmbH Nuernberg, Germany. All rights reserved. +# +# +### BEGIN INIT INFO +# Provides: bluez-coldplug +# Required-Start: dbus $remote_fs +# Should-Start: $network $syslog +# Required-Stop: $null +# Should-Stop: $null +# Default-Start: 2 3 5 +# Default-Stop: +# Short-Description: +# Description: handles udev coldplug of bluetooth dongles +### END INIT INFO + +. /etc/rc.status + +case "$1" in + start|restart|try-restart) + udevadm trigger --subsystem-match=bluetooth --action=add + rc_status -v + ;; + stop) + rc_status -v + ;; + force-reload|reload) + rc_status -v + ;; + status) + rc_status -v + ;; + *) + echo "Usage: $0" \ + "{start|stop|status|try-restart|restart|force-reload|reload}" + exit 1 + ;; +esac +rc_exit diff --git a/packaging/bluez.spec b/packaging/bluez.spec new file mode 100644 index 0000000..f4b0ff3 --- /dev/null +++ b/packaging/bluez.spec @@ -0,0 +1,288 @@ +%define with_libcapng --enable-capng + +Name: bluez +BuildRequires: pkgconfig(dbus-1) +BuildRequires: flex +BuildRequires: libcap-ng-devel +BuildRequires: systemd +%{?systemd_requires} +BuildRequires: pkgconfig(alsa) +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.101 +Release: 0 +Summary: Bluetooth Stack for Linux +License: GPL-2.0+ +Group: Hardware/Mobile +Source: bluez-%{version}.tar.gz +Source2: bluez-coldplug.init +Source3: bluetooth.sysconfig +Source4: bluetooth.sh +Source5: baselibs.conf +Source7: bluetooth.modprobe +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%define cups_lib_dir %{_prefix}/lib/cups + +%description +The Bluetooth stack for Linux. + +%package devel +Summary: Files needed for BlueZ development +License: GPL-2.0+ +Group: Development/Sources +Requires: libbluetooth = %{version} + +%description devel +Files needed to develop applications for the BlueZ Bluetooth protocol +stack. + +%package -n libbluetooth +Summary: Bluetooth Libraries +License: GPL-2.0+ +Group: Hardware/Mobile + +%description -n libbluetooth +Bluetooth protocol stack libraries. + +%package cups +Summary: CUPS Driver for Bluetooth Printers +License: GPL-2.0+ +Group: Hardware/Printing +Requires: libbluetooth = %{version} + +%description cups +Contains the files required by CUPS for printing to Bluetooth-connected +printers. + + +%package test +Summary: Tools for testing of various Bluetooth-functions +License: GPL-2.0+ ; MIT +Group: Development/Tools/Debuggers +Requires: dbus-python +Requires: libbluetooth = %{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. + + +%package sbc +Summary: Bluetooth Low-Complexity, Sub-Band Codec Utilities +License: GPL-2.0+ +Group: Hardware/Mobile +Requires: libbluetooth = %{version} +Requires: libsbc = %{version} + +%description sbc +The package contains utilities for using the SBC codec. + +The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., USA. + + + +%package -n libsbc +Summary: Bluetooth Low-Complexity, Sub-Band Codec Library +License: GPL-2.0+ +Group: Hardware/Mobile +Requires: libbluetooth = %{version} + +%description -n libsbc +The package contains libraries for using the SBC codec. + +The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., USA. + +%package alsa +Summary: Bluetooth Sound Support +License: GPL-2.0+ +Group: Productivity/Multimedia/Sound/Utilities +Requires: libbluetooth = %{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. + + +%package compat +Summary: Bluetooth Stack for Linux +License: GPL-2.0+ +Group: Hardware/Mobile +Requires: libbluetooth = %{version} + +%description compat +The Bluetooth stack for Linux. This package contains older and partly +deprecated binaries that might still be needed for compatibility. + + +%prep +%setup -q + +%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 \ + --with-systemdunitdir=%{_unitdir} \ + %{?with_libcapng} +make %{?_smp_mflags} all V=1 + +%check +make check + +%install +%make_install + +# bluez-test +cd test +install --mode=0755 \ + 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 -rvf $RPM_BUILD_ROOT/%{_libdir}/gstreamer-* +install --mode=0755 -D %{S:4} $RPM_BUILD_ROOT/usr/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 + + + + + +%post -n libsbc -p /sbin/ldconfig + +%postun -n libsbc -p /sbin/ldconfig + +%post -n libbluetooth -p /sbin/ldconfig + +%postun -n libbluetooth -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%doc COPYING +%{_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 /usr/lib/udev +/usr/lib/udev/* +/usr/lib/udev/bluetooth_serial +/usr/lib/udev/rules.d/97-bluetooth-serial.rules +/usr/share/dbus-1/system-services/org.bluez.service +%dir %{_sysconfdir}/bluetooth +%config(noreplace) %{_sysconfdir}/bluetooth/main.conf +%config(noreplace) %{_sysconfdir}/bluetooth/rfcomm.conf +%config %{_sysconfdir}/dbus-1/system.d/bluetooth.conf +%dir /var/lib/bluetooth +%dir %{_sysconfdir}/modprobe.d +%config(noreplace) %{_sysconfdir}/modprobe.d/50-bluetooth.conf +%{_unitdir}/bluetooth.service + +%files devel +%defattr(-, root, root) +/usr/include/bluetooth +%{_libdir}/libbluetooth.so +%{_libdir}/pkgconfig/bluez.pc + +%files -n libbluetooth +%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}/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 compat +%defattr(-,root,root) +%{_bindir}/dund +%{_bindir}/pand + +%docs_package + +%changelog -- 2.7.4