scsh-ncurses/pkg-def.scm

89 lines
2.9 KiB
Scheme
Raw Normal View History

2006-04-18 09:27:52 -04:00
(define-package "scsh-ncurses" (1 1)
2005-10-04 09:29:43 -04:00
((install-lib-version (1 1 2)))
(display "configuring, compiling and installing c-stubs")
(newline)
(let* ((scsh-includes (include-dir))
(build-host (get-option-value 'build))
(prefix (string-append (get-directory 'lib #f) "/" build-host))
(configure `("./configure"
,(string-append "--prefix=" prefix)
,(string-append "--with-scsh-includes=" scsh-includes)
,(string-append "--enable-static=no")
,(string-append "--build=" build-host)))
(make `(make install
,(string-append "DESTDIR=" (get-option-value 'dest-dir)))))
(if (get-option-value 'dry-run)
(begin
(display configure)
(newline)
(display make)
(newline))
(if (not (and (zero? (run ,configure))
(zero? (run ,make))))
(exit))))
(display "creating load.scm")
(newline)
(let ((schemedir (get-directory 'scheme #f))
(libdir (get-directory 'lib #f)))
(write-to-load-script
2005-10-04 09:29:43 -04:00
`((new-package)
(structure 'load-scsh-ncurses '(export))
(open 'scheme-with-scsh)
(open 'srfi-13)
(load-package 'dynamic-externals)
(open 'dynamic-externals)
(open 'external-calls)
(open 'configure)
(open 'signals)
2005-10-04 09:29:43 -04:00
(open 'define-record-types)
(open 'records)
(open 'i/o)
(run '(define (scsh-ncurses-init)
,@tmpl-libtool-la-reader
(let* ((lib-dir (string-append ,libdir "/" (host)))
(la-file-name (string-append lib-dir "/libscshncurses.la"))
(initializer-name "s48_init_ncurses"))
(let ((la-alist (read-libtool-la la-file-name)))
(cond
((assoc 'dlname la-alist)
=> (lambda (p)
(let ((module-file (string-append lib-dir "/" (cdr p))))
(dynamic-load module-file)
(lookup-all-externals) ;;; important when resuming images
(call-external (get-external initializer-name)))))
(else
(error "Could not figure out libscshncurses' name" )))))))
(run '(scsh-ncurses-init))
;; TODO: This is also in sunterlib/heap-images/reinitializer.scm
(run '(define-record-type reinitializer :reinitializer
(make-reinitializer thunk)
reinitializer?
(thunk reinitializer-thunk)))
(run '(define-record-resumer :reinitializer
(lambda (r)
((reinitializer-thunk r)))))
(run '(define scsh-ncurses-reinitializer
(make-reinitializer scsh-ncurses-init)))
(config)
(load ,(string-append schemedir "/ncurses-packages.scm"))
(user))))
(display "installing")
(newline)
(install-directory-contents "scheme" 'scheme)
2005-10-04 09:29:43 -04:00
(install-file '("COPYING" . "LICENSE") 'doc)
)