From 8b4b55b7488e96bbf1771382f35860f85cff2dd9 Mon Sep 17 00:00:00 2001 From: Scott Shambarger Date: Tue, 27 Dec 2016 15:32:08 -0800 Subject: [PATCH] [config] Make gperf/antlr maintainer tools, support distcheck Updated configure to allow gperf/antlr to be missing if products are in distribution (allows option of building w/o those tools) Removed circular dependency of antlr products on clean Added missing ffmpeg-compat.h header (correct dist) Include gperf/antlr products in dist gperf/antlr products removed with maintainer-clean Support vpath builds, distcheck passes Added support for non-verbose builds --- Makefile.am | 16 +++++++++-- configure.ac | 35 ++++++++++++----------- src/Makefile.am | 75 ++++++++++++++++++------------------------------- 3 files changed, 60 insertions(+), 66 deletions(-) diff --git a/Makefile.am b/Makefile.am index 09849364..568ba80a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,10 +2,22 @@ ACLOCAL_AMFLAGS = -I m4 sysconf_DATA = forked-daapd.conf -EXTRA_DIST = configure SUBDIRS = sqlext src -man_MANS = forked-daapd.8 +dist_man_MANS = forked-daapd.8 + +nobase_dist_doc_DATA = \ + UPGRADING \ + README.md \ + README_PULSE.md \ + README_SMARTPL.md \ + scripts/antlr35_install.sh \ + scripts/freebsd_install_10.1.sh \ + scripts/freebsd_start_10.1.sh \ + scripts/pairinghelper.sh + +EXTRA_DIST = \ + forked-daapd.conf install-data-hook: $(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/$(PACKAGE)/libspotify" diff --git a/configure.ac b/configure.ac index fb23d84c..b7afe10e 100644 --- a/configure.ac +++ b/configure.ac @@ -16,25 +16,26 @@ AM_PROG_CC_C_O LT_INIT([disable-static]) AC_CHECK_PROG(GPERF, [gperf], [gperf]) -if test "x$GPERF" = x; then - AC_MSG_ERROR([GNU gperf not found, please install it]) -fi -AC_SUBST(GPERF) +AS_IF([test -z "$GPERF"], + [AS_IF([test -f "$srcdir/src/dmap_fields_hash.h"], + [AM_MISSING_PROG([GPERF], [gperf]) + AC_MSG_NOTICE([ + +GNU gperf not found, but it's output appears to be present. +If you modify any gperf or ANTLR grammer files, you will need to install it. +])], + [AC_MSG_ERROR([GNU gperf required and not found, please install it.])])]) AC_CHECK_PROG(ANTLR, [antlr3], [antlr3]) -if test "x$ANTLR" = x; then - if test -d $srcdir/src/pregen; then - for f in $srcdir/src/pregen/*; do - bf=`basename $f` - ln -sf pregen/$bf $srcdir/src/$bf - done - AC_MSG_NOTICE([antlr3 wrapper not found, using pre-generated files]) - else - AC_MSG_ERROR([antlr3 wrapper not found and pre-generated files not available]) - fi -fi -AC_SUBST(ANTLR) -AM_CONDITIONAL(COND_ANTLR, test "x$ANTLR" != x) +AS_IF([test -z "$ANTLR"], + [AS_IF([test -f "$srcdir/src/SMARTPLLexer.h"], + [AM_MISSING_PROG([ANTLR], [antlr3]) + AC_MSG_NOTICE([ + +antlr3 not found, but it's output appears to be present. +If you modify any ANTLR grammer files (.g), you will need to install it. +])], + [AC_MSG_ERROR([antlr3 wrapper required and not found, please install it.])])]) AM_CPPFLAGS="-D_LARGEFILE_SOURCE -Wall" AC_SUBST([AM_CPPFLAGS]) diff --git a/src/Makefile.am b/src/Makefile.am index 80fd5caa..531a208b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,14 +39,18 @@ GPERF_FILES = \ dacp_prop.gperf \ dmap_fields.gperf -GPERF_PRODUCTS = $(GPERF_FILES:.gperf=_hash.h) +GPERF_SRC = $(GPERF_FILES:.gperf=_hash.h) ANTLR_GRAMMARS = \ RSP.g RSP2SQL.g \ DAAP.g DAAP2SQL.g \ SMARTPL.g SMARTPL2SQL.g -ANTLR_SOURCES = \ +ANTLR_TOKENS = $(ANTLR_GRAMMARS:.g=.tokens) + +ANTLR_DEPS = $(ANTLR_GRAMMARS:%.g=$(srcdir)/%.u) + +ANTLR_SRC = \ RSPLexer.c RSPLexer.h RSPParser.c RSPParser.h \ RSP2SQL.c RSP2SQL.h \ DAAPLexer.c DAAPLexer.h DAAPParser.c DAAPParser.h \ @@ -54,8 +58,6 @@ ANTLR_SOURCES = \ SMARTPLLexer.c SMARTPLLexer.h SMARTPLParser.c SMARTPLParser.h \ SMARTPL2SQL.c SMARTPL2SQL.h -ANTLR_PRODUCTS = - AM_CPPFLAGS += \ $(ZLIB_CFLAGS) \ $(AVAHI_CFLAGS) \ @@ -138,58 +140,37 @@ forked_daapd_SOURCES = main.c \ $(LASTFM_SRC) \ $(MPD_SRC) \ listener.c listener.h \ - commands.c commands.h - -nodist_forked_daapd_SOURCES = \ - $(ANTLR_SOURCES) + commands.c commands.h \ + ffmpeg-compat.h \ + $(GPERF_SRC) \ + $(ANTLR_SRC) +# built by maintainers, and distributed. Clean with maintainer-clean BUILT_SOURCES = \ - $(GPERF_PRODUCTS) + $(GPERF_SRC) \ + $(ANTLR_SRC) \ + $(ANTLR_TOKENS) \ + $(ANTLR_DEPS) EXTRA_DIST = \ - $(ANTLR_GRAMMARS) - -CLEANFILES = \ - $(GPERF_PRODUCTS) - + $(GPERF_FILES) \ + $(ANTLR_GRAMMARS) \ + $(ANTLR_TOKENS) \ + $(ANTLR_DEPS) # gperf construction rules %_hash.h: %.gperf - if $(GPERF) $< > $@.tmp; then \ - mv $@.tmp $@; \ - elif $(GPERF) --version >/dev/null 2>&1; then \ - rm $@.tmp; \ - exit 1; \ - else \ - rm $@.tmp; \ - touch $@; \ - fi - -# Support for building the parsers when ANTLR3 is available -if COND_ANTLR -SUFFIXES = .g .u + $(AM_V_GEN)$(GPERF) --output-file=$@ $< +# ANTLR grammar products %.tokens %.c %Lexer.c %Parser.c %Lexer.h %Parser.h %.h: %.g - $(ANTLR) -Xconversiontimeout 30000 $(ANTLR_OPTIONS) $< + @$(AM_V_P) || echo " GEN " $< "products" + $(AM_V_at)$(ANTLR) -Xconversiontimeout 30000 $(ANTLR_OPTIONS) -fo . $< +# ANTLR dependency files (bypass circular dependency of .g on .tokens) %.u: %.g - $(ANTLR) -depend $< > $@ - @echo -n "ANTLR_PRODUCTS += " > $@.tmp - @grep : $@ | cut -d : -f 1 | tr -d ' ' | { while read f; do test "$$f" != "$<" && echo -n "$$f "; done } >> $@.tmp - @cat $@.tmp >> $@ - @rm $@.tmp + $(AM_V_GEN)$(ANTLR) -depend -fo . $< > $@ + $(AM_V_at)sed -n -e '/^.*\.g[ ]*:\(.*\)/ { s//\1/;h;d }' -e '/\.tokens.*:/ { p;d }' -e '/:/ { G;s/\n/ /;p }' $@ > $@-t + $(AM_V_at)mv $@-t $@ -BUILT_SOURCES += $(ANTLR_SOURCES) - -CLEANFILES += \ - $(ANTLR_PRODUCTS) \ - $(ANTLR_GRAMMARS:.g=.u) - -else !COND_ANTLR -DISTCLEANFILES = \ - $(ANTLR_PRODUCTS) \ - $(ANTLR_GRAMMARS:.g=.u) - -endif - --include $(ANTLR_GRAMMARS:.g=.u) +-include $(ANTLR_DEPS)