change cp to $(CP)
[openwrt.git] / package / mpd / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=mpd
6 PKG_VERSION:=0.12.0
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=65e62cc813f2186dff0f96f164a853f8
9
10 PKG_SOURCE_URL:=http://users.tpg.com.au/davico/openwrt/
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_CAT:=zcat
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
16
17 PKG_CONFIGURE_OPTIONS := \
18         --disable-alsa \
19         --disable-shout \
20         --disable-mod \
21         --disable-audiofile \
22         --disable-iconv \
23         --disable-mpc \
24         --disable-aac \
25
26 ifneq ($(BR2_COMPILE_MPD_WITH_MP3),)
27 PKG_DEPENDS += libid3tag libmad
28 PKG_CONFIGURE_OPTIONS += \
29         --with-id3tag-includes=$(STAGING_DIR)/usr/include \
30         --with-id3tag-libraries=$(STAGING_DIR)/usr/lib \
31         --with-mad-includes=$(STAGING_DIR)/usr/include \
32         --with-mad-libraries=$(STAGING_DIR)/usr/lib
33 else
34 PKG_CONFIGURE_OPTIONS += --disable-id3 --disable-mp3
35 endif
36
37 ifneq ($(BR2_COMPILE_MPD_WITH_OGG),)
38 PKG_DEPENDS += libvorbisidec
39 PKG_CONFIGURE_OPTIONS += \
40         --with-tremor \
41         --with-tremor-includes=$(STAGING_DIR)/usr/include \
42         --with-tremor-libraries=$(STAGING_DIR)/usr/lib
43 else
44 PKG_CONFIGURE_OPTIONS += --disable-ogg
45 endif
46
47 ifneq ($(BR2_COMPILE_MPD_WITH_FLAC),)
48 PKG_DEPENDS += libflac
49 PKG_CONFIGURE_OPTIONS += \
50         --with-libFLAC-includes=$(STAGING_DIR)/usr/include \
51         --with-libFLAC-libraries=$(STAGING_DIR)/usr/lib
52 else
53 PKG_CONFIGURE_OPTIONS += --disable-flac
54 endif
55
56 COMMA:= ,
57 EMPTY:=
58 SPACE:= $(EMPTY) $(EMPTY)
59 PKG_DEPENDS:=$(subst $(SPACE),$(COMMA)$(SPACE),$(sort $(PKG_DEPENDS)))
60
61 include $(TOPDIR)/package/rules.mk
62
63 $(eval $(call PKG_template,MPD,mpd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
64
65 $(PKG_BUILD_DIR)/.configured:
66         (cd $(PKG_BUILD_DIR); \
67                 $(TARGET_CONFIGURE_OPTS) \
68                 CFLAGS="$(strip $(TARGET_CFLAGS))" \
69                 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
70                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
71                 ./configure \
72                         --target=$(GNU_TARGET_NAME) \
73                         --host=$(GNU_TARGET_NAME) \
74                         --build=$(GNU_HOST_NAME) \
75                         --program-prefix="" \
76                         --program-suffix="" \
77                         --prefix=/usr \
78                         --exec-prefix=/usr \
79                         --bindir=/usr/bin \
80                         --datadir=/usr/share \
81                         --includedir=/usr/include \
82                         --infodir=/usr/share/info \
83                         --libdir=/usr/lib \
84                         --libexecdir=/usr/lib \
85                         --localstatedir=/var \
86                         --mandir=/usr/share/man \
87                         --sbindir=/usr/sbin \
88                         --sysconfdir=/etc \
89                         $(PKG_CONFIGURE_OPTIONS) \
90         );
91         touch $@
92
93 $(PKG_BUILD_DIR)/.built:
94         rm -rf $(PKG_INSTALL_DIR)
95         mkdir -p $(PKG_INSTALL_DIR)
96         $(MAKE) -C $(PKG_BUILD_DIR) \
97                 $(TARGET_CONFIGURE_OPTS) \
98                 DESTDIR="$(PKG_INSTALL_DIR)" \
99                 all install
100         touch $@
101
102 $(IPKG_MPD):
103         install -d -m0755 $(IDIR_MPD)/usr/bin
104         install -d -m0755 $(IDIR_MPD)/etc
105         $(CP) $(PKG_INSTALL_DIR)/usr/bin/mpd $(IDIR_MPD)/usr/bin
106         $(CP) $(PKG_BUILD_DIR)/doc/mpdconf.example $(IDIR_MPD)/etc/mpd.conf
107         echo "Depends: $(PKG_DEPENDS)" >> $(IDIR_MPD)/CONTROL/control
108         $(RSTRIP) $(IDIR_MPD)
109         $(IPKG_BUILD) $(IDIR_MPD) $(PACKAGE_DIR)
110
111 mostlyclean:
112         make -C $(PKG_BUILD_DIR) clean
113         rm $(PKG_BUILD_DIR)/.built