commit 417e443ed324838c7810a9f90dc51c5e3e2a201b
parent 4ee558f906588deada2647093abdc7b4170e352c
Author: Daniel Barlow <dan@telent.net>
Date: Sat, 19 Mar 2022 16:09:03 +0000
create and document build.nix
Diffstat:
5 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/just/Makefile 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
@@ -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
@@ -0,0 +1,2 @@
+with import <nixpkgs> {} ;
+callPackage ./. {}
diff --git 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
@@ -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))