From b0113afac2a68066fafbb2796963fa2cb72ac638 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 10 Mar 2014 21:33:25 +0100 Subject: Add version number to the programs --- Makefile.am | 51 +++++++++++++++++++++++++++------------------- configure.ac | 2 ++ src/AlsaDabplus.cpp | 19 +++++++++++++---- src/dabplus-enc-file-zmq.c | 14 +++++++++---- src/dabplus-enc-file.c | 15 ++++++++++---- src/mot-encoder.c | 9 ++++++-- 6 files changed, 75 insertions(+), 35 deletions(-) diff --git a/Makefile.am b/Makefile.am index 459e61d..bf31fdd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,12 @@ ACLOCAL_AMFLAGS = -I m4 AUTOMAKE_OPTIONS = subdir-objects +if IS_GIT_REPO +GITVERSION_FLAGS = -DGITVERSION="\"`git describe`\"" +else +GITVERSION_FLAGS = +endif + AM_CPPFLAGS = \ -I$(top_srcdir)/libAACdec/include \ -I$(top_srcdir)/libAACenc/include \ @@ -37,27 +43,30 @@ libfdk_aac_la_LDFLAGS = -version-info @FDK_AAC_VERSION@ -no-undefined \ #aac_enc_SOURCES = src/aac-enc.c \ # src/wavreader.c -dabplus_enc_file_LDADD = libfdk-aac.la -lfec -dabplus_enc_file_SOURCES = src/dabplus-enc-file.c \ - src/wavreader.c - -dabplus_enc_file_zmq_LDADD = libfdk-aac.la -lfec -lzmq -dabplus_enc_file_zmq_SOURCES = src/dabplus-enc-file-zmq.c \ - src/wavreader.c \ - contrib/lib_crc.h \ - contrib/lib_crc.c - -dabplus_enc_alsa_zmq_LDFLAGS = -no-install -dabplus_enc_alsa_zmq_LDADD = libfdk-aac.la -lfec -lzmq -lasound \ - -lrt -lboost_thread -dabplus_enc_alsa_zmq_SOURCES = src/AlsaDabplus.cpp \ - src/AlsaInput.cpp \ - src/AlsaInput.h \ - src/SampleQueue.h \ - src/zmq.hpp - - -mot_encoder_CFLAGS = @MAGICKWAND_CFLAGS@ -Icontrib +dabplus_enc_file_LDADD = libfdk-aac.la -lfec +dabplus_enc_file_CFLAGS = $(AM_CPPFLAGS) $(GITVERSION_FLAGS) +dabplus_enc_file_SOURCES = src/dabplus-enc-file.c \ + src/wavreader.c + +dabplus_enc_file_zmq_LDADD = libfdk-aac.la -lfec -lzmq +dabplus_enc_file_zmq_CFLAGS = $(AM_CPPFLAGS) $(GITVERSION_FLAGS) +dabplus_enc_file_zmq_SOURCES = src/dabplus-enc-file-zmq.c \ + src/wavreader.c \ + contrib/lib_crc.h \ + contrib/lib_crc.c + +dabplus_enc_alsa_zmq_LDFLAGS = -no-install +dabplus_enc_alsa_zmq_LDADD = libfdk-aac.la -lfec -lzmq -lasound \ + -lrt -lboost_thread +dabplus_enc_alsa_zmq_CPPFLAGS = $(AM_CPPFLAGS) $(GITVERSION_FLAGS) +dabplus_enc_alsa_zmq_SOURCES = src/AlsaDabplus.cpp \ + src/AlsaInput.cpp \ + src/AlsaInput.h \ + src/SampleQueue.h \ + src/zmq.hpp + + +mot_encoder_CFLAGS = $(GITVERSION_FLAGS) @MAGICKWAND_CFLAGS@ -Icontrib mot_encoder_LDADD = @MAGICKWAND_LDADD@ mot_encoder_SOURCES = src/mot-encoder.c \ contrib/lib_crc.h \ diff --git a/configure.ac b/configure.ac index 93f8c2d..268d97d 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,8 @@ AC_SUBST(FDK_AAC_VERSION) AC_SUBST(LIBS_PUBLIC) AC_SUBST(LIBS_PRIVATE) +AM_CONDITIONAL([IS_GIT_REPO], [test -d '.git']) + AC_CONFIG_FILES([Makefile fdk-aac.pc]) AC_OUTPUT diff --git a/src/AlsaDabplus.cpp b/src/AlsaDabplus.cpp index c08c98d..99eec6e 100644 --- a/src/AlsaDabplus.cpp +++ b/src/AlsaDabplus.cpp @@ -40,9 +40,9 @@ using namespace std; void usage(const char* name) { fprintf(stderr, - "%s is a HE-AACv2 encoder for DAB+ based on fdk-aac-dabplus\n" - "that can encode from a ALSA source, and encode\n" - "to a ZeroMQ output for ODR-DabMux.\n" + "dabplus-enc-alsa-zmq %s is a HE-AACv2 encoder for DAB+\n" + "based on fdk-aac-dabplus that can read from a ALSA source\n" + "and encode to a ZeroMQ output for ODR-DabMux.\n" "\n" "The -D option enables experimental sound card clock drift compensation.\n" "A consumer sound card has a clock that is always a bit imprecise, and\n" @@ -62,7 +62,13 @@ void usage(const char* name) { "\n" " http://opendigitalradio.org\n" "\nUsage:\n" - "%s [OPTION...]\n", name, name); + "%s [OPTION...]\n", +#if defined(GITVERSION) + GITVERSION +#else + PACKAGE_VERSION +#endif + , name); fprintf(stderr, " -b, --bitrate={ 8, 16, ..., 192 } Output bitrate in kbps. Must be 8 multiple.\n" " -D, --drift-comp Enable ALSA sound card drift compensation.\n" @@ -206,6 +212,11 @@ int main(int argc, char *argv[]) { {0,0,0,0}, }; + if (argc < 2) { + usage(argv[0]); + return 1; + } + int index; while(ch != -1) { ch = getopt_long(argc, argv, "hab:c:o:r:d:Dp:P:", longopts, &index); diff --git a/src/dabplus-enc-file-zmq.c b/src/dabplus-enc-file-zmq.c index cb83877..e9d5a31 100644 --- a/src/dabplus-enc-file-zmq.c +++ b/src/dabplus-enc-file-zmq.c @@ -45,16 +45,22 @@ void usage(const char* name) { fprintf(stderr, - "%s is a HE-AACv2 encoder for DAB+ based on fdk-aac-dabplus\n" - "that can encode from a file or pipe source, and encode\n" - "to a ZeroMQ output for ODR-DabMux.\n" + "dabplus-enc-file-zmq %s is a HE-AACv2 encoder for DAB+\n" + "based on fdk-aac-dabplus that can read from a file\n" + "or pipe source and encode to a ZeroMQ output for ODR-DabMux.\n" "\n" "It includes PAD (DLS and MOT Slideshow) support by http://rd.csp.it\n" "to be used with mot-encoder\n" "\n" " http://opendigitalradio.org\n" "\nUsage:\n" - "%s [OPTION...]\n", name, name); + "%s [OPTION...]\n", +#if defined(GITVERSION) + GITVERSION +#else + PACKAGE_VERSION +#endif + , name); fprintf(stderr, " -b, --bitrate={ 8, 16, ..., 192 } Output bitrate in kbps. Must be 8 multiple.\n" diff --git a/src/dabplus-enc-file.c b/src/dabplus-enc-file.c index c6aff07..64c089d 100644 --- a/src/dabplus-enc-file.c +++ b/src/dabplus-enc-file.c @@ -33,9 +33,10 @@ void usage(const char* name) { fprintf(stderr, - "%s is a HE-AACv2 encoder for DAB+ based on fdk-aac-dabplus\n" - "that can encode from a file or pipe source, and encode\n" - "into a file or pipe. There is no PAD support.\n\n" + "dabplus-enc-file %s is a HE-AACv2 encoder for DAB+\n" + "based on fdk-aac-dabplus that can read from a file\n" + "or pipe source and encode into a file or pipe.\n" + "There is no PAD support.\n\n" "Usage:\n" "%s [OPTION...]\n\n" " -b, --bitrate={ 8, 16, ..., 192 } Output bitrate in kbps. Must be 8 multiple.\n" @@ -47,7 +48,13 @@ void usage(const char* name) { " -c, --channels={ 1, 2 } Nb of input channels for raw input (default: 2).\n" " -r, --rate={ 32000, 48000 } Sample rate for raw input (default: 48000).\n" //" -v, --verbose=LEVEL Set verbosity level.\n" - , name, name); + , +#if defined(GITVERSION) + GITVERSION +#else + PACKAGE_VERSION +#endif + , name); } diff --git a/src/mot-encoder.c b/src/mot-encoder.c index efa8f68..1fdc58e 100644 --- a/src/mot-encoder.c +++ b/src/mot-encoder.c @@ -97,14 +97,19 @@ void writeDLS(int output_fd, const char* dls_file, int padlen); void usage(char* name) { - fprintf(stderr, "DAB MOT encoder for slideshow and DLS\n\n" + fprintf(stderr, "DAB MOT encoder %s for slideshow and DLS\n\n" "By CSP Innovazione nelle ICT s.c.a r.l. (http://rd.csp.it/)\n\n" "Reads image data from the specified directory, and outputs PAD data\n" "on standard output\n" "Reads DLS from /tmp/dls.file\n\n" "WARNING: This program has memory leaks! Do not attempt\n" "to leave it running for long periods of time!\n\n" - " http://opendigitalradio.org\n\n" + " http://opendigitalradio.org\n\n", +#if defined(GITVERSION) + GITVERSION +#else + PACKAGE_VERSION +#endif ); fprintf(stderr, "Usage: %s [OPTIONS...]\n", name); fprintf(stderr, " -d, --dir=DIRNAME Directory to read images from.\n" -- cgit v1.2.3