forked from abrasive/shairport
-
-
Notifications
You must be signed in to change notification settings - Fork 574
/
Makefile.am
345 lines (265 loc) · 11.2 KB
/
Makefile.am
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
ARFLAGS = cr
man_MANS = $(top_srcdir)/man/shairport-sync.1
lib_pair_ap_a_CFLAGS = -Wall -g -DCONFIG_GCRYPT -pthread
lib_tinyhttp_a_CFLAGS = -pthread
lib_dbus_interface_a_CFLAGS = -pthread
lib_mpris_interface_a_CFLAGS = -pthread
bin_PROGRAMS = shairport-sync
BUILT_SOURCES =
noinst_HEADERS =
CLEANFILES =
shairport_sync_LDADD =
noinst_LIBRARIES =
# See below for the flags for the test client program
shairport_sync_SOURCES = shairport.c rtsp.c mdns.c common.c rtp.c player.c alac.c audio.c loudness.c activity_monitor.c
if BUILD_FOR_DARWIN
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS = -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
else
if BUILD_FOR_FREEBSD
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
else
if BUILD_FOR_OPENBSD
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
else
AM_CXXFLAGS = -fno-common -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
AM_CFLAGS = -fno-common -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
shairport_sync_SOURCES += scripts/shairport-sync.service scripts/shairport-sync.service-avahi scripts/shairport-sync
endif
endif
endif
# include information generated by 'git describe --tags --dirty --broken' if requested
if USE_GIT_VERSION
shairport_sync_SOURCES += gitversion.c
gitversion.h: .git/index
printf "// Do not edit!\n" > gitversion.h
printf "// This file is automatically generated by 'git describe --tags --dirty --broken', if available.\n" >> gitversion.h
printf " char git_version_string[] = \"" >> gitversion.h
git describe --tags --dirty --broken | tr -d '[[:space:]]' >> gitversion.h
printf "\";\n" >> gitversion.h
gitversion.c: gitversion.h
touch gitversion.c
BUILT_SOURCES += gitversion.c gitversion.h
noinst_HEADERS += $(BUILT_SOURCES)
# Correctly clean the generated headers, but keep the xml description
CLEANFILES += $(BUILT_SOURCES)
endif
if USE_APPLE_ALAC
shairport_sync_SOURCES += apple_alac.cpp
endif
if USE_CUSTOMPIDDIR
AM_CFLAGS+= \
-DPIDDIR=\"$(CUSTOM_PID_DIR)\"
endif
if USE_AVAHI
shairport_sync_SOURCES += mdns_avahi.c
endif
if USE_TINYSVCMDNS
shairport_sync_SOURCES += mdns_tinysvcmdns.c tinysvcmdns.c
endif
if USE_EXTERNAL_MDNS
shairport_sync_SOURCES += mdns_external.c
endif
if USE_ALSA
shairport_sync_SOURCES += audio_alsa.c
endif
if USE_JACK
shairport_sync_SOURCES += audio_jack.c
endif
if USE_SNDIO
shairport_sync_SOURCES += audio_sndio.c
endif
if USE_STDOUT
shairport_sync_SOURCES += audio_stdout.c
endif
if USE_PIPE
shairport_sync_SOURCES += audio_pipe.c
endif
if USE_DUMMY
shairport_sync_SOURCES += audio_dummy.c
endif
if USE_AO
shairport_sync_SOURCES += audio_ao.c
endif
if USE_SOUNDIO
shairport_sync_SOURCES += audio_soundio.c
endif
if USE_PA
shairport_sync_SOURCES += audio_pa.c
endif
if USE_PW
shairport_sync_SOURCES += audio_pw.c
endif
if USE_CONVOLUTION
shairport_sync_SOURCES += FFTConvolver/AudioFFT.cpp FFTConvolver/FFTConvolver.cpp FFTConvolver/Utilities.cpp FFTConvolver/convolver.cpp
AM_CXXFLAGS += -std=c++11
endif
if USE_DNS_SD
shairport_sync_SOURCES += mdns_dns_sd.c
endif
if USE_METADATA_HUB
shairport_sync_SOURCES += metadata_hub.c
endif
if USE_MQTT
shairport_sync_SOURCES += mqtt.c
endif
if USE_DACP_CLIENT
shairport_sync_SOURCES += dacp.c
shairport_sync_LDADD += lib_tinyhttp.a
noinst_LIBRARIES += lib_tinyhttp.a
lib_tinyhttp_a_SOURCES = tinyhttp/chunk.c tinyhttp/header.c tinyhttp/http.c
endif
if USE_AIRPLAY_2
shairport_sync_SOURCES += ptp-utilities.c plist_xml_strings.c
shairport_sync_LDADD += lib_pair_ap.a
lib_pair_ap_a_SOURCES = pair_ap/pair.c pair_ap/pair_fruit.c pair_ap/pair_homekit.c pair_ap/pair-tlv.c
noinst_LIBRARIES += lib_pair_ap.a
plist_xml_strings.h: plists/get_info_response.xml
printf "// Do not edit!\n" > plist_xml_strings.h
printf "// This file is automatically generated from files in the plists folder.\n\n" >> plist_xml_strings.h
xxd -i $(top_srcdir)/plists/get_info_response.xml - | sed -e 's/[^ ]*plists_get_info_response_xml/plists_get_info_response_xml/g' >> plist_xml_strings.h
printf "\n" >> plist_xml_strings.h
plist_xml_strings.c: plist_xml_strings.h
touch plist_xml_strings.c
BUILT_SOURCES += plist_xml_strings.c plist_xml_strings.h
noinst_HEADERS += $(BUILT_SOURCES)
# Correctly clean the generated headers, but keep the xml description
CLEANFILES += $(BUILT_SOURCES)
endif
if USE_DBUS
shairport_sync_LDADD += lib_dbus_interface.a
noinst_LIBRARIES += lib_dbus_interface.a
lib_dbus_interface_a_SOURCES = dbus-interface.c
shairport_sync_SOURCES += dbus-service.c
BUILT_SOURCES += dbus-interface.h dbus-interface.c
# We don't want to install this header
noinst_HEADERS += $(BUILT_SOURCES)
# Correctly clean the generated headers, but keep the xml description
CLEANFILES += $(BUILT_SOURCES)
dbus-interface.c: org.gnome.ShairportSync.xml
gdbus-codegen --interface-prefix org.gnome --generate-c-code dbus-interface $(top_srcdir)/org.gnome.ShairportSync.xml
dbus-interface.h: dbus-interface.c
touch dbus-interface.h
endif
if USE_MPRIS
shairport_sync_LDADD += lib_mpris_interface.a
noinst_LIBRARIES += lib_mpris_interface.a
lib_mpris_interface_a_SOURCES = mpris-interface.c
shairport_sync_SOURCES += mpris-service.c
BUILT_SOURCES += mpris-interface.h mpris-interface.c
# We don't want to install this header
noinst_HEADERS += $(BUILT_SOURCES)
# Correctly clean the generated headers, but keep the xml description
CLEANFILES += $(BUILT_SOURCES)
mpris-interface.c: org.mpris.MediaPlayer2.xml
gdbus-codegen --interface-prefix org.mpris --generate-c-code mpris-interface $(top_srcdir)/org.mpris.MediaPlayer2.xml
mpris-interface.h: mpris-interface.c
touch mpris-interface.h
endif
noinst_PROGRAMS =
if USE_DBUS_CLIENT
#Make it, but don't install it anywhere
noinst_PROGRAMS += shairport-sync-dbus-test-client
shairport_sync_dbus_test_client_SOURCES = shairport-sync-dbus-test-client.c
shairport_sync_dbus_test_client_LDADD = lib_dbus_interface.a
endif
if USE_MPRIS_CLIENT
#Make it, but don't install it anywhere
noinst_PROGRAMS += shairport-sync-mpris-test-client
shairport_sync_mpris_test_client_SOURCES = shairport-sync-mpris-test-client.c
shairport_sync_mpris_test_client_LDADD = lib_mpris_interface.a
endif
CONFIG_FILE_INSTALL_TARGET = config-file-install-local
$(CONFIG_FILE_INSTALL_TARGET): scripts/shairport-sync.conf
install -d $(DESTDIR)$(sysconfdir)
install -m 0644 $(top_srcdir)/scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf.sample
[ -f $(DESTDIR)$(sysconfdir)/shairport-sync.conf ] || cp $(top_srcdir)/scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf
if BUILD_FOR_LINUX
DBUS_POLICY_DIR = /etc/dbus-1/system.d
else
DBUS_POLICY_DIR = $(sysconfdir)/dbus-1/system.d
endif
if USE_DBUS
if INSTALL_CYGWIN_SERVICE
DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy-cygwin.conf
else
DBUS_POLICY_FILE = scripts/shairport-sync-dbus-policy.conf
endif # INSTALL_CYGWIN_SERVICE
DBUS_POLICY_INSTALL_TARGET = dbus-policy-install-local
$(DBUS_POLICY_INSTALL_TARGET): $(DBUS_POLICY_FILE)
install -d $(DESTDIR)$(DBUS_POLICY_DIR)
install -m 0644 $(top_srcdir)/$(DBUS_POLICY_FILE) $(DESTDIR)$(DBUS_POLICY_DIR)/shairport-sync-dbus.conf
endif # USE_DBUS
if USE_MPRIS
if INSTALL_CYGWIN_SERVICE
MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy-cygwin.conf
else
MPRIS_POLICY_FILE = scripts/shairport-sync-mpris-policy.conf
endif # INSTALL_CYGWIN_SERVICE
MPRIS_POLICY_INSTALL_TARGET = mpris-policy-install-local
$(MPRIS_POLICY_INSTALL_TARGET): $(MPRIS_POLICY_FILE)
install -d $(DESTDIR)$(DBUS_POLICY_DIR)
install -m 0644 $(top_srcdir)/$(MPRIS_POLICY_FILE) $(DESTDIR)$(DBUS_POLICY_DIR)/shairport-sync-mpris.conf
endif # USE_MPRIS
INSTALL_GROUP_TARGET = install-group-local
$(INSTALL_GROUP_TARGET):
getent group shairport-sync &>/dev/null || groupadd -r shairport-sync &>/dev/null
if INSTALL_CREATE_USER_GROUP
INSTALL_USER_TARGET = install-user-local
else
INSTALL_USER_TARGET =
endif
$(INSTALL_USER_TARGET): $(INSTALL_GROUP_TARGET)
getent passwd shairport-sync &>/dev/null || useradd -r -M -g shairport-sync -s /usr/sbin/nologin -G audio shairport-sync &>/dev/null
if INSTALL_SYSTEMV
INSTALL_SYSTEMV_TARGET = install-systemv-local
# watch out -- shairport-sync is created during the ./configure step and
# will be stored in a scripts folder in the _build_ folder
# which will be the source folder if you're not using a separate build folder
$(INSTALL_SYSTEMV_TARGET): scripts/shairport-sync $(INSTALL_USER_TARGET)
install -d $(DESTDIR)$(sysconfdir)/init.d
[ -e $(DESTDIR)$(sysconfdir)/init.d/shairport-sync ] || install -m 0755 scripts/shairport-sync $(DESTDIR)$(sysconfdir)/init.d
endif # INSTALL_SYSTEMV
if INSTALL_SYSTEMD
if USE_AVAHI
SYSTEMD_SERVICE = shairport-sync.service-avahi
else
SYSTEMD_SERVICE = shairport-sync.service
endif # USE_AVAHI
INSTALL_SYSTEMD_TARGET = install-systemd-local
# watch out -- shairport-sync.service is created during the ./configure step and
# will be stored in a scripts folder in the _build_ folder
# which will be the source folder if you're not using a separate build folder
$(INSTALL_SYSTEMD_TARGET): scripts/$(SYSTEMD_SERVICE) $(INSTALL_USER_TARGET)
install -d $(DESTDIR)$(systemdsystemunitdir)
[ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || install -m 0644 scripts/$(SYSTEMD_SERVICE) $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service
endif # INSTALL_SYSTEMD
if INSTALL_FREEBSD_SERVICE
# Choose a uid and gid of 801 completely arbitrarity, except that it should be below 1000. FreeBSD doesn't seem to allow you to say "an ID in the range of..."
install-freebsd-user-local:
pw showgroup shairport-sync > /dev/null 2>&1 || pw addgroup -n shairport-sync -g 801 > /dev/null 2>&1
pw showuser shairport-sync > /dev/null 2>&1 || pw adduser -c "shairport-sync unprivileged user" -n shairport-sync -u 801 -s /usr/sbin/nologin -d /nonexistent > /dev/null 2>&1
INSTALL_FREEBSD_TARGET = install-freebsd-local
$(INSTALL_FREEBSD_TARGET): scripts/shairport-sync.freebsd install-freebsd-user-local
install -d -o shairport-sync -g shairport-sync $(DESTDIR)/var/run/shairport-sync
install -d $(DESTDIR)/usr/local/etc/rc.d/
install -m 0555 $(top_srcdir)/scripts/shairport-sync.freebsd $(DESTDIR)/usr/local/etc/rc.d/shairport_sync
endif # INSTALL_FREEBSD_SERVICE
if INSTALL_CYGWIN_SERVICE
INSTALL_CYGWIN_TARGET = install-cygwin-local
$(INSTALL_CYGWIN_TARGET): scripts/shairport-sync-config
install -d $(DESTDIR)/usr/local/bin
[ -e $(DESTDIR)/usr/local/bin/shairport-sync-config ] || install -m 0755 $(top_srcdir)/scripts/shairport-sync-config $(DESTDIR)/usr/local/bin/
endif # INSTALL_CYGWIN_SERVICE
install-config-files: $(CONFIG_FILE_INSTALL_TARGET) \
$(DBUS_POLICY_INSTALL_TARGET) \
$(MPRIS_POLICY_INSTALL_TARGET) \
$(INSTALL_SYSTEMV_TARGET) \
$(INSTALL_SYSTEMD_TARGET) \
$(INSTALL_FREEBSD_TARGET) \
$(INSTALL_CYGWIN_TARGET)
if INSTALL_CONFIG_FILES
install-exec-hook: install-config-files
endif