scsh-ncurses/pkg-def.scm

63 lines
1.9 KiB
Scheme

(define-package "scsh-ncurses" (0 2)
((install-lib-version (1 0)))
(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
`((user)
(load-package 'dynamic-externals)
(open 'dynamic-externals)
(open 'external-calls)
(open 'configure)
(open 'signals)
,@(map (lambda (x) `(run ',x)) tmpl-libtool-la-reader)
(run '(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)
(call-external (get-external initializer-name)))))
(else
(error "Could not figure out libscshncurses' name" la-file-name))))))
(config)
(load ,(string-append schemedir "/ncurses-packages.scm"))
(user))))
(display "installing")
(newline)
(install-directory-contents "scheme" 'scheme)
; (install-file '("COPYING" . "LICENSE") 'doc)
)