Skip to content
Snippets Groups Projects
Commit 221a860c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Generate/use git_branch.h and git_hash.h for every make invocation

Allows reporting of branch/commit that was used to build the code.

If for some reason building without 'git', you'll need these 2 files to
already exist somehow - still need to work that out (e.g. for daily
built-source archives).

Need to update the Windows build to generate these files now.
parent e5fea17b
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1001 failed
git_branch.h
git_hash.h
......@@ -21,6 +21,8 @@
#include "msg_id.h"
#include "smblib.h"
#include "git_branch.h"
#include "git_hash.h"
static ulong msg_number(smbmsg_t* msg)
{
......@@ -242,8 +244,9 @@ char* DLLCALL msg_program_id(char* pid, size_t maxlen)
char compiler[64];
DESCRIBE_COMPILER(compiler);
snprintf(pid, maxlen, "%.10s %s%c-%s %s %s"
snprintf(pid, maxlen, "%.10s %s%c-%s %s/%s %s %s"
,VERSION_NOTICE,VERSION,REVISION,PLATFORM_DESC
,GIT_BRANCH, GIT_HASH
,__DATE__,compiler);
return pid;
}
......
......@@ -114,6 +114,17 @@ symlinks: all
ln -sfr */$(EXEODIR)/* $(SBBSEXEC)
endif
.PHONY: FORCE
FORCE:
ifneq ($(GIT), NO)
git_hash.h: FORCE ../../.git
echo '#define GIT_HASH "'`git log -1 HEAD --format=%h`\" > $@
git_branch.h: FORCE ../../.git
echo '#define GIT_BRANCH "'`git rev-parse --abbrev-ref HEAD`\" > $@
endif
ifeq ($(os),linux)
.PHONY: setcap
setcap: all
......
......@@ -38,6 +38,8 @@
#include "sbbs.h"
#include "ssl.h"
#include "git_hash.h"
#include "git_branch.h"
const char* beta_version = " "; /* Space if non-beta, " beta" otherwise */
......@@ -96,7 +98,10 @@ void sbbs_t::ver()
center(str);
CRLF;
sprintf(str,"%s - http://www.synchro.net", COPYRIGHT_NOTICE);
center("https://gitlab.synchro.net - " GIT_BRANCH " " GIT_HASH);
CRLF;
sprintf(str,"%s - http://synchro.net", COPYRIGHT_NOTICE);
center(str);
CRLF;
......
  • Developer

    Updated from git and now fails to compile.

    Compiling msg_id.c msg_id.c:24:10: fatal error: git_branch.h: No such file or directory 24 | #include "git_branch.h" | ^~~~~~~~~~~~~~ compilation terminated.

  • Author Owner

    Try a 'make clean' perhaps?

  • Developer

    I tried a make clean in sbbs3 then I did a cleanall.sh and still the same error.

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment