Index: head/devel/glib20/Makefile =================================================================== --- head/devel/glib20/Makefile +++ head/devel/glib20/Makefile @@ -3,6 +3,7 @@ PORTNAME= glib DISTVERSION= 2.66.7 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= devel MASTER_SITES= GNOME Index: head/devel/glib20/files/patch-glib_gspawn.c =================================================================== --- head/devel/glib20/files/patch-glib_gspawn.c +++ head/devel/glib20/files/patch-glib_gspawn.c @@ -1,64 +1,45 @@ ---- glib/gspawn.c 2018-09-21 12:29:23.000000000 +0300 -+++ glib/gspawn.c 2019-07-20 18:05:15.486558000 +0300 -@@ -51,6 +51,13 @@ +--- glib/gspawn.c.orig 2020-12-17 03:47:11.474608400 -0800 ++++ glib/gspawn.c 2021-02-17 13:58:15.271434000 -0800 +@@ -51,6 +51,12 @@ #include /* for syscall and SYS_getdents64 */ #endif +#ifdef __FreeBSD__ -+#include -+#include ++#include +#include -+#include ++#include +#endif + #include "gspawn.h" #include "gspawn-private.h" #include "gthread.h" -@@ -1204,6 +1211,51 @@ +@@ -1204,6 +1210,33 @@ filename_to_fd (const char *p) } #endif +#ifdef __FreeBSD__ +static int -+fdwalk2(int (*func)(void *, int), void *udata, int *ret) { -+ size_t i, bufsz = 0; -+ struct xfile *xfbuf, *xf; -+ int uret = 0, pid_found = 0; -+ int mib[2] = { CTL_KERN, KERN_FILE }; -+ pid_t pid; ++fdwalk2(int (*func)(void *, int), void *udata, gint *ret) ++{ ++ struct kinfo_file *kf; ++ int i, cnt; + + if (NULL == func) + return EINVAL; + -+ if (sysctl (mib, nitems(mib), NULL, &bufsz, NULL, 0) == -1) -+ return (errno); -+ bufsz += 65536; -+ xfbuf = alloca (bufsz); -+ if (xfbuf == NULL) -+ return errno; -+ if (sysctl (mib, 2, xfbuf, &bufsz, NULL, 0) == -1) -+ return errno; -+ bufsz /= sizeof(struct xfile); ++ kf = kinfo_getfile(getpid(), &cnt); ++ if (kf == NULL) ++ return ENOMEM; + -+ pid = getpid(); -+ for (i = 0; i < bufsz; i++) { -+ xf = &xfbuf[i]; -+ if (pid != xf->xf_pid) { -+ if (pid_found) { -+ return 0; -+ } else { -+ continue; -+ } -+ } -+ pid_found = 1; -+ if (0 > xf->xf_fd) ++ for (i = 0; i < cnt; i++) { ++ if (0 > kf[i].kf_fd) + continue; -+ uret = func (udata, xf->xf_fd); -+ if (uret != 0) ++ *ret = func (udata, kf[i].kf_fd); ++ if (*ret != 0) + break; -+ + } + ++ free(kf); + return 0; +} +#endif @@ -66,7 +47,7 @@ /* This function is called between fork() and exec() and hence must be * async-signal-safe (see signal-safety(7)). */ static int -@@ -1228,6 +1280,12 @@ +@@ -1228,6 +1261,12 @@ safe_fdwalk (int (*cb)(void *data, int fd), void *data #if 0 && defined(HAVE_SYS_RESOURCE_H) struct rlimit rl; Index: head/devel/glib20/files/patch-glib_meson.build =================================================================== --- head/devel/glib20/files/patch-glib_meson.build +++ head/devel/glib20/files/patch-glib_meson.build @@ -0,0 +1,11 @@ +--- glib/meson.build.orig 2021-02-18 15:31:48.638470000 -0800 ++++ glib/meson.build 2021-02-18 15:32:08.983695000 -0800 +@@ -376,7 +376,7 @@ + # intl.lib is not compatible with SAFESEH + link_args : [noseh_link_args, glib_link_flags, win32_ldflags], + include_directories : configinc, +- dependencies : pcre_deps + [thread_dep, librt] + libintl_deps + libiconv + platform_deps + gnulib_libm_dependency + [libsysprof_capture_dep], ++ dependencies : pcre_deps + [thread_dep, librt] + libintl_deps + libiconv + platform_deps + gnulib_libm_dependency + [libsysprof_capture_dep] + libutil, + c_args : glib_c_args, + objc_args : glib_c_args, + ) Index: head/devel/glib20/files/patch-meson.build =================================================================== --- head/devel/glib20/files/patch-meson.build +++ head/devel/glib20/files/patch-meson.build @@ -0,0 +1,11 @@ +--- meson.build.orig 2021-02-11 04:24:55.280943200 -0800 ++++ meson.build 2021-02-18 15:34:48.476370000 -0800 +@@ -2287,6 +2287,8 @@ + test_timeout = 60 + test_timeout_slow = 180 + ++libutil = [cc.find_library('util', required : true)] ++ + pkg = import('pkgconfig') + windows = import('windows') + subdir('glib')