From e55bbc04131ef7148c9a5ec2079416d086370004 Mon Sep 17 00:00:00 2001 From: Erik Moqvist Date: Sun, 13 Nov 2022 19:24:50 +0100 Subject: [PATCH] Optional build info compiled into turnserver binary (#1083) Example usage with make: make CPPFLAGS="-DTURN_SERVER_BUILD_INFO=\"\\\" git: $(git rev-parse HEAD) build: 123\\\"\"" Example usage with cmake: cmake .. -DTURN_SERVER_BUILD_INFO="\" git: $(git rev-parse HEAD) build: 123\"" --- CMakeLists.txt | 3 +++ src/ns_turn_defs.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc1c9a4..f08f97a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,6 +52,9 @@ string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type) if("debug" STREQUAL build_type) add_definitions(-D_DEBUG) endif() +if(DEFINED TURN_SERVER_BUILD_INFO) + add_definitions(-DTURN_SERVER_BUILD_INFO=${TURN_SERVER_BUILD_INFO}) +endif() IF(MSVC) # This option is to enable the /MP switch for Visual Studio 2005 and above compilers diff --git a/src/ns_turn_defs.h b/src/ns_turn_defs.h index 96bfd3d..d136b97 100644 --- a/src/ns_turn_defs.h +++ b/src/ns_turn_defs.h @@ -33,7 +33,10 @@ #define TURN_SERVER_VERSION "4.6.0" #define TURN_SERVER_VERSION_NAME "Gorst" -#define TURN_SOFTWARE "Coturn-" TURN_SERVER_VERSION " '" TURN_SERVER_VERSION_NAME "'" +#ifndef TURN_SERVER_BUILD_INFO +#define TURN_SERVER_BUILD_INFO "" +#endif +#define TURN_SOFTWARE "Coturn-" TURN_SERVER_VERSION " '" TURN_SERVER_VERSION_NAME "'" TURN_SERVER_BUILD_INFO #if (defined(__unix__) || defined(unix)) && !defined(USG) #include