From 5b60fed75f9121a67ac86d6ea7c7a5771cfc5c46 Mon Sep 17 00:00:00 2001 From: Josh Davies Date: Mon, 26 Jan 2026 16:46:51 +0000 Subject: [PATCH] feat: add pre-processor variable for subsubversion / patchversion Set this in form3.h, used if git-version-gen.sh fails to set the version information. Also added to the manual. Also remove the "beta" tag, in preparation for v5.0.0 release. --- configure.ac | 7 +++++-- doc/manual/prepro.tex | 7 +++---- sources/form3.h | 7 ++++--- sources/startup.c | 12 +++++++----- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index f49b70f3..768df67a 100644 --- a/configure.ac +++ b/configure.ac @@ -17,13 +17,16 @@ m4_define([FORM_VERSION], m4_esyscmd_s([ # As a fallback, try for form3.h. major_version=`grep MAJORVERSION sources/form3.h | sed -e 's/ *#define *MAJORVERSION *//'` minor_version=`grep MINORVERSION sources/form3.h | sed -e 's/ *#define *MINORVERSION *//'` - if test "x$major_version" != x && test "x$minor_version" != x; then + patch_version=`grep PATCHVERSION sources/form3.h | sed -e 's/ *#define *PATCHVERSION *//'` + if test "x$major_version" != x && test "x$minor_version" != x && test "x$patch_version" != x; then # Make the version files. - echo "$major_version.$minor_version" >.version + echo "$major_version.$minor_version.$patch_version" >.version echo "#define REPO_MAJOR_VERSION $major_version" >sources/version.h.in echo "#define REPO_MINOR_VERSION $minor_version" >>sources/version.h.in + echo "#define REPO_PATCH_VERSION $patch_version" >>sources/version.h.in echo '\\def\\repomajorversion'"{$major_version}" >doc/manual/version.tex.in echo '\\def\\repominorversion'"{$minor_version}" >>doc/manual/version.tex.in + echo '\\def\\repopatchversion'"{$patch_version}" >>doc/manual/version.tex.in cp doc/manual/version.tex.in doc/devref/version.tex.in touch doc/doxygen/version.sh.in fi diff --git a/doc/manual/prepro.tex b/doc/manual/prepro.tex index deb63fb2..0f1f736a 100644 --- a/doc/manual/prepro.tex +++ b/doc/manual/prepro.tex @@ -60,10 +60,9 @@ \section{The preprocessor variables} \noindent \FORM\ has a number of built in preprocessor variables. They are: \begin{description} -\item[VERSION\_] The current version\index{VERSION\_} as the \formmajorversion{} in - \formmajorversion.\formminorversion. -\item[SUBVERSION\_] The sub-version\index{SUBVERSION\_} as the \formminorversion{} in - \formmajorversion.\formminorversion. +\item[VERSION\_] The current version\index{VERSION\_} (or ``major version''), as the ``1'' in 1.2.3. +\item[SUBVERSION\_] The current sub-version\index{SUBVERSION\_} (or ``minor version''), as the ``2'' in 1.2.3. +\item[SUBSUBVERSION\_] The current sub-sub-version\index{SUBSUBVERSION\_} (or ``patch version''), as the ``3'' in 1.2.3. \item[NAME\_] The name\index{NAME\_} of the program file. \item[DATE\_] The date\index{DATE\_} of the current run. \item[CMODULE\_] The number\index{CMODULE\_} of the current module. diff --git a/sources/form3.h b/sources/form3.h index a24fc579..630309a9 100644 --- a/sources/form3.h +++ b/sources/form3.h @@ -46,15 +46,16 @@ #define MAJORVERSION 5 #define MINORVERSION 0 +#define PATCHVERSION 0 #ifdef __DATE__ #define PRODUCTIONDATE __DATE__ #else -#define PRODUCTIONDATE "8-nov-2022" +#define PRODUCTIONDATE "27-jan-2026" #endif -/*#undef BETAVERSION */ -#define BETAVERSION +#undef BETAVERSION +/*#define BETAVERSION*/ #ifdef LINUX32 #define UNIX diff --git a/sources/startup.c b/sources/startup.c index 3f30ce81..f3b94009 100644 --- a/sources/startup.c +++ b/sources/startup.c @@ -75,7 +75,7 @@ /* We have also version.h. */ #include "version.h" #ifndef REPO_VERSION - #define REPO_VERSION STRINGIFY(REPO_MAJOR_VERSION) "." STRINGIFY(REPO_MINOR_VERSION) + #define REPO_VERSION STRINGIFY(REPO_MAJOR_VERSION) "." STRINGIFY(REPO_MINOR_VERSION) "." STRINGIFY(REPO_PATCH_VERSION) #endif #ifndef REPO_DATE /* The build date, instead of the repo date. */ @@ -88,15 +88,16 @@ #endif #define MAJORVERSION REPO_MAJOR_VERSION #define MINORVERSION REPO_MINOR_VERSION + #define PATCHVERSION REPO_PATCH_VERSION #else /* - * Otherwise, form3.h defines MAJORVERSION, MINORVERSION and PRODUCTIONDATE, - * possibly BETAVERSION. + * Otherwise, form3.h defines MAJORVERSION, MINORVERSION, PATCHVERSION + * and PRODUCTIONDATE, possibly BETAVERSION. */ #ifdef BETAVERSION - #define VERSIONSTR__ STRINGIFY(MAJORVERSION) "." STRINGIFY(MINORVERSION) "Beta" + #define VERSIONSTR__ STRINGIFY(MAJORVERSION) "." STRINGIFY(MINORVERSION) "." STRINGIFY(PATCHVERSION) "Beta" #else - #define VERSIONSTR__ STRINGIFY(MAJORVERSION) "." STRINGIFY(MINORVERSION) + #define VERSIONSTR__ STRINGIFY(MAJORVERSION) "." STRINGIFY(MINORVERSION) "." STRINGIFY(PATCHVERSION) #endif #define VERSIONSTR FORMNAME " " VERSIONSTR__ " (" PRODUCTIONDATE ")" #endif @@ -1236,6 +1237,7 @@ void StartVariables(void) AM.oldnumextrasymbols = strDup1((UBYTE *)"OLDNUMEXTRASYMBOLS_","oldnumextrasymbols"); PutPreVar((UBYTE *)"VERSION_",(UBYTE *)STRINGIFY(MAJORVERSION),0,0); PutPreVar((UBYTE *)"SUBVERSION_",(UBYTE *)STRINGIFY(MINORVERSION),0,0); + PutPreVar((UBYTE *)"SUBSUBVERSION_",(UBYTE *)STRINGIFY(PATCHVERSION),0,0); PutPreVar((UBYTE *)"DATE_",(UBYTE *)MakeDate(),0,0); PutPreVar((UBYTE *)"random_",(UBYTE *)"________",0,0); PutPreVar((UBYTE *)"optimminvar_",(UBYTE *)("0"),0,0);