aboutsummaryrefslogtreecommitdiff
path: root/audio/musicpd/Makefile
blob: bb10f398caad269dba03e5a79bb0f305a4a812ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
PORTNAME=	musicpd
PORTVERSION=	0.22.6
CATEGORIES=	audio
MASTER_SITES=	https://www.musicpd.org/download/mpd/${PORTVERSION:R}/
DISTNAME=	mpd-${PORTVERSION}

MAINTAINER=	riggs@FreeBSD.org
COMMENT=	Remote-controllable music daemon

LICENSE=	GPLv2+
LICENSE_FILE=	${WRKSRC}/COPYING

LIB_DEPENDS=	libboost_iostreams.so:devel/boost-libs \
		libicudata.so:devel/icu

USES=		compiler:c++17-lang localbase:ldflags meson pkgconfig \
		python:build tar:xz

USE_RC_SUBR=	${PORTNAME}
MESON_ARGS=	-Dauto_features=disabled \
		-Dbzip2=enabled \
		-Dhttpd=true \
		-Dicu=enabled \
		-Doss=enabled \
		-Dpipe=true \
		-Dsyslog=enabled \
		-Dzlib=enabled

PORTDOCS=	AUTHORS README.md NEWS

SUB_FILES=	pkg-message

OPTIONS_SUB=	yes

OPTIONS_DEFINE=	DOCS ID3TAG IPV6 ISO9660 MANPAGES SQLITE3 \
		PROXYDB VORBISENC ZZIP

OPTIONS_RADIO=	RESAMPLER ZEROCONF

OPTIONS_RADIO_ZEROCONF=	AVAHI MDNSRESPONDER

OPTIONS_RADIO_RESAMPLER=	SAMPLERATE SOXR

OPTIONS_MULTI=	DOCUMENTATION FILE_FORMAT
OPTIONS_MULTI_FILE_FORMAT=	\
			ADPLUG AUDIOFILE FAAD FFMPEG FLAC FLUIDSYNTH \
			GME MAD MIKMOD MODPLUG MPG123 MUSEPACK \
			OPUS SIDPLAY SNDFILE TWOLAME \
			VORBIS WAVPACK WILDMIDI

OPTIONS_GROUP=	ACCESS PLAYBACK

OPTIONS_GROUP_ACCESS=	CDPARANOIA CURL LAME MMS NFS PLAYLISTS QOBUZ \
			SMB SOUNDCLOUD TIDAL YAJL

OPTIONS_GROUP_PLAYBACK=	AO JACK OPENAL PULSEAUDIO \
			SHOUTCAST SNDIO

ADPLUG_DESC=	AdPlug support
FAAD_DESC=	AAC/MP4 decoding via libfaad
GME_DESC=	GME support (video game music files)
ISO9660_DESC=	Direct support for ISO 9660 images
PROXYDB_DESC=	Proxy database support via libmpdclient
LAME_DESC=	Support for MP3 Icecast Streams
PLAYLISTS_DESC=	Enable extra playlist support (wma, RSS)
QOBUZ_DESC=	Streaming service support: Qobuz
SIDPLAY_DESC=	Sidplay support (C64 mono and stereo files)
SMB_DESC=	SMB network support (currently strongly discouraged)
SOUNDCLOUD_DESC=Streaming service support: SoundCloud
TIDAL_DESC=	Streaming service support: TIDAL (currently defunct)
TWOLAME_DESC=	TwoLAME support (mp2)
VORBISENC_DESC=	Ogg Vorbis encoder
WILDMIDI_DESC=	WildMIDI support (MIDI files)
YAJL_DESC=	JSON support via libyajl
ZZIP_DESC=	Support for zzip archives

OPTIONS_DEFAULT=CURL FFMPEG FLAC ID3TAG LAME MANPAGES OPUS \
		PLAYLISTS PROXYDB SNDFILE VORBIS VORBISENC

MANPAGES_MESON_ENABLED=	documentation
MANPAGES_BUILD_DEPENDS=	${LOCALBASE}/bin/sphinx-build:textproc/py-sphinx@${PY_FLAVOR}

# Decoder plugins
ADPLUG_MESON_ENABLED=	adplug
ADPLUG_LIB_DEPENDS=	libadplug.so:audio/libadplug
AUDIOFILE_MESON_ENABLED=audiofile
AUDIOFILE_LIB_DEPENDS=	libaudiofile.so:audio/libaudiofile
FAAD_MESON_ENABLED=	faad
FAAD_LIB_DEPENDS=	libfaad.so:audio/faad
FFMPEG_MESON_ENABLED=	ffmpeg
FFMPEG_LIB_DEPENDS=	libavcodec.so:multimedia/ffmpeg \
			libavformat.so:multimedia/ffmpeg \
			libavutil.so:multimedia/ffmpeg
FLAC_MESON_ENABLED=	flac
FLAC_LIB_DEPENDS=	libFLAC.so:audio/flac
FLUIDSYNTH_MESON_ENABLED=	fluidsynth
FLUIDSYNTH_LIB_DEPENDS=	libfluidsynth.so:audio/fluidsynth
GME_MESON_ENABLED=	gme
GME_LIB_DEPENDS=	libgme.so:audio/libgme
MAD_MESON_ENABLED=	mad
MAD_LIB_DEPENDS=	libmad.so:audio/libmad
MIKMOD_MESON_ENABLED=	mikmod
MIKMOD_LIB_DEPENDS=	libmikmod.so:audio/libmikmod
MODPLUG_MESON_ENABLED=	modplug
MODPLUG_LIB_DEPENDS=	libmodplug.so:audio/libmodplug
MPG123_MESON_ENABLED=	mpg123
MPG123_LIB_DEPENDS=	libmpg123.so:audio/mpg123
MUSEPACK_MESON_ENABLED=	mpcdec
MUSEPACK_LIB_DEPENDS=	libmpcdec.so:audio/musepack
NFS_MESON_ENABLED=	nfs
NFS_LIB_DEPENDS=	libnfs.so:net/libnfs
OPUS_MESON_ENABLED=	opus
OPUS_LIB_DEPENDS=	libopus.so:audio/opus \
			libogg.so:audio/libogg
PLAYLISTS_MESON_ENABLED=expat
PLAYLISTS_LIB_DEPENDS=	libexpat.so:textproc/expat2
SIDPLAY_MESON_ENABLED=	sidplay
SIDPLAY_LIB_DEPENDS=	libsidplayfp.so:audio/libsidplayfp
SIDPLAY_CXXFLAGS=	-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
SNDFILE_MESON_ENABLED=	sndfile
SNDFILE_LIB_DEPENDS=	libsndfile.so:audio/libsndfile
VORBIS_MESON_ENABLED=	vorbis
VORBIS_LIB_DEPENDS=	libvorbis.so:audio/libvorbis
WAVPACK_MESON_ENABLED=	wavpack
WAVPACK_LIB_DEPENDS=	libwavpack.so:audio/wavpack
WILDMIDI_MESON_ENABLED=	wildmidi
WILDMIDI_LIB_DEPENDS=	libWildMidi.so:audio/wildmidi

# Encoder plugins
VORBISENC_IMPLIES=	VORBIS
VORBISENC_MESON_ENABLED=	vorbisenc
VORBISENC_LIB_DEPENDS=	libvorbisenc.so:audio/libvorbis
LAME_MESON_ENABLED=	lame
LAME_LIB_DEPENDS=	libmp3lame.so:audio/lame
TWOLAME_MESON_ENABLED=	twolame
TWOLAME_LIB_DEPENDS=	libtwolame.so:audio/twolame

# Filter plugins
SAMPLERATE_MESON_ENABLED=	libsamplerate
SAMPLERATE_LIB_DEPENDS=	libsamplerate.so:audio/libsamplerate
SOXR_MESON_ENABLED=	soxr
SOXR_LIB_DEPENDS=	libsoxr.so:audio/libsoxr

# Output plugins
AO_MESON_ENABLED=	ao
AO_LIB_DEPENDS=		libao.so:audio/libao
JACK_MESON_ENABLED=	jack
JACK_LIB_DEPENDS=	libjack.so:audio/jack
JACK_CXXFLAGS=		-Wno-register
OPENAL_MESON_ENABLED=	openal
OPENAL_USES=		openal
PULSEAUDIO_MESON_ENABLED=	pulse
PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
SHOUTCAST_MESON_ENABLED=shout
SHOUTCAST_LIB_DEPENDS=	libshout.so:audio/libshout
SHOUTCAST_IMPLIES=	VORBIS
SNDIO_MESON_ENABLED=	sndio
SNDIO_LIB_DEPENDS=	libsndio.so:audio/sndio

# Input plugins
CDPARANOIA_MESON_ENABLED=	cdio_paranoia
CDPARANOIA_LIB_DEPENDS=	libcdio_paranoia.so:sysutils/libcdio-paranoia
CURL_MESON_ENABLED=	curl
CURL_LIB_DEPENDS=	libcurl.so:ftp/curl
MMS_MESON_ENABLED=	mms
MMS_LIB_DEPENDS=	libmms.so:net/libmms
SMB_MESON_ENABLED=	smbclient
SMB_USES=		samba:lib

# Archive plugins
ZZIP_MESON_ENABLED=	zzip
ZZIP_LIB_DEPENDS=	libzzip.so:devel/zziplib
ISO9660_MESON_ENABLED=	iso9660
ISO9660_LIB_DEPENDS=	libiso9660.so:sysutils/libcdio

# Database plugins
SQLITE3_MESON_ENABLED=	sqlite
SQLITE3_LIB_DEPENDS=	libsqlite3.so:databases/sqlite3
PROXYDB_MESON_ENABLED=	libmpdclient
PROXYDB_LIB_DEPENDS=	libmpdclient.so:audio/libmpdclient

# Tag plugins
ID3TAG_MESON_ENABLED=	id3tag
ID3TAG_LIB_DEPENDS=	libid3tag.so:audio/libid3tag

# Network support
IPV6_MESON_ENABLED=	ipv6

# Commercial service support
QOBUZ_MESON_ENABLED=	qobuz
QOBUZ_LIB_DEPENDS=	libgcrypt.so:security/libgcrypt
QOBUZ_IMPLIES=		CURL YAJL
SOUNDCLOUD_MESON_ENABLED=	soundcloud
SOUNDCLOUD_IMPLIES=	CURL YAJL
TIDAL_MESON_ENABLED=	tidal
TIDAL_IMPLIES=		CURL YAJL

# Misc library support
AVAHI_MESON_ON=		-Dzeroconf=avahi
AVAHI_LIB_DEPENDS=	libavahi-client.so:net/avahi-app
MDNSRESPONDER_MESON_ON=		-Dzeroconf=bonjour
MDNSRESPONDER_LIB_DEPENDS=	libdns_sd.so:net/mDNSResponder
YAJL_MESON_ENABLED=	yajl
YAJL_LIB_DEPENDS=	libyajl.so:devel/yajl

MPDUSER?=	mpd
MPDGROUP?=	mpd

USERS=	${MPDUSER}
GROUPS=	${MPDGROUP}

.include <bsd.port.pre.mk>

# Note that since the build system switch to meson, mpd fails to link with
# GNU ld 2.17 in base. Also, meson does not allow to set the linker via
# environment variables yet.
# For gcc-based platforms, gcc and ld from ports are used due to the c++14
# requirement. For clang, we set the linker explicitly in meson.build.
.if ${ARCH} == armv6
#lld may use movt/movw, doesn't work on armv6
BUILD_DEPENDS+=	${LOCALBASE}/bin/ld:devel/binutils
MPD_CLANG_LD=	${LOCALBASE}/bin/ld
.else
MPD_CLANG_LD=	lld
.endif

post-patch:
# Insert selected linker for clang
	@${REINPLACE_CMD} -e 's|%%MPD_CLANG_LD%%|${MPD_CLANG_LD}|' \
		${WRKSRC}/meson.build
# Replace ~/ with /var/mpd/ and make musicpd run as mpd by default
	@${REINPLACE_CMD} -e 's,^#\([^"]*"\)~/,\1/var/mpd/,g' \
		-e 's,^#\(user[^"]*"\)nobody,\1${MPDUSER},g' \
		${WRKSRC}/doc/mpdconf.example
# Uncomment OSS audio output part from mpd.conf; dragons!
	start=$$(expr $$(${SED} -n '/^#	type	*"oss"/=' \
		${WRKSRC}/doc/mpdconf.example) - 1); \
	 finish=$$(for n in $$(${JOT} 10 $$start); do \
		     [ "$$(${SED} -n $${n}p ${WRKSRC}/doc/mpdconf.example)" = \
				"#}" ] && ${ECHO_CMD} $$n || true; done); \
	 ${REINPLACE_CMD} -e "$${start},$${finish}s,^#,," \
		${WRKSRC}/doc/mpdconf.example
# Fix man pages for executable names
	@${REINPLACE_CMD} \
		-e 's#^``mpd#``${PORTNAME}#' \
		-e 's#:: mpd#:: ${PORTNAME}#' \
		-e 's#mpd(1)#${PORTNAME}(1)#' \
		-e 's#/etc/mpd.conf#${PREFIX}/etc/${PORTNAME}.conf#' \
		-e 's#mpd.conf#${PORTNAME}.conf#' \
		-e 's#mpd.conf(5)#${PORTNAME}.conf(5)#' \
		${WRKSRC}/doc/mpd.1.rst ${WRKSRC}/doc/mpd.conf.5.rst
	@${REINPLACE_CMD} \
		-e "s#'mpd'#'${PORTNAME}'#" \
		-e "s#'mpd.conf'#'${PORTNAME}.conf'#" \
		-e "s#'mpd.conf doc#'${PORTNAME}.conf doc#" \
		${WRKSRC}/doc/conf.py

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/_build/mpd \
		${STAGEDIR}${PREFIX}/bin/${PORTNAME}
.if ${PORT_OPTIONS:MMANPAGES}
	${INSTALL_MAN} ${WRKSRC}/_build/doc/${PORTNAME}.1 \
		${STAGEDIR}${PREFIX}/man/man1
	${INSTALL_MAN} ${WRKSRC}/_build/doc/${PORTNAME}.conf.5 \
		${STAGEDIR}${PREFIX}/man/man5
.endif
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}/
	${INSTALL_DATA} ${WRKSRC}/doc/mpdconf.example \
		${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample

.include <bsd.port.post.mk>