devel/glib20: Prevent the silent grabbing of libelf from ports

PR:		273479
This commit is contained in:
Gleb Popov 2025-04-24 11:12:15 +03:00
parent f3348645e1
commit 8107e8e7cb
3 changed files with 28 additions and 1 deletions

View file

@ -1,6 +1,6 @@
PORTNAME= glib
DISTVERSION= 2.84.1
PORTREVISION= 1
PORTREVISION= 2
PORTEPOCH= 2
CATEGORIES= devel
MASTER_SITES= GNOME
@ -42,6 +42,7 @@ MESON_ARGS= -Db_lundef=false \
-Ddefault_library=both \
-Dfile_monitor_backend='libinotify-kqueue' \
-Dinstalled_tests=false \
-Dlibelf=disabled \
-Dlibmount=disabled \
-Druntime_dir=/var/run \
-Dselinux=disabled \

View file

@ -0,0 +1,15 @@
--- gio/gresource-tool.c.orig 2025-04-03 14:38:51 UTC
+++ gio/gresource-tool.c
@@ -31,8 +31,10 @@
#include <locale.h>
#ifdef HAVE_LIBELF
-#include <libelf.h>
-#include <gelf.h>
+#include </usr/include/libelf.h>
+// fool libelf from ports to not include its libelf.h
+#define _LIBELF_H 1
+#include </usr/include/gelf.h>
#endif
#ifdef HAVE_MMAP

View file

@ -0,0 +1,11 @@
--- gio/meson.build.orig 2025-04-03 14:38:51 UTC
+++ gio/meson.build
@@ -971,7 +971,7 @@ else
# This fallback is necessary on *BSD. elfutils isn't the only libelf
# implementation, and *BSD usually includes their own libelf as a system
# library which doesn't have a corresponding .pc file.
- libelf = cc.find_library('elf', required : get_option ('libelf'))
+ libelf = declare_dependency(link_args: '/lib/libelf.so.2')
have_libelf = libelf.found()
have_libelf = have_libelf and cc.has_function('elf_begin', dependencies : libelf)
have_libelf = have_libelf and cc.has_function('elf_getshdrstrndx', dependencies : libelf)