From 13aed2463c7f10e238af86227c2d999b9fa620f2 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Mon, 16 Oct 2017 10:04:54 +0200 Subject: OPTFLAGS: Properly propagate build option flags to nxcomp{,ext,shad} and the nx-X11 build scripts. Backported from Arctica GH 3.6.x branch. v2: backport to nx-libs 3.5.0.x (Mihai Moldovan) Adds: - debian/patches/1500_all_propagate-optflags-to-subcompone.full+lite.patch --- debian/Makefile.nx-libs | 15 +- debian/changelog | 7 + ...ropagate-optflags-to-subcompone.full+lite.patch | 311 +++++++++++++++++++++ debian/patches/series | 1 + debian/rules | 2 +- nx-libs.spec | 1 + 6 files changed, 333 insertions(+), 4 deletions(-) create mode 100644 debian/patches/1500_all_propagate-optflags-to-subcompone.full+lite.patch diff --git a/debian/Makefile.nx-libs b/debian/Makefile.nx-libs index 45ea8a958..884787742 100644 --- a/debian/Makefile.nx-libs +++ b/debian/Makefile.nx-libs @@ -42,9 +42,18 @@ build-lite: build-full: # in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... - cd nxcomp && autoconf - cd nxcompext && autoconf - cd nxcompshad && autoconf + cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} + + # prepare Makefiles and the nx-X11 symlinking magic + cd nx-X11 && make BuildEnv + + # build libNX_X11 and libNX_Xext prior to building + # nxcomp{ext,shad}. + cd nx-X11/lib && make + + cd nxcompext && autoconf && (${CONFIGURE}) && ${MAKE} + cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} + cd nx-X11 && ${MAKE} World cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} diff --git a/debian/changelog b/debian/changelog index 1eaedd614..85fbd6ca0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -61,6 +61,13 @@ nx-libs (2:3.5.0.33-0x2go1) UNRELEASED; urgency=low '%:' ruleset afterwards. Backported from Arctica GH 3.6.x branch. v2: backport to nx-libs 3.5.0.x (Mihai Moldovan) + * buildsystem: + - OPTFLAGS: Properly propagate build option flags to nxcomp{,ext,shad} and + the nx-X11 build scripts. + Backported from Arctica GH 3.6.x branch. + v2: backport to nx-libs 3.5.0.x (Mihai Moldovan) + Adds: + - debian/patches/1500_all_propagate-optflags-to-subcompone.full+lite.patch [ Ulrich Sibiller ] * nx-X11: Backport CVE-2017-2624 (timingsafe_memcmp) diff --git a/debian/patches/1500_all_propagate-optflags-to-subcompone.full+lite.patch b/debian/patches/1500_all_propagate-optflags-to-subcompone.full+lite.patch new file mode 100644 index 000000000..abc89d348 --- /dev/null +++ b/debian/patches/1500_all_propagate-optflags-to-subcompone.full+lite.patch @@ -0,0 +1,311 @@ +commit d650a0b47eadeb675e2d2cf03ad10a4dbc564971 +Author: Mike Gabriel +Date: Thu Jun 23 14:27:15 2016 +0200 + +OPTFLAGS: Properly propagate build option flags to nxcomp{,ext,shad} and the nx-X11 build scripts. + + Note: + + - The "normal" way to inject CFLAGS (and CPPFLAGS) into nx-X11 builds is copying those + options over into the variable CDEBUGFLAGS. + - LDFLAGS have to be handed to nx-X11 via LOCAL_LDFLAGS. + + This change also includes a slight change in the nx-X11 build order. + + Old build order: + + Main Makefile: + + - [...] + - libNX_X11 + + implicitly building nxcomp + + implicitly building nxcompext + - [...] + - nxagent + + implicitly building nxcompshad + - [...] + + New build ordner: + + Main Makefile: + + - [...] + - nxcomp + - setup nx-X11 build env + + cd nx-X11 && make BuildEnv + - nx-X11/lib/* + - nxcompext + - nxcompshad + - [...] + - nxagent + - [...] + + Fixes ArcticaProject/nx-libs#141 + Fixes X2GoBTS#84 + + Backported from Arctica GH 3.6.x branch. + + v2: backport to nx-libs 3.5.0.x (Mihai Moldovan) +--- a/nx-X11/lib/X11/Imakefile ++++ b/nx-X11/lib/X11/Imakefile +@@ -1148,44 +1148,6 @@ includes:: ks_tables.h + + CONFIGURE ?= ./configure + +-#if NXLibraries +- +-$(NX_XCOMPCONFIGTARGET): +- cd ../../../nxcomp && \ +- ${CONFIGURE} +- +-$(NX_XCOMPEXTCONFIGTARGET): +- cd ../../../nxcompext && \ +- ${CONFIGURE} +- +-#ifdef SunArchitecture +-$(NX_XCOMPLIBTARGET): $(NX_XCOMPCONFIGTARGET) +- ${MAKE} -C $(NX_XCOMPLIBDIR) +- +-$(NX_XCOMPEXTLIBTARGET): $(NX_XCOMPEXTCONFIGTARGET) +- ${MAKE} -C ../../../nxcompext +- +-#else +-$(NX_XCOMPLIBTARGET): $(NX_XCOMPCONFIGTARGET) +- ${MAKE} -C $(NX_XCOMPLIBDIR) +- +-$(NX_XCOMPEXTLIBTARGET): $(NX_XCOMPEXTCONFIGTARGET) $(NX_XCOMPLIBTARGET) lib$(LIBNAME).so.$(SOXLIBREV) +- ${MAKE} -C ../../../nxcompext +- +-#endif +- +-depend:: +- +-lib$(LIBNAME).so.$(SOXLIBREV): $(NX_XCOMPLIBTARGET) +- +-all:: $(NX_XCOMPLIBTARGET) +- +-depend:: $(NX_XCOMPLIBTARGET) +- +-all:: $(NX_XCOMPEXTLIBTARGET) +- +-#endif +- + depend:: ks_tables.h + + clean:: +--- a/nx-X11/Makefile ++++ b/nx-X11/Makefile +@@ -56,6 +56,18 @@ World: + ;; esac; + @date + @echo "" ++ if [ ! -f xmakefile ]; then ${MAKE} ${MFLAGS} BuildEnv; fi ++ ${MAKE} ${MAKE_OPTS} $(MFLAGS) $(WORLDOPTS) World ++ @echo "" ++ @date ++ @echo "" ++ @-$(RM) $(VERSPROG) ++ @-$(CC) $(VERSINC) -o $(VERSPROG) $(VERSSRC) ++ @echo Full build of $(RELEASE) complete. ++ @-$(RM) $(VERSPROG) ++ @echo "" ++ ++BuildEnv: + @if [ -f xmakefile ]; then \ + ${MAKE} ${MAKE_OPTS} -k distclean || \ + ${MAKE} ${MAKE_OPTS} -k clean || \ +@@ -91,15 +103,6 @@ World: + ${MAKE} ${MAKE_OPTS} $(MFLAGS) BOOTSTRAPSUBDIRS= clean + ${MAKE} ${MAKE_OPTS} $(MFLAGS) includes + ${MAKE} ${MAKE_OPTS} $(MFLAGS) depend +- ${MAKE} ${MAKE_OPTS} $(MFLAGS) $(WORLDOPTS) World +- @echo "" +- @date +- @echo "" +- @-$(RM) $(VERSPROG) +- @-$(CC) $(VERSINC) -o $(VERSPROG) $(VERSSRC) +- @echo Full build of $(RELEASE) complete. +- @-$(RM) $(VERSPROG) +- @echo "" + + .PRECIOUS: Makefile + +--- a/nx-X11/programs/Xserver/Imakefile ++++ b/nx-X11/programs/Xserver/Imakefile +@@ -1035,27 +1035,7 @@ NX_XSHADOWLIBNAME = cygXcompshad.dll + NX_XSHADOWLIBNAME = libXcompshad.so + #endif + +-NX_XSHADOWLIBDIR = $(XTOP)/../nxcompshad +-NX_XSHADOWLIBTARGET = $(NX_XSHADOWLIBDIR)/$(NX_XSHADOWLIBNAME) +-NX_XSHADOWCONFIGTARGET = $(NX_XSHADOWLIBDIR)/config.status +- +-CONFIGURE ?= ./configure +- +-$(NX_XSHADOWCONFIGTARGET): +- cd $(NX_XSHADOWLIBDIR) && \ +- ${CONFIGURE} +- +-#ifdef SunArchitecture +-$(NX_XSHADOWLIBTARGET): $(NX_XSHADOWCONFIGTARGET) +- cd $(NX_XSHADOWLIBDIR) && \ +- ${MAKE} +-#else +-$(NX_XSHADOWLIBTARGET): $(NX_XSHADOWCONFIGTARGET) +- cd $(NX_XSHADOWLIBDIR) && \ +- rm -f *.o && ${MAKE} +-#endif +- +-ServerTarget(nxagent,$(NX_XSHADOWLIBTARGET) $(NXAGENTDIRS),$(NXAGENTOBJS), \ ++ServerTarget(nxagent,$(NXAGENTDIRS),$(NXAGENTOBJS), \ + $(LIBCWRAPPER) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXAGENTSYSLIBS) $(NXAGENTNXLIBS)) + + /* +--- a/nxcomp/Makefile.in ++++ b/nxcomp/Makefile.in +@@ -41,6 +41,8 @@ CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEF + CXXINCLUDES = + CXXDEFINES = + ++CPPFLAGS = @CPPFLAGS@ ++ + # + # C programs have their own CFLAGS. + # +@@ -84,9 +86,9 @@ DEPENDINCLUDES = -I/usr/include/c++ -I/u + .SUFFIXES: .cpp.c + + .cpp.o: +- $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< ++ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< + .c.o: +- $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< ++ $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< + + LIBRARY = Xcomp + +--- a/nxcomp/configure.in ++++ b/nxcomp/configure.in +@@ -7,8 +7,12 @@ AC_PREREQ(2.13) + + dnl Set our default compilation flags. + +-CXXFLAGS="$CXXFLAGS -O3 -fno-rtti -fno-exceptions" +-CFLAGS="$CFLAGS -O3" ++if test "x$CXXFLAGS" = "x"; then ++ CXXFLAGS="-O3 -fno-rtti -fno-exceptions" ++fi ++if test "x$CFLAGS" = "x"; then ++ CFLAGS="$CFLAGS -O3" ++fi + + dnl Reset default linking directives. + +--- a/nxcompext/Makefile.in ++++ b/nxcompext/Makefile.in +@@ -34,6 +34,8 @@ CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEF + CXXINCLUDES = -I. -I../nxcomp + CXXDEFINES = + ++CPPFLAGS = @CPPFLAGS@ ++ + CC = @CC@ + CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \ + -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ +@@ -75,9 +77,9 @@ DEPENDINCLUDES = -I/usr/include/c++ -I/ + .SUFFIXES: .cpp.c + + .cpp.o: +- $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $< ++ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $< + .c.o: +- $(CC) -c $(CCFLAGS) $(CCINCLUDES) $< ++ $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $< + + LIBRARY = Xcompext + +--- a/nxcompext/configure.in ++++ b/nxcompext/configure.in +@@ -7,8 +7,12 @@ AC_PREREQ(2.13) + + dnl Reset default compilation flags. + +-CXXFLAGS="$CXXFLAGS -O3" +-CFLAGS="$CFLAGS -O3" ++if test "x$CXXFLAGS" = "x"; then ++ CXXFLAGS="-O3" ++fi ++if test "x$CFLAGS" == "x"; then ++ CFLAGS="-O3" ++fi + + dnl Reset default linking directives. + +--- a/nxcompshad/Makefile.in ++++ b/nxcompshad/Makefile.in +@@ -36,6 +36,8 @@ CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEF + CXXINCLUDES = + CXXDEFINES = + ++CPPFLAGS = @CPPFLAGS@ ++ + # + # C programs don't share the C++ flags. They should + # have their own @CCFLAGS@. +@@ -96,9 +98,9 @@ DEPENDINCLUDES = -I/usr/include/g++ -I/u + .SUFFIXES: .cpp.c + + .cpp.o: +- $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< ++ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< + .c.o: +- $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< ++ $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< + + LIBRARY = Xcompshad + +--- a/nxcompshad/configure.in ++++ b/nxcompshad/configure.in +@@ -7,8 +7,12 @@ AC_PREREQ(2.13) + + dnl Reset default compilation flags. + +-CXXFLAGS="$CXXFLAGS -O3" +-CPPFLAGS="$CPPFLAGS -O3" ++if test "x$CXXFLAGS" == "x"; then ++ CXXFLAGS="-O3" ++fi ++if test "x$CPPFLAGS" == "x"; then ++ CPPFLAGS="-O3" ++fi + + dnl Reset default linking directives. + +@@ -77,8 +81,8 @@ case "${gcc_version}" in + + *) + AC_MSG_RESULT([yes]) +- CXXFLAGS="$CXXFLAGS -Wmissing-declarations -Wnested-externs" +- CPPFLAGS="$CPPFLAGS -Wmissing-declarations -Wnested-externs" ++ CXXFLAGS="$CXXFLAGS -Wmissing-declarations" ++ CPPFLAGS="$CPPFLAGS -Wmissing-declarations" + ;; + esac + +--- a/nxproxy/configure.in ++++ b/nxproxy/configure.in +@@ -7,8 +7,12 @@ AC_PREREQ(2.13) + + dnl Reset default compilation flags. + +-CXXFLAGS="$CXXFLAGS -O3" +-CPPFLAGS="$CPPFLAGS -O3" ++if test "x$CXXFLAGS" == "x"; then ++ CXXFLAGS="-O3" ++fi ++if test "x$CPPFLAGS" == "x"; then ++ CPPFLAGS="-O3" ++fi + + dnl Prefer headers and libraries from nx-X11 if present. + diff --git a/debian/patches/series b/debian/patches/series index 8756cc4cc..fa84f83ac 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -151,6 +151,7 @@ 1300_nxcomp_Set-TokenSize-to-1536-for-lin.full+lite.patch 1301_nxcomp_Reduce-TokenSize-slightly-for.full+lite.patch 1400_nx-X11_Render.c-Improve-situation-fo.full+lite.patch +1500_all_propagate-optflags-to-subcompone.full+lite.patch 9900-dxpc-license-history.full+lite.patch 0016_nx-X11_install-location.debian.patch 0102_xserver-xext_set-securitypolicy-path.debian.patch diff --git a/debian/rules b/debian/rules index 10a079872..86c8b5811 100755 --- a/debian/rules +++ b/debian/rules @@ -141,7 +141,7 @@ override_dh_auto_build: cp -av .preserve/* . rm -Rf .preserve/ - LOCAL_LDFLAGS="$(LDFLAGS)" SHLIBGLOBALSFLAGS="$(LDFLAGS)" SHLIBDIR="$(LIBDIR)" PREFIX=/usr dh_auto_build --parallel + PREFIX=/usr dh_auto_build --parallel -- CDEBUGFLAGS="$(CPPFLAGS) $(CFLAGS)" LOCAL_LDFLAGS="$(LDFLAGS)" SHLIBGLOBALSFLAGS="$(LDFLAGS)" SHLIBDIR="$(LIBDIR)" override_dh_strip: dh_strip -plibnx-x11-6 --dbg-package=libnx-x11-6-dbg diff --git a/nx-libs.spec b/nx-libs.spec index ab7c01ad0..ab32deb49 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -766,6 +766,7 @@ chmod a+x my_configure; %{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro} export SHLIBGLOBALSFLAGS="%{__global_ldflags}" export LOCAL_LDFLAGS="%{__global_ldflags}" +export CDEBUGFLAGS="%{__global_cppflags} %{__global_cflags}" make %{?_smp_mflags} CONFIGURE="$PWD/my_configure" PREFIX=%{_prefix} USRLIBDIR=%{_libdir} SHLIBDIR=%{_libdir} %install -- cgit v1.2.3