Changeset 26010 in project


Ignore:
Timestamp:
02/29/12 13:58:42 (9 years ago)
Author:
felix winkelmann
Message:

bugfixes, added trace helper

Location:
release/4/system/branches/rewrite
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/system/branches/rewrite/system-module.scm

    r26009 r26010  
    3030                file
    3131                scheme-file
    32                 scheme-module
    3332                compiled-scheme-file
    34                 compiled-scheme-module
    3533                load-system
    3634                compile-system
  • release/4/system/branches/rewrite/system.scm

    r26009 r26010  
    3131  (fprintf port "#<system ~a>" (system-name sys)))
    3232
     33(define (listify x)
     34  (if (list? x) x (list x)))
     35
    3336
    3437;;; targets
     
    6669
    6770(define-class <file-component> (<component>)
    68   ((path accessor: file-component-path)))
     71  ((path accessor: file-component-path)
     72   (byproducts accessor: file-byproducts initform: '())))
    6973
    7074(define-method (print-object (f <component>) port)
     
    96100   (load-time accessor: load-time initform: #f)
    97101   (output-path accessor: scheme-file-output-path)
     102   (modules accessor: scheme-file-modules initform: '())
    98103   (temporary-output-path accessor: scheme-file-temporary-output-path)
    99104   (options accessor: options initform: '())))
     
    116121(define ((file-maker class #!optional ext) name #!key (depends '()) path options
    117122         output-path modules)
    118   (define (listify x)
    119     (if (list? x) x (list x)))
    120123  (define (optarg name x)
    121124    (if x
     
    129132   (append
    130133    (optarg 'output-path output-path)
    131     (optarg 'options output-path)
    132     (optarg 'modules output-path))))
     134    (optarg 'options options)
     135    (optarg 'modules modules))))
    133136
    134137(define file (file-maker <file-component>)) 
    135138(define scheme-file (file-maker <scheme-file> "scm"))
    136 (define scheme-module (file-maker <scheme-file> "scm"))
    137139(define compiled-scheme-file (file-maker <compiled-scheme-file> "scm"))
    138 (define compiled-scheme-module (file-maker <compiled-scheme-file> "scm"))
    139140
    140141(define-record changed reason)
     
    212213    (when (and (load-time c)
    213214               (not (file-can-be-reloaded? out)))
    214       (let ((cf (compile-file
    215                  (file-component-path c)
    216                  output-file: out
    217                  load: #f
    218                  options: (append (options c) (options t))
    219                  verbose: (verbose t))))
     215      (let* ((opts0 (append (options c) (options t)))
     216             (mods (scheme-file-modules c))
     217             (opts (if (pair? mods)
     218                       (cons "-J" opts0)
     219                       opts0))
     220             (path (file-component-path c))
     221             (dir (pathname-directory out))
     222             (cf (compile-file
     223                  path
     224                  output-file: out
     225                  load: #f
     226                  options: opts
     227                  verbose: (verbose t))))
    220228        (set! (scheme-file-temporary-output-path c) cf)
    221         (unless cf (error "compilation failed" c))))))
     229        (unless cf (error "compilation failed" c))
     230        (for-each
     231         (lambda (m)
     232           (let ((m (->string m)))
     233             (unless (compile-file
     234                      (make-pathname dir m "import.scm")
     235                      output-file: (make-pathname dir m "import.so")
     236                      options: opts0
     237                      load: #f
     238                      verbose (verbose t))
     239               (error "compilation of import library `~a' failed" m c))))
     240         mods)))))
    222241
    223242(define-generic (clean-component component target))
    224243
    225244(define-method (clean-component (c <component>) (t <target>)) #f)
     245
     246(define (delete* fn)
     247  (when (file-exists? n)
     248    (dribble t "deleting ~a" dn)
     249    (delete-file* dn)))
    226250
    227251(define-method (clean-component (c <scheme-file>) (t <target>))
    228252  (when (load-time c)
    229     (let ((path (scheme-file-output-path c)))
    230       (dribble t "deleting ~a" path)
    231       (delete-file* path))))
     253    (let* ((path (scheme-file-output-path c))
     254           (dir (pathname-directory path)))
     255      (delete* path)))
     256  (for-each
     257   (lambda (m)
     258     (let ((il (make-pathname dir (->string m) "import.scm"))
     259           (ilc (make-pathname dir (->string m) "import.so")))
     260       (delete* il)
     261       (delete* ilc)))
     262   (scheme-file-modules c)))
    232263
    233264
Note: See TracChangeset for help on using the changeset viewer.