Start using automatic git-based versioning

This commit is contained in:
Mike Brady
2021-05-14 22:49:17 +01:00
parent 661b2e0238
commit 2203d6a335
4 changed files with 40 additions and 3 deletions
+4
View File
@@ -42,3 +42,7 @@ shairport-sync.core
# macOS stuff
.DS_Store
shairport-sync.xcodeproj
# version string generation
gitversion.h
+12
View File
@@ -32,6 +32,18 @@ else
endif
endif
# include information generated by 'git describe --dirty' if requested
if USE_GIT_VERSION
common.c: gitversion.h
gitversion.h: .git/index
echo "// Do not edit!" > gitversion.h
echo "// This file is automatically generated by 'git describe --dirty', if available." >> gitversion.h
echo -n " char git_version_string[] = \"" >> gitversion.h
git describe --dirty | tr -d '[[:space:]]' >> gitversion.h
echo "\";" >> gitversion.h
CLEANFILES += gitversion.h
endif
if USE_APPLE_ALAC
shairport_sync_SOURCES += apple_alac.cpp
endif
+17 -3
View File
@@ -2,7 +2,7 @@
* Utility routines. This file is part of Shairport.
* Copyright (c) James Laird 2013
* The volume to attenuation function vol2attn copyright (c) Mike Brady 2014
* Further changes and additions (c) Mike Brady 2014 -- 2019
* Further changes and additions (c) Mike Brady 2014 -- 2021
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
@@ -27,6 +27,11 @@
*/
#include "common.h"
#ifdef CONFIG_USE_GIT_VERSION_STRING
#include "gitversion.h"
#endif
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
@@ -88,6 +93,8 @@
#include <syslog.h>
#endif
#ifdef CONFIG_ALSA
void set_alsa_out_dev(char *);
#endif
@@ -1602,9 +1609,16 @@ void pthread_cleanup_debug_mutex_unlock(void *arg) { pthread_mutex_unlock((pthre
char *get_version_string() {
char *version_string = malloc(1024);
if (version_string) {
if (version_string) {
#ifdef CONFIG_USE_GIT_VERSION_STRING
if (git_version_string[0] != '\0')
strcpy(version_string, git_version_string);
else
#endif
strcpy(version_string, PACKAGE_VERSION);
#ifdef CONFIG_AIRPLAY_2
strcat(version_string, "-AirPlay2");
#endif
#ifdef CONFIG_APPLE_ALAC
strcat(version_string, "-alac");
#endif
+7
View File
@@ -8,6 +8,13 @@ AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
AC_PROG_RANLIB
AC_CHECK_PROGS([GIT], [git])
if test -n "$GIT"; then
AC_DEFINE([CONFIG_USE_GIT_VERSION_STRING], 1, [Use the version string produced by running 'git describe --dirty'.])
fi
AM_CONDITIONAL([USE_GIT_VERSION], [test -n "$GIT"])
# Derived from the Avahi configure.ac file
# Specifying the OS type, defaulting to linux.
#