source: project/release/4/gts/tags/1.4/gts.setup @ 26215

Last change on this file since 26215 was 26215, checked in by Ivan Raikov, 9 years ago

gts release 1.4

File size: 2.1 KB
Line 
1;; -*- Hen -*-
2
3(define (dynld-name fn)         
4  (make-pathname #f fn ##sys#load-dynamic-extension))   
5
6(define (gts-try-compile header ldflags cppflags)
7  (and (try-compile
8        (string-append header "\n"
9                        "int main(int argc, char **argv) { gts_finalize(); return 0; }\n")
10        ldflags: ldflags
11        cflags:  cppflags
12        )
13       (cons ldflags cppflags)))
14
15(define-syntax gts-test
16  (syntax-rules ()
17    ((_ (flags ...))
18     (condition-case (gts-try-compile flags ...)
19                     (t ()    #f)))))
20
21(define (ipipe:execute lam cmd)
22  (define (smooth lst)
23    (let ((slst (map ->string lst)))
24      (string-intersperse (cons (car slst) (cdr slst)) " ")))
25  ((lambda (cmd) (with-input-from-pipe (sprintf "~a" cmd) lam))
26   (smooth cmd)))
27
28(define-syntax ipipe
29  (syntax-rules ()
30    ((_ lam exp)
31     (ipipe:execute lam `exp ))))
32
33(define gts-pkg-cflags (ipipe read-line (pkg-config --cflags gts)))
34(define gts-pkg-libs   (ipipe read-line (pkg-config --libs gts)))
35(define gts-cflags (ipipe read-line (gts-config --cflags)))
36(define gts-libs   (ipipe read-line (gts-config --libs)))
37
38(define ld+cpp-options
39  (or (and (not (eof-object? gts-pkg-cflags))
40           (not (eof-object? gts-pkg-libs))
41           (gts-test ("#include <gts.h>" gts-pkg-libs gts-pkg-cflags)))
42      (and (not (eof-object? gts-cflags))
43           (not (eof-object? gts-libs))
44           (gts-test ("#include <gts.h>" gts-libs gts-cflags)))
45      (gts-test ("#include <gts.h>" gts-libs ""))
46      (gts-test ("#include <gts.h>" gts-libs "-I/usr/include/gts"))
47      (gts-test ("#include <gts.h>" gts-libs "-I/usr/lib/gts/include"))
48      (gts-test ("#include <gts.h>" (string-append "-L/opt/local/lib " gts-libs) "-I/opt/local/include"))
49      (error "unable to figure out location of GTS library")))
50
51(compile -O -d2 -I. -s gts.scm  -j gts
52         -L "\"" ,(car ld+cpp-options) "\""
53         -C "\"" ,(cdr ld+cpp-options) "\"")
54(compile -O2 -d0 -s gts.import.scm)
55
56(install-extension
57
58  ; Name of your extension:
59  'gts
60
61  ; Files to install for your extension:
62  `(,(dynld-name "gts") ,(dynld-name "gts.import") )
63   
64  ; Assoc list with properties for your extension:
65  `((version 1.4)
66    ))
67
Note: See TracBrowser for help on using the repository browser.