From ec1b3a44c0653e21dd252e1727ed42f86f0bb0ec Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 15 Dec 2017 00:48:35 +0100 Subject: Add support for custom version string Make nxproxy and nxagent print an arbitrary version number by running make NX_VERSION_CUSTOM="myvers". nxagent and nxproxy will then show this in addition to the original version number: NXPROXY - Version myvers (3.5.99.22) NXAGENT - Version myvers (3.5.99.22) Fixes ArcticaProject/nx-libs#606 --- Makefile | 15 +++++++++++---- nx-X11/config/cf/xorg.cf | 4 ++++ nxcomp/configure.ac | 7 +++++++ nxcomp/src/Loop.cpp | 13 +++++++++---- nxcompshad/configure.ac | 7 +++++++ nxproxy/configure.ac | 8 ++++++++ 6 files changed, 46 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 42f9f25b4..1f2cb2f74 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,10 @@ ifneq ($(shell pkg-config --exists fontutil && echo yes), yes) $(warning fontutil devel package missing, using imake default values) endif +ifneq "$(strip $(NX_VERSION_CUSTOM))" "" + CUSTOM_VERSION_DEFINE = NX_VERSION_CUSTOM="$(NX_VERSION_CUSTOM)" +endif + IMAKE_DEFINES ?= SHELL:=/bin/bash @@ -96,6 +100,9 @@ version: -e 's/###NX_VERSION_PATCH###/$(shell ./version.sh 4)/' \ nx-X11/config/cf/nxversion.def.in \ > nx-X11/config/cf/nxversion.def +ifneq "$(strip $(NX_VERSION_CUSTOM))" "" + echo '#define NX_VERSION_CUSTOM $(NX_VERSION_CUSTOM)' >>nx-X11/config/cf/nxversion.def +endif imakeconfig: # auto-config some setting @@ -157,17 +164,17 @@ build-full: build-env # in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... # build nxcomp first - cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} + cd nxcomp && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE)) && ${MAKE} # build libNX_X11 second - cd nx-X11/lib && autoreconf -vfsi && (${CONFIGURE} --disable-poll) && ${MAKE} + cd nx-X11/lib && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE) --disable-poll) && ${MAKE} mkdir -p nx-X11/exports/lib/ $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so nx-X11/exports/lib/libNX_X11.so $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6 nx-X11/exports/lib/libNX_X11.so.6 $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6.3.0 nx-X11/exports/lib/libNX_X11.so.6.3.0 # build nxcompshad third - cd nxcompshad && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} + cd nxcompshad && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE)) && ${MAKE} # build nxagent fourth ./mesa-quilt push -a @@ -175,7 +182,7 @@ build-full: build-env ${MAKE} -C nx-X11 World USRLIBDIR="$(USRLIBDIR)" SHLIBDIR="$(SHLIBDIR)" IMAKE_DEFINES="$(IMAKE_DEFINES)" # build nxproxy fifth - cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} + cd nxproxy && autoreconf -vfsi && (${CONFIGURE} $(CUSTOM_VERSION_DEFINE)) && ${MAKE} # "build" nxdialog last cd nxdialog && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index f9928b928..0444d18cc 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -59,8 +59,12 @@ RELEASE_VERSION = ReleaseVersion #if !defined(nxVersionString) && \ defined(NX_VERSION_MAJOR) && defined(NX_VERSION_MINOR) && \ defined(NX_VERSION_MICRO) && defined(NX_VERSION_PATCH) +#if defined(NX_VERSION_CUSTOM) +# define nxVersionString NX_VERSION_CUSTOM (`echo NX_VERSION_MAJOR NX_VERSION_MINOR NX_VERSION_MICRO NX_VERSION_PATCH | sed 's/ /./g'`) +#else # define nxVersionString `echo NX_VERSION_MAJOR NX_VERSION_MINOR NX_VERSION_MICRO NX_VERSION_PATCH | sed 's/ /./g'` #endif +#endif /* * NX versions are M.m.ยต.p, and NXVersion is: diff --git a/nxcomp/configure.ac b/nxcomp/configure.ac index a1839c719..0e17521c3 100644 --- a/nxcomp/configure.ac +++ b/nxcomp/configure.ac @@ -19,6 +19,13 @@ AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2]) # Initialize libtool AC_PROG_LIBTOOL +# enable this to add the variable to the Makefiles +#AC_ARG_VAR(NX_VERSION_CUSTOM, [custom version string]) + +if test "x$NX_VERSION_CUSTOM" != x; then + AC_DEFINE_UNQUOTED([NX_VERSION_CUSTOM], ["${NX_VERSION_CUSTOM}"], [user provided custom version string]) +fi + COMP_VERSION=nxcomp_version AC_SUBST([COMP_VERSION]) diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp index bb8a89d64..eb7373f9f 100644 --- a/nxcomp/src/Loop.cpp +++ b/nxcomp/src/Loop.cpp @@ -13308,13 +13308,18 @@ void PrintConnectionInfo() void PrintVersionInfo() { - cerr << "NXPROXY - " << "Version " + cerr << "NXPROXY - Version " +#ifdef NX_VERSION_CUSTOM + << NX_VERSION_CUSTOM << " (" +#endif << control -> LocalVersionMajor << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch << "." - << control -> LocalVersionMaintenancePatch; - - cerr << endl; + << control -> LocalVersionMaintenancePatch +#ifdef NX_VERSION_CUSTOM + << ")" +#endif + << endl; } void PrintCopyrightInfo() diff --git a/nxcompshad/configure.ac b/nxcompshad/configure.ac index 19a6ae7e4..239a4a739 100644 --- a/nxcompshad/configure.ac +++ b/nxcompshad/configure.ac @@ -19,6 +19,13 @@ AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2]) # Initialize libtool AC_PROG_LIBTOOL +# enable this to add the variable to the Makefiles +#AC_ARG_VAR(NX_VERSION_CUSTOM, [custom version string]) + +if test "x$NX_VERSION_CUSTOM" != x; then + AC_DEFINE_UNQUOTED([NX_VERSION_CUSTOM], ["${NX_VERSION_CUSTOM}"], [user provided custom version string]) +fi + COMPSHAD_VERSION=nxcompshad_version AC_SUBST([COMPSHAD_VERSION]) diff --git a/nxproxy/configure.ac b/nxproxy/configure.ac index 2ca64f61e..1345e32a3 100644 --- a/nxproxy/configure.ac +++ b/nxproxy/configure.ac @@ -8,6 +8,7 @@ m4_define([nxproxy_version], m4_esyscmd([tr -d '\n' < VERSION])) AC_PREREQ(2.60) AC_INIT([NX Proxy], [nxproxy_version], [https://github.com/ArcticaProject/nx-libs/issues]) + AC_CONFIG_AUX_DIR([build-aux]) AC_PROG_CC AC_CONFIG_SRCDIR([Makefile.am]) @@ -19,6 +20,13 @@ AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-bzip2]) # Initialize libtool AC_PROG_LIBTOOL +# enable this to add the variable to the Makefiles +#AC_ARG_VAR(NX_VERSION_CUSTOM, [custom version string]) + +if test "x$NX_VERSION_CUSTOM" != x; then + AC_DEFINE_UNQUOTED([NX_VERSION_CUSTOM], ["${NX_VERSION_CUSTOM}"], [user provided custom version string]) +fi + PROXY_VERSION=nxproxy_version AC_SUBST([PROXY_VERSION]) -- cgit v1.2.3