Tue Sep 1 10:21:55 2020 UTC ()
Borrow patches from OpenBSD ports to fix build, adding pledge() and
unveil() support while we're at it. NFCI for other platforms.
(schmonz)
diff -r1.42 -r1.43 pkgsrc/sysutils/desktop-file-utils/Makefile
diff -r1.18 -r1.19 pkgsrc/sysutils/desktop-file-utils/distinfo
diff -r0 -r1.1 pkgsrc/sysutils/desktop-file-utils/patches/patch-src_install.c
diff -r0 -r1.1 pkgsrc/sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c
diff -r0 -r1.1 pkgsrc/sysutils/desktop-file-utils/patches/patch-src_validator.c
--- pkgsrc/sysutils/desktop-file-utils/Makefile 2020/07/31 09:17:53 1.42
+++ pkgsrc/sysutils/desktop-file-utils/Makefile 2020/09/01 10:21:55 1.43
| @@ -1,26 +1,31 @@ | | | @@ -1,26 +1,31 @@ |
1 | # $NetBSD: Makefile,v 1.42 2020/07/31 09:17:53 wiz Exp $ | | 1 | # $NetBSD: Makefile,v 1.43 2020/09/01 10:21:55 schmonz Exp $ |
2 | | | 2 | |
3 | DISTNAME= desktop-file-utils-0.26 | | 3 | DISTNAME= desktop-file-utils-0.26 |
4 | CATEGORIES= sysutils gnome | | 4 | CATEGORIES= sysutils gnome |
5 | MASTER_SITES= http://freedesktop.org/software/desktop-file-utils/releases/ | | 5 | MASTER_SITES= http://freedesktop.org/software/desktop-file-utils/releases/ |
6 | EXTRACT_SUFX= .tar.xz | | 6 | EXTRACT_SUFX= .tar.xz |
7 | | | 7 | |
8 | MAINTAINER= pkgsrc-users@NetBSD.org | | 8 | MAINTAINER= pkgsrc-users@NetBSD.org |
9 | HOMEPAGE= https://www.freedesktop.org/wiki/Software/desktop-file-utils | | 9 | HOMEPAGE= https://www.freedesktop.org/wiki/Software/desktop-file-utils |
10 | COMMENT= Utilities to manage desktop entries | | 10 | COMMENT= Utilities to manage desktop entries |
11 | LICENSE= gnu-gpl-v2 | | 11 | LICENSE= gnu-gpl-v2 |
12 | | | 12 | |
13 | USE_TOOLS+= pkg-config | | 13 | USE_TOOLS+= pkg-config |
14 | | | 14 | |
15 | LDFLAGS.SunOS+= -lintl | | 15 | LDFLAGS.SunOS+= -lintl |
16 | | | 16 | |
17 | FILES_SUBST+= APPLICATIONS_PATH="${PREFIX}/share/applications" | | 17 | FILES_SUBST+= APPLICATIONS_PATH="${PREFIX}/share/applications" |
18 | FILES_SUBST+= UPDATE_DESKTOPDB="${PREFIX}/bin/update-desktop-database" | | 18 | FILES_SUBST+= UPDATE_DESKTOPDB="${PREFIX}/bin/update-desktop-database" |
19 | | | 19 | |
| | | 20 | SUBST_CLASSES+= paths |
| | | 21 | SUBST_STAGE.paths= pre-configure |
| | | 22 | SUBST_FILES.paths= src/update-desktop-database.c |
| | | 23 | SUBST_VARS.paths= LOCALBASE |
| | | 24 | |
20 | PRINT_PLIST_AWK+= /^share\/applications\/mimeinfo.cache$$/ \ | | 25 | PRINT_PLIST_AWK+= /^share\/applications\/mimeinfo.cache$$/ \ |
21 | { print "@comment in INSTALL script: " $$0; \ | | 26 | { print "@comment in INSTALL script: " $$0; \ |
22 | next; } | | 27 | next; } |
23 | | | 28 | |
24 | .include "../../devel/glib2/buildlink3.mk" | | 29 | .include "../../devel/glib2/buildlink3.mk" |
25 | .include "../../devel/meson/build.mk" | | 30 | .include "../../devel/meson/build.mk" |
26 | .include "../../mk/bsd.pkg.mk" | | 31 | .include "../../mk/bsd.pkg.mk" |
--- pkgsrc/sysutils/desktop-file-utils/distinfo 2020/07/31 09:17:53 1.18
+++ pkgsrc/sysutils/desktop-file-utils/distinfo 2020/09/01 10:21:55 1.19
| @@ -1,6 +1,9 @@ | | | @@ -1,6 +1,9 @@ |
1 | $NetBSD: distinfo,v 1.18 2020/07/31 09:17:53 wiz Exp $ | | 1 | $NetBSD: distinfo,v 1.19 2020/09/01 10:21:55 schmonz Exp $ |
2 | | | 2 | |
3 | SHA1 (desktop-file-utils-0.26.tar.xz) = 9fd94cb7de302163015fcbc0e157c61323b1205d | | 3 | SHA1 (desktop-file-utils-0.26.tar.xz) = 9fd94cb7de302163015fcbc0e157c61323b1205d |
4 | RMD160 (desktop-file-utils-0.26.tar.xz) = a68b5994a7d099e2dffa279ea20c31cc7e39266e | | 4 | RMD160 (desktop-file-utils-0.26.tar.xz) = a68b5994a7d099e2dffa279ea20c31cc7e39266e |
5 | SHA512 (desktop-file-utils-0.26.tar.xz) = 5b4e435f0b635d8f898ac7f5759f74a08ffbe2a56d41fee0e84ff57e73b98d08b57b4416f20b99f696dad8bcb1c20792b39acf836b0814220c0b386ea5f6b831 | | 5 | SHA512 (desktop-file-utils-0.26.tar.xz) = 5b4e435f0b635d8f898ac7f5759f74a08ffbe2a56d41fee0e84ff57e73b98d08b57b4416f20b99f696dad8bcb1c20792b39acf836b0814220c0b386ea5f6b831 |
6 | Size (desktop-file-utils-0.26.tar.xz) = 83132 bytes | | 6 | Size (desktop-file-utils-0.26.tar.xz) = 83132 bytes |
| | | 7 | SHA1 (patch-src_install.c) = b3a410c90382fbc54abcd97a6e0eb96317d294af |
| | | 8 | SHA1 (patch-src_update-desktop-database.c) = 162664c09deaf3b3f817e3f7d0b9f209151ca3b1 |
| | | 9 | SHA1 (patch-src_validator.c) = 41497fcd2da168e86d51387bba4bc3797adbc82f |
$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);
$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)
{
$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, "");