source: project/release/4/readline/trunk/readline.setup @ 34923

Last change on this file since 34923 was 34923, checked in by Alexej Magura, 3 years ago

releasing version 4.1.3: heres to a build that hopefully isnt broken

File size: 3.3 KB
Line 
1;;;; readline.setup -*- Scheme -*-
2;;;; vim:ft=scheme:
3
4(use files)
5
6;; get environment CFLAGS bindings
7
8
9(define old-files
10  (append
11    (filter (lambda (y) (or (string-suffix? ".o" y)
12                            (string-suffix? ".out" y)))
13            (find-files "./"))
14    '("readline-test" "readline.c")))
15
16;; cleans up from previous builds
17(do ((lst old-files (cdr lst)))
18  ((null? lst))
19  (display (string-append "rm -f " (car lst)))
20  (newline)
21  (delete-file* (car lst)))
22
23(define-syntax compile/error
24  ;; Required for Chicken < 4.6, which calls (reset) on (compile) error.
25  (syntax-rules ()
26    ((compile/error args ...)
27     (let ((old-reset (reset-handler)))
28       (parameterize ((reset-handler
29                       (lambda ()
30                         (parameterize ((reset-handler old-reset))
31                           (error 'compile "compilation error")))))
32         (compile args ...))))))
33
34(define rl-extra-cflags
35  (string-append
36   "-C -D_GNU_SOURCE=1"
37   " -C -std=gnu99"
38  (let ((cflags (get-environment-variable "CFLAGS")))
39    (if (and cflags (not (string=? cflags "")))
40        (string-append " -C "
41                       (string-join
42                        (string-split cflags " ")
43                        " -C "))
44        ""))
45  ))
46
47(define-syntax check-rllibs
48  (syntax-rules ()
49    ((_ libs)
50     (and (print "trying: " libs)
51          (handle-exceptions e #f
52            (compile/error readline-test.scm ,rl-extra-cflags ,libs))
53          libs))))
54
55;(define curry (lambda (f . c) (lambda x (apply f (append c x)))))
56
57#;(define rl-extralib
58  (list-ref (list-index (lambda (y) (equal? #t y))
59              (list (check-rllibs " -lreadline")
60                    (check-rllibs " -lreadinline -lhistory")
61                    (check-rllibs " -lreadline -lncurses")
62                    (check-rllibs " -lreadline -lcurses")
63                    (check-rllibs " -lreadline -ltermcap")
64                    (check-rllibs " -lreadline -lhistory -lncurses")
65                    (check-rllibs " -lreadline -lhistory -lcurses")
66                    (check-rllibs " -lreadline -lhistory -ltermcap")
67                    (check-rllibs " -lreadline -lhistory -lncurses")
68                    (check-rllibs " -lreadline -lhistory -lcurses")
69                    (check-rllibs " -lreadline -lhistory -ltermcap")))))
70
71(define rl-extralib
72  (or
73    (check-rllibs "-lreadline -lhistory -ltermcap")
74    (check-rllibs "-lreadline -lhistory -lcurses")
75    (check-rllibs "-lreadline -lhistory -lncurses")
76    (check-rllibs "-lreadline -ltermcap")
77    (check-rllibs "-lreadline -lcurses")
78    (check-rllibs "-lreadline -lhistory")
79    (check-rllibs "-lreadline -lncurses")
80    (check-rllibs "-lreadline")
81    (error
82      (string-append
83        "This extension requires GNU readline.  GNU readline "
84        "may be found at ftp://ftp.gnu.org/pub/gnu/readline\n"
85        "For more information, please consult "
86        "http://wiki.call-cc.org/egg/readline#installation-problems\n"))))
87
88(compile -s -O2 readline.scm ,rl-extra-cflags ,rl-extralib)
89
90(compile -c -O2 -d0 -j readline readline.scm
91         -o readline-static.o -unit readline ,rl-extra-cflags ,rl-extralib)
92
93(compile -s -O2 -d0 readline.import.scm)
94
95(install-extension
96    'readline
97    '("readline.so" "readline.import.so" "readline-static.o")
98    `((version           "4.1.3")
99      (static            "readline-static.o")
100      (static-options    ,rl-extralib)))
Note: See TracBrowser for help on using the repository browser.