scx/load.scm.in

79 lines
2.4 KiB
Scheme
Raw Normal View History

(user)
(load-package 'dynamic-externals)
(open 'dynamic-externals)
(open 'external-calls)
2003-11-28 10:41:39 -05:00
(open 'configure)
(open 'signals)
(run
'(define (normalize-la-entry key val)
(let ((left-quotes-rx (rx (: bos #\')))
(right-quotes-rx (rx (: #\' eos)))
(kill-matches
(lambda (rx str)
(regexp-substitute/global #f rx str 'pre 'post))))
(cons (string->symbol key)
(kill-matches left-quotes-rx
(kill-matches right-quotes-rx val))))))
(run
'(define add-la-entry
(let ((splitter (infix-splitter (rx #\=)))
(comment-rx (rx (: bos #\#))))
(lambda (line alist)
(cond
((and (not (regexp-search? comment-rx line))
(string-index line #\=))
(let ((lst (splitter line)))
(if (= 2 (length lst))
(cons (apply normalize-la-entry lst) alist)
(error "Could not read la entry" line list))))
(else alist))))))
(run
'(define (read-libtool-la file-name)
(call-with-input-file
file-name
(lambda (port)
(let lp ((line (read-line port)) (alist '()))
(if (eof-object? line)
alist
(lp (read-line port) (add-la-entry line alist))))))))
(run '(let* ((lib-dir (string-append "@yplibdir@/" @yphost@))
(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)
(dynamic-load (string-append lib-dir "/" (cdr p)))
(call-external (get-external initializer-name))))
(else
(error "Could not figure out libscshyp's name" la-file-name))))))
(run '(let ((lib-dir (string-append "@scxlibdir@/" @scxhost@))
(la-file-name (string-append lib-dir "/libscx.la"))
(initializer-name "scx_init_xlib"))
(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))
(if (string=? "@scxload_xft_packages@" "yes")
(begin
(call-external (get-external "scx_xft_init"))
(call-external (get-external "scx_xrender_init")))))))
(else
(error "Could not figure out libscx's name" la-file-name))))))
(config)
2003-11-22 15:05:09 -05:00
(load "@scxschemedir@/xlib/xlib-interfaces.scm")
(load "@scxschemedir@/xlib/xlib-packages.scm")
2003-12-02 07:10:28 -05:00
(load "@scxschemedir@/libs/libs-interfaces.scm")
(load "@scxschemedir@/libs/libs-packages.scm")
2004-01-08 11:13:27 -05:00
(user)