fix(gtk): install prebuilt modules without development files
This commit is contained in:
19
README.md
19
README.md
@@ -77,8 +77,8 @@ make check-stress # randomized, capacity, collision, failure, and restart test
|
|||||||
tests. `make docker-check` force-rebuilds and runs all three tiers in the
|
tests. `make docker-check` force-rebuilds and runs all three tiers in the
|
||||||
container; run `make docker-image` first after changing `Dockerfile`.
|
container; run `make docker-image` first after changing `Dockerfile`.
|
||||||
|
|
||||||
Native Linux builds require a C toolchain, Make, pkg-config, Python 3, and
|
Native Linux source builds require a C toolchain, Make, pkg-config, Python 3,
|
||||||
cmp/diff, plus:
|
and cmp/diff, plus development files for:
|
||||||
|
|
||||||
- Plan 9 port (`9c`, `9l`, `libthread`, and `libbio`);
|
- Plan 9 port (`9c`, `9l`, `libthread`, and `libbio`);
|
||||||
- D-Bus development files;
|
- D-Bus development files;
|
||||||
@@ -133,10 +133,17 @@ export GTK_IM_MODULE=strans
|
|||||||
GLFW_IM_MODULE=ibus kitty
|
GLFW_IM_MODULE=ibus kitty
|
||||||
```
|
```
|
||||||
|
|
||||||
The GTK module directory is derived from GTK's pkg-config `libdir` and binary
|
Building `gtk/im-strans.so` requires GTK development files. Installing an
|
||||||
version. It can be overridden with `GTK_MODULE_DIR`; `DESTDIR` staging is
|
already-built, up-to-date module from this build tree does not: the install
|
||||||
supported and deliberately skips the host module-cache update. Remove a
|
target first uses an explicit `GTK_MODULE_DIR`, then GTK's pkg-config
|
||||||
native installation with:
|
variables, and finally the module directory reported by the GTK runtime's
|
||||||
|
`gtk-query-immodules-3.0`. Packagers and cross builds should set
|
||||||
|
`GTK_MODULE_DIR` explicitly. A prebuilt module must still match the target
|
||||||
|
architecture and library ABI.
|
||||||
|
|
||||||
|
`DESTDIR` staging is supported and deliberately skips the host module-cache
|
||||||
|
update. A native install needs the GTK runtime query utility so it can refresh
|
||||||
|
that cache. Remove a native installation with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
doas make -C gtk uninstall
|
doas make -C gtk uninstall
|
||||||
|
|||||||
45
gtk/Makefile
45
gtk/Makefile
@@ -3,10 +3,17 @@ PKG_CONFIG ?= pkg-config
|
|||||||
CFLAGS ?= -O2
|
CFLAGS ?= -O2
|
||||||
GTK_CFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
|
GTK_CFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
|
||||||
GTK_LIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0)
|
GTK_LIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0)
|
||||||
GTK_LIBDIR ?= $(shell $(PKG_CONFIG) --variable=libdir gtk+-3.0)
|
|
||||||
GTK_BINARY_VERSION ?= $(shell $(PKG_CONFIG) --variable=gtk_binary_version gtk+-3.0)
|
|
||||||
GTK_MODULE_DIR ?= $(GTK_LIBDIR)/gtk-3.0/$(GTK_BINARY_VERSION)/immodules
|
|
||||||
GTK_QUERY_IMMODULES ?= gtk-query-immodules-3.0
|
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_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)
|
all: $(PROG)
|
||||||
|
|
||||||
@@ -15,19 +22,29 @@ $(PROG): main.c ../ipc.c ../ipc.h
|
|||||||
-shared -fPIC -o $@ main.c ../ipc.c $(GTK_LIBS) $(LDLIBS)
|
-shared -fPIC -o $@ main.c ../ipc.c $(GTK_LIBS) $(LDLIBS)
|
||||||
|
|
||||||
install: $(PROG)
|
install: $(PROG)
|
||||||
test -n "$(GTK_LIBDIR)"
|
module_dir="$(GTK_MODULE_DIR)"; \
|
||||||
test -n "$(GTK_BINARY_VERSION)"
|
test -n "$$module_dir" || { \
|
||||||
test -n "$(GTK_MODULE_DIR)"
|
echo "cannot find GTK 3 module directory; set GTK_MODULE_DIR" >&2; \
|
||||||
mkdir -p "$(DESTDIR)$(GTK_MODULE_DIR)"
|
exit 1; \
|
||||||
cp $(PROG) "$(DESTDIR)$(GTK_MODULE_DIR)/"
|
}; \
|
||||||
if test -z "$(DESTDIR)"; then $(GTK_QUERY_IMMODULES) --update-cache; fi
|
mkdir -p "$(DESTDIR)$$module_dir" && \
|
||||||
|
cp "$(PROG)" "$(DESTDIR)$$module_dir/" && \
|
||||||
|
if test -z "$(DESTDIR)"; then \
|
||||||
|
GTK_PATH= GTK_IM_MODULE_FILE= \
|
||||||
|
$(GTK_QUERY_IMMODULES) --update-cache; \
|
||||||
|
fi
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
test -n "$(GTK_LIBDIR)"
|
module_dir="$(GTK_MODULE_DIR)"; \
|
||||||
test -n "$(GTK_BINARY_VERSION)"
|
test -n "$$module_dir" || { \
|
||||||
test -n "$(GTK_MODULE_DIR)"
|
echo "cannot find GTK 3 module directory; set GTK_MODULE_DIR" >&2; \
|
||||||
rm -f "$(DESTDIR)$(GTK_MODULE_DIR)/$(PROG)"
|
exit 1; \
|
||||||
if test -z "$(DESTDIR)"; then $(GTK_QUERY_IMMODULES) --update-cache; fi
|
}; \
|
||||||
|
rm -f "$(DESTDIR)$$module_dir/$(PROG)" && \
|
||||||
|
if test -z "$(DESTDIR)"; then \
|
||||||
|
GTK_PATH= GTK_IM_MODULE_FILE= \
|
||||||
|
$(GTK_QUERY_IMMODULES) --update-cache; \
|
||||||
|
fi
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PROG)
|
rm -f $(PROG)
|
||||||
|
|||||||
Reference in New Issue
Block a user