Commit 221a860c authored by Rob Swindell's avatar Rob Swindell 💬
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
Pipeline #1001 failed with stage
in 22 minutes and 44 seconds
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;
......
  • 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.

  • Try a 'make clean' perhaps?

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

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment