Skip to content

Commit 0e341f5

Browse files
committed
Make nxagent process aware of its current NX'ish version.
This feature copies the way how X.Org version string and number are propagated at build time. First use case: if people start nxagent, it reports its version number on stderr. This is about being human-friendly. Second use case: None, so far. But it will now be easy to use the NXAGENT_VERSION_STRING in later feature add-ons.
1 parent eb49d40 commit 0e341f5

File tree

6 files changed

+58
-5
lines changed

6 files changed

+58
-5
lines changed

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ NXLIBDIR ?= $(PREFIX)/lib/nx
1919
X2GOLIBDIR ?= $(PREFIX)/lib/x2go
2020
CONFIGURE ?= ./configure
2121

22+
NX_VERSION_MAJOR=$(shell cat VERSION | cut -d"." -f1)
23+
NX_VERSION_MINOR=$(shell cat VERSION | cut -d"." -f2)
24+
NX_VERSION_MICRO=$(shell cat VERSION | cut -d"." -f3)
25+
NX_VERSION_PATCH=$(shell cat VERSION | cut -d"." -f4)
26+
2227
SHELL:=/bin/bash
2328

2429
%:
@@ -44,7 +49,20 @@ build-full:
4449
cd nxcomp && autoconf
4550
cd nxcompext && autoconf
4651
cd nxcompshad && autoconf
52+
53+
# prepare nx-X11/config/cf/nxversion.def
54+
cat nx-X11/config/cf/nxversion.def.in | sed \
55+
-e 's/###NX_VERSION_MAJOR###/$(NX_VERSION_MAJOR)/' \
56+
-e 's/###NX_VERSION_MINOR###/$(NX_VERSION_MINOR)/' \
57+
-e 's/###NX_VERSION_MICRO###/$(NX_VERSION_MICRO)/' \
58+
-e 's/###NX_VERSION_PATCH###/$(NX_VERSION_PATCH)/' \
59+
> nx-X11/config/cf/nxversion.def
60+
4761
cd nx-X11 && ${MAKE} World
62+
63+
# clean directly after build
64+
rm -f nx-X11/config/cf/nxversion.def
65+
4866
cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE}
4967

5068
build:

nx-X11/config/cf/Imakefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ xorgsite.def \
2727
$(VERSIONDEFFILES) \
2828
$(HOSTDEFFILES) \
2929
site.def \
30-
xorgversion.def
30+
xorgversion.def \
31+
nxversion.def
3132

3233
RULEFILES = \
3334
Imake.rules \

nx-X11/config/cf/nxversion.def.in

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#define NX_VERSION_MAJOR ###NX_VERSION_MAJOR###
2+
#define NX_VERSION_MINOR ###NX_VERSION_MINOR###
3+
#define NX_VERSION_MICRO ###NX_VERSION_MICRO###
4+
#define NX_VERSION_PATCH ###NX_VERSION_PATCH###

nx-X11/config/cf/xorg.cf

+25-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,31 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $
5454
XORG_VERSION_CURRENT = XorgVersion
5555
RELEASE_VERSION = ReleaseVersion
5656

57+
#if NXAgentServer
58+
#include "nxversion.def"
59+
60+
#if !defined(nxVersionString) && \
61+
defined(NX_VERSION_MAJOR) && defined(NX_VERSION_MINOR) && \
62+
defined(NX_VERSION_MICRO) && defined(NX_VERSION_PATCH)
63+
# define nxVersionString `echo NX_VERSION_MAJOR NX_VERSION_MINOR NX_VERSION_MICRO NX_VERSION_PATCH | sed 's/ /./g'`
64+
#endif
65+
66+
/*
67+
* NX versions are M.m.µ.p, and NXVersion is:
68+
*
69+
* M * 10000000 + m * 100000 + µ * 1000 + p
70+
*
71+
*/
72+
73+
#if !defined(nxVersion) && defined(nxVersionString)
74+
# define nxVersion (((NX_VERSION_MAJOR) * 10000000) + ((NX_VERSION_MINOR) * 100000) + ((NX_VERSION_MICRO) * 1000) + NX_VERSION_PATCH)
75+
76+
NX_VERSION_CURRENT = nxVersion
77+
NX_VERSION_CURRENT_STRING = nxVersionString
78+
79+
#endif
80+
#endif /* NXAgentServer */
81+
5782
#if !defined(XorgManVersionString) && \
5883
defined(XORG_VERSION_MAJOR) && defined(XORG_VERSION_MINOR) && \
5984
defined(XORG_VERSION_PATCH) && defined(XORG_VERSION_SNAP)
@@ -1686,4 +1711,3 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese
16861711
#include <cross.def>
16871712
#endif
16881713
#include <xf86.rules>
1689-

nx-X11/programs/Xserver/hw/nxagent/Imakefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,12 @@ UPG_DEFINES=-DNXAGENT_UPGRADE
189189
UPG_DEFINES=
190190
#endif
191191

192-
DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \
192+
#if nxVersion
193+
NX_DEFINES=-DNX_VERSION_CURRENT="$(NX_VERSION_CURRENT)" \
194+
-DNX_VERSION_CURRENT_STRING=\""$(NX_VERSION_CURRENT_STRING)"\"
195+
#endif
196+
197+
DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) $(NX_DEFINES) \
193198
-UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI -UXFree86LOADER \
194199
-DNXAGENT_SERVER \
195200
-DNXAGENT_CONSTRAINCURSOR \

nx-X11/programs/Xserver/hw/nxagent/Init.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ is" without express or implied warranty.
7474
#undef DEBUG
7575
#undef DUMP
7676

77-
#define NXAGENT_VERSION "3.5.0"
77+
#define NXAGENT_VERSION NX_VERSION_CURRENT
78+
#define NXAGENT_VERSION_STRING NX_VERSION_CURRENT_STRING
7879

7980
/*
8081
* ProcVector array defined in tables.c.
@@ -226,7 +227,7 @@ void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
226227

227228
if (serverGeneration <= 1)
228229
{
229-
fprintf(stderr, "\nNXAGENT - Version " NXAGENT_VERSION "\n\n");
230+
fprintf(stderr, "\nNXAGENT - Version " NXAGENT_VERSION_STRING "\n\n");
230231
fprintf(stderr, "Copyright (C) 2001, 2011 NoMachine.\n");
231232
fprintf(stderr, "See http://www.nomachine.com/ for more information.\n\n");
232233

0 commit comments

Comments
 (0)