[Openmcl-cvs-notifications] r12704 - in /trunk/source/cocoa-ide: build-application.lisp builder-utilities.lisp cocoa.lisp
palter at clozure.com
palter at clozure.com
Thu Aug 27 14:38:18 EDT 2009
Author: palter
Date: Thu Aug 27 14:38:18 2009
New Revision: 12704
Log:
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.
Modified:
trunk/source/cocoa-ide/build-application.lisp
trunk/source/cocoa-ide/builder-utilities.lisp
trunk/source/cocoa-ide/cocoa.lisp
Modified: trunk/source/cocoa-ide/build-application.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/build-application.lisp (original)
+++ trunk/source/cocoa-ide/build-application.lisp Thu Aug 27 14:38:18 2009
@@ -9,7 +9,7 @@
;;;;
;;;; *********************************************************************=
**
=
-(require "builder-utilities")
+(require "BUILDER-UTILITIES")
=
(in-package :ccl)
=
@@ -39,6 +39,7 @@
; as the app's main. this name get=
s written
; into the Info.plist on the "NSMa=
inNibFile" key
(application-class 'gui::cocoa-application)
+ (private-frameworks nil)
(toplevel-function nil))
=
(let* ((info-plist (or info-plist ; if the user supplied one then we use=
it
@@ -50,8 +51,8 @@
(ide-bundle-path (get-ide-bundle-path))
;; create the bundle directory
(app-bundle (make-application-bundle :name name :project-path dir=
ectory))
- (image-path (namestring (path (bundle-executable-path app-bundle)
- (bundle-executable-name name)))))
+ (executable-dir (bundle-executable-path app-bundle))
+ (image-path (namestring (path executable-dir (bundle-executable-n=
ame name)))))
;; maybe copy IDE resources to the bundle
(when copy-ide-resources
(recursive-copy-directory (path ide-bundle-path "Contents" "Resource=
s/")
@@ -71,6 +72,8 @@
(dolist (n nib-paths)
(let ((dest (path app-bundle "Contents" "Resources" "English.lp=
roj/")))
(copy-nibfile n dest :if-exists :overwrite)))))
+ ;; copy any private frameworks into the bundle
+ (copy-private-frameworks private-frameworks app-bundle)
;; save the application image into the bundle
(save-application image-path
:application-class application-class
@@ -88,4 +91,4 @@
(ccl::build-application :name "Foo"
:directory "/Users/mikel/Desktop"
:copy-ide-resources t)
-|#
+|#
Modified: trunk/source/cocoa-ide/builder-utilities.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/builder-utilities.lisp (original)
+++ trunk/source/cocoa-ide/builder-utilities.lisp Thu Aug 27 14:38:18 2009
@@ -331,3 +331,52 @@
(ensure-directories-exist executable-dir)
(ensure-directories-exist rsrc-dir)
app-bundle))
+
+;;; BUNDLE-FRAMEWORKS-PATH app-path
+;;; ----------------------------------------------------------------------=
--
+;;; Returns the pathname of the frameworks directory given the pathname of
+;;; an application bundle
+(defun bundle-frameworks-path (app-path)
+ (path app-path "Contents"
+ #-windows-target (ensure-directory-pathname "Frameworks")
+ #+windows-target (ensure-directory-pathname "Windows")))
+
+;;; FIND-FRAMEWORK-EXECUTABLE framework-path
+;;; ----------------------------------------------------------------------=
--
+;;; Returns the pathname of the framework's executable file given the
+;;; pathname of a framework
+(defun find-framework-executable (framework-path)
+ (let* ((raw-framework-name (car (last (pathname-directory framework-path=
))))
+ (framework-name (subseq raw-framework-name 0 (- (length raw-frame=
work-name)
+ #.(length ".frame=
work"))))
+ (executable-wildcard (path framework-path
+ (concatenate 'string framework-name "*=
.dll")))
+ (executables (directory executable-wildcard)))
+ (when executables
+ (truename (first executables)))))
+
+;;; COPY-PRIVATE-FRAMEWORKS private-frameworks app-path
+;;; ----------------------------------------------------------------------=
--
+;;; Copy any private frameworks into the bundle taking into account the
+;;; different directory structures used by Cocoa and Cocotron (Windows).
+(defun copy-private-frameworks (private-frameworks app-path)
+ (let ((private-frameworks #+windows-target (append *cocoa-application-fr=
ameworks*
+ private-frameworks)
+ #-windows-target private-frameworks)
+ (frameworks-dir (bundle-frameworks-path app-path)))
+ #+windows-target
+ (dolist (lib *cocoa-application-libraries*)
+ (copy-file lib frameworks-dir :preserve-attributes t :if-exists :sup=
ersede))
+ (when private-frameworks
+ (flet ((subdir (framework target)
+ (ensure-directory-pathname
+ (make-pathname :name (car (last (pathname-directory framew=
ork)))
+ :defaults target))))
+ (dolist (framework private-frameworks)
+ (recursive-copy-directory framework (subdir framework frameworks=
-dir)
+ :if-exists :overwrite)
+ #+windows-target
+ (let ((executable (find-framework-executable framework)))
+ (when executable
+ (copy-file executable frameworks-dir =
+ :preserve-attributes t :if-exists :supersede)))))=
)))
Modified: trunk/source/cocoa-ide/cocoa.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/cocoa-ide/cocoa.lisp (original)
+++ trunk/source/cocoa-ide/cocoa.lisp Thu Aug 27 14:38:18 2009
@@ -16,7 +16,7 @@
(format nil "temp bundle-~a~a" (string-downcase cpu) bits)))
(defvar *cocoa-ide-force-compile* nil)
(defvar *cocoa-application-frameworks* #+cocotron '("ccl:cocotron;Foundati=
on.framework;" "ccl:cocotron;AppKit.framework;") #-cocotron nil)
-(defvar *cocoa-application-libraries* ())
+(defvar *cocoa-application-libraries* #+cocotron '("ccl:cocotron;Foundatio=
n'.1'.0'.dll" "ccl:cocotron;AppKit'.1'.0'.dll") #-cocotron nil)
=
(load "ccl:cocoa-ide;defsystem.lisp")
(load-ide *cocoa-ide-force-compile*)
More information about the Openmcl-cvs-notifications
mailing list