diff --git a/pkg-def.scm b/pkg-def.scm index a700aa6..04946d9 100644 --- a/pkg-def.scm +++ b/pkg-def.scm @@ -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)))))))) + (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 "/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) ) - - \ No newline at end of file