;;;; -*- mode:lisp;coding:utf-8 -*-
;;;;**************************************************************************
;;;;FILE:               generate-client.lisp
;;;;LANGUAGE:           Common-Lisp
;;;;SYSTEM:             Common-Lisp
;;;;USER-INTERFACE:     NONE
;;;;DESCRIPTION
;;;;
;;;;    This scripts generates a ddns client executable.
;;;;
;;;;AUTHORS
;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
;;;;MODIFICATIONS
;;;;    2012-04-08 <PJB> Created.
;;;;BUGS
;;;;LEGAL
;;;;    AGPL3
;;;;
;;;;    Copyright Pascal J. Bourguignon 2012 - 2012
;;;;
;;;;    This program is free software: you can redistribute it and/or modify
;;;;    it under the terms of the GNU Affero General Public License as published by
;;;;    the Free Software Foundation, either version 3 of the License, or
;;;;    (at your option) any later version.
;;;;
;;;;    This program is distributed in the hope that it will be useful,
;;;;    but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;;    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;;    GNU Affero General Public License for more details.
;;;;
;;;;    You should have received a copy of the GNU Affero General Public License
;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
;;;;**************************************************************************

(in-package "COMMON-LISP-USER")
(setf *print-right-margin* 80
      *print-pretty* nil
      *print-case* :downcase)

(defun dirpath  (path) (make-pathname :name nil   :type nil   :version nil :defaults path))
(defun wildpath (path) (make-pathname :name :wild :type :wild :version nil :defaults path))
(defun fasldir  (system component)
  (first (asdf:output-files
          (make-instance 'asdf:compile-op)
          (asdf:find-component (asdf:find-system system) component))))

(setf *default-pathname-defaults* (dirpath *load-truename*))
(pushnew *default-pathname-defaults* asdf:*central-registry* :test 'equal)


(defparameter *program-name* "ddns-client")
(defparameter *program-system*  :com.informatimago.ddns.client)


(ql:quickload *program-system*)
;; (ql:quickload :com.informatimago.manifest)
;; (shadow 'date)
;; (use-package "COM.INFORMATIMAGO.MANIFEST")


;;;---------------------------------------------------------------------
;;; Let's generate the target.

(in-package "COMMON-LISP-USER")
(format t "~%Generating ~A~%" *program-name*)
(finish-output)

;; (write-manifest *program-name* *program-system*)


#+ccl (progn
        (ccl:save-application *program-name*
                              :toplevel-function (function com.informatimago.ddns.client:main)
                              :init-file nil
                              :error-handler :quit-quietly
                              ;; :application-class ccl:lisp-development-system
                              ;; :clear-clos-cache t
                              ;; :impurify t
                              ;; :native t
                              :purify nil
                              :mode #o755
                              :prepend-kernel t))

#+clisp (progn
          (ext:saveinitmem *program-name*
                           :quiet t
                           :verbose t
                           :norc t
                           :script t
                           :init-function (lambda ()
                                            (ext:exit (handler-case
                                                          (com.informatimago.ddns.client:main)
                                                        (error ()
                                                          1))))
                           :documentation "
DDNS Client usage:

    ddns-client -- $hostname

"
                           :start-package "COMMON-LISP-USER"
                           :keep-global-handlers nil
                           :executable t)
          (ext:quit))

;;;; THE END ;;;;
ViewGit