add loading stuff and edit makefile

This commit is contained in:
Zsombor Barna 2024-04-16 13:05:29 +02:00
parent 20f3d91def
commit f7bda86058
2 changed files with 26 additions and 25 deletions

View File

@ -1,6 +1,8 @@
ARCH := $(shell uname -m)
DOCKER_IMAGE := "gerbil/gerbilxx:$(ARCH)"
default: linux-static
ARCH := `shell uname -m`
DOCKER_IMAGE := "gerbil/gerbilxx:${ARCH}"
MAKEINFO_FLAGS+=-D "VERSION 0.2.9" -D "UPDATED 2024-02-28"
default: linux-static actkbd.info
build-release:
/opt/gerbil/bin/gxpkg deps -i
@ -8,10 +10,10 @@ build-release:
linux-static:
docker run -it \
-e USER=$(USER) \
-e USER=${USER} \
-e GERBIL_PATH=/src/.gerbil \
-v $(PWD):/src:z \
$(DOCKER_IMAGE) \
-v ${PWD}:/src:z \
${DOCKER_IMAGE} \
make -C /src/ build-release
install:
@ -20,20 +22,5 @@ install:
clean:
gerbil clean
gerbil clean all
PRG = actkbd
DEPS = guile-3.0
CFLAGS += -std=c11 `pkg-config --cflags ${DEPS}`
LDFLAGS += `pkg-config --libs ${DEPS}`
all: ${PRG} ${PRG}.info Makefile
${PRG}: ${PRG}.c
${CC} ${CPPFLAGS} ${CFLAGS} -o $@ $< ${LDFLAGS}
${PRG}.info: ${PRG}.texi
makeinfo -o $@ -D "VERSION 0.2.9" -D "UPDATED 2024-02-28" ${PRG}.texi
lint:
clang-tidy ${PRG}.c -- ${CPPFLAGS} ${CFLAGS}
.PHONY: all lint
%.info: %.texinfo

View File

@ -3,7 +3,10 @@
:std/getopt
:std/format
;; :std/misc/process
:gerbil/gambit
:gerbil/expander
:gerbil/runtime
:gerbil/runtime/loader
./lib)
(export main)
@ -35,15 +38,17 @@
(flag 'grab "-g" help: "Grab the keyboard, getting exclusive
access to the device")
(argument 'device help: "Device file")
(argument 'config help: "Configuration file, scheme script")
))
(argument 'config help: "Configuration file, scheme script")))
(def (actkbd-main opts)
(let-hash opts
(set! verbose .?verbose)
(init-kb .device .?grab)
(gerbil-load-expander!)
(eval-module .config)
;;(add-load-path! .config)
;; (load-module "example-config.scm")
(eval `(import ,.config))
;; (cut )
(while #t
(let* ((ev (read-ev)))
(when verbose
@ -51,3 +56,12 @@
(evt-key ev)
(evt-action ev)))
(call-cb ev)))))
;; GERBIL_LOADPATH=./actkbd .gerbil/bin/actkbd -v /dev/input/event15 actkbd/example-config.scm ;; segfaults
;; add-load-path! ;; where's the symbol?
;; load-module ;; does not find module by absolute or relative path
;; (eval-module .config) ;; segfaults
;; (import-module .config) ;; segfaults
;; (eval `(import ,.config)) ;; segfaults
;; (module-import-source .config) ;; type error