gtk: find the module directory through the GTK runtime again

A module built in the container is installed on a host that has no GTK
development files, and there pkg-config knows nothing: dropping the
runtime query left `doas make install` with nowhere to put the module.
gtk-query-immodules-3.0 answers where GTK looks, so ask it when
pkg-config cannot, as before, and say so in the README.
This commit is contained in:
2026-08-17 14:37:57 +09:00
parent ae7dbae993
commit 544ed835b7
2 changed files with 14 additions and 5 deletions

View File

@@ -7,8 +7,14 @@ GTK_QUERY_IMMODULES ?= gtk-query-immodules-3.0
GTK_LIBDIR ?= $(shell $(PKG_CONFIG) --variable=libdir gtk+-3.0 2>/dev/null)
GTK_BINARY_VERSION ?= $(shell $(PKG_CONFIG) \
--variable=gtk_binary_version gtk+-3.0 2>/dev/null)
GTK_MODULE_DIR ?= $(strip $(if $(GTK_BINARY_VERSION),\
$(GTK_LIBDIR)/gtk-3.0/$(GTK_BINARY_VERSION)/immodules))
# Without GTK development files, ask the runtime where its modules live.
GTK_RUNTIME_MODULE_DIR = $(shell GTK_PATH= GTK_IM_MODULE_FILE= \
$(GTK_QUERY_IMMODULES) 2>/dev/null | \
awk -F '"' '/^"\// { sub("/[^/]*$$", "", $$2); print $$2; exit }')
GTK_MODULE_DIR ?= $(strip $(if \
$(and $(strip $(GTK_LIBDIR)),$(strip $(GTK_BINARY_VERSION))),\
$(GTK_LIBDIR)/gtk-3.0/$(GTK_BINARY_VERSION)/immodules,\
$(GTK_RUNTIME_MODULE_DIR)))
all: $(PROG)