Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't package private library and typelib files separately. #456

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backup-locker/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ backup_locker = executable('cs-backup-locker',
include_directories: inc,
dependencies: [x11, gtk, glib],
link_with: libcscreensaver,
install_dir: libexecdir,
install_rpath: pkglibdir,
install_dir: pkglibdir,
install: true
)

Expand Down
2 changes: 0 additions & 2 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ endif
dbus_service = configure_file(
output: 'org.cinnamon.ScreenSaver.service',
input: 'org.cinnamon.ScreenSaver.service.in',
# meson 0.49
# configuration: { 'EXPANDED_BINDIR': bindir }
configuration: misc_conf
)

Expand Down
2 changes: 1 addition & 1 deletion data/org.cinnamon.ScreenSaver.service.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[D-BUS Service]
Name=org.cinnamon.ScreenSaver
Exec=@EXPANDED_BINDIR@/cinnamon-screensaver
Exec=@bindir@/cinnamon-screensaver
3 changes: 1 addition & 2 deletions debian/cinnamon-screensaver.install
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
etc/pam.d/cinnamon-screensaver
usr/bin
usr/lib/*/cinnamon-screensaver/cinnamon-screensaver-pam-helper
usr/lib/*/cinnamon-screensaver/cs-backup-locker
usr/share/applications
usr/share/cinnamon-screensaver/*.css
usr/share/cinnamon-screensaver/*.py
usr/share/cinnamon-screensaver/*/*.py
usr/share/dbus-1
usr/share/icons
usr/libexec/cinnamon-screensaver
18 changes: 3 additions & 15 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Depends:
gir1.2-gtk-3.0,
gir1.2-xapp-1.0,
iso-flag-png,
libcscreensaver0 (= ${binary:Version}),
libxdo3,
python3,
python3-gi,
Expand All @@ -46,7 +45,8 @@ Recommends: libpam-gnome-keyring
Breaks:
cinnamon-screensaver-pam-helper (<< 3.8),
cinnamon-screensaver-webkit-plugin (<< 3.9),
cinnamon-screensaver-x-plugin (<< 3.9)
cinnamon-screensaver-x-plugin (<< 3.9),
libcscreensaver0 (<< ${source:Version})
Replaces:
cinnamon-screensaver-pam-helper (<< 3.8),
cinnamon-screensaver-webkit-plugin (<< 3.9),
Expand All @@ -61,18 +61,6 @@ Priority: extra
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: libcscreensaver0 (= ${binary:Version}), ${misc:Depends}
Depends: cinnamon-screensaver (= ${binary:Version}), ${misc:Depends}
Description: Cinnamon Screensaver library - debug symbols
This package contains the symbols files needed to debug the Cinnamon Screensaver library.

Package: libcscreensaver0
Section: libs
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: library and introspection data used by cinnamon-screensaver
cinnamon-screensaver is a screen saver and locker that aims to have simple,
sane and secure defaults, and be well integrated with the Cinnamon desktop.
.
This package contains the library used by the screensaver.
3 changes: 0 additions & 3 deletions debian/libcscreensaver0.install

This file was deleted.

7 changes: 6 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ override_dh_strip:

override_dh_auto_configure:
dh_auto_configure -- \
--libexecdir=lib/$(DEB_HOST_MULTIARCH)/cinnamon-screensaver \
--libexecdir=libexec \
--buildtype=debugoptimized \
-D use-debian-pam=true \

execute_after_dh_fixperms:
: # fix executable libraries
chmod 0644 debian/cinnamon-screensaver/usr/libexec/cinnamon-screensaver/girepository-1.0/CScreensaver-1.0.typelib
chmod 0644 debian/cinnamon-screensaver/usr/libexec/cinnamon-screensaver/libcscreensaver.so

# there has never been a testsuite, so don't try running it and breaking
# just because there isn't one
override_dh_auto_test:
Expand Down
15 changes: 2 additions & 13 deletions libcscreensaver/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -140,24 +140,13 @@ endif
libcscreensaver = library(
'cscreensaver',
cscreensaver_sources + gir_sources,
version: '0.0.0',
include_directories: inc,
cpp_args: '-DG_LOG_DOMAIN="CScreensaver"',
dependencies: libcscreensaver_deps,
install_dir: pkglibdir,
install: true
)

pkgconfig.generate(
# TODO meson 0.46 replace libraries, name, version with positional library argument
libraries: libcscreensaver,
name: 'cscreensaver',
version: meson.project_version(),
description: 'Small utility lib used by cinnamon-screensaver v3.1+ to provide a GdkWindow filter (not currently introspectable)',
subdirs: 'cscreensaver',
# these should be their variables, but meson < 0.46 strikes again
requires: ['gobject-2.0', 'gtk+-3.0', 'gdk-3.0']
)

cscreensaver_gir = gnome.generate_gir(
libcscreensaver,
sources: gir_sources,
Expand All @@ -166,8 +155,8 @@ cscreensaver_gir = gnome.generate_gir(
identifier_prefix: 'Cs',
symbol_prefix: 'cs_',
includes: 'Gtk-3.0',
install_dir_typelib: typelibdir,
install: true

)

test_passwd = executable(
Expand Down
7 changes: 5 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ bindir = join_paths(prefix, get_option('bindir'))
datadir = join_paths(prefix, get_option('datadir'))
pkgdatadir = join_paths(datadir, meson.project_name())
libexecdir = join_paths(prefix, get_option('libexecdir'))
pkglibdir = join_paths(libexecdir, meson.project_name())
typelibdir = join_paths(pkglibdir, 'girepository-1.0')

libdir = join_paths(prefix, get_option('libdir'))
#needed?
sysconfdir = join_paths(prefix, get_option('sysconfdir'))
Expand All @@ -24,10 +27,10 @@ localedir = join_paths(prefix, get_option('localedir'))
# and 0.49 for using them in configure_file
misc_conf = configuration_data()
misc_conf.set('prefix', prefix)
misc_conf.set('EXPANDED_BINDIR', bindir)
misc_conf.set('bindir', bindir)
misc_conf.set('datadir', datadir)
misc_conf.set('pkgdatadir', pkgdatadir)
misc_conf.set('libexecdir', libexecdir)
misc_conf.set('pkglibdir', pkglibdir)
misc_conf.set('libdir', libdir)
misc_conf.set('PACKAGE', meson.project_name())
misc_conf.set('VERSION', meson.project_version())
Expand Down
3 changes: 3 additions & 0 deletions src/binfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
exit 1
fi

export GI_TYPELIB_PATH="@typelibdir@"
export LD_LIBRARY_PATH="@pkglibdir@"
Comment on lines +8 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use

Suggested change
export GI_TYPELIB_PATH="@typelibdir@"
export LD_LIBRARY_PATH="@pkglibdir@"
export GI_TYPELIB_PATH="@typelibdir@${GI_TYPELIB_PATH:+:}$GI_TYPELIB_PATH"
export LD_LIBRARY_PATH="@pkglibdir@${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH"

here? On NixOS we relies on e.g. GI_TYPELIB_PATH to discover the system libraries, it will be nice not to override the existing one (ref: GNOME/libsecret@2089893 and/or GNOME/gtk@29e6cc5). Without this the screensaver complains:

Traceback (most recent call last):
  File "/nix/store/acsigjq0ps6isqvy4jn37xmka7gw1psb-cinnamon-screensaver-6.2.0/share/cinnamon-screensaver/cinnamon-screensaver-main.py", line 4, in <module>
    gi.require_version('Gtk', '3.0')
  File "/nix/store/whykd0srhqzgfsxkkgbi1bx8yx9qdaz4-python3-3.12.4-env/lib/python3.12/site-packages/gi/__init__.py", line 122, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these just append to the standard path list? Why is this behavior different in NixOS?

Copy link
Contributor

@bobby285271 bobby285271 Aug 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same case on Guix 😂 On our side GOBJECT_INTROSPECTION_LIBDIR is a path like /nix/store/4cbm71y0q5r8i9r6jkx09vr22k55slsq-gobject-introspection-1.80.1/lib which is actually immutable and actually only contains typelibs from gobject-introspection. We have toolings to automatically wrap the program with the proper environment variables but that can't work if the program itself resets the env.

For example:

$ ls /nix/store/4cbm71y0q5r8i9r6jkx09vr22k55slsq-gobject-introspection-1.80.1/lib/girepository-1.0    
cairo-1.0.typelib  DBusGLib-1.0.typelib    freetype2-2.0.typelib     GL-1.0.typelib       Vulkan-1.0.typelib  xfixes-4.0.typelib  xlib-2.0.typelib
DBus-1.0.typelib   fontconfig-2.0.typelib  GIRepository-2.0.typelib  libxml2-2.0.typelib  win32-1.0.typelib   xft-2.0.typelib     xrandr-1.3.typelib

$ ls /nix/store/hrqbw86y0rid5qpxcy3s6sj97qgq23hb-xapp-2.8.5/lib/girepository-1.0                                                                                             
XApp-1.0.typelib


exec @install_dir@/@target@ "$@"
2 changes: 1 addition & 1 deletion src/config.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ datadir="@datadir@"
localedir=datadir+"/locale"
pkgdatadir="@pkgdatadir@"
libdir="@libdir@"
libexecdir="@libexecdir@"
pkglibdir="@pkglibdir@"
PACKAGE="@PACKAGE@"
VERSION="@VERSION@"
GETTEXT_PACKAGE="@GETTEXT_PACKAGE@"
2 changes: 1 addition & 1 deletion src/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _real_spawn_fallback_window(self, stage, data=None):
term_tty, session_tty = self.get_tty_vals()

argv = [
os.path.join(config.libexecdir, "cs-backup-locker"),
os.path.join(config.pkglibdir, "cs-backup-locker"),
"--xid", str(self.stage.get_window().get_xid()),
"--term", term_tty,
"--session", session_tty
Expand Down
13 changes: 2 additions & 11 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ subdir('widgets')
config_py = configure_file(
output: 'config.py',
input: 'config.py.in',
# meson 0.49
#configuration: {
# 'prefix': prefix,
# 'datadir': datadir,
# 'pkgdatadir': pkgdatadir,
# 'libexecdir': libexecdir,
# 'libdir': libdir,
# 'PACKAGE': meson.project_name(),
# 'VERSION': meson.project_version(),
# 'GETTEXT_PACKAGE': meson.project_name()
#}
configuration: misc_conf
)

Expand Down Expand Up @@ -62,6 +51,8 @@ foreach script : app_scripts
prefix_info = configuration_data()
prefix_info.set('install_dir', pkgdatadir)
prefix_info.set('target', script[0])
prefix_info.set('pkglibdir', pkglibdir)
prefix_info.set('typelibdir', typelibdir)

bin_file = configure_file(
input : 'binfile.in',
Expand Down
21 changes: 3 additions & 18 deletions src/pamhelper/authClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,10 @@ def initialize(self):

try:
helper_path = None
architecture = platform.machine()
paths = [config.libexecdir, "/usr/lib", "/usr/lib/cinnamon-screensaver", "/usr/libexec", "/usr/libexec/cinnamon-screensaver"]

# On x86 archs, iterate through multiple paths
# For instance, on a Mint i686 box, the path is actually /usr/lib/i386-linux-gnu
x86archs = ["i386", "i486", "i586", "i686"]
if architecture in x86archs:
for arch in x86archs:
paths += ["/usr/lib/%s" % arch, "/usr/lib/%s-linux-gnu" % arch]
elif architecture == "x86_64":
paths += ["/usr/lib/x86_64", "/usr/lib/x86_64-linux-gnu", "/usr/lib64"]
else:
paths += ["/usr/lib/%s" % architecture, "/usr/lib/%s-linux-gnu" % architecture]

for path in paths:
full_path = os.path.join(path, "cinnamon-screensaver-pam-helper")
if os.path.exists(full_path):
helper_path = full_path
break
full_path = os.path.join(config.pkglibdir, "cinnamon-screensaver-pam-helper")
if os.path.exists(full_path):
helper_path = full_path

if helper_path is None:
print ("authClient: critical Error: PAM Helper could not be found!")
Expand Down
3 changes: 2 additions & 1 deletion src/pamhelper/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ executable('cinnamon-screensaver-pam-helper',
dependencies: [gio_unix, glib],
include_directories: inc,
link_with: libcscreensaver,
install_rpath: pkglibdir,
install: true,
install_dir: libexecdir
install_dir: pkglibdir
)
Loading