Skip to content

Commit

Permalink
Add the ability to build a standalone cl-ledger program with ASDF
Browse files Browse the repository at this point in the history
  • Loading branch information
glv2 committed Jan 11, 2018
1 parent c591683 commit c0331cc
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
cl-ledger
11 changes: 11 additions & 0 deletions Makefile
@@ -0,0 +1,11 @@
LISP ?= sbcl
asdf_system := cl-ledger

all:
${LISP} \
--load "${asdf_system}.asd" \
--eval "(asdf:make \"${asdf_system}\")" \
--eval "(uiop:quit)"

clean:
rm -f cl-ledger
12 changes: 10 additions & 2 deletions README.org
Expand Up @@ -380,8 +380,16 @@ a /series/ of the corresponding type. Example:

* Command line

You can use the [[https://github.com/roswell/roswell][Roswell]] script /cl-ledger.ros/ to use *CL-Ledger* from
the command line:
You can build a standalone /cl-ledger/ binary using the /Makefile/:

#+BEGIN_SRC shell
make LISP=sbcl
cl-ledger -f doc/sample.dat balance
#+END_SRC


You can also use the [[https://github.com/roswell/roswell][Roswell]] script /cl-ledger.ros/ to use *CL-Ledger*
from the command line:

#+BEGIN_SRC shell
cl-ledger.ros -f doc/sample.dat balance
Expand Down
2 changes: 1 addition & 1 deletion cambl
Submodule cambl updated 1 files
+284 −24 README.org
8 changes: 8 additions & 0 deletions cl-ledger.asd
Expand Up @@ -31,6 +31,11 @@

(cl:in-package :asdf-user)

;; Redefine 'program-op' to actvate compression
;; #+sbcl
;; (defmethod asdf:perform ((o asdf:program-op) (c asdf:system))
;; (uiop:dump-image (asdf:output-file o c) :executable t :compression t))

(defsystem :cl-ledger
:serial t
:description "Double-entry accounting system."
Expand All @@ -39,6 +44,9 @@
:license "BSD-3"
:version "4.0.0"
:depends-on (:local-time :periods-series :cambl :cl-ppcre)
:build-operation program-op
:build-pathname "cl-ledger"
:entry-point "ledger::main"
:components
((:module "core"
:components ((:file "packages")
Expand Down
16 changes: 16 additions & 0 deletions driver.lisp
Expand Up @@ -194,6 +194,22 @@ Options:
(t
(driver-help))))))

(defun command-line-args ()
(or #+abcl ext:*command-line-argument-list*
#+allegro (sys:command-line-arguments)
#+ccl (ccl::command-line-arguments)
#+clisp (ext:argv)
#+cmu extensions:*command-line-words*
#+ecl (loop for i from 0 below (si:argc) collect (si:argv i))
#+gcl si:*command-args*
#+lispworks sys:*line-arguments-list*
#+sbcl sb-ext:*posix-argv*
nil))

(defun main ()
(handler-case (apply #'process-command-line (rest (command-line-args)))
(t (err) (format *error-output* "~a~%" err))))

(provide 'driver)

;; driver.lisp ends here

0 comments on commit c0331cc

Please sign in to comment.