diff --git a/just/Makefile b/just/Makefile new file mode 100644 index 0000000..060131d --- /dev/null +++ b/just/Makefile @@ -0,0 +1,24 @@ +FENNEL?=$(fennel) +PREFIX?=/usr/local + +PROGRAM_NAME=just +MAIN=$(PROGRAM_NAME).fnl +SOURCES=$(MAIN) listeners.fnl viewplex.fnl webview.fnl + +$(PROGRAM_NAME): $(SOURCES) Makefile + (echo -e "#!/usr/bin/env lua\n" ; \ + : we reset package.path so that --require-as-include cannot find ; \ + : and inline third-party modules ; \ + lua -e 'package.path="./?.lua"' $(FENNEL) --require-as-include --compile $(MAIN) ) > $@ + chmod +x $@ + +install: + mkdir -p $(PREFIX)/bin $(PREFIX)/lib/$(PROGRAM_NAME) + cp $(PROGRAM_NAME) $(PREFIX)/bin +# cp interface.xml styles.css $(PREFIX)/lib/$(PROGRAM_NAME) + +test: + for i in *-test.fnl ; do lua $(fennel) $$i; done + +easylist.txt: + curl https://easylist.to/easylist/easylist.txt -O diff --git a/just/README.md b/just/README.md index 2688c43..f78696d 100644 --- a/just/README.md +++ b/just/README.md @@ -2,6 +2,22 @@ Touchscreen-friendly wrapper around Webkit +## Building + +If you have Nix + + nix-build build.nix + +Otherwise, very approximately + +* find and install the Lua packages described by the lua5_3.withPackages form in `default.nix` +* install [Fennel](https://fennel-lang.org/setup#downloading-fennel) +* `make` + +This *should* result in an executable called `just`, but +YMMV. Consider Nix? + + ## TO DO * functional diff --git a/just/build.nix b/just/build.nix new file mode 100644 index 0000000..e404c8c --- /dev/null +++ b/just/build.nix @@ -0,0 +1,2 @@ +with import {} ; +callPackage ./. {} diff --git a/just/default.nix b/just/default.nix index eeb6ebb..2506531 100644 --- a/just/default.nix +++ b/just/default.nix @@ -41,5 +41,7 @@ in stdenv.mkDerivation { nativeBuildInputs = [ lua makeWrapper ]; makeFlags = [ "PREFIX=${placeholder "out"}" ]; - + postInstall = '' + wrapProgram $out/bin/just --set GI_TYPELIB_PATH "$GI_TYPELIB_PATH" + ''; } diff --git a/just/just.fnl b/just/just.fnl index 86bf9ce..db8318a 100644 --- a/just/just.fnl +++ b/just/just.fnl @@ -3,7 +3,8 @@ (local { : Gtk : Gdk : WebKit2 : cairo } lgi) -(local {: view} (require :fennel)) +(if (os.getenv "JUST_HACKING") + (local {: view} (require :fennel))) (local Listeners (require :listeners)) (local Webview (require :webview))