Changeset 12053 in project
- Timestamp:
- 10/01/08 01:23:34 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chicken/trunk/scripts/chicken-bundle.scm
r12052 r12053 21 21 (define (sl\ p lst) (string-intersperse (map ->string lst) p)) 22 22 23 24 (define *default-cc-options* "-Os -fomit-frame-pointer -g -DHAVE_GRP_H") 25 23 26 (define opts 24 27 `( … … 26 29 (s+ "build eggs in directory DIR")) 27 30 ,(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* ")")) 29 32 ,(args:make-option (chicken-dir) (required: "DIR") 30 33 (s+ "directory where Chicken C files can be found")) … … 49 52 ;; suitable for embedding into help text. 50 53 (define (usage) 51 (print "Usage: " (car (argv)) " options... [list of eggs to be bu ilt] ")54 (print "Usage: " (car (argv)) " options... [list of eggs to be bundled] ") 52 55 (newline) 53 56 (print "The following options are recognized: ") … … 93 96 (if (file-exists? path) (loop (random 10000)) path)))) 94 97 95 (define ( chxpflst)98 (define (make-paths-c+h flst) 96 99 (concatenate (map (lambda (p) (append (map (lambda (f) (s+ (second p) dirsep f)) (third p)) 97 100 (map (lambda (f) (s+ (second p) dirsep f)) (fourth p)))) 98 101 flst))) 99 102 100 (define ( cxpflst)103 (define (make-paths-c flst) 101 104 (concatenate (map (lambda (p) (map (lambda (f) (s+ (second p) dirsep f)) (fourth p))) flst))) 102 105 103 106 (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))) 104 109 (message "Creating Makefile" ) 105 110 (call-with-output-file "Makefile" … … 108 113 ## This file was generated by chicken-bundle 109 114 ## 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) 111 116 #(list->string (list #\tab)) $(CC) #(identity cc-options) -o $@ $^ 112 117 EOF 113 118 )) 114 (display text out))))) 119 (display text out)))))) 115 120 116 121 (define (build-bundle egg-name suffix repo-dir build-dir chicken-dir … … 120 125 (bundle-name (s+ egg-name suffix ".tar.gz") )) 121 126 (run (rm -rf ,(s+ build-dir dirsep "*"))) 122 (run (rm -rf ,(s+ repo-dir dirsep "*")))127 (run (rm -rf ,(s+ repo-dir dirsep "*"))) 123 128 (run (chicken-setup ,(if *verbose* "-v" "") -d -k -build-prefix ,build-dir -repository ,repo-dir ,egg-name)) 124 129 (let ((flst … … 152 157 (for-each (lambda (p) (run (mv ,(first p) ,(s+ bundle-dir dirsep (second p))))) flst) 153 158 (let* ((bundle-dir-name (pathname-strip-directory bundle-dir)) 154 (m kbp(lambda (x) (s+ bundle-dir-name dirsep x)))155 (m kbpu(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")))) 156 161 (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)))) 159 165 (run (mv ,(s+ build-dir dirsep bundle-name) ,cwd)) 160 166 (change-directory cwd) … … 167 173 (list))) 168 174 (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*)) 170 176 (opt_chicken-dir (or (alist-ref 'chicken-dir options) ".")) 171 177 (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.