fix(runtime): make startup and GTK installation explicit

This commit is contained in:
2026-08-14 23:17:18 +09:00
parent 516ec98a70
commit 133cc97e55
9 changed files with 168 additions and 89 deletions

View File

@@ -1,24 +1,33 @@
PROG = im-strans.so
CFLAGS = -Wall -O2 -I.. $(shell pkg-config --cflags gtk+-3.0)
LDFLAGS = $(shell pkg-config --libs gtk+-3.0)
LIBDIR ?= /usr/lib
GTK_MODULE_DIR = $(LIBDIR)/gtk-3.0/3.0.0/immodules
PKG_CONFIG ?= pkg-config
CFLAGS ?= -O2
GTK_CFLAGS = $(shell $(PKG_CONFIG) --cflags 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
all: $(PROG)
$(PROG): main.c ../ipc.c ../ipc.h
$(CC) -shared -fPIC $(CFLAGS) -o $@ main.c ../ipc.c $(LDFLAGS)
$(CC) $(CPPFLAGS) -I.. $(GTK_CFLAGS) -Wall $(CFLAGS) $(LDFLAGS) \
-shared -fPIC -o $@ main.c ../ipc.c $(GTK_LIBS) $(LDLIBS)
install: $(PROG)
test -n "$(LIBDIR)"
test -n "$(GTK_LIBDIR)"
test -n "$(GTK_BINARY_VERSION)"
test -n "$(GTK_MODULE_DIR)"
mkdir -p "$(DESTDIR)$(GTK_MODULE_DIR)"
cp $(PROG) "$(DESTDIR)$(GTK_MODULE_DIR)/"
if test -z "$(DESTDIR)"; then gtk-query-immodules-3.0 --update-cache; fi
if test -z "$(DESTDIR)"; then $(GTK_QUERY_IMMODULES) --update-cache; fi
uninstall:
test -n "$(LIBDIR)"
test -n "$(GTK_LIBDIR)"
test -n "$(GTK_BINARY_VERSION)"
test -n "$(GTK_MODULE_DIR)"
rm -f "$(DESTDIR)$(GTK_MODULE_DIR)/$(PROG)"
if test -z "$(DESTDIR)"; then gtk-query-immodules-3.0 --update-cache; fi
if test -z "$(DESTDIR)"; then $(GTK_QUERY_IMMODULES) --update-cache; fi
clean:
rm -f $(PROG)