Skip to content

Commit

Permalink
Move versioning info from janus.c to in version.h/.c (autogenerated)
Browse files Browse the repository at this point in the history
Added versioning (and commit/build) info to janus-pp-rec too
  • Loading branch information
lminiero committed Jan 10, 2018
1 parent 8ce6af1 commit c131106
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ endif

version.c: FORCE | $(dir_target)
echo "$(build_date)" | awk 'BEGIN {} {print "const char *janus_build_git_time = \""$$0"\";"} END {} ' >> version.c
echo "$(JANUS_VERSION)" | awk 'BEGIN {} {print "int janus_version = "$$0";"} END {} ' >> version.c
echo "$(JANUS_VERSION_STRING)" | awk 'BEGIN {} {print "const char *janus_version_string = \""$$0"\";"} END {} ' >> version.c

$(dir_present):
`which git` rev-parse HEAD | awk 'BEGIN {print "#include \"version.h\""} {print "const char *janus_build_git_sha = \"" $$0"\";"} END {}' > version.c
Expand Down Expand Up @@ -452,6 +454,7 @@ janus_pp_rec_SOURCES = \
postprocessing/pp-webm.h \
postprocessing/janus-pp-rec.c \
log.c \
version.c \
$(NULL)

janus_pp_rec_CFLAGS = \
Expand Down
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ AC_PROG_CC
LT_PREREQ([2.2])
LT_INIT

JANUS_VERSION=30
AC_SUBST(JANUS_VERSION)
JANUS_VERSION_STRING="0.3.0"
AC_SUBST(JANUS_VERSION_STRING)

case "$host_os" in
darwin*)
CFLAGS="$CFLAGS -I/usr/local/opt/openssl/include -I/usr/local/include"
Expand Down
8 changes: 3 additions & 5 deletions janus.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@

#define JANUS_NAME "Janus WebRTC Gateway"
#define JANUS_AUTHOR "Meetecho s.r.l."
#define JANUS_VERSION 30
#define JANUS_VERSION_STRING "0.3.0"
#define JANUS_SERVER_NAME "MyJanusInstance"

#ifdef __MACH__
Expand Down Expand Up @@ -192,8 +190,8 @@ static json_t *janus_info(const char *transaction) {
if(transaction != NULL)
json_object_set_new(info, "transaction", json_string(transaction));
json_object_set_new(info, "name", json_string(JANUS_NAME));
json_object_set_new(info, "version", json_integer(JANUS_VERSION));
json_object_set_new(info, "version_string", json_string(JANUS_VERSION_STRING));
json_object_set_new(info, "version", json_integer(janus_version));
json_object_set_new(info, "version_string", json_string(janus_version_string));
json_object_set_new(info, "author", json_string(JANUS_AUTHOR));
json_object_set_new(info, "commit-hash", json_string(janus_build_git_sha));
json_object_set_new(info, "compile-time", json_string(janus_build_git_time));
Expand Down Expand Up @@ -3176,7 +3174,7 @@ gint main(int argc, char *argv[])
exit(1);

JANUS_PRINT("---------------------------------------------------\n");
JANUS_PRINT(" Starting Meetecho Janus (WebRTC Gateway) v%s\n", JANUS_VERSION_STRING);
JANUS_PRINT(" Starting Meetecho Janus (WebRTC Gateway) v%s\n", janus_version_string);
JANUS_PRINT("---------------------------------------------------\n\n");

/* Handle SIGINT (CTRL-C), SIGTERM (from service managers) */
Expand Down
5 changes: 5 additions & 0 deletions postprocessing/janus-pp-rec.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include <jansson.h>

#include "../debug.h"
#include "../version.h"
#include "pp-rtp.h"
#include "pp-webm.h"
#include "pp-h264.h"
Expand Down Expand Up @@ -98,6 +99,10 @@ int main(int argc, char *argv[])
janus_log_init(FALSE, TRUE, NULL);
atexit(janus_log_destroy);

JANUS_LOG(LOG_INFO, "Janus version: %d (%s)\n", janus_version, janus_version_string);
JANUS_LOG(LOG_INFO, "Janus commit: %s\n", janus_build_git_sha);
JANUS_LOG(LOG_INFO, "Compiled on: %s\n\n", janus_build_git_time);

/* Check the JANUS_PPREC_DEBUG environment variable for the debugging level */
if(g_getenv("JANUS_PPREC_DEBUG") != NULL) {
int val = atoi(g_getenv("JANUS_PPREC_DEBUG"));
Expand Down
2 changes: 2 additions & 0 deletions version.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#ifndef _JANUS_VERSION_H
#define _JANUS_VERSION_H

extern int janus_version;
extern const char *janus_version_string;
extern const char *janus_build_git_time;
extern const char *janus_build_git_sha;

Expand Down

0 comments on commit c131106

Please sign in to comment.