Minor object check fix
[clfswm.git] / load.lisp
blob900601fe2fd6e0c389db0b7a5f6df358adb12e71
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: System loading functions
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2005 Philippe Brochard <hocwp@free.fr>
9 ;;;
10 ;;; This program is free software; you can redistribute it and/or modify
11 ;;; it under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or
13 ;;; (at your option) any later version.
14 ;;;
15 ;;; This program is distributed in the hope that it will be useful,
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with this program; if not, write to the Free Software
22 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 ;;;
24 ;;; --------------------------------------------------------------------------
25 ;;;
26 ;;; Edit this file (or its copy) and load it with your lisp implementation.
27 ;;; If you want, it can download ASDF and CLX for you. You'll need wget and
28 ;;; git program.
29 ;;;
30 ;;; Here are command line reference:
31 ;;;
32 ;;; clisp -E iso-8859-1 load.lisp
33 ;;; sbcl --load load.lisp
34 ;;; cmucl -load load.lisp
35 ;;; ccl -l load.lisp
36 ;;; ecl -load load.lisp
37 ;;;
38 ;;; --------------------------------------------------------------------------
40 ;;;------------------
41 ;;; Customization part
42 ;;;------------------
43 (defparameter *interactive* t)
45 ;;; Comment or uncomment the lines above to fit your needs.
46 (pushnew :clfswm-compile *features*)
47 ;;(pushnew :clfswm-run *features*)
48 (pushnew :clfswm-build-image *features*)
49 ;;(pushnew :clfswm-install *features*)
50 ;;(pushnew :clfswm-build-doc *features*)
52 (defparameter *binary-name* "clfswm")
54 (defparameter *install-prefix* "/usr/local")
56 (defun with-prefix (&rest place)
57 (apply #'concatenate 'string *install-prefix* place))
59 (defparameter *install-bin* (with-prefix "/bin/"))
60 (defparameter *install-contrib* (with-prefix "/lib/clfswm/"))
61 (defparameter *install-doc* (with-prefix "/share/doc/clfswm/"))
62 (defparameter *install-man* (with-prefix "/share/man/man1/"))
65 ;;;;; Uncomment the line below if you want to see all ignored X errors
66 ;;(pushnew :xlib-debug *features*)
68 ;;;;; Uncomment the line below if you want to see all event debug messages
69 ;;(pushnew :event-debug *features*)
73 #+:CMU (setf ext:*gc-verbose* nil)
75 #+:SBCL
76 (require :sb-posix)
78 (load (compile-file "src/tools.lisp"))
80 (defun load-info (formatter &rest args)
81 (format t "~& ==> ~A~%" (apply #'format nil formatter args))
82 (force-output))
84 (defun interactive-ask (formatter &rest args)
85 (when *interactive*
86 (y-or-n-p (apply #'format nil formatter args))))
88 ;;;------------------
89 ;;; XLib part 1
90 ;;;------------------
91 #+(or :CMU :ECL)
92 (require :clx)
95 ;;;------------------
96 ;;; ASDF part
97 ;;;------------------
98 ;;;; Loading ASDF
99 (load-info "Requiring ASDF")
101 #+(or :SBCL :CMUCL :CCL :ECL)
102 (require :asdf)
104 #-ASDF
105 (when (probe-file "asdf.lisp")
106 (load "asdf.lisp"))
108 #-:ASDF
109 (let ((asdf-url "http://common-lisp.net/project/asdf/asdf.lisp"))
110 (when (interactive-ask "ASDF not found. Do you want to download it from ~A ?" asdf-url)
111 (tools:do-shell-output "wget ~A" asdf-url)
112 (load "asdf.lisp")))
114 (format t "ASDF version: ~A~%" (asdf:asdf-version))
116 ;;;------------------
117 ;;; XLib part 2
118 ;;;------------------
119 (load-info "Requiring CLX")
121 ;;; Loading clisp dynamic module. This part needs clisp >= 2.50
122 ;;#+(AND CLISP (not CLX))
123 ;;(when (fboundp 'require)
124 ;; (require "clx.lisp"))
125 #-CLX
126 (progn
127 (when (probe-file "clx/clx.asd")
128 (load "clx/clx.asd")
129 (asdf:oos 'asdf:load-op :clx)))
131 #-CLX
132 (progn
133 (let ((clx-url "git://github.com/sharplispers/clx.git"))
134 (when (interactive-ask "CLX not found. Do you want to download it from ~A ?" clx-url)
135 (unless (probe-file "clx/clx.asd")
136 (tools:do-shell-output "git clone ~A" clx-url))
137 (load "clx/clx.asd")
138 (asdf:oos 'asdf:load-op :clx))))
140 ;;;------------------
141 ;;; CLFSWM loading
142 ;;;------------------
143 #+:clfswm-compile
144 (progn
145 (load-info "Compiling CLFSWM")
146 (asdf:oos 'asdf:load-op :clfswm))
149 ;;;-------------------------
150 ;;; Starting clfswm
151 ;;;-------------------------
152 #+(or :clfswm-run :clfswm-build-doc :clfswm-build-image)
153 (in-package :clfswm)
155 #+:clfswm-run
156 (progn
157 (cl-user::load-info "Running CLFSWM")
158 (ignore-errors
159 (main :read-conf-file-p t)))
162 ;;;-------------------------
163 ;;; Building documentation
164 ;;;-------------------------
165 #+:clfswm-build-doc
166 (progn
167 (cl-user::load-info "Building documentation")
168 (produce-all-docs))
170 ;;;-----------------------
171 ;;; Building image part
172 ;;;-----------------------
173 #+:clfswm-build-image
174 (progn
175 (cl-user::load-info "Building CLFSWM executable image")
176 (build-lisp-image "clfswm"))
178 ;;;-----------------------
179 ;;; Installation part
180 ;;;-----------------------
181 #+:clfswm-install
182 (in-package :cl-user)
184 #+:clfswm-install
185 (defun check-directory (dir)
186 (format t "Checking ~A~%" dir)
187 (ensure-directories-exist dir :verbose t))
190 #+:clfswm-install
191 (defun move-file (file where)
192 (format t "cp -Rf ~A ~A~%" file where)
193 (tools:do-shell-output "cp -Rf ~A ~A" file where))
197 #+:clfswm-install
198 (progn
199 (load-info "Installing CLFSWM")
200 (check-directory *install-prefix*)
201 (check-directory *install-bin*)
202 (check-directory *install-contrib*)
203 (check-directory *install-doc*)
204 (check-directory *install-man*)
205 (move-file *binary-name* *install-bin*)
206 (move-file "contrib/*" *install-contrib*)
207 (move-file "doc/*" *install-doc*)
208 (move-file "clfswm.1" *install-man*)
209 (format t "Please, adjust *contrib-dir* variable to ~A in your configuration file.~%" *install-contrib*)
210 (format t "Something like: (setf *contrib-dir* ~S)~%" *install-contrib*)
211 (tools:do-shell-output "rm -f ~A/clfswm.1.gz && gzip ~A/clfswm.1" *install-man* *install-man*)
212 (tools:uquit))