summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2020-09-01 10:21:55 +0000
committerschmonz <schmonz@pkgsrc.org>2020-09-01 10:21:55 +0000
commit41fb7603c9c094fe94f08bb1c2fb1ed3c1ce2639 (patch)
tree86d003801ddd0d8575ff836cae4dfb0b6880ae1d /sysutils
parent5d2d57908bc7acc50b50e443f75ee516411c75ac (diff)
downloadpkgsrc-41fb7603c9c094fe94f08bb1c2fb1ed3c1ce2639.tar.gz
Borrow patches from OpenBSD ports to fix build, adding pledge() and
unveil() support while we're at it. NFCI for other platforms.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/desktop-file-utils/Makefile7
-rw-r--r--sysutils/desktop-file-utils/distinfo5
-rw-r--r--sysutils/desktop-file-utils/patches/patch-src_install.c37
-rw-r--r--sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c51
-rw-r--r--sysutils/desktop-file-utils/patches/patch-src_validator.c30
5 files changed, 128 insertions, 2 deletions
diff --git a/sysutils/desktop-file-utils/Makefile b/sysutils/desktop-file-utils/Makefile
index 2061c49ab45..31a22646e17 100644
--- a/sysutils/desktop-file-utils/Makefile
+++ b/sysutils/desktop-file-utils/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.42 2020/07/31 09:17:53 wiz Exp $
+# $NetBSD: Makefile,v 1.43 2020/09/01 10:21:55 schmonz Exp $
DISTNAME= desktop-file-utils-0.26
CATEGORIES= sysutils gnome
@@ -17,6 +17,11 @@ LDFLAGS.SunOS+= -lintl
FILES_SUBST+= APPLICATIONS_PATH="${PREFIX}/share/applications"
FILES_SUBST+= UPDATE_DESKTOPDB="${PREFIX}/bin/update-desktop-database"
+SUBST_CLASSES+= paths
+SUBST_STAGE.paths= pre-configure
+SUBST_FILES.paths= src/update-desktop-database.c
+SUBST_VARS.paths= LOCALBASE
+
PRINT_PLIST_AWK+= /^share\/applications\/mimeinfo.cache$$/ \
{ print "@comment in INSTALL script: " $$0; \
next; }
diff --git a/sysutils/desktop-file-utils/distinfo b/sysutils/desktop-file-utils/distinfo
index c39c751fa39..2c59ee498e6 100644
--- a/sysutils/desktop-file-utils/distinfo
+++ b/sysutils/desktop-file-utils/distinfo
@@ -1,6 +1,9 @@
-$NetBSD: distinfo,v 1.18 2020/07/31 09:17:53 wiz Exp $
+$NetBSD: distinfo,v 1.19 2020/09/01 10:21:55 schmonz Exp $
SHA1 (desktop-file-utils-0.26.tar.xz) = 9fd94cb7de302163015fcbc0e157c61323b1205d
RMD160 (desktop-file-utils-0.26.tar.xz) = a68b5994a7d099e2dffa279ea20c31cc7e39266e
SHA512 (desktop-file-utils-0.26.tar.xz) = 5b4e435f0b635d8f898ac7f5759f74a08ffbe2a56d41fee0e84ff57e73b98d08b57b4416f20b99f696dad8bcb1c20792b39acf836b0814220c0b386ea5f6b831
Size (desktop-file-utils-0.26.tar.xz) = 83132 bytes
+SHA1 (patch-src_install.c) = b3a410c90382fbc54abcd97a6e0eb96317d294af
+SHA1 (patch-src_update-desktop-database.c) = 162664c09deaf3b3f817e3f7d0b9f209151ca3b1
+SHA1 (patch-src_validator.c) = 41497fcd2da168e86d51387bba4bc3797adbc82f
diff --git a/sysutils/desktop-file-utils/patches/patch-src_install.c b/sysutils/desktop-file-utils/patches/patch-src_install.c
new file mode 100644
index 00000000000..6d1dcffe9f8
--- /dev/null
+++ b/sysutils/desktop-file-utils/patches/patch-src_install.c
@@ -0,0 +1,37 @@
+$NetBSD: patch-src_install.c,v 1.1 2020/09/01 10:21:55 schmonz Exp $
+
+From OpenBSD ports, add pledge() support.
+
+--- src/install.c.orig Thu Jan 1 00:00:00 1970
++++ src/install.c
+@@ -839,6 +839,13 @@ main (int argc, char **argv)
+
+ setlocale (LC_ALL, "");
+
++#ifdef HAVE_PLEDGE
++ if (pledge ("stdio rpath wpath cpath fattr", NULL) == -1) {
++ g_printerr ("pledge\n");
++ return 1;
++ }
++#endif
++
+ basename = g_path_get_basename (argv[0]);
+ if (g_strcmp0 (basename, "desktop-file-edit") == 0)
+ edit_mode = TRUE;
+@@ -854,6 +861,16 @@ main (int argc, char **argv)
+ g_option_group_add_entries (group, install_options);
+ g_option_context_add_group (context, group);
+ }
++#ifdef HAVE_PLEDGE
++ else
++ {
++ /* In edit mode we can drop the fattr pledge. */
++ if (pledge ("stdio rpath wpath cpath", NULL) == -1) {
++ g_printerr ("pledge in edit_mode\n");
++ return 1;
++ }
++ }
++#endif
+
+ group = g_option_group_new ("edit", _("Edition options for desktop file"), _("Show desktop file edition options"), NULL, NULL);
+ g_option_group_add_entries (group, edit_options);
diff --git a/sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c b/sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c
new file mode 100644
index 00000000000..f2b1e063909
--- /dev/null
+++ b/sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c
@@ -0,0 +1,51 @@
+$NetBSD: patch-src_update-desktop-database.c,v 1.1 2020/09/01 10:21:55 schmonz Exp $
+
+From OpenBSD ports, "Unveil the required directory with .desktop
+files and where the cache file needs to be written out to."
+
+--- src/update-desktop-database.c.orig Thu Jan 1 00:00:00 1970
++++ src/update-desktop-database.c
+@@ -451,8 +451,8 @@ main (int argc,
+ { NULL }
+ };
+
+-#if HAVE_PLEDGE
+- if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) {
++#ifdef HAVE_PLEDGE
++ if (pledge ("stdio rpath wpath cpath fattr unveil", NULL) == -1) {
+ g_printerr ("pledge\n");
+ return 1;
+ }
+@@ -478,9 +478,19 @@ main (int argc,
+
+ print_desktop_dirs (desktop_dirs);
+
++#ifdef HAVE_PLEDGE
++ if (unveil ("@LOCALBASE@/share/locale/locale.alias", "r") == -1) {
++ g_printerr ("Can't unveil '@LOCALBASE@/share/locale/locale.alias': %s\n", g_strerror(errno));
++ }
++#endif
+ found_processable_dir = FALSE;
+ for (i = 0; desktop_dirs[i] != NULL; i++)
+ {
++#ifdef HAVE_PLEDGE
++ if (unveil (desktop_dirs[i], "rwc") == -1) {
++ g_printerr ("Can't unveil '%s' directory: %s\n", desktop_dirs[i], g_strerror(errno));
++ }
++#endif
+ error = NULL;
+ update_database (desktop_dirs[i], &error);
+
+@@ -495,6 +505,12 @@ main (int argc,
+ found_processable_dir = TRUE;
+ }
+ g_option_context_free (context);
++
++#ifdef HAVE_PLEDGE
++ if (unveil (NULL, NULL) == -1) {
++ g_printerr ("unveil\n");
++ }
++#endif
+
+ if (!found_processable_dir)
+ {
diff --git a/sysutils/desktop-file-utils/patches/patch-src_validator.c b/sysutils/desktop-file-utils/patches/patch-src_validator.c
new file mode 100644
index 00000000000..7e863071c6b
--- /dev/null
+++ b/sysutils/desktop-file-utils/patches/patch-src_validator.c
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_validator.c,v 1.1 2020/09/01 10:21:55 schmonz Exp $
+
+From OpenBSD ports, add pledge() support.
+
+--- src/validator.c.orig Thu Jan 1 00:00:00 1970
++++ src/validator.c
+@@ -28,6 +28,9 @@
+
+ #include <locale.h>
+
++#ifdef HAVE_PLEDGE
++#include <unistd.h>
++#endif
+ #include "validate.h"
+
+ static gboolean warn_kde = FALSE;
+@@ -50,6 +53,13 @@ main (int argc, char *argv[])
+ GError *error;
+ int i;
+ gboolean all_valid;
++
++#ifdef HAVE_PLEDGE
++ if (pledge ("stdio rpath", NULL) == -1) {
++ g_printerr ("pledge\n");
++ return 1;
++ }
++#endif
+
+ setlocale (LC_ALL, "");
+