source: project/release/3/pyffi/trunk/pyffi.setup @ 11623

Last change on this file since 11623 was 11623, checked in by Ivan Raikov, 11 years ago

Some fixed in utf8 support; version set to 2.10

File size: 1.7 KB
Line 
1;; -*- Hen -*-
2
3(define pyflags
4  (case (software-version)
5    ((macosx)   (map cons (list "-I/System/Library/Frameworks/Python.framework/Headers") (list "-framework Python")))
6    ((linux)    (map cons
7                     (list "-I/usr/include/python2.5" "-I/usr/include/python2.4" "-I/usr/include/python2.3")
8                     (list "-lpython2.5" "-lpython2.4" "-lpython2.3")))
9    ((windows)  (map cons
10                     (list "" "" "")
11                     (list "-lpython25" "-lpython24" "-lpython23")))
12    (else       (list (cons "-I/usr/include/python" "-lpython")))))
13
14(define (python-try-compile header cppflags ldflags)
15  (and (try-compile
16        (string-append "#include " header "\n"
17                       "int main() { Py_Initialize(); return 0; }\n")
18        ldflags: ldflags
19        cflags: cppflags)
20       (cons cppflags ldflags) ))
21
22(define-macro (python-test rest)
23  `(define cpp+ld-options
24     (or (any identity (map (lambda (p) (python-try-compile "<Python.h>" (car p) (cdr p))) ,rest))
25         (error "unable to find Python library"))))
26
27(python-test pyflags)
28
29(define c-options  (car cpp+ld-options))
30(define ld-options (cdr cpp+ld-options))
31
32(define has-exports? (string>=? (chicken-version) "2.310"))
33
34(define (dynld-name fn)         
35  (make-pathname #f fn ##sys#load-dynamic-extension))   
36
37(compile -d2 -s -o ,(dynld-name "pyffi-support")
38         ,@(if has-exports? '(-check-imports -emit-exports pyffi-support.exports) '())
39         pyffi-support.scm -L "\"" ,ld-options "\"" -C "\"" ,c-options "\"" -X easyffi)
40
41(run (csi -qbs pyffi-eggdoc.scm > pyffi.html))
42
43(install-extension
44 'pyffi
45 `(,(dynld-name "pyffi-support") "pyffi.scm" 
46   ,@(if has-exports? '("pyffi-support.exports") (list)) )
47 `((version 2.10)
48   (syntax)
49   (require-at-runtime pyffi-support)
50   (documentation "pyffi.html")))
Note: See TracBrowser for help on using the repository browser.