source: project/release/4/ploticus/trunk/ploticus.setup @ 28504

Last change on this file since 28504 was 28504, checked in by Ivan Raikov, 7 years ago

ploticus: extended setup script with ability to use custom install dir for libploticus

File size: 1.7 KB
Line 
1;; -*- Hen -*-
2
3(define (dynld-name fn)         
4  (make-pathname #f fn ##sys#load-dynamic-extension))   
5
6(define (ploticus-try-compile header ldflags cppflags)
7  (and (try-compile
8        (string-append "#include <stdio.h>\n"
9                       header "\n"
10                       "int main(int argc, char **argv) { ploticus_end(); return 0; }\n")
11        ldflags: ldflags
12        cflags: cppflags)
13       (cons ldflags cppflags)))
14
15(define-syntax ploticus-test
16  (syntax-rules ()
17    ((_ (flags ...))
18     (condition-case (ploticus-try-compile flags ...)
19                     (t ()    #f)))))
20
21(define ploticus-dir (get-environment-variable "PLOTICUS_DIR"))
22
23(define ld+cpp-options
24  (or
25   (and ploticus-dir (ploticus-test ("#include <libploticus.h>"
26                                     (sprintf "-lploticus -L~S" (make-pathname ploticus-dir "lib") )
27                                     (sprintf "-I~S -L~S"
28                                              (make-pathname ploticus-dir "include")
29                                              (make-pathname ploticus-dir "lib") ))
30                                    ))
31   (ploticus-test ("#include <libploticus.h>" "-lploticus" ""))
32   (ploticus-test ("#include <libploticus.h>" "-lploticus" "-I/usr/include/ploticus"))
33   (ploticus-test ("#include <libploticus.h>" "-lploticus" "-I/opt/local/include"))
34   (error "unable to figure out location of libploticus")))
35
36
37(compile -O -d2 -I. -s ploticus.scm  -j ploticus
38         -L "\"" ,(car ld+cpp-options) "\""
39         -C "\"" ,(cdr ld+cpp-options) "\"")
40(compile -O -d2 -s ploticus.import.scm)
41
42(install-extension
43
44  ; Name of your extension:
45  'ploticus
46
47  ; Files to install for your extension:
48  `(,(dynld-name "ploticus") ,(dynld-name "ploticus.import")  )
49
50  ; Assoc list with properties for your extension:
51  `((version 1.3)))
52
Note: See TracBrowser for help on using the repository browser.