#
# Copyright (C) 2007-2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 14443 2009-02-08 13:48:04Z florian $

include $(TOPDIR)/rules.mk

PKG_NAME:=esound
PKG_VERSION:=0.2.41
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://ftp.gnome.org/pub/GNOME/sources/esound/0.2
PKG_MD5SUM:=8d9aad3d94d15e0d59ba9dc0ea990c6c
PKG_CAT:=bzcat

include $(INCLUDE_DIR)/package.mk

define Package/esound/Default
  SECTION:=sound
  CATEGORY:=Sound
  TITLE:=EsounDaemon
  URL:=http://ftp.gnome.org/pub/GNOME/sources/esound/0.2
endef

define Package/esound
  $(Package/esound/Default)
  DEPENDS:= +libaudiofile +alsa-lib +librt
endef

define Package/esound/Description
  The Enlightened Sound Daemon is a server process that
  allows multiple applications to share a single sound card.
endef

CONFIGURE_ARGS += \
	--prefix=/usr \
	--sysconfdir=/etc \
	--without-libiconv-prefix \
	--without-libintl-prefix \
	--disable-nls \
	--enable-arts=no \
	--enable-alsa=yes \
	--enable-oss=no \
	--program-transform-name="" 

define Package/esound/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/esd $(1)/usr/bin/
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libesd.so* $(1)/usr/lib
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_DATA) ./files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME)
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
	$(INSTALL_DATA) ./files/*.conf $(1)/etc
endef

#define Build/Configure
#	(cd $(PKG_BUILD_DIR); \
#		$(TARGET_CONFIGURE_OPTS) \
#		CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
#		LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
#		CFLAGS="$(TARGET_CFLAGS) -fno-builtin-sin -fno-builtin-cos" \
#		./configure \
#		--target=$(GNU_TARGET_NAME) \
#		--host=$(GNU_TARGET_NAME) \
#		--build=$(GNU_HOST_NAME) \
#		--prefix=/usr \
#		--sysconfdir=/etc \
#		--without-libiconv-prefix \
#		--without-libintl-prefix \
#		--disable-nls \
#		--enable-arts=no \
#		--enable-alsa=yes \
#		--enable-oss=no \
#		--program-transform-name="" \
#	);
#endef

define Build/Compile
	$(MAKE) -C $(PKG_BUILD_DIR) \
		CC="$(TARGET_CC)" \
		KERNEL=$(LINUX_DIR) \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		install
endef

define Build/InstallDev
	$(MAKE) -C $(PKG_BUILD_DIR) \
		BUILDCC="$(HOSTCC)" \
		DESTDIR="$(STAGING_DIR)" \
		install
endef


$(eval $(call BuildPackage,esound))
