Changeset 12704


Ignore:
Timestamp:
Aug 27, 2009, 6:38:18 PM (10 years ago)
Author:
palter
Message:

Update build-application so that it can build
standalone applications on Windows. Add a :private-frameworks
argument to include private frameworks in the bundle. The code
which copies the frameworks knows how to structure them on
both Mac and Windows.

With these changes, I can build a standalone version of XMLisp.

Still need to figure out how to arrange for a console window to
popup when needed.

Location:
trunk/source/cocoa-ide
Files:
3 edited

Legend:

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

    r12676 r12704  
    1010;;;; ***********************************************************************
    1111
    12 (require "builder-utilities")
     12(require "BUILDER-UTILITIES")
    1313
    1414(in-package :ccl)
     
    4040                                        ; into the Info.plist on the "NSMainNibFile" key
    4141                          (application-class 'gui::cocoa-application)
     42                          (private-frameworks nil)
    4243                          (toplevel-function nil))
    4344
     
    5152         ;; create the bundle directory
    5253         (app-bundle (make-application-bundle :name name :project-path directory))
    53          (image-path (namestring (path (bundle-executable-path app-bundle)
    54                                        (bundle-executable-name name)))))
     54         (executable-dir (bundle-executable-path app-bundle))
     55         (image-path (namestring (path executable-dir (bundle-executable-name name)))))
    5556    ;; maybe copy IDE resources to the bundle
    5657    (when copy-ide-resources
     
    7273          (let ((dest (path app-bundle  "Contents" "Resources" "English.lproj/")))
    7374            (copy-nibfile n dest :if-exists :overwrite)))))
     75    ;; copy any private frameworks into the bundle
     76    (copy-private-frameworks private-frameworks app-bundle)
    7477    ;; save the application image into the bundle
    7578    (save-application image-path
  • trunk/source/cocoa-ide/builder-utilities.lisp

    r12703 r12704  
    332332    (ensure-directories-exist rsrc-dir)
    333333    app-bundle))
     334
     335;;; BUNDLE-FRAMEWORKS-PATH app-path
     336;;; ------------------------------------------------------------------------
     337;;; Returns the pathname of the frameworks directory given the pathname of
     338;;; an application bundle
     339(defun bundle-frameworks-path (app-path)
     340  (path app-path "Contents"
     341        #-windows-target (ensure-directory-pathname "Frameworks")
     342        #+windows-target (ensure-directory-pathname "Windows")))
     343
     344;;; FIND-FRAMEWORK-EXECUTABLE framework-path
     345;;; ------------------------------------------------------------------------
     346;;; Returns the pathname of the framework's executable file given the
     347;;; pathname of a framework
     348(defun find-framework-executable (framework-path)
     349  (let* ((raw-framework-name (car (last (pathname-directory framework-path))))
     350         (framework-name (subseq raw-framework-name 0 (- (length raw-framework-name)
     351                                                         #.(length ".framework"))))
     352         (executable-wildcard (path framework-path
     353                                    (concatenate 'string framework-name "*.dll")))
     354         (executables (directory executable-wildcard)))
     355    (when executables
     356      (truename (first executables)))))
     357
     358;;; COPY-PRIVATE-FRAMEWORKS private-frameworks app-path
     359;;; ------------------------------------------------------------------------
     360;;; Copy any private frameworks into the bundle taking into account the
     361;;; different directory structures used by Cocoa and Cocotron (Windows).
     362(defun copy-private-frameworks (private-frameworks app-path)
     363  (let ((private-frameworks #+windows-target (append *cocoa-application-frameworks*
     364                                                     private-frameworks)
     365                            #-windows-target private-frameworks)
     366        (frameworks-dir (bundle-frameworks-path app-path)))
     367    #+windows-target
     368    (dolist (lib *cocoa-application-libraries*)
     369      (copy-file lib frameworks-dir :preserve-attributes t :if-exists :supersede))
     370    (when private-frameworks
     371      (flet ((subdir (framework target)
     372               (ensure-directory-pathname
     373                (make-pathname :name (car (last (pathname-directory framework)))
     374                               :defaults target))))
     375        (dolist (framework private-frameworks)
     376          (recursive-copy-directory framework (subdir framework frameworks-dir)
     377                                    :if-exists :overwrite)
     378          #+windows-target
     379          (let ((executable (find-framework-executable framework)))
     380            (when executable
     381              (copy-file executable frameworks-dir
     382                         :preserve-attributes t :if-exists :supersede))))))))
  • trunk/source/cocoa-ide/cocoa.lisp

    r12460 r12704  
    1717(defvar *cocoa-ide-force-compile* nil)
    1818(defvar *cocoa-application-frameworks* #+cocotron '("ccl:cocotron;Foundation.framework;" "ccl:cocotron;AppKit.framework;") #-cocotron nil)
    19 (defvar *cocoa-application-libraries* ())
     19(defvar *cocoa-application-libraries* #+cocotron '("ccl:cocotron;Foundation'.1'.0'.dll" "ccl:cocotron;AppKit'.1'.0'.dll") #-cocotron nil)
    2020
    2121(load "ccl:cocoa-ide;defsystem.lisp")
Note: See TracChangeset for help on using the changeset viewer.