use WRITE-TO-LOAD-SCRIPT instead of sed and load.scm.in

This commit is contained in:
eknauel 2004-02-09 09:55:26 +00:00
parent 0c903274c8
commit b91f8d05d4
1 changed files with 29 additions and 25 deletions

View File

@ -23,31 +23,35 @@
(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))))))))
(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 "/libscshyp.la"))
(initializer-name "scsh_yp_main"))
(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 libscshyp's name" la-file-name))))))
(config)
(load ,(string-append schemedir "/yp-interfaces.scm"))
(load ,(string-append schemedir "/yp-packages.scm"))
(user))))
(install-directory-contents "scheme" 'scheme)
)