Changeset 12896 in project for chicken


Ignore:
Timestamp:
12/28/08 01:30:31 (11 years ago)
Author:
felix winkelmann
Message:

changed semantics of -static-extension option; added it to core compiler

Location:
chicken/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/batch-driver.scm

    r12813 r12896  
    287287    (when (and outfile filename (string=? outfile filename))
    288288      (quit "source- and output-filename are the same") )
    289     (set! uses-units
    290       (map string->symbol
    291            (append-map
    292             (cut string-split <> ",")
    293             (collect-options 'uses))))
     289    (set! uses-units (map string->symbol (collect-options 'uses)))
    294290    (when (memq 'keep-shadowed-macros options)
    295291      (set! undefine-shadowed-macros #f) )
     
    316312    (set! initforms (append initforms postponed-initforms))
    317313
    318     ;; Handle `-extension' options:
    319     (when (memq 'extension options)
    320       (set! initforms
    321         (append
    322          initforms
    323          `((define-extension
    324              ,(string->symbol
    325                (cond (outfile (pathname-file outfile))
    326                      (filename (pathname-file filename))
    327                      (else (quit "no filename available for `-extension' option")) ) ) ) ) ) ) )
    328 
    329     ;; Append required extensions to initforms:
    330     (let ()
    331       (define (ids opt)
    332         (lset-difference
    333          eq?
    334          (map string->symbol
    335               (append-map
    336                (cut string-split <> ",")
    337                (collect-options opt)))
    338          uses-units))
     314    (let ((se (map string->symbol (collect-options 'static-extension))))
     315      ;; Append required extensions to initforms:
    339316      (set! initforms
    340317        (append
    341318         initforms
    342319         (map (lambda (r) `(##core#require-extension (,r) #t))
    343               (ids 'require-extension))))
     320              (append se (collect-options 'require-extension)))))
     321
     322      ;; add static-extensions as used units:
     323      (set! ##sys#explicit-library-modules
     324        (append ##sys#explicit-library-modules se)))
    344325
    345326    (when (memq 'compile-syntax options)
     
    637618                                (when (memq 't debugging-chicken) (##sys#display-times (##sys#stop-timer)))
    638619                                (compiler-cleanup-hook)
    639                                 (dribble "compilation finished.") ) ) ] ) ) ) ) ) ) ) ) ) ) )
     620                                (dribble "compilation finished.") ) ) ] ) ) ) ) ) ) ) ) ) )
  • chicken/trunk/c-platform.scm

    r12813 r12896  
    123123    disable-stack-overflow-checks disable-c-syntax-checks unsafe-libraries raw
    124124    emit-external-prototypes-first release local inline-global
    125     analyze-only dynamic extension) )
     125    analyze-only dynamic) )
    126126
    127127(define valid-compiler-options-with-argument
     
    129129          inline-limit profile-name disable-warning
    130130    prelude postlude prologue epilogue nursery extend feature
    131     emit-import-library emit-inline-file
     131    emit-import-library emit-inline-file static-extension
    132132    heap-growth heap-shrinkage heap-initial-size ffi-define ffi-include-path) )
    133133
  • chicken/trunk/csc.scm

    r12789 r12896  
    176176    -check-syntax -case-insensitive -benchmark-mode -shared -compile-syntax -no-lambda-info
    177177    -lambda-lift -dynamic -disable-stack-overflow-checks -local
    178     -emit-external-prototypes-first -inline -extension -release -static-extensions
     178    -emit-external-prototypes-first -inline -extension -release
    179179    -analyze-only -keep-shadowed-macros -inline-global) -ignore-repository)
    180180
     
    182182  '(-debug -output-file -heap-size -nursery -stack-size -compiler -unit -uses -keyword-style
    183183    -optimize-level -include-path -database-size -extend -prelude -postlude -prologue -epilogue
    184     -inline-limit -profile-name -disable-warning
    185     -require-static-extension -emit-inline-file
     184    -inline-limit -profile-name -disable-warning -emit-inline-file
    186185    -feature -debug-level -heap-growth -heap-shrinkage -heap-initial-size
    187     -emit-import-library))
     186    -emit-import-library -static-extension))
    188187
    189188(define-constant shortcuts
     
    207206
    208207(define short-options
    209   (string->list "PHhsfiENxubvwAOeWkctgG") )
     208  (string->list "PHhsfiENxubvwAOeWkctg") )
    210209
    211210
     
    306305(define static #f)
    307306(define static-libs #f)
    308 (define static-extensions #f)
     307(define static-extensions '())
    309308(define required-extensions '())
    310309(define gui #f)
     
    432431    -static-libs                link with static CHICKEN libraries
    433432    -static                     generate completely statically linked executable
    434     -static-extensions          link with static extensions (if available)
     433    -static-extension NAME      link extension NAME statically (if available)
    435434    -F<DIR>                     pass \"-F<DIR>\" to C compiler (add framework
    436435                                 header path on Mac OS X)
     
    565564                (set! translate-options (cons* "-feature" "chicken-compile-static" translate-options))
    566565                (set! static-libs #t) ]
    567                [(-static-extensions)
    568                 (set! static-extensions #t) ]
    569566               [(-cflags)
    570567                (set! inquiry-only #t)
     
    610607                (set! required-extensions (append required-extensions (list (car rest))))
    611608                (t-options "-require-extension" (car rest))
     609                (set! rest (cdr rest)) ]
     610               [(-static-extension)
     611                (check s rest)
     612                (set! static-extensions (append static-extensions (list (car rest))))
     613                (t-options "-static-extension" (car rest))
    612614                (set! rest (cdr rest)) ]
    613615               [(-windows |-W|)
     
    776778                              '("-to-stdout")
    777779                              `("-output-file" ,(cleanup-filename fc)) )
    778                           (if (or static static-libs static-extensions)
    779                               (map (lambda (e) (conc "-uses " e)) required-extensions)
    780                               '() )
    781780                          (map quote-option (append translate-options translation-optimization-options)) ) )
    782781                  " ") ) )
     
    856855(define (static-extension-info)
    857856  (let ((rpath (repository-path)))
    858     (if (and rpath (or static static-libs static-extensions))
    859         (let loop ((exts required-extensions) (libs '()) (opts '()))
     857    (if (and rpath (pair? static-extensions))
     858        (let loop ((exts static-extensions) (libs '()) (opts '()))
    860859          (if (null? exts)
    861860              (values (reverse libs) (reverse opts))
     
    909908
    910909(define (quote-option x)
    911   (if (any (lambda (c)
    912              (or (char-whitespace? c) (memq c +hairy-chars+)) )
    913            (string->list x) )
     910  (if (string-any (lambda (c)
     911                    (or (char-whitespace? c) (memq c +hairy-chars+)) )
     912                  x)
    914913      (cleanup x)
    915914      x) )
  • chicken/trunk/manual/Using the compiler

    r12797 r12896  
    102102; -extend FILENAME : Loads a Scheme source file or compiled Scheme program (on systems that support it) before compilation commences. This feature can be used to extend the compiler.  This option may be given multiple times. The file is also searched in the current include path and in the extension-repository.
    103103
    104 ; -extension : Mostly equivalent to {{-prelude '(define-extension <NAME>)'}}, where {{<NAME>}} is the basename of the currently compiled file. Note that if you want to compile a file as a normal (dynamically loadable) extension library, you should also pass the {{-shared}} option.
    105 
    106104; -feature SYMBOL : Registers {{SYMBOL}} to be a valid feature identifier for {{cond-expand}}. Multiple symbols may be given, if comma-separated.
    107105
     
    171169
    172170; -require-extension NAME : Loads the extension {{NAME}} before the compilation process commences. This is identical to adding {{(require-extension NAME)}} at the start of the compiled program. If {{-uses NAME}} is also given on the command line, then any occurrences of {{-require-extension NAME}} are replaced with {{(declare (uses NAME))}}. Multiple names may be given and should be separated by {{,}}.
     171
     172; -static-extension NAME : similar to {{-require-extension NAME}}, but links extension statically (also applies for an explicit {{(require-extension NAME)}}).
    173173
    174174; -compile-syntax : Makes macros also available at run-time. By default macros are not available at run-time.
  • chicken/trunk/support.scm

    r12819 r12896  
    13031303    -dynamic                    compile as dynamically loadable code
    13041304    -require-extension NAME     require and import extension NAME
     1305    -static-extension NAME      import extension NAME but link statically (if available)
    13051306    -extension                  compile as extension (dynamic or static)
    13061307    -ignore-repository          do not refer to repository for extensions
Note: See TracChangeset for help on using the changeset viewer.