Changeset 12053 in project


Ignore:
Timestamp:
10/01/08 01:23:34 (12 years ago)
Author:
Ivan Raikov
Message:

Some procedures renamed to have meaningful names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/scripts/chicken-bundle.scm

    r12052 r12053  
    2121(define (sl\ p lst)   (string-intersperse (map ->string lst) p))
    2222
     23
     24(define *default-cc-options* "-Os -fomit-frame-pointer -g -DHAVE_GRP_H")
     25
    2326(define opts
    2427  `(
     
    2629                       (s+ "build eggs in directory DIR"))
    2730    ,(args:make-option (cc-options)       (required: "STRING")   
    28                        (s+ "C compiler options to be used in the makefile"))
     31                       (s+ "C compiler options to be used in the makefile (default is " *default-cc-options* ")"))
    2932    ,(args:make-option (chicken-dir)       (required: "DIR")   
    3033                       (s+ "directory where Chicken C files can be found"))
     
    4952;; suitable for embedding into help text.
    5053(define (usage)
    51   (print "Usage: " (car (argv)) " options... [list of eggs to be built] ")
     54  (print "Usage: " (car (argv)) " options... [list of eggs to be bundled] ")
    5255  (newline)
    5356  (print "The following options are recognized: ")
     
    9396      (if (file-exists? path) (loop (random 10000)) path))))
    9497
    95 (define (chxp flst)
     98(define (make-paths-c+h flst)
    9699  (concatenate (map (lambda (p) (append (map (lambda (f) (s+ (second p) dirsep f)) (third p))
    97100                                        (map (lambda (f) (s+ (second p) dirsep f)) (fourth p))))
    98101                    flst)))
    99102
    100 (define (cxp flst)
     103(define (make-paths-c flst)
    101104  (concatenate (map (lambda (p) (map (lambda (f) (s+ (second p) dirsep f)) (fourth p))) flst)))
    102105
    103106(define (build-makefile egg-name flst units cc-options)
     107  (let ((units-c-files (map (lambda (u) (s+ u ".c")) units))
     108        (libs-c-files  (make-paths-c flst)))
    104109  (message "Creating Makefile" )
    105110  (call-with-output-file "Makefile"
     
    108113## This file was generated by chicken-bundle
    109114##
    110 #(s+ egg-name ": ") runtime.c library.c #(sl\ " " (map (lambda (u) (s+ u ".c")) units)) #(sl\ " " (cxp flst))
     115#(s+ egg-name ": ") runtime.c library.c #(sl\ " " units-c-files) #(sl\ " " libs-c-files)
    111116#(list->string (list #\tab)) $(CC) #(identity cc-options) -o $@ $^
    112117EOF
    113118))
    114         (display text out)))))
     119        (display text out))))))
    115120
    116121(define (build-bundle egg-name suffix repo-dir build-dir chicken-dir
     
    120125        (bundle-name  (s+ egg-name suffix ".tar.gz") ))
    121126    (run (rm -rf ,(s+ build-dir dirsep "*")))
    122     (run (rm -rf ,(s+ repo-dir dirsep "*")))
     127    (run (rm -rf ,(s+ repo-dir  dirsep "*")))
    123128    (run (chicken-setup ,(if *verbose* "-v" "") -d -k -build-prefix ,build-dir -repository ,repo-dir ,egg-name))
    124129    (let ((flst
     
    152157      (for-each (lambda (p) (run (mv ,(first p) ,(s+ bundle-dir dirsep (second p))))) flst)
    153158      (let* ((bundle-dir-name (pathname-strip-directory bundle-dir))
    154              (mkbp  (lambda (x) (s+ bundle-dir-name dirsep x)))
    155              (mkbpu (lambda (x) (s+ bundle-dir-name dirsep x ".c"))))
     159             (make-bundle-path   (lambda (x) (s+ bundle-dir-name dirsep x)))
     160             (make-bundle-path+c (lambda (x) (s+ bundle-dir-name dirsep x ".c"))))
    156161        (run (tar zcf ,bundle-name
    157                   ,@(map mkbp `(Makefile chicken.h runtime.c library.c ))
    158                   ,@(map mkbp (chxp flst)) ,@(map mkbpu chicken-units))))
     162                  ,@(map make-bundle-path `(Makefile chicken.h runtime.c library.c ))
     163                  ,@(map make-bundle-path  (make-paths-c+h flst))
     164                  ,@(map make-bundle-path+c chicken-units))))
    159165      (run (mv ,(s+ build-dir dirsep bundle-name) ,cwd))
    160166      (change-directory cwd)
     
    167173                               (list)))
    168174        (opt_suffix        (or (alist-ref 'suffix options) "-bundle"))
    169         (opt_cc-options    (or (alist-ref 'cc-options options) "-g -O2"))
     175        (opt_cc-options    (or (alist-ref 'cc-options options) *default-cc-options*))
    170176        (opt_chicken-dir   (or (alist-ref 'chicken-dir options) "."))
    171177        (opt_chicken-units (or ((lambda (x) (and x (string-split x ","))) (alist-ref 'chicken-units options))
Note: See TracChangeset for help on using the changeset viewer.