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