1 ;;; com.dvlsoft.clon.asd --- ASDF system definition
3 ;; Copyright (C) 2010, 2011, 2012 Didier Verna.
5 ;; Author: Didier Verna <didier@lrde.epita.fr>
6 ;; Maintainer: Didier Verna <didier@lrde.epita.fr>
8 ;; This file is part of clon.
10 ;; Permission to use, copy, modify, and distribute this software for any
11 ;; purpose with or without fee is hereby granted, provided that the above
12 ;; copyright notice and this permission notice appear in all copies.
14 ;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 ;; Contents management by FCM version 0.1.
37 (defpackage :com.dvlsoft.clon.asdf
38 (:documentation "The Command-Line Options Nuker package for ASDF.")
41 (in-package :com.dvlsoft.clon.asdf)
44 ;; --------------------
45 ;; Very early utilities
46 ;; --------------------
50 (defvar cl-user::com.dvlsoft.clon.configuration nil
51 "The Clon configuration settings.
52 This variable contains a property list of configuration options.
54 - :swank-eval-in-emacs (Boolean)
55 - :restricted (Boolean)
58 See section A.1 of the user manual for more information.")
60 (defun configuration (key)
61 "Return KEY's value in the current Clon configuration."
62 (getf cl-user::com.dvlsoft.clon.configuration key))
64 (defun set-configuration (key value)
65 "Set KEY to VALUE in the current Clon configuration."
66 (setf (getf cl-user::com.dvlsoft.clon.configuration key) value))
68 (defsetf configuration set-configuration)
73 (defmacro define-constant (name value &optional doc)
74 `(defconstant ,name (if (boundp ',name) (symbol-value ',name) ,value)
75 ,@(when doc (list doc))))
77 (defconstant +release-major-level+ 1
78 "The major level of this release.")
80 (defconstant +release-minor-level+ 0
81 "The minor level of this release.")
83 (defconstant +release-status+ :beta
84 "The status of this release.")
86 (defconstant +release-status-level+ 23
87 "The status level of this release.")
89 (define-constant +release-name+ "Michael Brecker"
90 "The name of this release.")
92 ;; #### TODO: I'm sure the format strings can be improved
93 (defun %version (type major minor status level name)
99 (when (eq status :patchlevel)
123 release candidate ~*~S ~;~
124 ~:[patchlevel ~S ~;~*~]~
138 (defun version (&optional (type :number))
139 "Return the current version of Clon.
140 TYPE can be one of :number, :short or :long.
142 A version number is computed as major*10000 + minor*100 + patchlevel, leaving
143 two digits for each level. Alpha, beta and rc status are ignored in version
146 A short version is something like 1.3{a,b,rc}4, or 1.3.4 for patchlevel.
147 Alpha, beta or rc levels start at 1. Patchlevels start at 0 but are ignored
148 in the output, so that 1.3.0 appears as just 1.3.
150 A long version is something like
151 1.3 {alpha,beta,release candidate,patchlevel} 4 \"Michael Brecker\". As for
152 the short version, a patchlevel of 0 is ignored in the output."
153 (%version type +release-major-level+ +release-minor-level+
154 +release-status+ +release-status-level+
158 ;; -------------------
159 ;; System requirements
160 ;; -------------------
162 (defun restrict-because (reason)
163 "Put Clon in restricted mode because of REASON."
164 (format *error-output* "~
165 *******************************************************************
167 * Clon will be loaded without support for terminal autodetection. *
168 * See sections 2 and A.1 of the user manual for more information. *
169 *******************************************************************"
171 (setf (configuration :restricted) t))
173 (unless (configuration :restricted)
177 (unless (funcall (intern "GETENV" :sb-posix) "CC")
178 (restrict-because "the CC environment variable is not set"))
179 (handler-case (asdf:load-system :sb-grovel)
181 (restrict-because "unable to load module SB-GROVEL"))))
183 (cond ((member :ffi *features*)
184 (handler-case (asdf:load-system :cffi-grovel)
187 "unable to load ASDF component CFFI-GROVEL"))))
190 "CLISP is compiled without FFI support")))
191 #+(or allegro lispworks)
192 (handler-case (asdf:load-system :cffi-grovel)
195 "unable to load ASDF component CFFI-GROVEL")))
197 (restrict-because "ABCL is in use"))
199 (if (configuration :restricted)
200 (setq *features* (delete :com.dvlsoft.clon.termio *features*))
201 (pushnew :com.dvlsoft.clon.termio *features*))
208 (asdf:defsystem :com.dvlsoft.clon
209 :description "The Command-Line Options Nuker."
210 :long-description "Clon is a library for command-line option management.
211 It is intended to ease the creation of standalone Common Lisp applications by
212 providing a powerful and uniform command-line option interface.
213 The most important features of Clon are:
214 - [from the programmer's point of view] Centralized command-line options
215 specification and management, including automatic generation of help
216 strings, conversion from command-line / environment strings to
217 application-level option values, global or on-demand option retrieval, and
218 extensibility (the programmer can define his own option types).
219 - [from the end-user's point of view] Uniform command-line option syntax
220 across Clonified applications, including customization of the help strings
221 layout (with optional ISO6429 coloring on terminals that support it),
222 possibly abbreviated option calls and short/long syntax."
223 :author "Didier Verna <didier@lrde.epita.fr>"
224 :maintainer "Didier Verna <didier@lrde.epita.fr>"
226 :version #.(version :short)
227 :depends-on (#+sbcl :sb-posix
228 #+(and clisp com.dvlsoft.clon.termio) :cffi)
230 :components ((:file "package")
231 #+com.dvlsoft.clon.termio
237 :components ((sb-grovel:grovel-constants-file "constants"
238 :package :com.dvlsoft.clon)))
239 #+(or clisp allegro lispworks)
241 :components ((cffi-grovel:grovel-file "constants")))
244 :depends-on (#+com.dvlsoft.clon.termio "termio")
245 :components ((:file "util")
246 (:file "item" :depends-on ("util"))
247 (:file "text" :depends-on ("item"))
250 :components ((:file "option")
252 :depends-on ("option"))
254 :depends-on ("option"))
256 :depends-on ("valued"))
258 :depends-on ("negatable"))
263 :depends-on ("valued"))
265 :depends-on ("valued"))
267 :depends-on ("valued"))
275 :depends-on ("valued"
278 (:file "container" :depends-on ("options"))
279 (:file "group" :depends-on ("container"))
281 :depends-on ("options")
282 :components ((:file "cmdline")
284 (:file "synopsis" :depends-on ("group"))
286 :depends-on ("synopsis" "retrieval")
287 :components ((:file "face")
289 :depends-on ("face"))))
291 :depends-on ("output"))))))
294 ;;; com.dvlsoft.clon.asd ends here