This commit is contained in:
Anton Bolshakov 2026-02-02 09:47:25 +08:00
parent 056e385d9d
commit 4d1275f826
No known key found for this signature in database
GPG key ID: 32BDCED870788F04
13 changed files with 816 additions and 0 deletions

View file

@ -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

View file

@ -0,0 +1,26 @@
See bug for rationale, gist is that this is still useful.
Patch from Erik Wallin <erikw@sizeit.se>
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()

View file

@ -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()

View file

@ -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";

View file

@ -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

View file

@ -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
}

View file

@ -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

View file

@ -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 <ossman@cendio.se>
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);
}

View file

@ -0,0 +1,46 @@
From 62d47fc4aab4419dbc2937b4aebdc6ff52671f06 Mon Sep 17 00:00:00 2001
From: Adrian Fedoreanu <phedoreanu@users.noreply.github.com>
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 <FL/Fl.H>\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)

View file

@ -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)

View file

@ -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)

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>ceamac@gentoo.org</email>
<name>Viorel Munteanu</name>
</maintainer>
<use>
<flag name="dri3">Build with DRI3 support</flag>
<flag name="drm">Build with DRM support</flag>
<flag name="java">Build TigerVNC Java viewer</flag>
<flag name="pwquality">Use <pkg>dev-libs/libpwquality</pkg> for password quality checking in vncpasswd</flag>
<flag name="server">Build TigerVNC server</flag>
<flag name="viewer">Build TigerVNC viewer</flag>
</use>
<upstream>
<remote-id type="github">TigerVNC/tigervnc</remote-id>
</upstream>
</pkgmetadata>

View file

@ -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
# <fltk-1.4: https://github.com/TigerVNC/tigervnc/pull/1887#issuecomment-2545662546
COMMON_DEPEND="
dev-libs/gmp:=
dev-libs/nettle:=
media-libs/libjpeg-turbo:=
virtual/zlib:=
x11-libs/libX11
x11-libs/libXext
x11-libs/libXrandr
x11-libs/pixman
gnutls? ( net-libs/gnutls:= )
nls? ( virtual/libiconv )
server? (
dev-libs/openssl:0=
sys-libs/pam
x11-libs/libXau
x11-libs/libxcvt
x11-libs/libXdamage
x11-libs/libXdmcp
x11-libs/libXfixes
x11-libs/libXfont2
x11-libs/libXtst
x11-libs/pixman
x11-apps/xauth
x11-apps/xinit
x11-apps/xkbcomp
x11-apps/xsetroot
x11-misc/xkeyboard-config
dri3? (
media-libs/mesa[opengl]
x11-libs/libxshmfence
)
opengl? ( media-libs/libglvnd[X] )
!net-misc/turbovnc[server]
)
viewer? (
media-video/ffmpeg:=
x11-libs/fltk:=
x11-libs/libXi
x11-libs/libXrender
!net-misc/turbovnc[viewer]
)
"
RDEPEND="${COMMON_DEPEND}
java? ( >=virtual/jre-1.8:* )
server? ( dev-lang/perl )
"
DEPEND="${COMMON_DEPEND}
java? ( >=virtual/jdk-1.8:* )
drm? ( x11-libs/libdrm )
server? (
media-fonts/font-util
x11-base/xorg-proto
x11-libs/libXi
x11-libs/libxkbfile
x11-libs/libXrender
x11-libs/xtrans
x11-misc/util-macros
opengl? ( media-libs/mesa )
)
"
BDEPEND="
virtual/pkgconfig
nls? ( sys-devel/gettext )
"
PATCHES=(
# Restore Java viewer
"${FILESDIR}"/${PN}-1.11.0-install-java-viewer.patch
"${FILESDIR}"/${PN}-1.14.0-xsession-path.patch
"${FILESDIR}"/${PN}-1.12.80-disable-server-and-pam.patch
"${FILESDIR}"/${PN}-1.14.1-pam.patch
"${FILESDIR}"/${P}-fix-inetd.patch
# https://github.com/TigerVNC/tigervnc/issues/1949
"${FILESDIR}"/${PN}-1.15.0-fltk.patch
)
src_unpack() {
if [[ ${PV} == *9999 ]]; then
git-r3_src_unpack
use server && unpack xorg-server-${XSERVER_VERSION}.tar.xz
else
default
fi
}
src_prepare() {
if use server; then
cp -r "${WORKDIR}"/xorg-server-${XSERVER_VERSION}/. unix/xserver || die
fi
cmake_src_prepare
if use server; then
cd unix/xserver || die
eapply ../xserver${XSERVER_PATCH_VERSION}.patch
eautoreconf
sed -i '/strcmp.*-fakescreenfps/,/^ \}/d' os/utils.c || die
if use drm; then
cd "${WORKDIR}" && \
sed -i 's:\(drm_fourcc.h\):libdrm/\1:' $(grep drm_fourcc.h -rl .) || die
fi
fi
}
src_configure() {
if use arm || use hppa; then
append-flags "-fPIC"
fi
local mycmakeargs=(
-DENABLE_GNUTLS=$(usex gnutls)
-DENABLE_NLS=$(usex nls)
-DBUILD_JAVA=$(usex java)
-DBUILD_SERVER=$(usex server)
-DBUILD_VIEWER=$(usex viewer)
)
cmake_src_configure
if use server; then
cd unix/xserver || die
econf \
$(use_enable opengl glx) \
$(use_enable drm libdrm) \
--disable-config-hal \
--disable-config-udev \
--disable-devel-docs \
--disable-dri \
$(use_enable dri3) \
--disable-glamor \
--disable-kdrive \
--disable-libunwind \
--disable-linux-acpi \
--disable-record \
--disable-selective-werror \
--disable-static \
--disable-unit-tests \
--disable-xephyr \
$(use_enable xinerama) \
--disable-xnest \
--disable-xorg \
--disable-xvfb \
--disable-xwin \
--enable-dri2 \
--with-pic \
--without-dtrace \
--with-sha1=libcrypto
fi
}
src_compile() {
cmake_src_compile
if use server; then
# deps of the vnc module and the module itself
local d subdirs=(
fb xfixes Xext dbe $(usex opengl glx "") $(usev dri3) randr render
damageext miext Xi xkb composite dix mi os present hw/vnc
)
for d in "${subdirs[@]}"; do
emake -C unix/xserver/"${d}"
done
fi
}
src_install() {
cmake_src_install
if use server; then
emake -C unix/xserver/hw/vnc DESTDIR="${D}" install
rm -v "${ED}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la || die
newconfd "${FILESDIR}"/${PN}-1.14.0.confd ${PN}
newinitd "${FILESDIR}"/${PN}-1.14.0.initd ${PN}
systemd_douserunit unix/vncserver/vncserver@.service
# install vncserver to /usr/bin too, see bug #836620
dosym -r /usr/libexec/vncserver /usr/bin/vncserver
fi
}
pkg_postinst() {
xdg_pkg_postinst
use server && ver_replacing -lt 1.13.1-r3 && {
elog 'OpenRC users: please migrate to one service per display as documented here:'
elog 'https://wiki.gentoo.org/wiki/TigerVNC#Migrating_from_1.13.1-r2_or_lower:'
elog
}
use server && {
elog 'PLEASE NOTE:'
elog ' The default config directory is now ${XDG_CONFIG_HOME}/tigervnc or'
elog ' ~/.config/tigervnc instead of ~/.vnc'
elog
}
local OPTIONAL_DM="gnome-base/gdm x11-misc/lightdm x11-misc/sddm x11-misc/slim"
use server && \
optfeature "keeping track of the xorg-server module" net-misc/tigervnc-xorg-module && \
optfeature_header "Install any additional display manager package:" && \
optfeature "proper session support" ${OPTIONAL_DM}
}