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

Last change on this file since 11020 was 11020, checked in by Ivan Raikov, 12 years ago

Added support for the instance type.

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