# Tanım: Linux için bluetooth istemci ve kütüphaneleri.
# URL: http://www.bluez.org/
# Paketçi: milisarge
# Gerekler: libical libvorbis alsa-lib libusb-compat libsndfile cups glib
# Grup: kütüphane

isim=bluez
surum=5.50
devir=1
kaynak=(http://www.kernel.org/pub/linux/bluetooth/$isim-$surum.tar.xz
        bluetooth.modprobe
        bluez-5.50-obexd_without_systemd-1.patch
        refresh_adv_manager_for_non-LE_devices.diff)

derle() {
	cd $isim-$surum
	patch -Np1 -i ../bluez-5.50-obexd_without_systemd-1.patch
	patch -Np1 -i ../refresh_adv_manager_for_non-LE_devices.diff
	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--libexecdir=/usr/lib \
		--disable-systemd \
		--enable-gstreamer \
		--enable-alsa \
		--enable-usb \
		--enable-tools \
		--enable-bccmd \
		--enable-dfutool \
		--enable-hid2hci \
		--enable-hidd \
		--enable-pand \
		--enable-dund \
		--enable-cups \
		--disable-test \
		--enable-sixaxis \
		--enable-experimental \
		--enable-library \
		--without-systemdunitdir
	make
	make DESTDIR=${PKG} \
       install-libexecPROGRAMS \
       install-dbussessionbusDATA \
       install-dbussystembusDATA \
       install-dbusDATA 
	
	make DESTDIR=${PKG} install-binPROGRAMS
	
	make DESTDIR=${PKG} install-cupsPROGRAMS
	
	 make DESTDIR=${PKG} \
       install-udevPROGRAMS \
       install-rulesDATA \
       install-includeHEADERS \
       install-pkgconfigDATA
       
    make DESTDIR=${PKG} \
       install-pluginLTLIBRARIES
	install -dm755 ${PKG}/etc/bluetooth
	install -Dm644 ${SRC}/${isim}-${surum}/src/main.conf ${PKG}/etc/bluetooth/main.conf
	install -dm755 ${PKG}/etc/modprobe.d
	install -Dm644 ${SRC}/bluetooth.modprobe ${PKG}/etc/modprobe.d/bluetooth-usb.conf
	
	for files in `find tools/ -type f -perm -755`; do
		filename=$(basename $files)
		install -Dm755 ${SRC}/${isim}-${surum}/tools/$filename ${PKG}/usr/bin/$filename
	done
    mkdir -p "$PKG/usr/sbin"
    ln -sf /usr/lib/bluetooth/bluetoothd "$PKG/usr/sbin/bluetoothd"
    ln -sf /usr/lib/bluetooth/obexd "$PKG/usr/sbin/obexd"
	rm -rf ${PKG}/lib/udev/hid2hci
	cd /sources/milis.git/ayarlar/servisler
	make DESTDIR=$PKG kur-bluetooth 
	
	install -dm755 $PKG/usr/lib/modules-load.d
    echo "crypto_user" > $PKG/usr/lib/modules-load.d/bluez.conf   
}
