From 85da5069bb5bd719db778ffd62a4656d1a1e3bf3 Mon Sep 17 00:00:00 2001 From: "Brian P. Hinz" Date: Sat, 12 Sep 2015 16:11:36 -0400 Subject: [PATCH] Compile legacy Xvnc with relative rpath for portability Build with rpath link so that Xvnc finds our libGL even if it's not installed in "/". Also applied dridir and xkbcompdir patches so that the correct DRI driver gets loaded. --- .../SOURCES/tigervnc14-Add-dridir-param.patch | 103 ++++++++++++++++++ .../tigervnc14-Add-xkbcompdir-param.patch | 46 ++++++++ contrib/packages/rpm/el5/SPECS/tigervnc.spec | 36 +++--- 3 files changed, 171 insertions(+), 14 deletions(-) create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch create mode 100644 contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch new file mode 100644 index 00000000..2445f519 --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-dridir-param.patch @@ -0,0 +1,103 @@ +From 0acffdd6f443198378012405e7f814f5abf278b3 Mon Sep 17 00:00:00 2001 +From: Adam Tkac +Date: Wed, 15 Sep 2010 15:37:01 +0200 +Subject: [PATCH] Add -dridir parameter to specify DRI drivers directory from command line. + +Signed-off-by: Adam Tkac +--- + glx/glxdri.c | 2 -- + glx/glxdri2.c | 2 -- + glx/glxdriswrast.c | 2 -- + glx/glxext.c | 27 +++++++++++++++++++++++++++ + glx/glxserver.h | 3 +++ + os/utils.c | 9 +++++++++ + 6 files changed, 39 insertions(+), 6 deletions(-) + +diff --git a/glx/glxext.c b/glx/glxext.c +index 89e58b0..5e7cf23 100644 +--- a/glx/glxext.c ++++ b/glx/glxext.c +@@ -608,3 +608,30 @@ static int __glXDispatch(ClientPtr client) + + return retval; + } ++ ++char *dri_driver_path = DRI_DRIVER_PATH; ++ ++int GlxProcessArguments(int argc, char *argv[], int i) ++{ ++ if (strncmp(argv[i], "-dridir", 7) == 0) { ++ if (++i < argc) { ++#if !defined(WIN32) && !defined(__CYGWIN__) ++ if (getuid() != geteuid()) { ++ LogMessage(X_WARNING, "-dridir is not available for setuid X servers\n"); ++ return -1; ++ } else ++#endif ++ { ++ if (strlen(argv[i]) < PATH_MAX) { ++ dri_driver_path = argv[i]; ++ return 2; ++ } else { ++ LogMessage(X_ERROR, "-dridir pathname too long\n"); ++ return -1; ++ } ++ } ++ } ++ } ++ ++ return 0; ++} +diff --git a/glx/glxserver.h b/glx/glxserver.h +index 1daf977..082ff82 100644 +--- a/glx/glxserver.h ++++ b/glx/glxserver.h +@@ -251,4 +251,7 @@ extern unsigned glxMinorVersion; + + extern int __glXEventBase; + ++extern char *dri_driver_path; ++extern int GlxProcessArguments(int argc, char *argv[], int i); ++ + #endif /* !__GLX_server_h__ */ +diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c +--- a/glx/glxdricommon.c ++++ b/glx/glxdricommon.c +@@ -209,6 +209,4 @@ + return head.next; + } + +-static const char dri_driver_path[] = DRI_DRIVER_PATH; +- + void * + glxProbeDriver(const char *driverName, +diff --git a/os/utils.c b/os/utils.c +index 13d3b3f..ff97c86 100644 +--- a/os/utils.c ++++ b/os/utils.c +@@ -139,6 +139,7 @@ Bool noDPMSExtension = FALSE; + #ifdef GLXEXT + Bool noGlxExtension = FALSE; + Bool noGlxVisualInit = FALSE; ++extern int GlxProcessArguments(int argc, char *argv[], int i); + #endif + #ifdef SCREENSAVER + Bool noScreenSaverExtension = FALSE; +@@ -704,6 +705,14 @@ ProcessCommandLine(int argc, char *argv[]) + else + UseMsg(); + } ++#ifdef GLXEXT ++ else if ((skip = GlxProcessArguments(argc,argv,i)) != 0) { ++ if (skip > 0) ++ i += skip - 1; ++ else ++ UseMsg(); ++ } ++#endif + #ifdef RLIMIT_DATA + else if (strcmp(argv[i], "-ld") == 0) { + if (++i < argc) { +-- +1.7.3.2 + diff --git a/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch b/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch new file mode 100644 index 00000000..0d82ba4a --- /dev/null +++ b/contrib/packages/rpm/el5/SOURCES/tigervnc14-Add-xkbcompdir-param.patch @@ -0,0 +1,46 @@ +From 5e6e99eaef3ca346c78a3e520ed58ec8b8100b41 Mon Sep 17 00:00:00 2001 +From: Adam Tkac +Date: Thu, 2 Sep 2010 17:24:38 +0200 +Subject: [PATCH] Add -xkbcompdir parameter to modify "xkbcomp" path from commandline. + +Signed-off-by: Adam Tkac +--- + xkb/xkbInit.c | 21 +++++++++++++++++++++ + 1 files changed, 21 insertions(+), 0 deletions(-) + +diff --git a/xkb/xkbInit.c b/xkb/xkbInit.c +index fbf8f14..29fb33e 100644 +--- a/xkb/xkbInit.c ++++ b/xkb/xkbInit.c +@@ -742,7 +742,28 @@ XkbProcessArguments(int argc,char *argv[],int i) + } + } + return j; ++ } else if (strncmp(argv[i], "-xkbcompdir", 11)==0) { ++ if (++i < argc) { ++#if !defined(WIN32) && !defined(__CYGWIN__) ++ if (getuid() != geteuid()) { ++ LogMessage(X_WARNING, "-xkbdir is not available for setuid X servers\n"); ++ return -1; ++ } else ++#endif ++ { ++ if (strlen(argv[i]) < PATH_MAX) { ++ XkbBinDirectory = argv[i]; ++ return 2; ++ } else { ++ LogMessage(X_ERROR, "-xkbcompdir pathname too long\n"); ++ return -1; ++ } ++ } ++ } else { ++ return -1; ++ } + } ++ + if ((strcmp(argv[i], "-ardelay") == 0) || (strcmp(argv[i], "-ar1") == 0)) { /* -ardelay int */ + if (++i >= argc) + UseMsg(); +-- +1.7.2.3 + diff --git a/contrib/packages/rpm/el5/SPECS/tigervnc.spec b/contrib/packages/rpm/el5/SPECS/tigervnc.spec index 94c2fcfc..ca5d7678 100644 --- a/contrib/packages/rpm/el5/SPECS/tigervnc.spec +++ b/contrib/packages/rpm/el5/SPECS/tigervnc.spec @@ -5,7 +5,7 @@ Name: tigervnc Version: @VERSION@ -Release: 7%{?snap:.%{snap}}%{?dist} +Release: 8%{?snap:.%{snap}}%{?dist} Summary: A TigerVNC remote display system Group: User Interface/Desktops @@ -100,7 +100,7 @@ Source203: http://dri.freedesktop.org/libdrm/libdrm-2.4.52.tar.bz2 Source204: ftp://ftp.freedesktop.org/pub/mesa/older-versions/9.x/9.2.5/MesaLib-9.2.5.tar.bz2 # NOTE: # libgcrypt from el5 is not new enough to satisfy newer Xorg requirements for --with-sha1, -# which causes Xorg to link against libssl.so and introduce about 10 dynamic dependencies. +# which causes Xorg to link against libssl.so and introduce about 10 dynamic dependencies. # to prevent this, build a static libsha1 and link against that. # NOTE: Source205: https://github.com/dottedmag/libsha1/archive/0.3.tar.gz @@ -133,6 +133,8 @@ Obsoletes: tightvnc < 1.5.0-0.15.20090204svn3586 # tigervnc patches Patch4: tigervnc-cookie.patch Patch12: tigervnc14-static-build-fixes.patch +Patch13: tigervnc14-Add-dridir-param.patch +Patch14: tigervnc14-Add-xkbcompdir-param.patch # fltk patches Patch15: fltk-1.3.3-static-libs.patch @@ -187,7 +189,7 @@ Patch10001: 17_CVE-regressions.diff Patch10002: CVE-2015-0255.diff # http://www.x.org/wiki/Development/Security/Advisory-2015-03-17/ Patch10003: CVE-2015-1802.diff -Patch10004: CVE-2015-1803.diff +Patch10004: CVE-2015-1803.diff Patch10005: CVE-2015-1804.diff # http://lists.x.org/archives/xorg-announce/2015-April/002561.html Patch10006: CVE-2013-7439.diff @@ -422,6 +424,8 @@ for all in `find . -type f -perm -001`; do chmod -x "$all" done patch -p1 < %{_builddir}/%{name}-%{version}%{?snap:-%{snap}}/unix/xserver112.patch +%patch13 -p1 -b .dridir +%patch14 -p1 -b .xkbcompdir popd @@ -557,7 +561,7 @@ cat >%{xorg_buildroot}%{_includedir}/freetype2/freetype/config/ftconfig.h < %{xorg_buildroot}%{_libdir}/pkgconfig/pthread-stubs.pc - sed -i -e 's/^\(Libs.private:.*\)$/\1 -L${libdir} -lXdmcp -lXau/' %{xorg_buildroot}%{_libdir}/pkgconfig/xcb.pc + sed -i -e 's/^\(Libs.private:.*\)$/\1 -L${libdir} -lXdmcp -lXau/' %{xorg_buildroot}%{_libdir}/pkgconfig/xcb.pc elif [ "${module}" = "libX11" ]; then - sed -i -e 's/^\(Libs:.*\)$/\1 -ldl/' %{xorg_buildroot}%{_libdir}/pkgconfig/x11.pc - sed -i -e 's/^\(Libs.private:.*\)$/\1 -L${libdir} -lxcb/' %{xorg_buildroot}%{_libdir}/pkgconfig/x11.pc + sed -i -e 's/^\(Libs:.*\)$/\1 -ldl/' %{xorg_buildroot}%{_libdir}/pkgconfig/x11.pc + sed -i -e 's/^\(Libs.private:.*\)$/\1 -L${libdir} -lxcb/' %{xorg_buildroot}%{_libdir}/pkgconfig/x11.pc elif [ "${module}" = "libSM" ]; then echo 'Libs.private: -L${libdir} -lICE' >> %{xorg_buildroot}%{_libdir}/pkgconfig/sm.pc fi @@ -748,7 +752,7 @@ autoreconf -fiv %endif # link libGL statically against any xorg libraries built above -LDFLAGS="$LDFLAGS -Wl,-Bstatic -lxcb -lX11 -lXdmcp -lXau -lXext -lXxf86vm -ldrm -Wl,-Bdynamic -Wl,-rpath,%{_libdir}/tigervnc:%{_libdir}" \ +LDFLAGS="$LDFLAGS -Wl,-Bstatic -lxcb -lX11 -lXdmcp -lXau -lXext -lXxf86vm -ldrm -Wl,-Bdynamic -Wl,-rpath,"'\$$'"ORIGIN/../..%{_libdir}/tigervnc:%{_libdir}/tigervnc:%{_libdir}" \ PKG_CONFIG="pkg-config --static" ./configure %{common_flags} \ --prefix=%{_prefix} \ --libdir=%{_libdir}/tigervnc \ @@ -789,7 +793,7 @@ echo "*** Building fltk ***" pushd fltk-* export CMAKE_PREFIX_PATH="%{xorg_buildroot}%{_prefix}:%{_prefix}" export CMAKE_EXE_LINKER_FLAGS=$LDFLAGS -export PKG_CONFIG="pkg-config --static" +export PKG_CONFIG="pkg-config --static" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir} \ @@ -804,7 +808,7 @@ CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" ./configure \ --enable-xdbe \ --enable-xfixes \ --enable-xcursor \ - --with-x + --with-x make %{?_smp_mflags} make DESTDIR=%{xorg_buildroot} install popd @@ -828,10 +832,10 @@ make %{?_smp_mflags} pushd unix/xserver export PIXMANINCDIR=%{xorg_buildroot}%{_includedir}/pixman-1 sed -i -e 's/^\(\s*WAYLAND_SCANNER_RULES.*\)/dnl\1/' configure.ac -autoreconf -fiv +autoreconf -fiv chmod +x ./configure # create a relocatable Xvnc so that we can bundle the custom libGL & swrast w/o overwriting existing libs -GL_LIBS='-Wl,-Bdynamic -lGL' LDFLAGS="$LDFLAGS -L%{xorg_buildroot}%{_libdir}/tigervnc -Wl,-rpath,%{_libdir}/tigervnc:%{_libdir}" \ +GL_LIBS='-Wl,-Bdynamic -lGL' LDFLAGS="$LDFLAGS -L%{xorg_buildroot}%{_libdir}/tigervnc -Wl,-rpath,"'\$$'"ORIGIN/../..%{_libdir}/tigervnc:%{_libdir}/tigervnc:%{_libdir}" \ %configure \ --prefix=%{_prefix} --libdir=%{_libdir} --mandir=%{_datadir}/man \ --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} \ @@ -997,6 +1001,10 @@ fi %{_datadir}/icons/hicolor/*/apps/* %changelog +* Sun Sep 12 2015 Brian P. Hinz 1.5.80-8 +- Build Xvnc with link path relative to $ORIGIN and apply dridir patch + to make it portable. + * Sun Aug 09 2015 Brian P. Hinz 1.5.80-7 - Patch Xorg sources with latest relevant CVE patches. - Update libjpeg-turbo, gnutls, libtasn1 to latest upstream versions. @@ -1048,11 +1056,11 @@ fi * Sat Mar 30 2013 Brian P. Hinz 1.2.0-11.20130330svn5066 - Updated to TigerVNC svn 5066 - Updated fltk to 1.3.2 and updated fltk patches per BUILDING.txt -- Fixed vncserver init script & config file which had been overwritten by +- Fixed vncserver init script & config file which had been overwritten by systemd versions. * Wed Nov 28 2012 Brian P. Hinz 1.2.0-7.20120915svn4999 -- Changed BuildRequires to cmake28 +- Changed BuildRequires to cmake28 - Set PIXMANINCDIR when building Xvnc * Tue Sep 18 2012 Brian P. Hinz 1.2.0-6.20120915svn4999 -- 2.39.5