scsh-yp/pkg-def.scm

53 lines
1.7 KiB
Scheme

(define-package "yp" (0 2 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 "--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))))
(if (not (get-option-value 'non-shared-only))
(begin
(display "creating load.scm")
(newline)
(let ((config-data
(call-with-input-file "config-data.scm" read)))
(let ((schemedir (get-directory 'scheme #f))
(libdir (get-directory 'lib #f))
(target-dir (get-directory 'base #t))
(shared-ext (cadr (assoc 'shared-module-extension config-data)))
(sed-replace (lambda (from to)
(string-append "s|" from "|" to "|g"))))
(let ((cmd `(sed -e ,(sed-replace "@ypschemedir@" schemedir)
-e ,(sed-replace "@yphost@" "(host)")
-e ,(sed-replace "@yplibdir@" libdir)
-e ,(sed-replace "@sharedmoduleext@" shared-ext)
"load.scm.in"))
(tgt (string-append target-dir "/load.scm")))
(if (get-option-value 'dry-run)
(begin
(display cmd) (display " > ") (display tgt)
(newline))
(or (zero? (run ,cmd (> ,tgt))) (exit))))))))
(install-directory-contents "scheme" 'scheme)
)