source: project/release/4/box/trunk/box.setup @ 13546

Last change on this file since 13546 was 13546, checked in by Kon Lovett, 11 years ago

Test

File size: 3.9 KB
Line 
1;;;; box.setup
2(print "FOOBAR")
3;;; Release 4 Only!
4
5(required-chicken-version 4.0)
6
7;;; Extension Information
8
9(define *extension-name* 'box)
10(define *extension-version* (extension-version "2.0.0"))
11
12(let ([extnam (symbol->string *extension-name*)])
13  (unless (string=? extnam (extension-name))
14    (warning "expecting extension-name - got: " extnam (extension-name)) ) )
15
16;;; Support
17
18;; Filename Support
19
20(define (make-fn bn . en)
21  (apply make-pathname #f (->string bn) en) )
22
23(define (doc-fn bn)
24  (make-fn bn "html") )
25
26(define (source-fn bn)
27  (make-fn bn "scm") )
28
29(define (shared-fn bn)
30  (make-fn bn ##sys#load-dynamic-extension) )
31
32(define (static-fn bn)
33  (make-fn bn "o") )
34
35(define (import-fn bn)
36  (make-fn bn "import") )
37
38(define (source-import-fn bn)
39  (source-fn (import-fn bn)) )
40
41(define (shared-import-fn bn)
42  (shared-fn (import-fn bn)) )
43
44(define (inline-fn bn)
45  (make-fn bn "inline") )
46
47(define (program-fn bn)
48  (make-fn bn (and (eq? 'windows (software-type)) "exe")) )
49
50;; File Support
51
52(define (copy-file-to-directory fn dn)
53  (copy-file fn (make-pathname dn fn)) )
54
55(define (copy-to-repository fn)
56  (copy-file-to-directory fn (repository-path)) )
57
58(define (copy-to-home fn)
59  (copy-file-to-directory fn (chicken-home)) )
60
61;; SRFI-29 Bundle Support
62
63(define *srfi-29-bundles-path* (make-pathname (repository-path) "srfi-29-bundles"))
64
65(define (srfi-29-bundle-directory spec)
66  (let ([dir (append (list *srfi-29-bundles-path*) (take spec (sub1 (length spec))))]
67        [nam (last spec)])
68    (make-pathname dir nam) ) )
69
70(define (install-srfi-29-bundle nam . spec)
71  (unless (directory? *srfi-29-bundles-path*)
72          (error "missing SRFI-29 bundles directory; please install SRFI-29") )
73        (let ([bundle-dir (srfi-29-bundle-directory spec)])
74    (unless (directory? bundle-dir) (create-directory/parents bundle-dir)) )
75        (let* ([namstr (->string nam)]
76               [bundle-src (make-pathname (append '(".") spec) namstr)]
77               [bundle-dst (make-pathname (append (list *srfi-29-bundles-path*) spec) namstr)])
78                (copy-file bundle-src bundle-dst) ) )
79
80;; Compile Support
81
82(define (compile-static-extension nam . args)
83  (compile ,(source-fn nam)
84    -optimize-level 2 -debug-level 1
85    -c -unit ,nam -output-file ,(static-fn nam)
86    ,@args) )
87
88(define (compile-shared-extension nam . args)
89  (compile ,(source-fn nam)
90    -optimize-level 2 -debug-level 1
91    -shared -output-file ,(shared-fn nam)
92    -emit-import-library ,nam
93    ,@args)
94  (compile ,(source-import-fn nam)
95    -optimize-level 2 #;4 -debug-level 0
96    -shared -output-file ,(shared-import-fn nam)) )
97
98;; Install Support
99
100(define (install-shared-extension nam ver . args)
101  (install-extension nam
102   `(,(shared-fn nam) ,(shared-import-fn nam))
103   `((version ,ver)
104     (documentation ,(doc-fn nam))
105     ,@args)) )
106
107(define (install-static-extension nam ver . args)
108  (install-extension nam
109   `(,(static-fn nam))
110   `((version ,ver)
111     (static ,(static-fn nam))
112     (documentation ,(doc-fn nam))
113     ,@args)) )
114
115(define (install-shared+static-extension ver nam . args)
116  (install-extension nam
117   `(,(shared-fn nam) ,(shared-import-fn nam) ,(static-fn nam))
118   `((version ,ver)
119     (static ,(static-fn nam))
120     (documentation ,(doc-fn nam))
121     ,@args)) )
122
123;; Build Support
124
125(define (build-shared-extension nam ver #!key (compile '()) (install '()))
126  (apply compile-shared-extension nam compile)
127  (apply install-shared-extension nam ver install) )
128
129(define (build-static-extension nam ver #!key (compile '()) (install '()))
130  (apply compile-static-extension nam compile)
131  (apply install-static-extension nam ver install) )
132
133(define (build-shared+static-extension nam ver #!key (shared-compile '()) (static-compile '()) (install '()))
134  (apply compile-shared-extension nam shared-compile)
135  (apply compile-static-extension nam static-compile)
136  (apply install-shared+static-extension nam ver install) )
137
138;;;
139
140(build-shared-extension *extension-name* *extension-version*)
Note: See TracBrowser for help on using the repository browser.