Packageize

This commit is contained in:
Tony Garnock-Jones 2014-12-17 11:54:44 -05:00
parent f10d1ac0f0
commit 7c3b3f3c6c
14 changed files with 62 additions and 14 deletions

View File

@ -1,17 +1,16 @@
SYSTEM_LIBRARY_SUBPATH:=compiled/native/$(shell racket -e '(display (path->string (system-library-subpath)))')
SYSTEM_LIBRARY_SUFFIX:=$(shell racket -e '(begin (require dynext/file) (display (path->string (append-extension-suffix "DUMMY"))))' | sed -e s:DUMMY::)
PACKAGENAME=ansi
COLLECTS=ansi
all: $(SYSTEM_LIBRARY_SUBPATH)/tty-raw-extension$(SYSTEM_LIBRARY_SUFFIX)
all: setup
clean:
rm -rf compiled
find . -name compiled -type d | xargs rm -rf
$(SYSTEM_LIBRARY_SUBPATH):
mkdir -p $@
setup:
raco setup $(COLLECTS)
$(SYSTEM_LIBRARY_SUBPATH)/%$(SYSTEM_LIBRARY_SUFFIX): %.c $(SYSTEM_LIBRARY_SUBPATH)
mzc --xform $*.c
mzc --3m --cc $*.3m.c
mzc --3m --ld $@ $*_3m.o
rm -f $*.3m.c
rm -f $*_3m.o
link:
raco pkg install --link -n $(PACKAGENAME) $$(pwd)
unlink:
raco pkg remove $(PACKAGENAME)

11
ansi/info.rkt Normal file
View File

@ -0,0 +1,11 @@
#lang setup/infotab
(define name "ansi")
(define blurb
(list
`(p "ANSI and VT10x escape sequences.")))
(define homepage "https://github.com/tonyg/racket-ansi")
(define primary-file "main.rkt")
(define pre-install-collection "private/install.rkt")
(define compile-omit-files '("private/install.rkt"))

View File

@ -149,7 +149,7 @@
))
(module+ main
(require "tty-raw-extension")
(require "private/tty-raw-extension")
(tty-raw!)
(let loop ()
(match (lex-lcd-input (current-input-port))

7
ansi/main.rkt Normal file
View File

@ -0,0 +1,7 @@
#lang racket/base
(require "ansi.rkt"
"lcd-terminal.rkt")
(provide (all-from-out "ansi.rkt")
(all-from-out "lcd-terminal.rkt"))

29
ansi/private/install.rkt Normal file
View File

@ -0,0 +1,29 @@
#lang racket/base
(provide pre-installer)
(require racket/file)
(require dynext/file)
(require dynext/compile)
(require dynext/link)
(define (pre-installer collections-top-path collection-path)
(define private-path (build-path collection-path "private"))
(parameterize ((current-directory private-path))
(define shared-object-target-path (build-path private-path
"compiled"
"native"
(system-library-subpath)))
(define shared-object-target (build-path shared-object-target-path
(append-extension-suffix "tty-raw-extension")))
(when (not (file-exists? shared-object-target))
(define c-source (build-path private-path "tty-raw-extension.c"))
(define object (build-path shared-object-target-path "tty-raw-extension.o"))
(make-directory* shared-object-target-path)
(compile-extension #f ;; not quiet
c-source
object
'())
(link-extension #f ;; not quiet
(list object)
shared-object-target))))

View File

@ -1,6 +1,6 @@
#lang racket/base
(require "tty-raw-extension")
(require "private/tty-raw-extension")
(require "ansi.rkt")
(define (main)

2
info.rkt Normal file
View File

@ -0,0 +1,2 @@
#lang setup/infotab
(define collection 'multi)