From 4d1275f82671b1bb7cf639367eb412b3e821428d Mon Sep 17 00:00:00 2001 From: Anton Bolshakov Date: Mon, 2 Feb 2026 09:47:25 +0800 Subject: [PATCH] tigervnc: fork, workaround for https://github.com/TigerVNC/tigervnc/issues/1949 --- net-misc/tigervnc/Manifest | 2 + .../tigervnc-1.11.0-install-java-viewer.patch | 26 ++ ...ervnc-1.12.80-disable-server-and-pam.patch | 57 +++++ .../files/tigervnc-1.14.0-xsession-path.patch | 28 ++ net-misc/tigervnc/files/tigervnc-1.14.0.confd | 13 + net-misc/tigervnc/files/tigervnc-1.14.0.initd | 90 +++++++ .../tigervnc/files/tigervnc-1.14.1-pam.patch | 28 ++ .../files/tigervnc-1.15.0-fix-inetd.patch | 50 ++++ .../tigervnc/files/tigervnc-1.15.0-fltk.patch | 46 ++++ ...ervnc-1.15.90-disable-server-and-pam.patch | 123 +++++++++ ...nc-1.15.90-r2-disable-server-and-pam.patch | 94 +++++++ net-misc/tigervnc/metadata.xml | 19 ++ net-misc/tigervnc/tigervnc-1.15.0-r1.ebuild | 240 ++++++++++++++++++ 13 files changed, 816 insertions(+) create mode 100644 net-misc/tigervnc/Manifest create mode 100644 net-misc/tigervnc/files/tigervnc-1.11.0-install-java-viewer.patch create mode 100644 net-misc/tigervnc/files/tigervnc-1.12.80-disable-server-and-pam.patch create mode 100644 net-misc/tigervnc/files/tigervnc-1.14.0-xsession-path.patch create mode 100644 net-misc/tigervnc/files/tigervnc-1.14.0.confd create mode 100644 net-misc/tigervnc/files/tigervnc-1.14.0.initd create mode 100644 net-misc/tigervnc/files/tigervnc-1.14.1-pam.patch create mode 100644 net-misc/tigervnc/files/tigervnc-1.15.0-fix-inetd.patch create mode 100644 net-misc/tigervnc/files/tigervnc-1.15.0-fltk.patch create mode 100644 net-misc/tigervnc/files/tigervnc-1.15.90-disable-server-and-pam.patch create mode 100644 net-misc/tigervnc/files/tigervnc-1.15.90-r2-disable-server-and-pam.patch create mode 100644 net-misc/tigervnc/metadata.xml create mode 100644 net-misc/tigervnc/tigervnc-1.15.0-r1.ebuild diff --git a/net-misc/tigervnc/Manifest b/net-misc/tigervnc/Manifest new file mode 100644 index 000000000..0568655a2 --- /dev/null +++ b/net-misc/tigervnc/Manifest @@ -0,0 +1,2 @@ +DIST tigervnc-1.15.0.tar.gz 2126369 BLAKE2B c8646860884ae8fec7f81d9e87967bb279e7bf7ebcc69973660ed827f5a1cf6d8700a70a364e9099e68779b6dfb168242db2afa428f5cfc11784020696261191 SHA512 0b550296b5bd06ac9d63ce10861ff54d24e79b6ac1551d80e9b81845fa873d85bfd684112c66d86188c9c61fdffb9421ea8696c1c7fd15a24fb1bf6bfe6a5e05 +DIST xorg-server-21.1.15.tar.xz 5009756 BLAKE2B a7d5df70a4af98b903a306850a169879cf083b2c811f6e75e1e916f85441214541f7c9fa0e0089c4bf08c67597166d97ea194c6a0a511948568120e579d1104f SHA512 677bbec81ecdd1d14e1d289a00c40249988985ec636e5473b30c4f63bad03a6cc5f9168cea94969e1550370eee8863595bc9c064c3d218a96123afc7567bf363 diff --git a/net-misc/tigervnc/files/tigervnc-1.11.0-install-java-viewer.patch b/net-misc/tigervnc/files/tigervnc-1.11.0-install-java-viewer.patch new file mode 100644 index 000000000..3afaf82d0 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.11.0-install-java-viewer.patch @@ -0,0 +1,26 @@ +See bug for rationale, gist is that this is still useful. + +Patch from Erik Wallin +https://bugs.gentoo.org/769794 +--- a/java/CMakeLists.txt ++++ b/java/CMakeLists.txt +@@ -7,6 +7,8 @@ + + find_package(Java) + ++set(DATA_DIR "${CMAKE_INSTALL_PREFIX}/share") ++ + set(DEFAULT_JAVACFLAGS "-source 8 -target 8 -encoding UTF-8 -Xlint:all,-serial,-cast,-unchecked,-fallthrough,-dep-ann,-deprecation,-rawtypes") + set(JAVACFLAGS ${DEFAULT_JAVACFLAGS} CACHE STRING + "Java compiler flags (Default: ${DEFAULT_JAVACFLAGS})") +@@ -172,3 +174,10 @@ + -P ${SRCDIR}/cmake/SignJar.cmake) + + add_custom_target(java ALL DEPENDS VncViewer.jar) ++ ++if(NOT WIN32) ++ install(FILES ++ ${BINDIR}/VncViewer.jar ++ ${SRCDIR}/${CLASSPATH}/README ++ DESTINATION ${DATA_DIR}/vnc/classes) ++endif() diff --git a/net-misc/tigervnc/files/tigervnc-1.12.80-disable-server-and-pam.patch b/net-misc/tigervnc/files/tigervnc-1.12.80-disable-server-and-pam.patch new file mode 100644 index 000000000..e61f099d3 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.12.80-disable-server-and-pam.patch @@ -0,0 +1,57 @@ +See https://bugs.gentoo.org/852830 + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -234,6 +234,7 @@ + add_subdirectory(java) + endif() + ++option(BUILD_SERVER "Build TigerVNC server" ON) + option(BUILD_VIEWER "Build TigerVNC viewer" ON) + if(BUILD_VIEWER) + # Check for FLTK +@@ -276,7 +277,7 @@ + endif() + + # Check for PAM library +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + check_include_files(security/pam_appl.h HAVE_PAM_H) + set(CMAKE_REQUIRED_LIBRARIES -lpam) + check_function_exists(pam_start HAVE_PAM_START) +@@ -315,9 +316,6 @@ + add_subdirectory(media) + endif() + +-add_subdirectory(tests) +- +- + if(BUILD_VIEWER) + add_subdirectory(release) + endif() +--- a/common/rfb/CMakeLists.txt ++++ b/common/rfb/CMakeLists.txt +@@ -88,7 +88,7 @@ + target_sources(rfb PRIVATE WinPasswdValidator.cxx) + endif(WIN32) + +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + target_sources(rfb PRIVATE UnixPasswordValidator.cxx pam.c) + target_link_libraries(rfb ${PAM_LIBS}) + endif() +--- a/unix/CMakeLists.txt ++++ b/unix/CMakeLists.txt +@@ -1,6 +1,8 @@ + add_subdirectory(tx) + add_subdirectory(common) +-add_subdirectory(vncconfig) +-add_subdirectory(vncpasswd) +-add_subdirectory(vncserver) +-add_subdirectory(x0vncserver) ++if(BUILD_SERVER) ++ add_subdirectory(vncconfig) ++ add_subdirectory(vncpasswd) ++ add_subdirectory(vncserver) ++ add_subdirectory(x0vncserver) ++endif() diff --git a/net-misc/tigervnc/files/tigervnc-1.14.0-xsession-path.patch b/net-misc/tigervnc/files/tigervnc-1.14.0-xsession-path.patch new file mode 100644 index 000000000..898bd2122 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.14.0-xsession-path.patch @@ -0,0 +1,28 @@ +Add more possible paths for Xsession, depending on which display manager is +installed. We need an Xsession that executes its command line parameters, so +leave xinit last. + +See also https://bugs.gentoo.org/746227 and https://bugs.gentoo.org/936475 + +--- a/unix/vncserver/vncserver.in ++++ b/unix/vncserver/vncserver.in +@@ -437,11 +437,14 @@ + die "$prog: couldn't find \"$cmd\" on your PATH.\n"; + } + +- foreach $cmd ("/etc/X11/xinit/Xsession", "/etc/X11/Xsession") { +- if (-x "$cmd") { +- $Xsession = $cmd; +- last; +- } ++ $Xsession=$ENV{TIGERVNC_XSESSION_FILE}; ++ if (not defined $Xsession) { ++ foreach $cmd ("/usr/share/sddm/scripts/Xsession", "/etc/gdm/Xsession", "/etc/lightdm/Xsession", "/usr/share/slim/Xsession", "/etc/X11/Sessions/Xsession", "/etc/X11/xinit/Xsession", "/etc/X11/Xsession") { ++ if (-r "$cmd") { ++ $Xsession = $cmd; ++ last; ++ } ++ } + } + if (not defined $Xsession) { + die "$prog: Couldn't find suitable Xsession.\n"; diff --git a/net-misc/tigervnc/files/tigervnc-1.14.0.confd b/net-misc/tigervnc/files/tigervnc-1.14.0.confd new file mode 100644 index 000000000..9cadc6ab8 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.14.0.confd @@ -0,0 +1,13 @@ +# Config file for /etc/init.d/tigervnc + +# Add the user(s) Xvnc(1) should be run for to /etc/tigervnc/vncserver.users +# DISPLAYS is no loger used. + +# Optionally override the default Xsession file +# TIGERVNC_XSESSION_FILE="/usr/share/sddm/scripts/Xsession" +# TIGERVNC_XSESSION_FILE="/etc/gdm/Xsession" +# TIGERVNC_XSESSION_FILE="/etc/lightdm/Xsession" +# TIGERVNC_XSESSION_FILE="/usr/share/slim/Xsession" + +# vncsession no longer supports VNC_OPTS +# Use /etc/tigervnc/vncserver-config-defaults or $HOME/.config/tigervnc/config instead diff --git a/net-misc/tigervnc/files/tigervnc-1.14.0.initd b/net-misc/tigervnc/files/tigervnc-1.14.0.initd new file mode 100644 index 000000000..fa9e4248b --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.14.0.initd @@ -0,0 +1,90 @@ +#!/sbin/openrc-run +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License, v2 or later + +# shellcheck shell=sh + +# Create symlinks for all displays. +# For example for display :1, run `ln -s tigervnc /etc/init.d/tigervnc.1` +# Then `rc-update add tigervnc.1 default` +# For compatibility, /etc/init.d/tigervnc will start all displays. + +DISPLAYS=${SVCNAME#*.} +if [ "$DISPLAYS" = "tigervnc" ]; then + should_warn=1 + DISPLAYS=$(grep -v "^#" /etc/tigervnc/vncserver.users | sed -e 's/=.*//' -e 's/^://') +fi + +depend() { + need net +} + +checkconfig() { + if [ -n "${DISPLAYS}" ]; then + if [ "$1" = "start" ]; then + for display in $DISPLAYS; do + user="$(grep "^:${display}" /etc/tigervnc/vncserver.users)" + user=${user#*=} + if [ -z "${user}" ]; then + eerror "User is not defined for display :${display} in /etc/tigervnc/vncserver.users" + return 1 + elif [ -e "/tmp/.X11-unix/X${display}" ]; then + eerror "Display :${display} appears to be already in use because of /tmp/.X11-unix/X${display}" + eerror "Remove this file if there is no X server for :${display}" + return 1 + elif [ -e "/tmp/.X${display}-lock" ]; then + eerror "Display :${display} appears to be already in use because of /tmp/.X${display}-lock" + eerror "Remove this file if there is no X server for :${display}" + return 1 + # bug #690046 + # The default config directory is now ~/.config/tigervnc, but still supports ~/.vnc if not found + # Only warn if password is missing, do not error out. See bug #936442 + elif ! runuser -l "${user}" -s /bin/bash -c \ + "[[ ( -d ${XDG_CONFIG_HOME:-~/.config}/tigervnc && -f ${XDG_CONFIG_HOME:-~/.config}/tigervnc/passwd ) || ( ! -d ${XDG_CONFIG_HOME:-~/.config}/tigervnc && -f ~/.vnc/passwd ) ]]"; then + ewarn "There are no passwords defined for user ${user}. The server may not start." + fi + FREEDISPLAYS="${FREEDISPLAYS} ${display}" + done + fi + return 0 + else + eerror 'There are no displays configured in /etc/tigervnc/vncserver.users' + return 1 + fi +} + +checkwarn() { + if [ "${should_warn}" = "1" ]; then + ewarn 'Running /etc/init.d/tigervnc in compatibility mode' + ewarn 'Please migrate to one service per display as detailed here:' + ewarn 'https://wiki.gentoo.org/wiki/TigerVNC#Migrating_from_1.13.1-r2_or_lower:' + fi +} + +start() { + checkwarn + FREEDISPLAYS="" + checkconfig start || return 1 + for display in $FREEDISPLAYS; do + [ -n "${TIGERVNC_XSESSION_FILE}" ] && export TIGERVNC_XSESSION_FILE + ebegin "Starting TigerVNC server :${display}" + start-stop-daemon --start --pidfile=/run/vncsession-":${display}".pid /usr/libexec/vncsession-start -- ":${display}" + eend $? + done +} + +stop() { + checkconfig stop || return 2 + for display in $DISPLAYS; do + ebegin "Stopping TigerVNC server :${display}" + start-stop-daemon --stop --pidfile=/run/vncsession-":${display}".pid + eend $? + done + # Do not fail if a server is missing + /bin/true +} + +restart() { + svc_stop + svc_start +} diff --git a/net-misc/tigervnc/files/tigervnc-1.14.1-pam.patch b/net-misc/tigervnc/files/tigervnc-1.14.1-pam.patch new file mode 100644 index 000000000..b4630fab5 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.14.1-pam.patch @@ -0,0 +1,28 @@ +Comment out pam_selinux.so, the server does not start if missing. +Add pam_elogind.so for non-systemd installs. + +See also: +Bug: https://bugs.gentoo.org/746227 +Bug: https://bugs.gentoo.org/937283 + +--- a/unix/vncserver/tigervnc.pam ++++ b/unix/vncserver/tigervnc.pam +@@ -1,15 +1,13 @@ + #%PAM-1.0 + +-# THIS IS AN EXAMPLE CONFIGURATION +-# MODIFY AS NEEDED FOR YOUR DISTRIBUTION +- + # pam_selinux.so close should be the first session rule +--session required pam_selinux.so close ++#-session required pam_selinux.so close + session required pam_loginuid.so +--session required pam_selinux.so open ++#-session required pam_selinux.so open + session required pam_namespace.so + session optional pam_keyinit.so force revoke + session required pam_limits.so + -session optional pam_systemd.so ++-session optional pam_elogind.so + session required pam_unix.so + -session optional pam_reauthorize.so prepare diff --git a/net-misc/tigervnc/files/tigervnc-1.15.0-fix-inetd.patch b/net-misc/tigervnc/files/tigervnc-1.15.0-fix-inetd.patch new file mode 100644 index 000000000..b53940ecf --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.15.0-fix-inetd.patch @@ -0,0 +1,50 @@ +https://github.com/TigerVNC/tigervnc/commit/1f1aaca09a1f9919f5169caea9c396b14c2af765 +https://bugs.gentoo.org/952991 + +From 1f1aaca09a1f9919f5169caea9c396b14c2af765 Mon Sep 17 00:00:00 2001 +From: Pierre Ossman +Date: Tue, 8 Apr 2025 14:41:04 +0200 +Subject: [PATCH] Don't print Xvnc banner before parsing args + +If we'll be running in inetd mode, then stdout and stderr will be a +client socket and not an appropriate place for logging. + +Mimic what Xorg does instead. +--- + unix/xserver/hw/vnc/xvnc.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c +index ddb249937..a13168c47 100644 +--- a/unix/xserver/hw/vnc/xvnc.c ++++ b/unix/xserver/hw/vnc/xvnc.c +@@ -446,7 +446,7 @@ ddxProcessArgument(int argc, char *argv[], int i) + } + + if (!strcmp(argv[i], "-showconfig") || !strcmp(argv[i], "-version")) { +- /* Already shown at start */ ++ vncPrintBanner(); + exit(0); + } + +@@ -1171,8 +1171,11 @@ InitOutput(ScreenInfo * scrInfo, int argc, char **argv) + int i; + int NumFormats = 0; + +- if (serverGeneration == 1) ++ if (serverGeneration == 1) { ++ vncPrintBanner(); ++ + LoadExtensionList(vncExtensions, ARRAY_SIZE(vncExtensions), TRUE); ++ } + + #if XORG_AT_LEAST(1, 20, 0) + xorgGlxCreateVendor(); +@@ -1266,7 +1269,5 @@ vncClientGone(int fd) + int + main(int argc, char *argv[], char *envp[]) + { +- vncPrintBanner(); +- + return dix_main(argc, argv, envp); + } diff --git a/net-misc/tigervnc/files/tigervnc-1.15.0-fltk.patch b/net-misc/tigervnc/files/tigervnc-1.15.0-fltk.patch new file mode 100644 index 000000000..91e1666b5 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.15.0-fltk.patch @@ -0,0 +1,46 @@ +From 62d47fc4aab4419dbc2937b4aebdc6ff52671f06 Mon Sep 17 00:00:00 2001 +From: Adrian Fedoreanu +Date: Mon, 16 Dec 2024 20:42:14 +0100 +Subject: [PATCH] Avoid conflict with Fl_Window::maximize() + +First step to enable compatibility with FLTK 1.4. +--- + vncviewer/DesktopWindow.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx +index 45d22ef2cf..c11f9f85ec 100644 +--- a/vncviewer/DesktopWindow.cxx ++++ b/vncviewer/DesktopWindow.cxx +@@ -174,7 +174,7 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name, + #ifdef __APPLE__ + // On OS X we can do the maximize thing properly before the + // window is showned. Other platforms handled further down... +- if (maximize) { ++ if (::maximize) { + int dummy; + Fl::screen_work_area(dummy, dummy, w, h, geom_x, geom_y); + } +@@ -213,7 +213,7 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name, + // maximized property on Windows and X11 before showing the window. + // See STR #2083 and STR #2178 + #ifndef __APPLE__ +- if (maximize) { ++ if (::maximize) { + maximizeWindow(); + } + #endif +--- a/CMakeLists.txt.orig 2026-02-02 09:14:25.723507760 +0800 ++++ b/CMakeLists.txt 2026-02-02 09:14:49.660635476 +0800 +@@ -306,11 +306,6 @@ + set(CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES}) + +- check_cxx_source_compiles("#include \n#if FL_MAJOR_VERSION != 1 || FL_MINOR_VERSION != 3\n#error Wrong FLTK version\n#endif\nint main(int, char**) { return 0; }" OK_FLTK_VERSION) +- if(NOT OK_FLTK_VERSION) +- message(FATAL_ERROR "Incompatible version of FLTK") +- endif() +- + set(CMAKE_REQUIRED_FLAGS) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_REQUIRED_LIBRARIES) diff --git a/net-misc/tigervnc/files/tigervnc-1.15.90-disable-server-and-pam.patch b/net-misc/tigervnc/files/tigervnc-1.15.90-disable-server-and-pam.patch new file mode 100644 index 000000000..a7a130281 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.15.90-disable-server-and-pam.patch @@ -0,0 +1,123 @@ +Add BUILD_SERVER similar to BUILD_VIEWER + +Add a BUILD_SERVER option similar to BUILD_VIEWER. When BUILD_SERVER is +not active, we do not require pam, so also disable everything that needs +pam. This allows building the viewer on a machine where pam is not +installed. + +See https://bugs.gentoo.org/852830 + +Set ENABLE_WAYLAND to 0 if BUILD_SERVER is not active. + +Do not define _FORTIFY_SOURCE, it is already defined in Gentoo. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + + # Tell the compiler to be stringent +-add_compile_definitions(_FORTIFY_SOURCE=2) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant") +@@ -260,6 +259,7 @@ if(BUILD_JAVA) + add_subdirectory(java) + endif() + ++trioption(BUILD_SERVER "Build TigerVNC server") + trioption(BUILD_VIEWER "Build TigerVNC viewer") + if(BUILD_VIEWER) + # Check for FLTK +@@ -341,7 +341,7 @@ if (ENABLE_NETTLE) + endif() + + # Check for PAM library +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + find_package(PAM REQUIRED) + endif() + +@@ -391,21 +391,9 @@ if(UNIX AND NOT APPLE) + endif() + + # check for libraries needed for wayland support +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + trioption(ENABLE_WAYLAND "Enable wayland support") +- if(ENABLE_WAYLAND STREQUAL "AUTO") +- find_package(GLib) +- find_package(Gio) +- find_package(Gobject) +- +- # Portals specific +- find_package(PipeWire) +- find_package(Uuid) +- +- # wlroots specific +- find_package(WaylandClient) +- find_package(Xkbcommon) +- else() ++ if(ENABLE_WAYLAND) + find_package(GLib REQUIRED) + find_package(Gio REQUIRED) + find_package(Gobject REQUIRED) +@@ -418,11 +406,8 @@ if(UNIX AND NOT APPLE) + find_package(WaylandClient REQUIRED) + find_package(Xkbcommon REQUIRED) + endif() +- if(NOT GLIB_FOUND OR NOT GIO_FOUND OR NOT GOBJECT_FOUND OR NOT PIPEWIRE_FOUND +- OR NOT UUID_FOUND OR NOT WAYLANDCLIENT_FOUND OR NOT XKBCOMMON_FOUND) +- set(ENABLE_WAYLAND 0) +- message(WARNING "GLib, Gio, Gobject, PipeWire, Uuid, WaylandClient or Xkbcommon NOT found. w0vncserver disabled.") +- endif() ++else() ++ set(ENABLE_WAYLAND 0) + endif() + + find_package(GTest) +--- a/common/rfb/CMakeLists.txt ++++ b/common/rfb/CMakeLists.txt +@@ -76,7 +76,7 @@ if(WIN32) + target_sources(rfb PRIVATE WinPasswdValidator.cxx) + endif(WIN32) + +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + target_sources(rfb PRIVATE UnixPasswordValidator.cxx) + target_include_directories(rfb SYSTEM PRIVATE ${PAM_INCLUDE_DIRS}) + target_link_libraries(rfb ${PAM_LIBRARIES}) +--- a/tests/perf/CMakeLists.txt ++++ b/tests/perf/CMakeLists.txt +@@ -8,8 +8,10 @@ target_link_libraries(convperf test_util rfb) + add_executable(decperf decperf.cxx) + target_link_libraries(decperf test_util rdr rfb) + +-add_executable(encperf encperf.cxx) +-target_link_libraries(encperf test_util core rdr rfb) ++if(BUILD_SERVER) ++ add_executable(encperf encperf.cxx) ++ target_link_libraries(encperf test_util core rdr rfb) ++endif() + + if (BUILD_VIEWER) + add_executable(fbperf +--- a/unix/CMakeLists.txt ++++ b/unix/CMakeLists.txt +@@ -4,10 +4,12 @@ endif() + + add_subdirectory(tx) + add_subdirectory(common) +-add_subdirectory(vncconfig) +-add_subdirectory(vncpasswd) +-add_subdirectory(vncserver) +-add_subdirectory(x0vncserver) ++if(BUILD_SERVER) ++ add_subdirectory(vncconfig) ++ add_subdirectory(vncpasswd) ++ add_subdirectory(vncserver) ++ add_subdirectory(x0vncserver) ++endif() + + if (ENABLE_WAYLAND) + add_subdirectory(w0vncserver) diff --git a/net-misc/tigervnc/files/tigervnc-1.15.90-r2-disable-server-and-pam.patch b/net-misc/tigervnc/files/tigervnc-1.15.90-r2-disable-server-and-pam.patch new file mode 100644 index 000000000..f23a09884 --- /dev/null +++ b/net-misc/tigervnc/files/tigervnc-1.15.90-r2-disable-server-and-pam.patch @@ -0,0 +1,94 @@ +Add BUILD_SERVER similar to BUILD_VIEWER + +Add a BUILD_SERVER option similar to BUILD_VIEWER. When BUILD_SERVER is +not active, we do not require pam, so also disable everything that needs +pam. This allows building the viewer on a machine where pam is not +installed. + +See https://bugs.gentoo.org/852830 + +Set ENABLE_WAYLAND to 0 if BUILD_SERVER is not active. + +Do not define _FORTIFY_SOURCE, it is already defined in Gentoo. + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") + + # Tell the compiler to be stringent +-add_compile_definitions(_FORTIFY_SOURCE=2) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wformat=2 -Wvla") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wzero-as-null-pointer-constant") +@@ -260,6 +259,7 @@ if(BUILD_JAVA) + add_subdirectory(java) + endif() + ++trioption(BUILD_SERVER "Build TigerVNC server") + trioption(BUILD_VIEWER "Build TigerVNC viewer") + if(BUILD_VIEWER) + # Check for FLTK +@@ -341,7 +341,7 @@ if (ENABLE_NETTLE) + endif() + + # Check for PAM library +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + find_package(PAM REQUIRED) + endif() + +@@ -391,7 +391,7 @@ if(UNIX AND NOT APPLE) + endif() + + # check for libraries needed for wayland support +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + trioption(ENABLE_WAYLAND "Enable wayland support") + if(ENABLE_WAYLAND) + if(ENABLE_WAYLAND STREQUAL "AUTO") +--- a/common/rfb/CMakeLists.txt ++++ b/common/rfb/CMakeLists.txt +@@ -76,7 +76,7 @@ if(WIN32) + target_sources(rfb PRIVATE WinPasswdValidator.cxx) + endif(WIN32) + +-if(UNIX AND NOT APPLE) ++if(BUILD_SERVER AND UNIX AND NOT APPLE) + target_sources(rfb PRIVATE UnixPasswordValidator.cxx) + target_include_directories(rfb SYSTEM PRIVATE ${PAM_INCLUDE_DIRS}) + target_link_libraries(rfb ${PAM_LIBRARIES}) +--- a/tests/perf/CMakeLists.txt ++++ b/tests/perf/CMakeLists.txt +@@ -8,8 +8,10 @@ target_link_libraries(convperf test_util rfb) + add_executable(decperf decperf.cxx) + target_link_libraries(decperf test_util rdr rfb) + +-add_executable(encperf encperf.cxx) +-target_link_libraries(encperf test_util core rdr rfb) ++if(BUILD_SERVER) ++ add_executable(encperf encperf.cxx) ++ target_link_libraries(encperf test_util core rdr rfb) ++endif() + + if (BUILD_VIEWER) + add_executable(fbperf +--- a/unix/CMakeLists.txt ++++ b/unix/CMakeLists.txt +@@ -4,10 +4,12 @@ endif() + + add_subdirectory(tx) + add_subdirectory(common) +-add_subdirectory(vncconfig) +-add_subdirectory(vncpasswd) +-add_subdirectory(vncserver) +-add_subdirectory(x0vncserver) ++if(BUILD_SERVER) ++ add_subdirectory(vncconfig) ++ add_subdirectory(vncpasswd) ++ add_subdirectory(vncserver) ++ add_subdirectory(x0vncserver) ++endif() + + if (ENABLE_WAYLAND) + add_subdirectory(w0vncserver) diff --git a/net-misc/tigervnc/metadata.xml b/net-misc/tigervnc/metadata.xml new file mode 100644 index 000000000..9c726cced --- /dev/null +++ b/net-misc/tigervnc/metadata.xml @@ -0,0 +1,19 @@ + + + + + ceamac@gentoo.org + Viorel Munteanu + + + Build with DRI3 support + Build with DRM support + Build TigerVNC Java viewer + Use dev-libs/libpwquality for password quality checking in vncpasswd + Build TigerVNC server + Build TigerVNC viewer + + + TigerVNC/tigervnc + + diff --git a/net-misc/tigervnc/tigervnc-1.15.0-r1.ebuild b/net-misc/tigervnc/tigervnc-1.15.0-r1.ebuild new file mode 100644 index 000000000..c8b7f74fe --- /dev/null +++ b/net-misc/tigervnc/tigervnc-1.15.0-r1.ebuild @@ -0,0 +1,240 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +CMAKE_IN_SOURCE_BUILD=1 +inherit autotools cmake eapi9-ver flag-o-matic java-pkg-opt-2 optfeature systemd xdg + +XSERVER_VERSION="21.1.15" +XSERVER_PATCH_VERSION="21" + +DESCRIPTION="Remote desktop viewer display system" +HOMEPAGE="https://tigervnc.org" +SRC_URI="server? ( https://www.x.org/releases/individual/xserver/xorg-server-${XSERVER_VERSION}.tar.xz )" + +if [[ ${PV} == *9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/TigerVNC/tigervnc/" +else + SRC_URI+=" https://github.com/TigerVNC/tigervnc/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~alpha amd64 arm ~arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~sparc x86" +fi + +LICENSE="GPL-2" +SLOT="0" +IUSE="dri3 +drm gnutls java nls +opengl +server +viewer xinerama" +REQUIRED_USE=" + dri3? ( drm ) + java? ( viewer ) + opengl? ( server ) + || ( server viewer ) +" + +# TODO: sys-libs/libselinux +#