chiark / gitweb /
b72edc1d11f3a448807e811de2d298a487fb73c8
[clg] / clg.system
1 ;;; -*- Mode: lisp -*-
2
3 (defpackage "CLG-SYSTEM"
4   (:use "COMMON-LISP" "EXTENSIONS" "ALIEN")
5   (:export "*GTK-LIBRARY-PATH*"))
6
7 (in-package "CLG-SYSTEM")
8
9 ;; We used to do this, but I think it's better if everybody puts such
10 ;; definitions in his/her own Lisp startup files so that clg.system
11 ;; can be used without local modifications.
12 ;(setf
13 ; (logical-pathname-translations "clg")
14 ; '(("**;*.*.*" "/home/espen/src/clg/**/*.*.*")))
15
16 ;; Uncomment and edit the next line if pkg-config needs to search for
17 ;; .pc files in directories other than the default (/usr/lib/pkgconfig)
18 ;(push '(:PKG_CONFIG_PATH . "/opt/gnome/lib/pkgconfig") ext:*environment-list*)
19
20 (load "clg:tools;config")
21 (load "clg:tools;sharedlib")
22
23 (defvar *gtk-library-path* (pkg-variable "gtk+-2.0" "libdir"))
24 (defvar *cmucl-include-path* (ext:unix-namestring "target:lisp"))
25
26 ;; A hack to get around a bug in gdk's init code
27 (defvar argc (make-alien c-call:int))
28 (defvar progname (make-alien c-call:char))
29 (defvar argv0 (make-alien (* c-call:char)))
30 (defvar argv (make-alien (* (* c-call:char))))
31 (setf (deref argc) 1)
32 (setf (deref progname) 0)
33 (setf (deref argv0) progname)
34 (setf (deref argv) argv0)
35
36 ;; Without this, MAKE uses "CLG:glib;.err" as a namestring, which fails.
37 ;; TODO: Find and fix the bug, then remove this.
38 (setq mk::*cmu-errors-to-file* nil)
39
40 (eval
41  `(mk:defsystem clg
42     :initially-do
43     (progn
44       (pkg-exists-p "glib-2.0" :atleast-version "1.3.9")
45       (pkg-exists-p "pango" :atleast-version "0.20")
46       (pkg-exists-p "gtk+-2.0" :atleast-version "1.3.9"))
47     :source-pathname "clg:"
48     :binary-pathname "clg:"
49     :components
50     ((:module tools
51       :components ("autoexport"))
52      (:file "pcl" :source-pathname "glib;" :binary-pathname "glib;")
53      (:module glib
54       :initially-do
55       (progn
56         (load-shared-library "libglib-1.3.so")
57         (load-shared-library "libgobject-1.3.so" :init "g_type_init"))
58       :components
59       ((:file "callback"
60         :language :c
61         :source-extension "c"
62         :binary-extension "o"
63         :compiler-options
64         (:cflags ,(pkg-cflags "glib-2.0")
65                  :optimize 2
66                  :definitions (#+cmu CMUCL)
67                  :include-paths (,*cmucl-include-path*)))
68        (:file "glib-package")
69        (:file "gutils" :depends-on ("glib-package"))
70        (:file "gforeign" :depends-on ("gutils"))
71        (:file "glib" :depends-on ("gforeign"))
72        (:file "proxy" :depends-on ("glib"))
73        (:file "gtype" :depends-on ("proxy"))
74        (:file "gboxed" :depends-on ("gtype"))
75        (:file "genums" :depends-on ("gtype"))
76        (:file "gparam" :depends-on ("genums"))
77        (:file "gobject" :depends-on ("gparam"))
78        (:file "gcallback" :depends-on ("gtype" "gparam" "gobject" "callback"))
79        (:file "glib-export"
80         :depends-on
81         ("gutils" "glib" "proxy" "gboxed" "gtype" "gparam" "gcallback"
82          "genums" "gobject")))
83       :depends-on (tools "pcl"))
84      (:file "gdkglue"
85       :source-pathname "gdk;"
86       :binary-pathname "gdk;"
87       :initially-do
88       (progn
89         (load-shared-library "libgdk_pixbuf-1.3.so")
90         (load-shared-library "libgdk-x11-1.3.so"
91          :init "gdk_init"
92          :prototype '(function
93                       c-call:void (* c-call:int) (* (* (* char))))
94          :initargs (list argc argv)))
95       :language :c
96       :source-extension "c"
97       :binary-extension "o"
98       :compiler-options (:cflags ,(pkg-cflags "gtk+-2.0")
99                          :optimize 2))
100      (:module gdk
101        :components
102        ((:file "gdk-package")
103         (:file "gdk-export" :depends-on ("gdkevents" "gdktypes" "gdk"))
104         (:file "gdktypes" :depends-on ("gdk-package"))
105         (:file "gdkevents" :depends-on ("gdktypes"))
106         (:file "gdk" :depends-on ("gdkevents")))
107        :depends-on (glib "gdkglue"))
108      (:module pango
109       :initially-do (load-shared-library "libpango.so")
110        :components
111        ((:file "pango-package")
112         (:file "pango" :depends-on ("pango-package"))
113         (:file "pango-export" :depends-on ("pango")))
114        :depends-on (glib))
115      (:file "gtkglue"
116       :source-pathname "gtk;"
117       :binary-pathname "gtk;"
118       :initially-do
119       (progn
120         (load-shared-library
121          "libgtk-x11-1.3.so"
122          :init "gtk_init"
123          :prototype '(function
124                       c-call:void
125                       system-area-pointer
126                       system-area-pointer)
127          :initargs (list (system:int-sap 0) (system:int-sap 0))))
128       :language :c
129       :source-extension "c"
130       :binary-extension "o"
131       :compiler-options (:cflags ,(pkg-cflags "gtk+-2.0")
132                          :optimize 2
133                          :definitions (#+cmu CMUCL)
134                          :include-paths (,*cmucl-include-path*)))
135      (:module gtk
136       :components
137       ((:file "gtk-package")
138        (:file "gtk-export" :depends-on ("gtktypes" "gtk"))
139        (:file "gtkobject" :depends-on ("gtk-package"))
140        (:file "gtktypes" :depends-on ("gtkobject"))
141        (:file "gtkwidget" :depends-on ("gtktypes"))
142        (:file "gtkcontainer" :depends-on ("gtktypes"))
143        (:file "gtk" :depends-on ("gtktypes"))
144        (:file "gtkutils" :depends-on ("gtk")))
145       :depends-on (glib gdk pango "gtkglue")))))
146
147
148