Document CLISP's ffi option.
[clon.git] / com.dvlsoft.clon.asd
blob51d4b1ee49411108db5f842e756d7fd6bb6bed1b
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.
23 ;;; Commentary:
25 ;; Contents management by FCM version 0.1.
28 ;;; Code:
30 (in-package :cl-user)
32 (eval-when (:load-toplevel :execute)
33   #+sbcl  (require :sb-grovel)
34   #+clisp (if (featurep :ffi)
35               (handler-case (asdf:load-system :cffi-grovel)
36                 (asdf:missing-component ()
37                   (format *error-output* "~
38 *********************************************************************
39 * WARNING: ASDF component CFFI-GROVEL not found.                    *
40 * Clon will be loaded without support for terminal autodetection.   *
41 * See section A.1 of the user manual for more information.          *
42 *********************************************************************")))
43             (format *error-output* "~
44 *********************************************************************
45 * WARNING: CLISP is compiled without ffi support.                   *
46 * Clon will be loaded without support for terminal autodetection.   *
47 * See section A.1 of the user manual for more information.          *
48 *********************************************************************")))
50 (defpackage :com.dvlsoft.clon.asdf
51   (:documentation "The Command-Line Options Nuker package for ASDF.")
52   (:use :cl)
53   (:export :define-constant
54            :+release-major-level+
55            :+release-minor-level+
56            :+release-status+ :+release-status-level+
57            :+release-name+
58            :version))
61 (in-package :com.dvlsoft.clon.asdf)
63 (defmacro define-constant (name value &optional doc)
64   `(defconstant ,name (if (boundp ',name) (symbol-value ',name) ,value)
65      ,@(when doc (list doc))))
67 (defconstant +release-major-level+ 1
68   "The major level of this release.")
70 (defconstant +release-minor-level+ 0
71   "The minor level of this release.")
73 (defconstant +release-status+ :beta
74   "The status of this release.")
76 (defconstant +release-status-level+ 20
77   "The status level of this release.")
79 (define-constant +release-name+ "Michael Brecker"
80   "The name of this release.")
82 ;; #### TODO: I'm sure the format strings can be improved
83 (defun %version (type major minor status level name)
84   (ecase type
85     (:number
86      (apply #'+
87        (* major 10000)
88        (* minor 100)
89        (when (eq status :patchlevel)
90          (list level))))
91     (:short
92      (format nil "~S.~S~
93                  ~[~
94                    a~*~S~;~
95                    b~*~S~;~
96                    rc~*~S~;~
97                    ~:[.~S~;~*~]~
98                  ~]"
99        major
100        minor
101        (ecase status
102          (:alpha 0)
103          (:beta 1)
104          (:rc 2)
105          (:patchlevel 3))
106        (zerop level)
107        level))
108     (:long
109      (format nil "~S.~S ~
110                  ~[~
111                    alpha ~*~S ~;~
112                    beta ~*~S ~;~
113                    release candidate ~*~S ~;~
114                    ~:[patchlevel ~S ~;~*~]~
115                  ~]~
116                  ~S"
117        major
118        minor
119        (ecase status
120          (:alpha 0)
121          (:beta 1)
122          (:rc 2)
123          (:patchlevel 3))
124        (zerop level)
125        level
126        name))))
128 (defun version (&optional (type :number))
129   "Return the current version of Clon.
130 TYPE can be one of :number, :short or :long.
132 A version number is computed as major*10000 + minor*100 + patchlevel, leaving
133 two digits for each level. Alpha, beta and rc status are ignored in version
134 numbers.
136 A short version is something like 1.3{a,b,rc}4, or 1.3.4 for patchlevel.
137 Alpha, beta or rc levels start at 1. Patchlevels start at 0 but are ignored
138 in the output, so that 1.3.0 appears as just 1.3.
140 A long version is something like
141 1.3 {alpha,beta,release candidate,patchlevel} 4 \"Michael Brecker\". As for
142 the short version, a patchlevel of 0 is ignored in the output."
143   (%version type +release-major-level+ +release-minor-level+
144             +release-status+ +release-status-level+
145             +release-name+))
147 (asdf:defsystem :com.dvlsoft.clon
148   :description "The Command-Line Options Nuker."
149   :long-description "Clon is a library for command-line option management.
150 It is intended to ease the creation of standalone Common Lisp applications by
151 providing a powerful and uniform command-line option interface.
152 The most important features of Clon are:
153 - [from the programmer's point of view] Centralized command-line options
154   specification and management, including automatic generation of help
155   strings, conversion from command-line / environment strings to
156   application-level option values, global or on-demand option retrieval, and
157   extensibility (the programmer can define his own option types).
158 - [from the end-user's point of view] Uniform command-line option syntax
159   across Clonified applications, including customization of the help strings
160   layout (with optional ISO6429 coloring on terminals that support it),
161   possibly abbreviated option calls and short/long syntax."
162   :author "Didier Verna <didier@lrde.epita.fr>"
163   :maintainer "Didier Verna <didier@lrde.epita.fr>"
164   :license "BSD"
165   :version #.(version :long)
166   :depends-on (#+sbcl             :sb-posix
167                #+(and clisp ffi cffi) :cffi)
168   :components ((:file "package")
169                #+sbcl
170                (:module "sbcl"
171                 :depends-on ("package")
172                 :serial t
173                 :components ((sb-grovel:grovel-constants-file
174                               "constants" :package :com.dvlsoft.clon)
175                              (:file "util")))
177                #+(and clisp cffi)
178                (:module "clisp"
179                 :depends-on ("package")
180                 :serial t
181                 :components ((cffi-grovel:grovel-file "constants")
182                              (:file "util")))
183                (module "src"
184                        :depends-on (#+sbcl "sbcl"
185                                     #+(and clisp cffi) "clisp"
186                                            "package")
187                        :components ((:file "util")
188                                     (:file "item" :depends-on ("util"))
189                                     (:file "text" :depends-on ("item"))
190                                     (:module "options"
191                                      :depends-on ("text")
192                                      :components ((:file "option")
193                                                   (:file "flag"
194                                                    :depends-on ("option"))
195                                                   (:file "valued"
196                                                    :depends-on ("option"))
197                                                   (:file "negatable"
198                                                    :depends-on ("valued"))
199                                                   (:file "switch-base"
200                                                    :depends-on ("negatable"))
201                                                   (:file "switch"
202                                                    :depends-on
203                                                          ("switch-base"))
204                                                   (:file "stropt"
205                                                    :depends-on ("valued"))
206                                                   (:file "lispobj"
207                                                    :depends-on ("valued"))
208                                                   (:file "path"
209                                                    :depends-on ("valued"))
210                                                   (:file "enum-base")
211                                                   (:file "enum"
212                                                    :depends-on
213                                                          ("valued"
214                                                           "enum-base"))
215                                                   (:file
216                                                    "xswitch"
217                                                    :depends-on ("valued"
218                                                                 "switch-base"
219                                                                 "enum-base"))))
220                                     (:file "container" :depends-on ("options"))
221                                     (:file "group" :depends-on ("container"))
222                                     (:module "retrieval"
223                                      :depends-on ("options")
224                                      :components ((:file "cmdline")
225                                                   (:file "environ")))
226                                     (:file "synopsis" :depends-on ("group"))
227                                     (:module "output"
228                                      :depends-on ("synopsis" "retrieval")
229                                      :components ((:file "face")
230                                                   (:file "sheet"
231                                                    :depends-on ("face"))))
232                                     (:file "context"
233                                      :depends-on ("output"))))))
236 ;;; com.dvlsoft.clon.asd ends here