public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/tigervnc/files/, net-misc/tigervnc/
Date: Fri, 18 Mar 2022 18:52:34 +0000 (UTC)	[thread overview]
Message-ID: <1647629518.c0660ebeeddda8fb14f5f34f40d467b6e6f288d1.sam@gentoo> (raw)

commit:     c0660ebeeddda8fb14f5f34f40d467b6e6f288d1
Author:     Viorel Munteanu <ceamac.paragon <AT> gmail <DOT> com>
AuthorDate: Fri Feb 18 17:38:03 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 18 18:51:58 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c0660ebe

net-misc/tigervnc: fix start server with openrc

Add support to override the default Xsession file

Bug: https://bugs.gentoo.org/746227
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Viorel Munteanu <ceamac.paragon <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/tigervnc-1.12.0-xsession-path.patch      |  28 +++
 net-misc/tigervnc/files/tigervnc-1.12.0.confd      |  15 ++
 net-misc/tigervnc/files/tigervnc-1.12.0.initd      |  75 ++++++++
 net-misc/tigervnc/tigervnc-1.12.0-r2.ebuild        | 201 +++++++++++++++++++++
 4 files changed, 319 insertions(+)

diff --git a/net-misc/tigervnc/files/tigervnc-1.12.0-xsession-path.patch b/net-misc/tigervnc/files/tigervnc-1.12.0-xsession-path.patch
new file mode 100644
index 000000000000..bfcf6ceaef16
--- /dev/null
+++ b/net-misc/tigervnc/files/tigervnc-1.12.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
+
+--- 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 (-x "$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.12.0.confd b/net-misc/tigervnc/files/tigervnc-1.12.0.confd
new file mode 100644
index 000000000000..a65c991eabcc
--- /dev/null
+++ b/net-misc/tigervnc/files/tigervnc-1.12.0.confd
@@ -0,0 +1,15 @@
+# Config file for /etc/init.d/tigervnc
+
+# Specify the user(s) Xvnc(1) should be run for. The syntax is: "username:display".
+# example: "DISPLAYS="foo:1 bar:2" You can specify more users separated by space.
+# DISPLAYS="myuser:1"
+# Do not forget to add them to /etc/tigervnc/vncserver.users too
+
+# 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"
+
+# Specify any of vncserver(1) and Xvnc(1) options. See the respective man pages for more information.
+# VNC_OPTS=""

diff --git a/net-misc/tigervnc/files/tigervnc-1.12.0.initd b/net-misc/tigervnc/files/tigervnc-1.12.0.initd
new file mode 100644
index 000000000000..59da61eed5f7
--- /dev/null
+++ b/net-misc/tigervnc/files/tigervnc-1.12.0.initd
@@ -0,0 +1,75 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License, v2 or later
+
+depend() {
+	need net
+}
+
+checkconfig() {
+	if [ -n "${DISPLAYS}" ]; then
+		if [ $1 = "start" ]; then
+			local user
+			for user in $DISPLAYS; do
+				if eval [ ! -f "~${user%%:*}/.vnc/passwd" ]; then
+					eerror "There are no passwords defined for user ${user%%:*}."
+					return 1
+				elif [ -e "/tmp/.X11-unix/X${user##*:}" ]; then
+					eerror "Display :${user##*:} appears to be already in use because of /tmp/.X11-unix/X${user##*:}"
+					eerror "Remove this file if there is no X server $HOSTNAME:${user##*:}"
+					return 1
+				elif [ -e "/tmp/.X${user##*:}-lock" ]; then
+					eerror "Display :${user##*:} appears to be already in use because of /tmp/.X${user##*:}-lock"
+					eerror "Remove this file if there is no X server $HOSTNAME:${user##*:}"
+					return 1
+				elif ! grep -E "^[^#]*:${user##*:}=${user%%:*}" /etc/tigervnc/vncserver.users > /dev/null 2>&1; then
+					eerror "User ${user%%:*} is not defined for display :${user##*:} in /etc/tigervnc/vncserver.users"
+					return 1
+				fi
+			done
+		fi
+		return 0
+	else
+		eerror 'Please define $DISPLAYS in /etc/conf.d/tigervnc'
+		return 1
+	fi
+}
+
+start() {
+	checkconfig start || return 1
+	ebegin "Starting TigerVNC server"
+	for user in $DISPLAYS; do
+		usrname=${user%%:*}
+		usropts=VNC_OPTS_${usrname}
+		usrdisp=${user##*:}
+		usrvar=$usropts"["$usrdisp"]"
+		[ -z ${!usrvar} ] && vnc_opts=$VNC_OPTS || vnc_opts=${!usrvar}
+
+		[ -n "${TIGERVNC_XSESSION_FILE}" ] && export TIGERVNC_XSESSION_FILE
+
+		/usr/libexec/vncsession-start :${user##*:} $vnc_opts &>/dev/null
+	done
+	eend $?
+}
+
+stop() {
+	checkconfig stop || return 2
+	ebegin "Stopping TigerVNC server"
+	for user in $DISPLAYS; do
+		# vncserver no longer provides a `-kill` option
+		# killing vncsession does not work, we have to kill Xvnc
+		# run pstree to see exactly what's going on
+		sessionpid=`cat /run/vncsession-\:${user##*:}.pid`
+		serverpid=`pstree -p $sessionpid | grep Xvnc | sed -e 's/^.*Xvnc(//
+			s/).*$//'`
+		kill $serverpid &>/dev/null
+	done
+	# Do not fail if a server is missing
+	/bin/true
+	eend $?
+}
+
+restart() {
+        svc_stop
+        svc_start
+}

diff --git a/net-misc/tigervnc/tigervnc-1.12.0-r2.ebuild b/net-misc/tigervnc/tigervnc-1.12.0-r2.ebuild
new file mode 100644
index 000000000000..a87123a7d275
--- /dev/null
+++ b/net-misc/tigervnc/tigervnc-1.12.0-r2.ebuild
@@ -0,0 +1,201 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_IN_SOURCE_BUILD=1
+inherit autotools cmake flag-o-matic java-pkg-opt-2 optfeature systemd xdg
+
+XSERVER_VERSION="21.1.1"
+
+DESCRIPTION="Remote desktop viewer display system"
+HOMEPAGE="http://www.tigervnc.org"
+SRC_URI="https://github.com/TigerVNC/tigervnc/archive/v${PV}.tar.gz -> ${P}.tar.gz
+	server? (
+		ftp://ftp.freedesktop.org/pub/xorg/individual/xserver/xorg-server-${XSERVER_VERSION}.tar.xz
+		https://github.com/TigerVNC/tigervnc/commit/0c5a2b2e7759c2829c07186cfce4d24aa9b5274e.patch -> ${P}-xserver-21.patch
+	)"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="dri3 +drm gnutls java nls +opengl server xinerama +xorgmodule"
+
+CDEPEND="
+	virtual/jpeg:0
+	sys-libs/zlib:=
+	>=x11-libs/fltk-1.3.1
+	sys-libs/pam
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXrender
+	x11-libs/pixman
+	gnutls? ( net-libs/gnutls:= )
+	nls? ( virtual/libiconv )
+	server? (
+		x11-libs/libXau
+		x11-libs/libXdamage
+		x11-libs/libXdmcp
+		x11-libs/libXfont2
+		x11-libs/libXtst
+		>=x11-libs/pixman-0.27.2
+		>=x11-apps/xauth-1.0.3
+		x11-apps/xsetroot
+		>=x11-misc/xkeyboard-config-2.4.1-r3
+		xorgmodule? ( =x11-base/xorg-server-${XSERVER_VERSION%.*}* )
+		drm? ( x11-libs/libdrm )
+		dev-libs/openssl:0=
+	)
+	xinerama? ( x11-libs/libXinerama )
+	"
+
+RDEPEND="${CDEPEND}
+	java? ( virtual/jre:1.8 )
+	server? (
+		dev-lang/perl
+		sys-process/psmisc
+	)"
+
+DEPEND="${CDEPEND}
+	nls? ( sys-devel/gettext )
+	java? ( virtual/jdk:1.8 )
+	x11-base/xorg-proto
+	media-libs/fontconfig
+	x11-libs/libICE
+	x11-libs/libSM
+	x11-libs/libXcursor
+	x11-libs/libXfixes
+	x11-libs/libXft
+	x11-libs/libXi
+	server? (
+		dev-libs/libbsd
+		x11-libs/libxkbfile
+		x11-libs/libxshmfence
+		virtual/pkgconfig
+		media-fonts/font-util
+		x11-misc/util-macros
+		>=x11-libs/xtrans-1.3.3
+		opengl? ( >=media-libs/mesa-10.3.4-r1 )
+	)"
+
+PATCHES=(
+	# Restore Java viewer
+	"${FILESDIR}"/${PN}-1.11.0-install-java-viewer.patch
+	"${FILESDIR}"/${PN}-1.12.0-xsession-path.patch
+)
+
+src_prepare() {
+	if use server; then
+		cp -r "${WORKDIR}"/xorg-server-${XSERVER_VERSION}/. unix/xserver || die
+		eapply "${FILESDIR}"/${P}-xorg-1.21.patch
+		eapply "${DISTDIR}"/${P}-xserver-21.patch
+	fi
+
+	cmake_src_prepare
+
+	if use server; then
+		cd unix/xserver || die
+		eapply ../xserver${XSERVER_VERSION}.patch
+		eautoreconf
+		sed -i 's:\(present.h\):../present/\1:' os/utils.c || die
+		sed -i '/strcmp.*-fakescreenfps/,/^        \}/d' os/utils.c || die
+	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)
+	)
+
+	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 \
+			--disable-present \
+			--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 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
+		if ! use xorgmodule; then
+			rm -rv "${ED}"/usr/$(get_libdir)/xorg || die
+		else
+			rm -v "${ED}"/usr/$(get_libdir)/xorg/modules/extensions/libvnc.la || die
+		fi
+
+		newconfd "${FILESDIR}"/${PN}-${PV}.confd ${PN}
+		newinitd "${FILESDIR}"/${PN}-${PV}.initd ${PN}
+
+		systemd_douserunit unix/vncserver/vncserver@.service
+
+		# comment out pam_selinux.so, the server does not start if missing
+		# part of bug #746227
+		sed -i -e '/pam_selinux/s/^/#/' "${ED}"/etc/pam.d/tigervnc || die
+	else
+		local f
+		for f in x0vncserver vncconfig; do
+			rm "${ED}"/usr/bin/${f} || die
+			rm "${ED}"/usr/share/man/man1/${f}.1 || die
+		done
+		rm -r "${ED}"/usr/{sbin,libexec} || die
+		rm -r "${ED}"/usr/share/man/man8 || die
+	fi
+}
+
+pkg_postinst() {
+	local OPTIONAL_DM="gnome-base/gdm x11-misc/lightdm x11-misc/sddm x11-misc/slim"
+
+	use server && \
+		optfeature_header "Install any additional display manager package:" && \
+		optfeature "proper session support" ${OPTIONAL_DM}
+}


             reply	other threads:[~2022-03-18 18:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 18:52 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-01 12:53 [gentoo-commits] repo/gentoo:master commit in: net-misc/tigervnc/files/, net-misc/tigervnc/ Viorel Munteanu
2024-10-27 16:43 Viorel Munteanu
2024-08-30  9:27 Viorel Munteanu
2024-07-27 19:36 Viorel Munteanu
2023-01-15  8:39 Viorel Munteanu
2022-07-04  0:33 Sam James
2017-12-06 12:14 Michael Palimaka
2017-02-18 17:53 Thomas Deutschmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1647629518.c0660ebeeddda8fb14f5f34f40d467b6e6f288d1.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox