License date update
[clfswm.git] / load.lisp
blobc8c4cf02df95281fdf9d1a416d885ad5acaed5d8
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: System loading functions
6 ;;; --------------------------------------------------------------------------
7 ;;;
8 ;;; (C) 2005-2015 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 (defparameter *build-original-doc* t
46 "Set to t to use original configuration or to nil to use your own configuration
47 from $XDG_CONFIG_HOME/clfswm/clfswmrc")
50 ;;; Comment or uncomment the lines above to fit your needs.
51 (pushnew :clfswm-compile *features*)
52 ;;(pushnew :clfswm-run *features*)
53 (pushnew :clfswm-build-image *features*)
54 ;;(pushnew :clfswm-build-doc *features*)
56 (defparameter *binary-name* "clfswm")
58 ;;;;; Uncomment the line below if you want to see all ignored X errors
59 ;;(pushnew :xlib-debug *features*)
61 ;;;;; Uncomment the line below if you want to see all event debug messages
62 ;;(pushnew :event-debug *features*)
66 #+:CMU (setf ext:*gc-verbose* nil)
68 #+:SBCL
69 (require :sb-posix)
71 (load (compile-file "src/tools.lisp"))
73 (defun load-info (formatter &rest args)
74 (format t "~& ==> ~A~%" (apply #'format nil formatter args))
75 (force-output))
77 (defun interactive-ask (formatter &rest args)
78 (when *interactive*
79 (y-or-n-p (apply #'format nil formatter args))))
81 ;;;------------------
82 ;;; XLib part 1
83 ;;;------------------
84 #+(or :CMU :ECL)
85 (require :clx)
88 ;;;------------------
89 ;;; ASDF part
90 ;;;------------------
91 ;;;; Loading ASDF
92 (load-info "Requiring ASDF")
94 #+(or :SBCL :CMUCL :CCL :ECL)
95 (require :asdf)
97 #-ASDF
98 (when (probe-file "asdf.lisp")
99 (load "asdf.lisp"))
101 #-:ASDF
102 (let ((asdf-url "http://common-lisp.net/project/asdf/asdf.lisp"))
103 (when (interactive-ask "ASDF not found. Do you want to download it from ~A ?" asdf-url)
104 (tools:do-shell-output "wget ~A" asdf-url)
105 (load "asdf.lisp")))
107 (format t "ASDF version: ~A~%" (asdf:asdf-version))
109 ;;;------------------
110 ;;; XLib part 2
111 ;;;------------------
112 (load-info "Requiring CLX")
114 ;;; Loading clisp dynamic module. This part needs clisp >= 2.50
115 ;;#+(AND CLISP (not CLX))
116 ;;(when (fboundp 'require)
117 ;; (require "clx.lisp"))
118 #-CLX
119 (progn
120 (when (probe-file "clx/clx.asd")
121 (load "clx/clx.asd")
122 (asdf:oos 'asdf:load-op :clx)))
124 #-CLX
125 (progn
126 (let ((clx-url "git://github.com/sharplispers/clx.git"))
127 (when (interactive-ask "CLX not found. Do you want to download it from ~A ?" clx-url)
128 (unless (probe-file "clx/clx.asd")
129 (tools:do-shell-output "git clone ~A" clx-url))
130 (load "clx/clx.asd")
131 (asdf:oos 'asdf:load-op :clx))))
133 ;;;------------------
134 ;;; CLFSWM loading
135 ;;;------------------
136 #+:clfswm-compile
137 (progn
138 (load-info "Compiling CLFSWM")
139 (load "clfswm.asd")
140 (asdf:oos 'asdf:load-op :clfswm))
143 ;;;-------------------------
144 ;;; Starting clfswm
145 ;;;-------------------------
146 #+(or :clfswm-run :clfswm-build-doc :clfswm-build-image)
147 (in-package :clfswm)
149 #+(or :clfswm-run :clfswm-build-doc)
150 (progn
151 (cl-user::load-info "Running CLFSWM")
152 (ignore-errors
153 (main :read-conf-file-p (not cl-user::*build-original-doc*))))
156 ;;;-------------------------
157 ;;; Building documentation
158 ;;;-------------------------
159 #+:clfswm-build-doc
160 (progn
161 (cl-user::load-info "Building documentation")
162 (produce-all-docs))
164 ;;;-----------------------
165 ;;; Building image part
166 ;;;-----------------------
168 ;;; Uncomment the line below to set the contrib directory in the image
169 ;; (setf *contrib-dir* "/usr/local/lib/clfswm/")
171 #+:clfswm-build-image
172 (progn
173 (cl-user::load-info "Building CLFSWM executable image")
174 (build-lisp-image "clfswm"))