Skip to content

Commit c910bf7

Browse files
committed
Merge pull request #3 from sunweaver/feature/nxagent-version-v2
Make nxagent aware of its NX'ish version string (and number).
2 parents 65deb86 + 203d971 commit c910bf7

File tree

8 files changed

+93
-6
lines changed

8 files changed

+93
-6
lines changed

Makefile

+19
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 ./version.sh 1)
23+
NX_VERSION_MINOR=$(shell ./version.sh 2)
24+
NX_VERSION_MICRO=$(shell ./version.sh 3)
25+
NX_VERSION_PATCH=$(shell ./version.sh 4)
26+
2227
SHELL:=/bin/bash
2328

2429
%:
@@ -44,7 +49,21 @@ build-full:
4449
cd nxcomp && autoconf
4550
cd nxcompext && autoconf
4651
cd nxcompshad && autoconf
52+
53+
# prepare nx-X11/config/cf/nxversion.def
54+
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.in \
60+
> nx-X11/config/cf/nxversion.def
61+
4762
cd nx-X11 && ${MAKE} World
63+
64+
# clean directly after build
65+
rm -f nx-X11/config/cf/nxversion.def
66+
4867
cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE}
4968

5069
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

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

-1
This file was deleted.

version.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
# Copyright (C) 2015 Mihai Moldovan <ionic@ionic.de>
4+
# Copyright (C) 2015 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
5+
#
6+
# This program is free software; you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation; either version 2 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program; if not, write to the
18+
# Free Software Foundation, Inc.,
19+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20+
21+
COMPONENT="$1"
22+
VERSION_FILE="VERSION"
23+
24+
case "${COMPONENT}" in
25+
(1|2|3|4) :;;
26+
(*) echo "usage: $(basename ${0}) <position-in-version-number>" >&2; exit 1;;
27+
esac
28+
29+
# More than one line is not supported.
30+
VER="$(head -n "1" "${VERSION_FILE}" | cut -d"." -f"${COMPONENT}")"
31+
32+
[ "x${VER}" = "x" ] && VER="0"
33+
34+
printf "${VER}"

0 commit comments

Comments
 (0)