On Sun 01 Feb 2004 18:52, Michel Schinz <Michel.Schinz@epfl.ch> writes:
>>> For example, we could imagine having something like this:
>>>
>>> (write-to-load-script `((user)
>>> (load-package (quote (dynamic-externals)))
>>> ;; ...
>>> (load ,(absolute-file-name
>>> "yp-interfaces.scm"
>>> yp-scheme-dir))))
>> That's a very good idea! Here another point: As Martin pointed out,
>> the right way for packages with c code for finding the shared module
>> to load is to look at the .la files generated by libtool. The code
>> for reading that has to go somewhere, IMHO it makes no sense to
>> copy/paste that code into every load.scm. Install-lib.scm seems to be
>> a good place, since then one could include simply by saying:
>>
>> (write-to-load-script
>> `((user)
>> (load-package (quote (dynamic-externals)))
>> ,@libtool-la-reader-code
>> ...))
>>
>> There is a pretty-printer for scsh (,open pp), may be it's suitable
>> for layouting the resulting code.
>
> Perfect, so I've added some support in install-lib which follows this
> proposal. So now you have access to the following new functions:
>
> (with-output-to-load-script* thunk) evaluates THUNK with
> CURRENT-OUTPUT-PORT opened on the current package's loading script (in
> the install directory). During a dry run, or when only non-shared data
> has to be installed, do nothing.
Excellent! I just upgraded scsh-yp to use this new facility.
BTW, I'm not sure what --dry-run original intention was, seems like a
good option for debugging the installation procedure, so this little
patch to install-lib.scm simply prints load.scm to stdout if --dry-run
is given:
Index: install-lib.scm
===================================================================
RCS file: /cvsroot/scsh/scsh-packages/scheme/install-lib/install-lib.scm,v
retrieving revision 1.8
diff -u -r1.8 install-lib.scm
--- install-lib.scm 8 Feb 2004 09:50:14 -0000 1.8
+++ install-lib.scm 9 Feb 2004 09:57:52 -0000
@@ -415,15 +415,19 @@
;;
;; Evaluate THUNK with CURRENT-OUTPUT-PORT opened on the current
-;; package's loading script (in the install directory). During a dry
-;; run, or when only non-shared data has to be installed, do nothing.
+;; package's loading script (in the install directory). If called
+;; during a dry run, set CURRENT-OUTPUT-PORT to stdout.
(define (with-output-to-load-script* thunk)
- (let ((dir (get-directory 'base #t)))
- (create-directory&parents dir)
- (if (not (or (get-option-value 'dry-run)
- (get-option-value 'non-shared-only)))
- (with-output-to-file (absolute-file-name "load.scm" dir)
- thunk))))
+ (let ((dir (get-directory 'base #t))
+ (do-it (lambda (port)
+ (with-current-output-port port (thunk)))))
+ (and (not (get-option-value 'non-shared-only))
+ (cond
+ ((get-option-value 'dry-run)
+ (do-it (current-output-port)))
+ (else
+ (create-directory&parents dir)
+ (call-with-output-file (absolute-file-name "load.scm" dir)
do-it))))))
;; Sugar for with-output-to-load-script*.
(define-syntax with-output-to-load-script
And here's another little patch that makes install-directory-contents
ignore CVS directories:
Index: install-lib.scm
===================================================================
RCS file: /cvsroot/scsh/scsh-packages/scheme/install-lib/install-lib.scm,v
retrieving revision 1.8
diff -u -r1.8 install-lib.scm
--- install-lib.scm 8 Feb 2004 09:50:14 -0000 1.8
+++ install-lib.scm 9 Feb 2004 09:57:52 -0000
@@ -477,10 +481,13 @@
location
target-rel-dir
perms-fn)
- (for-each (lambda (thing)
- (install-thing% layout thing location target-rel-dir perms-fn))
- (map (lambda (f) (absolute-file-name f name))
- (directory-files name #t))))
+ (let* ((absolute (lambda (fn) (absolute-file-name fn name)))
+ (files (map absolute (directory-files name #t))))
+ (for-each (lambda (thing)
+ (install-thing% layout thing location target-rel-dir perms-fn))
+ (filter (lambda (fn)
+ (not (and (file-directory? fn) (string-suffix? "CVS"
fn))))
+ files))))
(define (install-thing name-or-pair location . rest)
(if (active-location? location)
> I've also ripped the code to load libtool's ".la" files from the
> scsh-yp and put it as data into a variable called
> tmpl-libtool-la-reader. If you make further modifications to this
> code, please do them directly there, in install-lib.
Ok, thanks.
-Eric
--
"Excuse me --- Di Du Du Duuuuh Di Dii --- Huh Weeeheeee" (Albert King)
pgpKAbDoxX8km.pgp
Description: PGP signature
|