ncmpcpp: Sync with gentoo
[mpd.git] / media-sound / mpd / mpd-9999.ebuild
blob0206466d9e8a801f8cab68443bbad024a667ef0b
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 EAPI=4
6 inherit autotools eutils flag-o-matic git-2 linux-info multilib systemd user
8 DESCRIPTION="The Music Player Daemon (mpd)"
9 HOMEPAGE="http://www.musicpd.org"
10 EGIT_REPO_URI="git://git.musicpd.org/master/mpd.git"
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS=""
15 IUSE="aac +alsa ao audiofile bzip2 cdio +curl debug +fifo +ffmpeg flac
16 fluidsynth +id3tag inotify ipv6 jack lame lastfmradio mms libsamplerate +mad
17 mikmod modplug mpg123 musepack +network ogg openal oss pipe pulseaudio recorder
18 sid sndfile soundcloud soup sqlite systemd tcpd twolame unicode vorbis wavpack
19 wildmidi zeroconf zip"
21 OUTPUT_PLUGINS="alsa ao fifo jack network openal oss pipe pulseaudio recorder"
22 INPUT_PLUGINS="aac audiofile ffmpeg flac fluidsynth mad mikmod modplug mpg123
23 musepack ogg flac sid vorbis wavpack wildmidi"
24 ENCODER_PLUGINS="audiofile flac lame twolame vorbis"
26 REQUIRED_USE="|| ( ${OUTPUT_PLUGINS} )
27 || ( ${INPUT_PLUGINS} )
28 network? ( || ( ${ENCODER_PLUGINS} ) )
29 recorder? ( || ( ${ENCODER_PLUGINS} ) )
30 lastfmradio? ( curl )"
32 RDEPEND="!<sys-cluster/mpich2-1.4_rc2
33 dev-libs/glib:2
34 aac? ( media-libs/faad2 )
35 alsa? ( media-sound/alsa-utils
36 media-libs/alsa-lib )
37 ao? ( media-libs/libao[alsa?,pulseaudio?] )
38 audiofile? ( media-libs/audiofile )
39 bzip2? ( app-arch/bzip2 )
40 cdio? ( dev-libs/libcdio[-minimal] )
41 curl? ( net-misc/curl )
42 ffmpeg? ( virtual/ffmpeg )
43 flac? ( media-libs/flac[ogg?] )
44 fluidsynth? ( media-sound/fluidsynth )
45 id3tag? ( media-libs/libid3tag )
46 jack? ( media-sound/jack-audio-connection-kit )
47 lame? ( network? ( media-sound/lame ) )
48 libsamplerate? ( media-libs/libsamplerate )
49 mad? ( media-libs/libmad )
50 mikmod? ( media-libs/libmikmod:0 )
51 mms? ( media-libs/libmms )
52 modplug? ( media-libs/libmodplug )
53 mpg123? ( >=media-sound/mpg123-1.12.2 )
54 musepack? ( media-sound/musepack-tools )
55 network? ( >=media-libs/libshout-2
56 !lame? ( !vorbis? ( media-libs/libvorbis ) ) )
57 ogg? ( media-libs/libogg )
58 openal? ( media-libs/openal )
59 pulseaudio? ( media-sound/pulseaudio )
60 sid? ( media-libs/libsidplay:2 )
61 sndfile? ( media-libs/libsndfile )
62 soundcloud? ( >=dev-libs/yajl-2 )
63 soup? ( net-libs/libsoup:2.4 )
64 sqlite? ( dev-db/sqlite:3 )
65 systemd? ( sys-apps/systemd )
66 tcpd? ( sys-apps/tcp-wrappers )
67 twolame? ( media-sound/twolame )
68 vorbis? ( media-libs/libvorbis )
69 wavpack? ( media-sound/wavpack )
70 wildmidi? ( media-sound/wildmidi )
71 zeroconf? ( net-dns/avahi[dbus] )
72 zip? ( dev-libs/zziplib )"
73 DEPEND="${RDEPEND}
74 virtual/pkgconfig"
76 pkg_setup() {
77 use network || ewarn "Icecast and Shoutcast streaming needs networking."
78 use fluidsynth && ewarn "Using fluidsynth is discouraged by upstream."
80 enewuser mpd "" "" "/var/lib/mpd" audio
82 if use inotify; then
83 CONFIG_CHECK="~INOTIFY_USER"
84 ERROR_INOTIFY_USER="${P} requires inotify in-kernel support."
85 linux-info_pkg_setup
89 src_prepare() {
90 eautoreconf
91 cp -f doc/mpdconf.example doc/mpdconf.dist || die "cp failed"
92 epatch "${FILESDIR}"/${PN}conf.patch
95 src_configure() {
96 local mpdconf="--disable-despotify --disable-documentation --disable-ffado
97 --disable-gme --disable-mvp --disable-roar --enable-largefile
98 --enable-tcp --enable-un --docdir=${EPREFIX}/usr/share/doc/${PF}"
100 if use network; then
101 mpdconf+=" --enable-shout $(use_enable vorbis vorbis-encoder)
102 --enable-httpd-output $(use_enable lame lame-encoder)
103 $(use_enable twolame twolame-encoder)
104 $(use_enable audiofile wave-encoder)"
105 else
106 mpdconf+=" --disable-shout --disable-vorbis-encoder
107 --disable-httpd-output --disable-lame-encoder
108 --disable-twolame-encoder --disable-wave-encoder"
111 append-lfs-flags
112 append-ldflags "-L/usr/$(get_libdir)/sidplay/builders"
114 econf \
115 $(use_enable aac) \
116 $(use_enable alsa) \
117 $(use_enable ao) \
118 $(use_enable audiofile) \
119 $(use_enable bzip2) \
120 $(use_enable cdio cdio-paranoia) \
121 $(use_enable cdio iso9660) \
122 $(use_enable curl) \
123 $(use_enable debug) \
124 $(use_enable ffmpeg) \
125 $(use_enable fifo) \
126 $(use_enable flac) \
127 $(use_enable fluidsynth) \
128 $(use_enable id3tag id3) \
129 $(use_enable inotify) \
130 $(use_enable ipv6) \
131 $(use_enable jack) \
132 $(use_enable lastfmradio lastfm) \
133 $(use_enable libsamplerate lsr) \
134 $(use_enable mad) \
135 $(use_enable mikmod) \
136 $(use_enable mms) \
137 $(use_enable modplug) \
138 $(use_enable mpg123) \
139 $(use_enable musepack mpc) \
140 $(use_enable openal) \
141 $(use_enable oss) \
142 $(use_enable pipe pipe-output) \
143 $(use_enable pulseaudio pulse) \
144 $(use_enable recorder recorder-output) \
145 $(use_enable sid sidplay) \
146 $(use_enable sndfile sndfile) \
147 $(use_enable soundcloud) \
148 $(use_enable soup) \
149 $(use_enable sqlite) \
150 $(use_enable systemd systemd-daemon) \
151 $(use_enable tcpd libwrap) \
152 $(use_enable vorbis) \
153 $(use_enable wavpack) \
154 $(use_enable wildmidi) \
155 $(use_enable zip zzip) \
156 $(use_with zeroconf zeroconf avahi) \
157 "$(systemd_with_unitdir)" \
158 ${mpdconf}
161 src_install() {
162 emake DESTDIR="${D}" install
164 insinto /etc
165 newins doc/mpdconf.dist mpd.conf
167 newinitd "${FILESDIR}"/mpd.init mpd
169 if use unicode; then
170 sed -i -e 's:^#filesystem_charset.*$:filesystem_charset "UTF-8":' \
171 "${ED}"/etc/mpd.conf || die "sed failed"
174 use prefix || diropts -m0755 -o mpd -g audio
175 dodir /var/lib/mpd
176 keepdir /var/lib/mpd
177 dodir /var/lib/mpd/music
178 keepdir /var/lib/mpd/music
179 dodir /var/lib/mpd/playlists
180 keepdir /var/lib/mpd/playlists
183 pkg_postinst() {
184 elog "If you will be starting mpd via /etc/init.d/mpd, please make"
185 elog "sure that MPD's pid_file is unset."
187 # also change the homedir if the user has existed before
188 usermod -d "/var/lib/mpd" mpd