Changeset 7497


Ignore:
Timestamp:
Oct 22, 2007, 11:49:44 PM (14 years ago)
Author:
gz
Message:

Got rid of ccl:cocoa-ide;Clozure CL.app and moved its contents to
ccl:cocoa-ide;ide-contents;

Modified the IDE loading scheme to create bundles by copying from
cocoa-ide;ide-contents; as follows:

(require'cocoa) creates 'ccl:temp bundle.app', a fake bundle that is only
there to enable using cocoa immediately after loading it. This is not
something that users are expected to do in normal circumstances, but is just
there for us to bootstrap. (Users who use cocoa will ordinary use the IDE,
which will have cocoa preloaded).

(require'cocoa-application) creates 'ccl:Clozure CL.app', the real IDE bundle
that is ready to use and/or redistribute. By default it includes the
interface headers for the target architecture, so it can be moved out of the
ccl directory if so desired. I also made it load easygui unconditionally.

Location:
trunk/ccl/cocoa-ide
Files:
1 deleted
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/ccl/cocoa-ide/cocoa-application.lisp

    r7460 r7497  
    2121  (use-interface-dir :cocoa))
    2222
     23;;; loading cocoa.lisp creates an IDE bundle in *cocoa-application-path*,
     24;;; perhaps copying headers as per *cocoa-application-copy-headers-p*
     25(defvar *cocoa-application-path* "ccl:Clozure CL.app;")
     26(defvar *cocoa-application-copy-headers-p* t)
    2327(require "COCOA")
    24 ;;; Alternately, one could
    25 ;;; (require "COCOA-INSPECTOR").  I haven't tried this yet, but think
    26 ;;; that it -should- work.
    27 
    28 
    29 
    3028
    3129(defclass cocoa-application (application)
     
    5048    (#_ _exit -1))
    5149  (setq *standalone-cocoa-ide* t)
     50  ;; TODO: to avoid confusion, should now reset *cocoa-application-path* to
     51  ;; actual bundle path where started up.
    5252  (start-cocoa-application))
    5353
    5454
    55 ;;; Wait until we're sure that the Cocoa event loop has started.
    56 (wait-on-semaphore *cocoa-application-finished-launching*)
     55  ;;; The saved image will be an instance of COCOA-APPLICATION (mostly
     56  ;;; so that it'll ignore its argument list.)  When it starts up, it'll
     57  ;;; run the Cocoa event loop in the cocoa event process.
     58  ;;; If you use an init file ("home:ccl-init"), it'll be loaded
     59  ;;; in an environment in which *STANDARD-INPUT* always generates EOF
     60  ;;; and where output and error streams are directed to the OSX console
     61  ;;; (see below).  If that causes problems, you may want to suppress
     62  ;;; the loading of your init file (via an :INIT-FILE nil arg to
     63  ;;; the call to SAVE-APPLICATION, below.)
    5764
     65(defun build-ide (bundle-path)
     66  (setq bundle-path (ensure-directory-pathname bundle-path))
    5867
    59 ;;; If easygui is a feature, make it so.
    60 #+easygui (require :easygui)
     68  ;; The bundle is expected to exists, we'll just add the executable into it.
     69  (assert (probe-file bundle-path))
    6170
    62 ;;; The saved image will be an instance of COCOA-APPLICATION (mostly
    63 ;;; so that it'll ignore its argument list.)  When it starts up, it'll
    64 ;;; run the Cocoa event loop in the cocoa event process.
    65 ;;; If you use an init file ("home:openmcl-init"), it'll be loaded
    66 ;;; in an environment in which *STANDARD-INPUT* always generates EOF
    67 ;;; and where output and error streams are directed to the OSX console
    68 ;;; (see below).  If that causes problems, you may want to suppress
    69 ;;; the loading of your init file (via an :INIT-FILE nil arg to
    70 ;;; the call to SAVE-APPLICATION, below.)
     71  ;; Wait until we're sure that the Cocoa event loop has started.
     72  (wait-on-semaphore *cocoa-application-finished-launching*)
    7173
    72 ;;; As things are distributed, the file "dppccl" in the application
    73 ;;; bundle is just a placeholder.  LaunchServices may have already
    74 ;;; decided that the application isn't really executable and may
    75 ;;; have cached that fact; touching the bundle directory
    76 ;;; here is an attempt to force LaunchServices to discard that
    77 ;;; cached information.
     74  (require :easygui)
    7875
    79 (touch *fake-cfbundle-path*)
     76  (maybe-map-objc-classes t)
     77  (let* ((missing ()))
     78    (do-interface-dirs (d)
     79      (cdb-enumerate-keys
     80       (db-objc-classes d)
     81       (lambda (name)
     82         (let* ((class (lookup-objc-class name nil))) (unless (objc-class-id  class) (push name missing))))))
     83    (when missing
     84      (break "ObjC classes ~{~&~a~} are declared but not defined.")))
    8085
    81 (maybe-map-objc-classes t)
     86  (touch bundle-path)
    8287
    83 (let* ((missing ()))
    84   (do-interface-dirs (d)
    85     (cdb-enumerate-keys
    86      (db-objc-classes d)
    87      (lambda (name)
    88        (let* ((class (lookup-objc-class name nil))) (unless (objc-class-id  class) (push name missing))))))
    89   (when missing
    90     (break "ObjC classes ~{~&~a~} are declared but not defined.")))
    91 
    92 
    93 (save-application
    94  (make-pathname
    95   :directory (pathname-directory (translate-logical-pathname (merge-pathnames ";Contents;MacOS;" *fake-cfbundle-path*)))
    96   :name (standard-kernel-name))
    97  :prepend-kernel t
    98  :application-class 'cocoa-application)
     88  (let ((image-file (make-pathname :name (standard-kernel-name) :type nil :version nil
     89                                   :defaults (merge-pathnames ";Contents;MacOS;" bundle-path))))
     90    (ensure-directories-exist image-file)
     91    (save-application image-file
     92                      :prepend-kernel t
     93                      :application-class 'cocoa-application)))
    9994
    10095;;; If things go wrong, you might see some debugging information via
     
    10297;;; and error output for the initial lisp process will be directed
    10398;;; there.
    104 
     99(build-ide *cocoa-application-path*)
  • trunk/ccl/cocoa-ide/cocoa.lisp

    r7493 r7497  
    22
    33;;; We need to be able to point the CoreFoundation and Cocoa libraries
    4 ;;; at some bundle very early in the process.  If you want to use some
    5 ;;; other bundle path, you may need to change the call to FAKE-CFBUNDLE-PATH
    6 ;;; below.
     4;;; at some bundle very early in the process, so do that before anything
     5;;; else.
     6;;;
     7;;; If you're using this file to load something other than the IDE,
     8;;; you might want to change create-ide-bundle...
     9
     10(defvar *cocoa-application-path* "ccl:temp bundle.app;")
     11(defvar *cocoa-application-copy-headers-p* nil)
     12
     13(defun create-ide-bundle (bundle-path &key (source "ccl:cocoa-ide;ide-contents;")
     14                                           (source-ignore '(".svn" "cvs" ".cvsignore"))
     15                                           (copy-headers *cocoa-application-copy-headers-p*)
     16                                           (if-exists :overwrite))
     17  ;; TODO: Right now if the bundle exists, we leave alone any files that we don't replace.
     18  ;; I'd like :if-exists :supersede mean to remove such files, for clean builds, but
     19  ;; recursive-copy-directory doesn't support :if-exists :supersede yet...
     20  (flet ((subdir (dir sub)
     21           (ensure-directory-pathname (make-pathname :name sub :defaults dir)))
     22         (ignore-test (p)
     23           (flet ((backup-p (name)
     24                    (and (stringp name)
     25                         (let ((len (length name)))
     26                           (and (> len 0)
     27                                (or (eql (aref name (1- len)) #\~)
     28                                    (eql (aref name 0) #\#)))))))
     29             (not (or (member (car (last (pathname-directory p))) source-ignore :test #'equalp)
     30                      (backup-p (pathname-name p))
     31                      (backup-p (pathname-type p))
     32                      (member (pathname-name p) source-ignore :test #'equalp))))))
     33    (let* ((source-dir (ensure-directory-pathname source))
     34           (target-dir (ensure-directory-pathname bundle-path))
     35           (contents-dir (subdir target-dir "Contents")))
     36      (recursive-copy-directory source-dir contents-dir :if-exists if-exists :test #'ignore-test)
     37      (when copy-headers
     38        (let* ((subdirs (cdb-subdirectory-path))
     39               (ccl-headers (make-pathname :host "ccl" :directory `(:absolute ,@subdirs)))
     40               (dest-headers (make-pathname :host (pathname-host contents-dir)
     41                                            :directory (append (pathname-directory contents-dir)
     42                                                               (cons "Resources" subdirs)))))
     43          (recursive-copy-directory ccl-headers dest-headers :if-exists if-exists :test #'ignore-test)))
     44      ;; Is this necessary?
     45      (let* ((image-name (standard-kernel-name))
     46             (ccl-image (make-pathname :name image-name :host "ccl"))
     47             (dest-image (make-pathname :name image-name
     48                                        :defaults (subdir contents-dir "MacOS"))))
     49        (ensure-directories-exist dest-image)
     50        (copy-file ccl-image dest-image :if-exists :supersede :preserve-attributes t))
     51      (touch target-dir))))
    752
    853#+darwin-target
    954(progn
    1055  (require "FAKE-CFBUNDLE-PATH")
    11   (defparameter *fake-cfbundle-path*
    12     #+clozure-common-lisp "ccl:cocoa-ide;Clozure CL.app;"
    13     #-clozure-common-lisp "ccl:cocoa-ide;OpenMCL.app;")
    14   (fake-cfbundle-path *fake-cfbundle-path* "ccl:cocoa-ide;Info.plist-proto" "com.clozure"))
     56  (create-ide-bundle *cocoa-application-path*)
     57  (fake-cfbundle-path *cocoa-application-path* "ccl:cocoa-ide;Info.plist-proto" "com.clozure"))
    1558
    1659
Note: See TracChangeset for help on using the changeset viewer.