From 3c9c82664c473e666056e5cbd3f1b943783967ed Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Sun, 21 Mar 2021 12:21:17 -0400 Subject: [PATCH] Switch to compiled executable --- .gitignore | 2 +- Makefile | 20 +++++++++++++++----- README.md | 4 +--- TODO | 4 ++-- info.rkt | 2 +- tt.rkt | 5 +++-- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 724bbe1..c49c556 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -compiled/ +tt diff --git a/Makefile b/Makefile index 882fda6..a801484 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,18 @@ -SRC_FILE := tt.rkt +PKG_NAME := tt +EXE_FILE := $(PKG_NAME) +SRC_FILE := $(EXE_FILE).rkt +PREFIX := $(HOME) + +.PHONY: build +build: $(EXE_FILE) + +$(EXE_FILE): $(SRC_FILE) + raco exe -o $@ $< .PHONY: install -install: - raco pkg install --deps search-auto +install: $(EXE_FILE) + mkdir -p $(PREFIX)/bin/ + cp $(EXE_FILE) $(PREFIX)/bin/ .PHONY: test test: @@ -10,11 +20,11 @@ test: .PHONY: remove remove: - raco pkg remove tt + raco pkg remove $(PKG_NAME) .PHONY: clean clean: - rm -rf compiled + rm -f $(EXE_FILE) ### dev helpers ### # scmindent.rkt : https://github.com/ds26gte/scmindent diff --git a/README.md b/README.md index 3c8630d..1daf22d 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,7 @@ instructions [Racket](https://download.racket-lang.org/) ### installation -1. Run `make install` or `raco pkg install` -2. Add `$HOME/.racket/7.9/bin` to your `$PATH` - (replacing `7.9` with whatever version you have installed) +`make build && make install` will build and copy `tt` binary into `$PREFIX/bin`. ### usage Download feeds from the Internet: diff --git a/TODO b/TODO index de2aaf6..5368d46 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,7 @@ - [ ] Convert to Typed Racket - requires: build executable (otherwise too slow) -- [ ] Build executable - - requires: fix of "collection not found" when executing the built executable +- [x] Build executable + Implies fix of "collection not found" when executing the built executable outside the source directory: collection-path: collection not found diff --git a/info.rkt b/info.rkt index 232640e..7b384b7 100644 --- a/info.rkt +++ b/info.rkt @@ -6,7 +6,7 @@ (define pkg-desc "twtxt client") (define version - "0.11.0") + "0.12.0") (define pkg-authors '("Siraaj Khandkar ")) (define deps diff --git a/tt.rkt b/tt.rkt index f7731c4..03db6e6 100644 --- a/tt.rkt +++ b/tt.rkt @@ -2,12 +2,13 @@ (require openssl/sha1) (require racket/date) -(require (prefix-in info: setup/getinfo)) (require net/http-client net/url-string net/url-structs) +(require (prefix-in info: "info.rkt")) + (module+ test (require rackunit)) @@ -221,7 +222,7 @@ (define user-agent (let* ([prog-name "tt"] - [prog-version ((info:get-info (list prog-name)) 'version)] + [prog-version (info:#%info-lookup 'version)] [prog-uri "https://github.com/xandkar/tt"] [user-feed-file (expand-user-path "~/twtxt-me.txt")] [user -- 2.20.1