Build bundled libvncserver statically

Since we're building libvncserver, building it statically avoids the
need for any handling of rpath, provides/requires exclusion, etc., but
does require some minor build tweaks to the build system which generally
expects shared libraries.

Resolves: rhbz#2188174
This commit is contained in:
Yaakov Selkowitz 2023-06-29 10:59:03 -04:00
parent 040f9c0d9d
commit e2f314cf2d
3 changed files with 50 additions and 65 deletions

View File

@ -1,50 +0,0 @@
From 1a6737f4a26c38f3c703d84263d0a0779a607359 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Date: Wed, 21 Apr 2021 14:49:36 +0200
Subject: [PATCH] build: Set rpath on executable
---
meson.build | 1 +
src/meson.build | 1 +
tests/meson.build | 1 +
3 files changed, 3 insertions(+)
diff --git a/meson.build b/meson.build
index 9d7bda1..9148eb9 100644
--- a/meson.build
+++ b/meson.build
@@ -75,6 +75,7 @@ top_srcdir = meson.current_source_dir()
builddir = meson.current_build_dir()
prefix = get_option('prefix')
+libdir = join_paths(prefix, get_option('libdir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
datadir = join_paths(prefix, get_option('datadir'))
schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
diff --git a/src/meson.build b/src/meson.build
index 843746d..3757afb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -100,6 +100,7 @@ executable('gnome-remote-desktop-daemon',
daemon_sources,
dependencies: deps,
include_directories: [configinc],
+ install_rpath: join_paths(libdir, 'gnome-remote-desktop'),
install: true,
install_dir: libexecdir)
diff --git a/tests/meson.build b/tests/meson.build
index 978ae23..ab74a28 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -5,6 +5,7 @@ if have_vnc
dependencies: [glib_dep,
libvncclient_dep],
include_directories: [configinc],
+ install_rpath: join_paths(libdir, 'gnome-remote-desktop'),
install: false)
test_runner = find_program('vnc-test-runner.sh')
--
2.31.1

View File

@ -13,9 +13,6 @@
%global libvncserver_name LibVNCServer
%global libvncserver_version 0.9.13
# https://bugzilla.redhat.com/show_bug.cgi?id=2188174
%global __provides_exclude_from ^%{_libdir}/%{name}
Name: gnome-remote-desktop
Version: 40.0
Release: 8%{?dist}
@ -33,9 +30,6 @@ Patch0: gnutls-anontls.patch
# Backport upstream leak fix (rhbz#1951129)
Patch1: 0001-pipewire-stream-Don-t-leak-GSource-s.patch
## LibVNCServer patches required for bundling
Patch100: 0001-build-Set-rpath-on-executable.patch
### LibVNCServer patches
## TLS security type enablement patches
# https://github.com/LibVNC/libvncserver/pull/234
@ -54,6 +48,7 @@ Patch1004: 0001-libvncserver-don-t-NULL-out-internal-of-the-default-.patch
## downstream patches
Patch2000: libvncserver-LibVNCServer-0.9.13-system-crypto-policy.patch
Patch2001: libvncserver-LibVNCServer-0.9.13-static-library-link.patch
## Don't compile SHA1 support
Patch2100: 0001-crypto-Don-t-compile-SHA1-support-when-Websockets-ar.patch
@ -111,6 +106,7 @@ GNOME desktop environment.
%patch1003 -p1 -b .pointers
%patch1004 -p1 -b .cursor_null
%patch2000 -p1 -b .crypto_policy
%patch2001 -p1 -b .static
# Nuke bundled minilzo
rm -fv common/lzodefs.h common/lzoconf.h commmon/minilzo.h common/minilzo.c
@ -128,9 +124,6 @@ done
%setup -n %{name}-%{tarball_version}
%patch0 -p1
%patch1 -p1
%if 0%{?bundle_libvncserver}
%patch100 -p1
%endif
%build
@ -148,7 +141,7 @@ mkdir -p %{_builddir}/libvncserver/
-DSYSCONF_INSTALL_DIR=%{libvncserver_install_dir}/etc \
-DWITH_FFMPEG=OFF -DWITH_GTK=OFF -DWITH_OPENSSL=OFF -DWITH_GNUTLS=ON \
-DWITH_SDL=OFF -DWITH_X11=OFF -DWITH_WEBSOCKETS=OFF \
-DLIBVNCSERVER_WITH_WEBSOCKETS=OFF
-DLIBVNCSERVER_WITH_WEBSOCKETS=OFF -DBUILD_SHARED_LIBS=OFF
%cmake_build
%__cmake --install "%{__cmake_builddir}"
popd
@ -175,8 +168,6 @@ popd
%if 0%{?bundle_libvncserver}
pushd ../libvncserver-%{libvncserver_name}-%{libvncserver_version}
mkdir -p %{buildroot}/%{_libdir}/gnome-remote-desktop/
cp %{__cmake_builddir}/libvncserver.so.1 %{buildroot}/%{_libdir}/gnome-remote-desktop/
cp COPYING %{_builddir}/%{name}-%{tarball_version}/COPYING.libvncserver
popd
%endif
@ -201,9 +192,6 @@ popd
%endif
%doc README
%{_libexecdir}/gnome-remote-desktop-daemon
%if 0%{?bundle_libvncserver}
%{_libdir}/gnome-remote-desktop/libvncserver.so.1
%endif
%{_userunitdir}/gnome-remote-desktop.service
%{_datadir}/glib-2.0/schemas/org.gnome.desktop.remote-desktop.gschema.xml
%{_datadir}/glib-2.0/schemas/org.gnome.desktop.remote-desktop.enums.xml

View File

@ -0,0 +1,47 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b6228a..20fec85 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -495,7 +495,7 @@ if(WIN32)
endif(WITH_TIGHTVNC_FILETRANSFER)
endif(WIN32)
-target_link_libraries(vncclient
+target_link_libraries(vncclient PUBLIC
${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES}
${LZO_LIBRARIES}
@@ -504,7 +504,7 @@ target_link_libraries(vncclient
${GNUTLS_LIBRARIES}
${OPENSSL_LIBRARIES}
)
-target_link_libraries(vncserver
+target_link_libraries(vncserver PUBLIC
${ADDITIONAL_LIBS}
${ZLIB_LIBRARIES}
${LZO_LIBRARIES}
diff --git a/libvncclient.pc.cmakein b/libvncclient.pc.cmakein
index ceeda39..f131dca 100644
--- a/libvncclient.pc.cmakein
+++ b/libvncclient.pc.cmakein
@@ -8,7 +8,6 @@ Description: A library for easy implementation of a VNC client.
Version: @LibVNCServer_VERSION@
Requires:
Requires.private:
-Libs: -L${libdir} -lvncclient
-Libs.private: @PRIVATE_LIBS@
+Libs: -L${libdir} -lvncclient @PRIVATE_LIBS@
Cflags: -I${includedir}
diff --git a/libvncserver.pc.cmakein b/libvncserver.pc.cmakein
index 33ec668..5ae98c9 100644
--- a/libvncserver.pc.cmakein
+++ b/libvncserver.pc.cmakein
@@ -8,6 +8,5 @@ Description: A library for easy implementation of a VNC server.
Version: @LibVNCServer_VERSION@
Requires:
Requires.private:
-Libs: -L${libdir} -lvncserver
-Libs.private: @PRIVATE_LIBS@
+Libs: -L${libdir} -lvncserver @PRIVATE_LIBS@
Cflags: -I${includedir}