fix(runtime): make startup and GTK installation explicit
This commit is contained in:
@@ -19,6 +19,7 @@ RUN pacman -Syu --noconfirm --needed \
|
|||||||
python \
|
python \
|
||||||
ttf-dejavu \
|
ttf-dejavu \
|
||||||
ttf-jigmo \
|
ttf-jigmo \
|
||||||
|
valgrind \
|
||||||
which \
|
which \
|
||||||
xorg-server-xvfb \
|
xorg-server-xvfb \
|
||||||
xcb-imdkit \
|
xcb-imdkit \
|
||||||
|
|||||||
35
Makefile
35
Makefile
@@ -1,14 +1,19 @@
|
|||||||
CC = 9c
|
CC = 9c
|
||||||
LD = 9l
|
LD = 9l
|
||||||
PKG_CFLAGS = $(shell pkg-config --cflags dbus-1 xkbcommon)
|
PKG_CONFIG ?= pkg-config
|
||||||
PKG_LIBS = $(shell pkg-config --libs dbus-1 xkbcommon)
|
CFLAGS ?= -O2 -g
|
||||||
XIM_CFLAGS = $(shell pkg-config --cflags xcb-imdkit xkbcommon-x11)
|
WARN_CFLAGS = -Wall -Wextra
|
||||||
XIM_LIBS = $(shell pkg-config --libs xcb-imdkit xkbcommon-x11)
|
PKG_CFLAGS = $(shell $(PKG_CONFIG) --cflags dbus-1 xkbcommon)
|
||||||
TEXT_CFLAGS = $(shell pkg-config --cflags pangocairo cairo)
|
PKG_LIBS = $(shell $(PKG_CONFIG) --libs dbus-1 xkbcommon)
|
||||||
TEXT_LIBS = $(shell pkg-config --libs pangocairo cairo)
|
XIM_CFLAGS = $(shell $(PKG_CONFIG) --cflags xcb-imdkit xkbcommon-x11)
|
||||||
POPUP_CFLAGS = $(shell pkg-config --cflags xcb-randr)
|
XIM_LIBS = $(shell $(PKG_CONFIG) --libs xcb-imdkit xkbcommon-x11)
|
||||||
POPUP_LIBS = $(shell pkg-config --libs xcb-randr)
|
TEXT_CFLAGS = $(shell $(PKG_CONFIG) --cflags pangocairo cairo)
|
||||||
CFLAGS = -Wall -Wextra -O2 -g $(PKG_CFLAGS)
|
TEXT_LIBS = $(shell $(PKG_CONFIG) --libs pangocairo cairo)
|
||||||
|
POPUP_CFLAGS = $(shell $(PKG_CONFIG) --cflags xcb-randr)
|
||||||
|
POPUP_LIBS = $(shell $(PKG_CONFIG) --libs xcb-randr)
|
||||||
|
PROJECT_CPPFLAGS = $(PKG_CFLAGS)
|
||||||
|
PROJECT_LDLIBS = -lthread -lbio -lxcb $(PKG_LIBS) $(TEXT_LIBS) \
|
||||||
|
$(XIM_LIBS) $(POPUP_LIBS)
|
||||||
PROG = strans
|
PROG = strans
|
||||||
DOCKER_IMAGE = strans-build
|
DOCKER_IMAGE = strans-build
|
||||||
DOCKER_RUN = docker run --rm --user "$$(id -u):$$(id -g)" \
|
DOCKER_RUN = docker run --rm --user "$$(id -u):$$(id -g)" \
|
||||||
@@ -23,13 +28,15 @@ OBJS = $(SRCS:.c=.o) $(XIMOBJS)
|
|||||||
all: $(PROG) gtk
|
all: $(PROG) gtk
|
||||||
|
|
||||||
$(PROG): $(OBJS)
|
$(PROG): $(OBJS)
|
||||||
$(LD) -o $@ $(OBJS) -lthread -lbio -lxcb $(PKG_LIBS) $(TEXT_LIBS) \
|
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(PROJECT_LDLIBS) $(LDLIBS)
|
||||||
$(XIM_LIBS) $(POPUP_LIBS)
|
|
||||||
|
|
||||||
$(OBJS): dat.h fn.h ipc.h
|
$(OBJS): dat.h fn.h ipc.h
|
||||||
font.o: CFLAGS += $(TEXT_CFLAGS)
|
font.o: PROJECT_CPPFLAGS += $(TEXT_CFLAGS)
|
||||||
win.o: CFLAGS += $(POPUP_CFLAGS)
|
win.o: PROJECT_CPPFLAGS += $(POPUP_CFLAGS)
|
||||||
$(XIMOBJS): CFLAGS += -I. $(XIM_CFLAGS)
|
$(XIMOBJS): PROJECT_CPPFLAGS += -I. $(XIM_CFLAGS)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(CPPFLAGS) $(PROJECT_CPPFLAGS) $(WARN_CFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(PROG)
|
rm -f $(OBJS) $(PROG)
|
||||||
|
|||||||
68
README.md
68
README.md
@@ -41,15 +41,20 @@ XIM supports `UTF8_STRING` and `COMPOUND_TEXT`. Position clients place the
|
|||||||
popup from `XNSpotLocation`; otherwise XIM placement falls back to the bottom
|
popup from `XNSpotLocation`; otherwise XIM placement falls back to the bottom
|
||||||
of the focus or client window.
|
of the focus or client window.
|
||||||
|
|
||||||
|
The popup is an X11 window, XIM is X11-only, and GTK popup placement converts
|
||||||
|
the GTK caret to X11 root coordinates. There is no native Wayland popup
|
||||||
|
surface or Wayland caret positioning. GTK and IBus clients can still use
|
||||||
|
inline preedit where their display environment supports it.
|
||||||
|
|
||||||
## Build and test
|
## Build and test
|
||||||
|
|
||||||
Docker is the supported build environment:
|
Initialize the bundled test library, then use the pinned Docker environment
|
||||||
|
for a reproducible build:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
make docker-image
|
make docker-image
|
||||||
make docker-build
|
make docker-build
|
||||||
make docker-check
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Build output:
|
Build output:
|
||||||
@@ -59,9 +64,32 @@ strans daemon with IBus and XIM frontends
|
|||||||
gtk/im-strans.so GTK 3 frontend module
|
gtk/im-strans.so GTK 3 frontend module
|
||||||
```
|
```
|
||||||
|
|
||||||
Use `make docker-check TESTARGS=hangul` to run selected C tests. Native
|
Tests have three tiers:
|
||||||
`make all`, `make check`, and `make bench` are also available when the
|
|
||||||
dependencies listed in [`Dockerfile`](Dockerfile) are installed.
|
```sh
|
||||||
|
make check # generated-map validation and focused unit tests
|
||||||
|
make check-live # one IBus, GTK, XIM, and IPC daemon smoke
|
||||||
|
make check-stress # randomized, capacity, collision, failure, and restart tests
|
||||||
|
```
|
||||||
|
|
||||||
|
`UNITARGS` filters only the focused C unit suite, for example
|
||||||
|
`make check UNITARGS=hangul`. It does not select or skip live and stress
|
||||||
|
tests. `make docker-check` force-rebuilds and runs all three tiers in the
|
||||||
|
container; run `make docker-image` first after changing `Dockerfile`.
|
||||||
|
|
||||||
|
Native Linux builds require a C toolchain, Make, pkg-config, Python 3, and
|
||||||
|
cmp/diff, plus:
|
||||||
|
|
||||||
|
- Plan 9 port (`9c`, `9l`, `libthread`, and `libbio`);
|
||||||
|
- D-Bus development files;
|
||||||
|
- XCB, XCB RandR, xcb-imdkit, xkbcommon, and xkbcommon-x11;
|
||||||
|
- Pango, PangoCairo, Cairo, and Fontconfig;
|
||||||
|
- GTK 3, plus libibus and Xlib for the live clients;
|
||||||
|
- Xvfb for the X11 live tests;
|
||||||
|
- a working `C.UTF-8` locale and fonts covering Latin, CJK, and emoji.
|
||||||
|
|
||||||
|
The package names used by the canonical Arch Linux image are listed in
|
||||||
|
[`Dockerfile`](Dockerfile).
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
@@ -75,12 +103,21 @@ from the build tree:
|
|||||||
./strans map
|
./strans map
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`run.sh` stays in the foreground and replaces itself with the daemon. Stop it
|
||||||
|
with `Ctrl-C` or let a service supervisor own it. It neither finds nor kills
|
||||||
|
other `strans` processes. Endpoint collisions and requested frontend startup
|
||||||
|
failures make the process exit non-zero.
|
||||||
|
|
||||||
|
The build does not copy or install the daemon or its data. `./strans DIR`
|
||||||
|
opens `hira.map`, `kata.map`, `telex.map`, `kanji.dict`, `emoji.dict`, and
|
||||||
|
`hanja.dict` from `DIR` at runtime; `run.sh` passes the tracked `map/`
|
||||||
|
directory. Only the GTK subdirectory has install and uninstall targets.
|
||||||
|
|
||||||
Pango shapes the complete string and selects glyph fallback from the system
|
Pango shapes the complete string and selects glyph fallback from the system
|
||||||
font set.
|
font set.
|
||||||
|
|
||||||
The popup renderer uses Pango/PangoCairo and Cairo. When `DISPLAY` is set,
|
The popup renderer uses Pango/PangoCairo and Cairo. When `DISPLAY` is set,
|
||||||
`strans` starts its XIM worker in the same process. `run.sh` restarts the
|
`strans` starts its XIM worker in the same process.
|
||||||
existing `strans` process owned by the current user.
|
|
||||||
|
|
||||||
Configure clients as needed:
|
Configure clients as needed:
|
||||||
|
|
||||||
@@ -90,11 +127,21 @@ export XMODIFIERS=@im=strans
|
|||||||
|
|
||||||
# GTK 3 module
|
# GTK 3 module
|
||||||
doas make -C gtk install
|
doas make -C gtk install
|
||||||
|
export GTK_IM_MODULE=strans
|
||||||
|
|
||||||
# IBus client example
|
# IBus client example
|
||||||
GLFW_IM_MODULE=ibus kitty
|
GLFW_IM_MODULE=ibus kitty
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The GTK module directory is derived from GTK's pkg-config `libdir` and binary
|
||||||
|
version. It can be overridden with `GTK_MODULE_DIR`; `DESTDIR` staging is
|
||||||
|
supported and deliberately skips the host module-cache update. Remove a
|
||||||
|
native installation with:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
doas make -C gtk uninstall
|
||||||
|
```
|
||||||
|
|
||||||
strans provides its own IBus endpoint; `ibus-daemon` and fcitx are not
|
strans provides its own IBus endpoint; `ibus-daemon` and fcitx are not
|
||||||
required. Without `DISPLAY`, the daemon and IBus frontend still work, but XIM
|
required. Without `DISPLAY`, the daemon and IBus frontend still work, but XIM
|
||||||
is not started and the popup is disabled.
|
is not started and the popup is disabled.
|
||||||
@@ -112,6 +159,13 @@ make verify-map
|
|||||||
See [`map/README`](map/README) for Hanja import and Japanese dictionary
|
See [`map/README`](map/README) for Hanja import and Japanese dictionary
|
||||||
generation.
|
generation.
|
||||||
|
|
||||||
|
## Benchmark
|
||||||
|
|
||||||
|
`make bench` builds `bench/bench`. With the daemon stopped, `./bench.sh` starts
|
||||||
|
one build-tree instance, warms it up, and records the workload with Linux
|
||||||
|
`perf`. It requires `perf` and permission to profile the daemon, and writes
|
||||||
|
`bench/perf.data`.
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
Third-party license notices are in [`LICENSES`](LICENSES). The repository does
|
Third-party license notices are in [`LICENSES`](LICENSES). The repository does
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
CC = cc
|
CC = cc
|
||||||
CFLAGS = -Wall -O2
|
CFLAGS ?= -O2
|
||||||
|
|
||||||
bench: main.c ../ipc.c ../ipc.h
|
bench: main.c ../ipc.c ../ipc.h
|
||||||
$(CC) $(CFLAGS) -I.. -o $@ main.c ../ipc.c
|
$(CC) $(CPPFLAGS) -I.. -Wall $(CFLAGS) $(LDFLAGS) -o $@ \
|
||||||
|
main.c ../ipc.c $(LDLIBS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f bench
|
rm -f bench
|
||||||
|
|||||||
27
gtk/Makefile
27
gtk/Makefile
@@ -1,24 +1,33 @@
|
|||||||
PROG = im-strans.so
|
PROG = im-strans.so
|
||||||
CFLAGS = -Wall -O2 -I.. $(shell pkg-config --cflags gtk+-3.0)
|
PKG_CONFIG ?= pkg-config
|
||||||
LDFLAGS = $(shell pkg-config --libs gtk+-3.0)
|
CFLAGS ?= -O2
|
||||||
LIBDIR ?= /usr/lib
|
GTK_CFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
|
||||||
GTK_MODULE_DIR = $(LIBDIR)/gtk-3.0/3.0.0/immodules
|
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)
|
all: $(PROG)
|
||||||
|
|
||||||
$(PROG): main.c ../ipc.c ../ipc.h
|
$(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)
|
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)"
|
mkdir -p "$(DESTDIR)$(GTK_MODULE_DIR)"
|
||||||
cp $(PROG) "$(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:
|
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)"
|
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:
|
clean:
|
||||||
rm -f $(PROG)
|
rm -f $(PROG)
|
||||||
|
|||||||
@@ -78,4 +78,5 @@ rejected; rewrite or omit those rows before import.
|
|||||||
|
|
||||||
`verifymap.py` checks UTF-8, row structure, unique keys, 64-rune keys and
|
`verifymap.py` checks UTF-8, row structure, unique keys, 64-rune keys and
|
||||||
values, canonical candidate spacing, and duplicate dictionary candidates.
|
values, canonical candidate spacing, and duplicate dictionary candidates.
|
||||||
Pass it the exact `.map` and `.dict` files installed by the build.
|
Pass it the exact `.map` and `.dict` files used for runtime or validation.
|
||||||
|
The normal build does not install map data.
|
||||||
|
|||||||
14
run.sh
14
run.sh
@@ -11,16 +11,4 @@ if ! test -x ./strans; then
|
|||||||
echo "run.sh: ./strans is not executable; run make first" >&2
|
echo "run.sh: ./strans is not executable; run make first" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! command -v pkill >/dev/null 2>&1; then
|
exec ./strans map
|
||||||
echo "run.sh: pkill is required" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
uid=$(id -u) || exit 1
|
|
||||||
pkill -TERM -u "$uid" -x strans 2>/dev/null || :
|
|
||||||
sleep 0.1
|
|
||||||
pkill -KILL -u "$uid" -x strans 2>/dev/null || :
|
|
||||||
|
|
||||||
./strans map </dev/null &
|
|
||||||
strans_pid=$!
|
|
||||||
echo "run.sh: started strans $strans_pid"
|
|
||||||
|
|||||||
@@ -1,22 +1,26 @@
|
|||||||
CC = 9c
|
CC = 9c
|
||||||
LD = 9l
|
LD = 9l
|
||||||
HOSTCC = cc
|
HOSTCC = cc
|
||||||
CFLAGS = -std=c99 -Wall -Wextra -O2 -g -I.. -I../cutest
|
PKG_CONFIG ?= pkg-config
|
||||||
TEXT_CFLAGS = $(shell pkg-config --cflags pangocairo cairo)
|
CFLAGS ?= -O2 -g
|
||||||
TEXT_LIBS = $(shell pkg-config --libs pangocairo cairo)
|
UNIT_CPPFLAGS = -I.. -I../cutest
|
||||||
DBUS_CFLAGS = $(shell pkg-config --cflags dbus-1)
|
UNIT_CFLAGS = -std=c99 -Wall -Wextra
|
||||||
DBUS_LIBS = $(shell pkg-config --libs dbus-1)
|
HOST_CFLAGS = -std=c99 -Wall -Wextra
|
||||||
GTK_CFLAGS = $(shell pkg-config --cflags gtk+-3.0)
|
TEXT_CFLAGS = $(shell $(PKG_CONFIG) --cflags pangocairo cairo)
|
||||||
GTK_LIBS = $(shell pkg-config --libs gtk+-3.0)
|
TEXT_LIBS = $(shell $(PKG_CONFIG) --libs pangocairo cairo)
|
||||||
IBUS_CFLAGS = $(shell pkg-config --cflags dbus-1 xkbcommon)
|
DBUS_CFLAGS = $(shell $(PKG_CONFIG) --cflags dbus-1)
|
||||||
IBUS_LIBS = $(shell pkg-config --libs dbus-1 xkbcommon)
|
DBUS_LIBS = $(shell $(PKG_CONFIG) --libs dbus-1)
|
||||||
IBUS_CLIENT_CFLAGS = $(shell pkg-config --cflags ibus-1.0)
|
GTK_CFLAGS = $(shell $(PKG_CONFIG) --cflags gtk+-3.0)
|
||||||
IBUS_CLIENT_LIBS = $(shell pkg-config --libs ibus-1.0)
|
GTK_LIBS = $(shell $(PKG_CONFIG) --libs gtk+-3.0)
|
||||||
X11_CFLAGS = $(shell pkg-config --cflags x11)
|
IBUS_CFLAGS = $(shell $(PKG_CONFIG) --cflags dbus-1 xkbcommon)
|
||||||
X11_LIBS = $(shell pkg-config --libs x11)
|
IBUS_LIBS = $(shell $(PKG_CONFIG) --libs dbus-1 xkbcommon)
|
||||||
XIM_CFLAGS = $(shell pkg-config --cflags xcb-imdkit xkbcommon-x11)
|
IBUS_CLIENT_CFLAGS = $(shell $(PKG_CONFIG) --cflags ibus-1.0)
|
||||||
XIM_LIBS = $(shell pkg-config --libs xcb-imdkit xkbcommon-x11)
|
IBUS_CLIENT_LIBS = $(shell $(PKG_CONFIG) --libs ibus-1.0)
|
||||||
LIBS = -lthread -lbio $(TEXT_LIBS) $(IBUS_LIBS) $(XIM_LIBS)
|
X11_CFLAGS = $(shell $(PKG_CONFIG) --cflags x11)
|
||||||
|
X11_LIBS = $(shell $(PKG_CONFIG) --libs x11)
|
||||||
|
XIM_CFLAGS = $(shell $(PKG_CONFIG) --cflags xcb-imdkit xkbcommon-x11)
|
||||||
|
XIM_LIBS = $(shell $(PKG_CONFIG) --libs xcb-imdkit xkbcommon-x11)
|
||||||
|
UNIT_LDLIBS = -lthread -lbio $(TEXT_LIBS) $(IBUS_LIBS) $(XIM_LIBS)
|
||||||
|
|
||||||
PROG = unit_test
|
PROG = unit_test
|
||||||
STRESS = stress_test
|
STRESS = stress_test
|
||||||
@@ -55,24 +59,29 @@ check-stress: $(STRESS) ibus_live_test ipc_live_test $(FAULT) ../strans
|
|||||||
./daemon_restart_test ../strans ../map
|
./daemon_restart_test ../strans ../map
|
||||||
|
|
||||||
$(PROG): unit_test.o $(COMMONOBJ)
|
$(PROG): unit_test.o $(COMMONOBJ)
|
||||||
$(LD) -o $@ unit_test.o $(COMMONOBJ) $(LIBS)
|
$(LD) $(LDFLAGS) -o $@ unit_test.o $(COMMONOBJ) $(UNIT_LDLIBS) \
|
||||||
|
$(LDLIBS)
|
||||||
|
|
||||||
$(STRESS): stress_test.o $(COMMONOBJ)
|
$(STRESS): stress_test.o $(COMMONOBJ)
|
||||||
$(LD) -o $@ stress_test.o $(COMMONOBJ) $(LIBS)
|
$(LD) $(LDFLAGS) -o $@ stress_test.o $(COMMONOBJ) $(UNIT_LDLIBS) \
|
||||||
|
$(LDLIBS)
|
||||||
|
|
||||||
stress_test.o: unit_test.c
|
stress_test.o: unit_test.c
|
||||||
$(CC) $(CFLAGS) -DSTRESS -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(UNIT_CFLAGS) $(CFLAGS) -DSTRESS \
|
||||||
|
-c -o $@ $<
|
||||||
|
|
||||||
ibus_live_test: ibus_live_test.c
|
ibus_live_test: ibus_live_test.c
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g $(DBUS_CFLAGS) -o $@ $< $(DBUS_LIBS)
|
$(HOSTCC) $(CPPFLAGS) $(DBUS_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
||||||
|
$(LDFLAGS) -o $@ $< $(DBUS_LIBS) $(LDLIBS)
|
||||||
|
|
||||||
ibus_client_smoke: ibus_client_smoke.c
|
ibus_client_smoke: ibus_client_smoke.c
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g $(IBUS_CLIENT_CFLAGS) -o $@ $< \
|
$(HOSTCC) $(CPPFLAGS) $(IBUS_CLIENT_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
||||||
$(IBUS_CLIENT_LIBS)
|
$(LDFLAGS) -o $@ $< $(IBUS_CLIENT_LIBS) $(LDLIBS)
|
||||||
|
|
||||||
gtk_live_test: gtk_live_test.c ../ipc.c ../ipc.h
|
gtk_live_test: gtk_live_test.c ../ipc.c ../ipc.h
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g -I.. $(GTK_CFLAGS) -o $@ \
|
$(HOSTCC) $(CPPFLAGS) -I.. $(GTK_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
||||||
gtk_live_test.c ../ipc.c $(GTK_LIBS) -pthread
|
$(LDFLAGS) -o $@ gtk_live_test.c ../ipc.c $(GTK_LIBS) -pthread \
|
||||||
|
$(LDLIBS)
|
||||||
|
|
||||||
../gtk/im-strans.so: ../gtk/main.c ../ipc.c ../ipc.h
|
../gtk/im-strans.so: ../gtk/main.c ../ipc.c ../ipc.h
|
||||||
$(MAKE) -C ../gtk
|
$(MAKE) -C ../gtk
|
||||||
@@ -81,44 +90,50 @@ gtk_live_test: gtk_live_test.c ../ipc.c ../ipc.h
|
|||||||
$(MAKE) -C .. strans
|
$(MAKE) -C .. strans
|
||||||
|
|
||||||
xim_live_test: xim_live_test.c ../ipc.c ../ipc.h
|
xim_live_test: xim_live_test.c ../ipc.c ../ipc.h
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g -I.. $(X11_CFLAGS) -o $@ \
|
$(HOSTCC) $(CPPFLAGS) -I.. $(X11_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
||||||
xim_live_test.c ../ipc.c $(X11_LIBS)
|
$(LDFLAGS) -o $@ xim_live_test.c ../ipc.c $(X11_LIBS) $(LDLIBS)
|
||||||
|
|
||||||
ipc_live_test: ipc_live_test.c ../ipc.c ../ipc.h
|
ipc_live_test: ipc_live_test.c ../ipc.c ../ipc.h
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g -I.. -o $@ ipc_live_test.c ../ipc.c
|
$(HOSTCC) $(CPPFLAGS) -I.. $(HOST_CFLAGS) $(CFLAGS) $(LDFLAGS) \
|
||||||
|
-o $@ ipc_live_test.c ../ipc.c $(LDLIBS)
|
||||||
|
|
||||||
daemon_collision_test: daemon_collision_test.c ../ipc.c ../ipc.h
|
daemon_collision_test: daemon_collision_test.c ../ipc.c ../ipc.h
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g -I.. $(DBUS_CFLAGS) -o $@ \
|
$(HOSTCC) $(CPPFLAGS) -I.. $(DBUS_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
||||||
daemon_collision_test.c ../ipc.c $(DBUS_LIBS)
|
$(LDFLAGS) -o $@ daemon_collision_test.c ../ipc.c $(DBUS_LIBS) \
|
||||||
|
$(LDLIBS)
|
||||||
|
|
||||||
daemon_failure_test: daemon_failure_test.c
|
daemon_failure_test: daemon_failure_test.c
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g -o $@ $<
|
$(HOSTCC) $(CPPFLAGS) $(HOST_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< \
|
||||||
|
$(LDLIBS)
|
||||||
|
|
||||||
daemon_restart_test: daemon_restart_test.c ../ipc.c ../ipc.h
|
daemon_restart_test: daemon_restart_test.c ../ipc.c ../ipc.h
|
||||||
$(HOSTCC) -std=c99 -Wall -Wextra -O2 -g -I.. $(DBUS_CFLAGS) -o $@ \
|
$(HOSTCC) $(CPPFLAGS) -I.. $(DBUS_CFLAGS) $(HOST_CFLAGS) $(CFLAGS) \
|
||||||
daemon_restart_test.c ../ipc.c $(DBUS_LIBS)
|
$(LDFLAGS) -o $@ daemon_restart_test.c ../ipc.c $(DBUS_LIBS) \
|
||||||
|
$(LDLIBS)
|
||||||
|
|
||||||
unit_test.o stress_test.o $(TESTOBJ): test.h ../dat.h ../fn.h ../ipc.h \
|
unit_test.o stress_test.o $(TESTOBJ): test.h ../dat.h ../fn.h ../ipc.h \
|
||||||
../cutest/cutest.h
|
../cutest/cutest.h
|
||||||
engine_test.o: ../strans.c
|
engine_test.o: ../strans.c
|
||||||
ibus_test.o: CFLAGS += $(IBUS_CFLAGS)
|
ibus_test.o: UNIT_CPPFLAGS += $(IBUS_CFLAGS)
|
||||||
ibus_test.o: ../ibus.c
|
ibus_test.o: ../ibus.c
|
||||||
xim_adapter_test.o: CFLAGS += $(XIM_CFLAGS)
|
xim_adapter_test.o: UNIT_CPPFLAGS += $(XIM_CFLAGS)
|
||||||
xim_adapter_test.o: ../xim/xim.c
|
xim_adapter_test.o: ../xim/xim.c
|
||||||
server_test.o: ../srv.c
|
server_test.o: ../srv.c
|
||||||
unit_font.o: CFLAGS += $(TEXT_CFLAGS)
|
unit_font.o: UNIT_CPPFLAGS += $(TEXT_CFLAGS)
|
||||||
|
|
||||||
unit_xim_keymap.o: ../xim/keymap.c
|
unit_xim_keymap.o: ../xim/keymap.c
|
||||||
$(CC) $(CFLAGS) $(XIM_CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(XIM_CFLAGS) $(UNIT_CFLAGS) \
|
||||||
|
$(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
unit_ximtext.o: ../xim/ximtext.c
|
unit_ximtext.o: ../xim/ximtext.c
|
||||||
$(CC) $(CFLAGS) $(XIM_CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(XIM_CFLAGS) $(UNIT_CFLAGS) \
|
||||||
|
$(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
unit_%.o: ../%.c ../dat.h ../fn.h ../ipc.h
|
unit_%.o: ../%.c ../dat.h ../fn.h ../ipc.h
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(UNIT_CFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(UNIT_CPPFLAGS) $(UNIT_CFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(PROG) $(STRESS) $(LIVE)
|
rm -f $(OBJS) $(PROG) $(STRESS) $(LIVE)
|
||||||
|
|||||||
11
xim/Makefile
11
xim/Makefile
@@ -1,13 +1,16 @@
|
|||||||
CC = cc
|
CC = cc
|
||||||
XIM_CFLAGS = $(shell pkg-config --cflags xcb-imdkit xkbcommon-x11)
|
PKG_CONFIG ?= pkg-config
|
||||||
XIM_LIBS = $(shell pkg-config --libs xcb-imdkit xkbcommon-x11)
|
CFLAGS ?= -O2
|
||||||
CFLAGS = -Wall -Wextra -O2 -I.. $(XIM_CFLAGS)
|
XIM_CFLAGS = $(shell $(PKG_CONFIG) --cflags xcb-imdkit xkbcommon-x11)
|
||||||
|
XIM_LIBS = $(shell $(PKG_CONFIG) --libs xcb-imdkit xkbcommon-x11)
|
||||||
TEST = xim_test
|
TEST = xim_test
|
||||||
|
|
||||||
all: $(TEST)
|
all: $(TEST)
|
||||||
|
|
||||||
$(TEST): ../tests/xim_test.c keymap.c ximtext.c
|
$(TEST): ../tests/xim_test.c keymap.c ximtext.c
|
||||||
$(CC) $(CFLAGS) -o $@ ../tests/xim_test.c keymap.c ximtext.c $(XIM_LIBS)
|
$(CC) $(CPPFLAGS) -I.. $(XIM_CFLAGS) -Wall -Wextra $(CFLAGS) \
|
||||||
|
$(LDFLAGS) -o $@ ../tests/xim_test.c keymap.c ximtext.c \
|
||||||
|
$(XIM_LIBS) $(LDLIBS)
|
||||||
|
|
||||||
check: $(TEST)
|
check: $(TEST)
|
||||||
./$(TEST)
|
./$(TEST)
|
||||||
|
|||||||
Reference in New Issue
Block a user