From fd5f69bdcee19f53d86d109865a31a5263aa6391 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 27 Nov 2024 06:25:08 +0800 Subject: [PATCH] secrets: new port in gnome Closes: https://trac.macports.org/ticket/70306 --- gnome/secrets/Portfile | 70 +++++++++++++++++++ .../files/patch-find-right-python.diff | 32 +++++++++ 2 files changed, 102 insertions(+) create mode 100644 gnome/secrets/Portfile create mode 100644 gnome/secrets/files/patch-find-right-python.diff diff --git a/gnome/secrets/Portfile b/gnome/secrets/Portfile new file mode 100644 index 00000000000..a43f95487ec --- /dev/null +++ b/gnome/secrets/Portfile @@ -0,0 +1,70 @@ +# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 + +PortSystem 1.0 +PortGroup gitlab 1.0 +PortGroup meson 1.0 + +gitlab.instance https://gitlab.gnome.org +# After the following commit libadwaita 1.6.x is required, +# which in turn needs a newer gtk4 than MacPorts now has. +# https://gitlab.gnome.org/World/secrets/-/commit/c52d6f9e5c483e1ec141f4a113425890fa8b4b29 +gitlab.setup World secrets 9.4 +revision 0 +categories gnome security sysutils +license GPL-3 +maintainers nomaintainer +description Password manager for GNOME +long_description {*}${description} +use_bzip2 yes +checksums rmd160 8f50951382df5d151553ab85a5ba4a212be10403 \ + sha256 5e0850fffc3a9d4ab20670b6c200e7f15f50ce31b73b5622de00939c1d0d69ce \ + size 465812 + +set py_ver 3.12 +set py_ver_nodot [string map {. {}} ${py_ver}] + +depends_build-append \ + port:gettext \ + path:bin/pkg-config:pkgconfig + +depends_lib-append port:desktop-file-utils \ + port:gettext-runtime \ + path:lib/pkgconfig/glib-2.0.pc:glib2 \ + path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \ + path:lib/pkgconfig/gtk+-4.0.pc:gtk4 \ + port:libadwaita \ + port:python${py_ver_nodot} \ + port:py${py_ver_nodot}-kcs11 \ + port:py${py_ver_nodot}-pykeepass \ + port:py${py_ver_nodot}-pyotp \ + port:py${py_ver_nodot}-validators \ + port:py${py_ver_nodot}-yubico \ + port:py${py_ver_nodot}-zxcvbn + +# Dependency is not declared anywhere explicitly, +# but secrets will fail to launch if usb module is not found. +depends_run-append port:py${py_ver_nodot}-pyusb + +patchfiles-append patch-find-right-python.diff + +set python.prefix ${frameworks_dir}/Python.framework/Versions/${py_ver} +set python.bin ${python.prefix}/bin/python${py_ver} +set python.pkgd ${python.prefix}/lib/python${py_ver}/site-packages + +post-patch { + reinplace "s|@PYTHON@|${python.bin}|" ${worksrcpath}/meson.build + reinplace "s|@PY_PACKAGES@|${python.pkgd}|" ${worksrcpath}/meson.build +} + +post-activate { + system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas" + system "${prefix}/bin/gtk4-update-icon-cache -f -t ${prefix}/share/icons/hicolor" + system "${prefix}/bin/update-desktop-database ${prefix}/share/applications" +} + +# https://trac.macports.org/ticket/70137 +notes " +If you get an error upon launching the app,\ +try setting GSK_RENDERER=cairo in the environment.\ +You may also add it into a shell config file. +" diff --git a/gnome/secrets/files/patch-find-right-python.diff b/gnome/secrets/files/patch-find-right-python.diff new file mode 100644 index 00000000000..b7f7746eb70 --- /dev/null +++ b/gnome/secrets/files/patch-find-right-python.diff @@ -0,0 +1,32 @@ +--- meson.build 2024-05-04 04:12:25 ++++ meson.build 2024-11-27 06:07:18 +@@ -28,7 +28,7 @@ + + message('Looking for dependencies') + # We need pykeepass>=4.0.7.post1 and pyotp>=2.4.0. +-python_bin = python.find_installation('python3', modules:[ ++python_bin = import('python').find_installation('@PYTHON@', modules:[ + 'pykeepass', + 'pyotp', + 'validators', +@@ -37,9 +37,9 @@ + 'yubico', + ]) + if not python_bin.found() +- error('No valid python3 binary found') ++ error('No valid python binary found') + else +- message('Found python3 binary') ++ message('Found python binary') + endif + + if not python_bin.language_version().version_compare('>= 3.8') +@@ -53,7 +53,7 @@ + dependency('gtk4', version: '>=4.9') + dependency('libadwaita-1', version: '>=1.5.alpha') + +-python_dir = python_bin.get_install_dir() ++python_dir = '@PY_PACKAGES@' + DATA_DIR = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name()) + bindir = join_paths(get_option('prefix'), get_option('bindir')) +