Summary: Bluetooth utilities
Summary(ja): Bluetooth ユーティリティ 
Name: bluez
Version: 4.101
Release: 4%{?_dist_release}
License: GPLv2+
Group: Applications/System

URL: http://www.bluez.org/

Vendor: Project Vine
Distribution: Vine Linux
Packager: daisuke, Takemikaduchi

#----------------------------------------------------------------------------

Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
Source1: bluetooth.init.vine
Source3: bluez-uinput.modules

Source11: trusts.txt
Source20: main.conf

# http://thread.gmane.org/gmane.linux.bluez.kernel/1754
Patch3: bluez-activate-wacom-mode2.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=498756
Patch4: bluez-socket-mobile-cf-connection-kit.patch

#----------------------------------------------------------------------------
BuildRoot:	%{_tmppath}/%{name}-%{version}-root

BuildRequires:	flex
BuildRequires:	bison
BuildRequires:	check-devel
BuildRequires:	dbus-devel
BuildRequires:	glib2-devel
BuildRequires:	libusb-devel
BuildRequires:	eudev-libudev-devel
BuildRequires:	alsa-lib-devel
BuildRequires:	gstreamer-devel
BuildRequires:	gstreamer-plugins-base-devel
BuildRequires:	libsndfile-devel
BuildRequires:	readline-devel
BuildRequires:  sbc-devel

ExcludeArch: s390 s390x

Obsoletes: bluez-pan < 4.0, bluez-sdp < 4.0
Requires: initscripts, bluez-libs = %{version}
Requires: dbus >= 0.60
# Requires: fuse
## Requires: hwdata >= 0.215
Requires: hwdata >= 0.146
# virtual provides "dbus-bluez-pin-helper" ex. bluez-gnome
Requires: dbus-bluez-pin-helper
Requires(preun): /sbin/chkconfig, /sbin/service
Requires(post): /sbin/chkconfig, /sbin/service
#----------------------------------------------------------------------------

Obsoletes: bluez-utils < 4.5-2
Provides: bluez-utils = %{version}-%{release}

#----------------------------------------------------------------------------
%description
Utilities for use in Bluetooth applications:
	- hcitool
	- hciattach
	- hciconfig
	- bluetoothd
	- l2ping
	- start scripts VineLinux (RedHat base)
	- pcmcia configuration files

 Please, read %{_defaultdocdir}/%{name}-%{version}/trusts.txt 

The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., U.S.A.

%description -l ja
Bluetooth ユーティリティ (bluez-utils):
	- hcitool
	- hciattach
	- hciconfig
	- l2ping
	- 起動スクリプト (Red Hat用をVineLinuxに合わせました)
	- pcmcia コンフィグレーション ファイル
※付属の%{_defaultdocdir}/%{name}-%{version}/trusts.txtもご覧下さい。

(BLUETOOTH は Bluetooth SIG, Inc.(USA)のトレードマークです)

#----------------------------------------------------------------------------
%package libs
Summary: Libraries for use in Bluetooth applications
Summary(ja): BlueTooth アプリケーションの使用するライブラリ(BlueZ)
Group: System Environment/Libraries

%description libs
Libraries for use in Bluetooth applications.

%description libs -l ja
Bluetooth アプリケーションのためのライブラリです。
※BlueZ のユーティリティのためにも必要です

#----------------------------------------------------------------------------
%package libs-devel
Summary: Development libraries for Bluetooth applications
Summary(ja): Bluetooth アプリケーション開発のためのdevelパッケージ
Group: Development/Libraries
Requires: bluez-libs = %{version}
Requires: pkgconfig
Obsoletes: bluez-sdp-devel < 4.0

%description libs-devel
bluez-libs-devel contains development libraries and headers for
use in Bluetooth applications.

%description libs-devel -l ja
bluez-libs-devel パッケージは Bluetooth アプリケーション開発のための
ライブラリやヘッダーファイルを提供します。

#----------------------------------------------------------------------------
%package cups
Summary: CUPS printer backend for Bluetooth printers
Summary(ja): Bluetooth 経由の CUPS プリンタシステム用
Group: System Environment/Daemons
Obsoletes: bluez-utils-cups < 4.5-2
Provides: bluez-utils-cups = %{version}-%{release}
Requires: bluez-libs = %{version}
Requires: cups

%description cups
This package contains the CUPS backend 

%description cups -l ja
Bluetooth対応 プリンターを CUPS印刷システムから利用する
ためのバックエンドです。

#----------------------------------------------------------------------------
%package gstreamer
Summary: GStreamer support for SBC audio format
Summary(ja):GStreamer で SBCオーディオプロファイルをサポートします
Group: System Environment/Daemons
Obsoletes: bluez-utils-gstreamer < 4.5-2
Provides: bluez-utils-gstreamer = %{version}-%{release}
Requires: bluez-libs = %{version}

%description gstreamer
This package contains gstreamer plugins for the Bluetooth SBC audio format

%description gstreamer -l ja
Bluetooth の SBCオーディオプロファイルを扱う gstreamer プラグインが
含まれています。

#----------------------------------------------------------------------------
%package alsa
Summary: ALSA support for Bluetooth audio devices
Summary(ja): Bluetooth オーディオ機器の ALSA サポート
Obsoletes: bluez-utils-alsa < 4.5-2
Provides: bluez-utils-alsa = %{version}-%{release}
Group: System Environment/Daemons
Requires: bluez-libs = %{version}

%description alsa
This package contains ALSA support for Bluetooth audio devices

%description alsa -l ja
Bluetooth オーディオ機器のためのALSAサポートを含むパッケージです。

#----------------------------------------------------------------------------

%prep
rm -rf $RPM_BUILD_ROOT

%setup -q
%patch3 -p1 -b .wacom
%patch4 -p1 -b .socket-mobile

%build
autoreconf -if
%configure \
    --enable-cups --enable-hid2hci --enable-dfutool \
    --enable-tools --enable-bccmd --enable-gstreamer \
    --enable-hidd --enable-pand --enable-dund

# copy txt
cp %{SOURCE11} .

make

#----------------------------------------------------------------------------
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT 
/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_libdir}
# Remove autocrap and libtool droppings
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la				\
	$RPM_BUILD_ROOT/%{_libdir}/alsa-lib/*.la		\
	$RPM_BUILD_ROOT/%{_libdir}/bluetooth/plugins/*.la	\
	$RPM_BUILD_ROOT/%{_libdir}/gstreamer-0.10/*.la

install -D -m0755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/bluetooth

# replace main.conf
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/bluetooth/main.conf
install -D -m0644 %{SOURCE20} $RPM_BUILD_ROOT%{_sysconfdir}/bluetooth/
# rename serial-api.txt 
mv  doc/serial-api.txt doc/serial-api_doc.txt


rm -f ${RPM_BUILD_ROOT}/%{_sysconfdir}/udev/*.rules
install -D -m0644 scripts/bluetooth-serial.rules ${RPM_BUILD_ROOT}/%{_sysconfdir}/udev/rules.d/97-bluetooth-serial.rules
install -D -m0755 scripts/bluetooth_serial ${RPM_BUILD_ROOT}/lib/udev/bluetooth_serial
install -D -m0644 scripts/bluetooth-hid2hci.rules ${RPM_BUILD_ROOT}/%{_sysconfdir}/udev/rules.d/97-bluetooth-hid2hci.rules

install -D -m0755 %{SOURCE3} $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/modules/bluez-uinput.modules

install -d -m0755 $RPM_BUILD_ROOT/%{_localstatedir}/lib/bluetooth

mkdir -p $RPM_BUILD_ROOT/%{_libdir}/bluetooth/

install -D -p -m0644 audio/audio.conf ${RPM_BUILD_ROOT}/etc/bluetooth/

%clean
rm -rf $RPM_BUILD_ROOT

#----------------------------------------------------------------------------
%post
/sbin/chkconfig --add bluetooth
if [ "$1" -ge "1" ]; then
        /sbin/service bluetooth condrestart >/dev/null 2>&1 || :
fi
exit 0

%preun
if [ "$1" = "0" ]; then
        /sbin/service bluetooth stop >/dev/null 2>&1 || :
        /sbin/chkconfig --del bluetooth
fi
exit 0

%post libs
/sbin/ldconfig

%postun libs
/sbin/ldconfig

#----------------------------------------------------------------------------
%files
%defattr(-, root, root)
%{_bindir}/*
%{_sbindir}/*
%{_mandir}/man1/*
%{_mandir}/man8/*
%dir %{_sysconfdir}/bluetooth/
%config(noreplace) %{_sysconfdir}/bluetooth/*
%config(noreplace) %{_sysconfdir}/sysconfig/*
%config %{_sysconfdir}/dbus-1/system.d/bluetooth.conf
%{_sysconfdir}/udev/rules.d/*.rules
%{_sysconfdir}/rc.d/init.d/*
%{_libdir}/bluetooth/
%{_datadir}/dbus-1/system-services/org.bluez.service
/lib/udev/bluetooth_serial
/lib/udev/hid2hci
/lib/udev/rules.d/*.rules

%files libs
%defattr(-, root, root)
%{_libdir}/libbluetooth.so.*
%doc AUTHORS COPYING INSTALL ChangeLog NEWS README trusts.txt
%doc */*.txt

%files libs-devel
%defattr(-, root, root)
%{_libdir}/libbluetooth.so
%dir %{_includedir}/bluetooth
%{_includedir}/bluetooth/*
%{_libdir}/pkgconfig/bluez.pc

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

%files gstreamer
%defattr(-, root, root)
%{_libdir}/gstreamer-*/*.so

%files alsa
%defattr(-, root, root)
#%config %{_sysconfdir}/alsa/bluetooth.conf
%config %{_datadir}/alsa/bluetooth.conf
%{_libdir}/alsa-lib/*.so

%changelog
* Tue Jun 17 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.101-4
- change BuildRequires: eudev-libudev-devel instead of libudev-devel

* Sat Jan 04 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.101-3
- rebuild with VineSeed environment

* Thu Jul 11 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 4.101-2
- build with sbc
  - add BR: sbc-devel

* Sun Jun 24 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.101-1
- new upstream release

* Sun Mar 11 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.99-1
- new upstream release

* Thu Feb 23 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.98-1
- new upstream release

* Sun Dec 25 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.97-1
- new upstream release
- add BuildRequires: check-devel, readline-devel

* Sun Aug 28 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.96-1
- new upstream release
- add BuildRequires: libudev-devel

* Thu Feb 24 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.89-1
- new upstream release

* Sat Feb 05 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.87-1
- new upstream release

* Thu Dec 30 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.84-1
- new upstream release

* Sun Dec 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.82-1
- new upstream release

* Fri Dec 10 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.81-1
- new upstream release

* Tue Nov 16 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.79-1
- new upstream release
- drop Patch2

* Wed Nov 03 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.77-1
- new upstream release
- fix %files (change path of alsa/bluetooth.conf)

* Thu Sep 23 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.69-2
- rebuild with rpm-4.8.1 for pkg-config file

* Mon Jul 19 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.69-1
- new upstream release

* Mon Jun 21 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.66-1
- new upstream release

* Sat May 01 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.64-1
- new upstream release
- drop Patch1, Patch5, Patch6

* Sun Jul 05 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 4.42-2
- add bluetooth.init again.
  - on-demand startup on bootup process will fail, because
    D-BUS service is not started yet.

* Sun Jun 28 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 4.42-1
- new upstream release

* Mon Jun 22 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 4.41-2
- remove bluetooth.init
  - on-demand start/stop bluetoothd using udev
  - run hid2hci using udev
- add missing files to %%files

* Fri Jun 19 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 4.41-1
- new upstream release
- add udev rule
- add upstream Patch[2-6]

* Tue May 26 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 4.37-1
- new upstream release

* Fri Oct 24 2008 Seiichirou Babasaki 4.15-1
- Update to 4.15
- added # Maintainers:  comments.
- FedoraCore - LOGS
-- 4.14-2
-- Add script to autoload uinput on startup, so the PS3 remote
   works out-of-the-box
-- 4.14-1 - Update to 4.14
-- 4.13-3
-- Update udev rules (#246840)
-- 4.13-2
-- Fix PS3 BD remote input event generation
-- 4.13-1 - Update to 4.13
-- 4.12-1 - Update to 4.12
-- 4.11-1 - Update to 4.11
-- 4.10-1 - Update to 4.10
-- 4.9-1 - Update to 4.9
-- 4.8-1 - Update to 4.8
-- 4.7-1 - Update to 4.7
-- 4.6-4
-- Fix patch application
-- 4.6-3
-- Add fuzz
-- 4.6-2
-- Fix possible crasher on resume from suspend
-- 4.6-1 - Update to 4.6
-- 4.5-4
-- SDP browse fixes
-- 4.5-3
-- Bluez-alsa needs to provide/obsolete bluez-utils-alsa
-- Use versioned Obsoletes:
-- 4.5-2
-- Change main utils package name to 'bluez'; likewise its subpackages
-- Remove references to obsolete initscripts (hidd,pand,dund)
-- 4.5-1
-- Update to 4.5
-- Fix initscript to actually start bluetoothd by hand
-- Add chkconfig information to the initscript
-- 4.4-2
-- Fix rpmlint problems
-- Fix input device handling
-- 4.4-1
-- Update to 4.4
-- Update source address, and remove unneeded deps (thanks Marcel)
-- 4.1-1
-- Initial build
- updated specfile
- VineLinux-4.2 logfile
-- *Thu Oct 2 2008 Seiichirou Babasaki 3.24-4
-- update bleuz-gnome, rebuild bluez-utils
-- Requires: fuse
-- updated specfile
-- *Tue Sep 30 2008 Seiichirou Babasaki 3.24-3
-- trusts.txt update (added audio profile)
-- updated specfile

#----------------------------------------------------------------------------
* Fri Sep 26 2008 Seiichirou Babasaki 3.32-2
- *.conf update 
- updated specfile

* Fri Jun 13 2008 Seiichirou Babasaki 3.32-1
- Updated 3.32
- Updated specfile
- ** LOGS 3.31-2
- ** Add a .service file, starting up hcid only when used (#446918)
- ** Fix descriptions in the initscript headers (#433647)
- ** LOGS 3.30-2
- ** Add support for Dell HID/HCI switch
- ** LOGS 3.27-1
- ** Ship audio.conf (#278831)
- ** Ship network service

* Sat Jan 26 2008 Seiichirou Babasaki 3.24-2
- Updated specfile 
-   marge bluez-utils-3.24-conf-vl.patch 
-      << bluez-utils-2.3-conf.patch
- add trusts.txt(ja)
- Updated specfile

* Mon Jan 21 2008 Seiichirou Babasaki 3.24-1vl2
- Updated specfile for (dbus-devel >= 0.90)

* Wed Jan 16 2008 Seiichirou Babasaki 3.24-1vl1
- Import bluez-utils - Packager: Babasaki
- Updated specfile for (dbus-devel >= 0.60)
- Update to 3.24