Merge branch 'master' of git://factorcode.org/git/jamesnvc

db4
Slava Pestov 2008-04-16 00:38:34 -05:00
commit b9c8667cee
9 changed files with 46 additions and 22 deletions

View File

@ -8,6 +8,15 @@ debugger io.streams.c io.streams.duplex io.files io.backend
quotations io.launcher words.private tools.deploy.config
bootstrap.image io.encodings.utf8 accessors ;
IN: tools.deploy.backend
: copy-vm ( executable bundle-name extension -- vm )
[ prepend-path ] dip append vm over copy-file ;
: copy-fonts ( name dir -- )
append-path "fonts/" resource-path swap copy-tree-into ;
: image-name ( vocab bundle-name -- str )
prepend-path ".image" append ;
: (copy-lines) ( stream -- )
dup stream-readln dup

View File

@ -7,7 +7,12 @@ ARTICLE: "tools.deploy" "Application deployment"
$nl
"For example, we can deploy the " { $vocab-link "hello-world" } " demo which comes with Factor:"
{ $code "\"hello-ui\" deploy" }
"On Mac OS X, this yields a program named " { $snippet "Hello world.app" } ". On Windows, it yields a directory named " { $snippet "Hello world" } " containing a program named " { $snippet "hello-ui.exe" } ". In both cases, running the program displays a window with a message."
{ $list
{ "On Mac OS X, this yields a program named " { $snippet "Hello world.app" } "." }
{ "On Windows, it yields a directory named " { $snippet "Hello world" } " containing a program named " { $snippet "hello-ui.exe" } "." }
{ "On Unix-like systems (Linux, BSD, Solaris, etc), it yields a directory named " { $snippet "Hello world" } " containing a program named " { $snippet "hello-ui" } "." }
}
"In all cases, running the program displays a window with a message."
$nl
"The deployment tool works by bootstrapping a fresh image, loading the vocabulary into this image, then applying various heuristics to strip the image down to minimal size."
$nl

View File

@ -7,3 +7,4 @@ IN: tools.deploy
os macosx? [ "tools.deploy.macosx" require ] when
os winnt? [ "tools.deploy.windows" require ] when
os unix? [ "tools.deploy.unix" require ] when

View File

@ -14,13 +14,6 @@ IN: tools.deploy.macosx
bundle-dir over append-path -rot
"Contents" prepend-path append-path copy-tree ;
: copy-vm ( executable bundle-name -- vm )
"Contents/MacOS/" append-path prepend-path vm over copy-file ;
: copy-fonts ( name -- )
"fonts/" resource-path
swap "Contents/Resources/" append-path copy-tree-into ;
: app-plist ( executable bundle-name -- assoc )
[
"6.0" "CFBundleInfoDictionaryVersion" set
@ -40,8 +33,8 @@ IN: tools.deploy.macosx
: create-app-dir ( vocab bundle-name -- vm )
dup "Frameworks" copy-bundle-dir
dup "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
dup copy-fonts
2dup create-app-plist copy-vm ;
dup "Contents/Resources/" copy-fonts
2dup create-app-plist "Contents/MacOS/" append-path "" copy-vm ;
: deploy.app-image ( vocab bundle-name -- str )
[ % "/Contents/Resources/" % % ".image" % ] "" make ;

View File

@ -0,0 +1 @@
James Cash

View File

@ -0,0 +1 @@
Deploying minimal stand-alone binaries on *nix-like systems

View File

@ -0,0 +1 @@
tools

View File

@ -0,0 +1,23 @@
! Copyright (C) 2008 James Cash
! See http://factorcode.org/license.txt for BSD license.
USING: io io.files io.backend kernel namespaces sequences
system tools.deploy.backend tools.deploy.config assocs
hashtables prettyprint ;
IN: tools.deploy.linux
: create-app-dir ( vocab bundle-name -- vm )
dup "" copy-fonts
"" copy-vm ;
: bundle-name ( -- str )
deploy-name get ;
M: linux deploy* ( vocab -- )
"." resource-path [
dup deploy-config [
[ bundle-name create-app-dir ] keep
[ bundle-name image-name ] keep
namespace make-deploy-image
bundle-name normalize-path [ "Binary deployed to " % % "." % ] "" make print
] bind
] with-directory ;

View File

@ -5,13 +5,6 @@ tools.deploy.backend tools.deploy.config assocs hashtables
prettyprint windows.shell32 windows.user32 ;
IN: tools.deploy.windows
: copy-vm ( executable bundle-name -- vm )
prepend-path ".exe" append
vm over copy-file ;
: copy-fonts ( bundle-name -- )
"fonts/" resource-path swap copy-tree-into ;
: copy-dlls ( bundle-name -- )
{ "freetype6.dll" "zlib1.dll" "factor.dll" }
[ resource-path ] map
@ -19,11 +12,8 @@ IN: tools.deploy.windows
: create-exe-dir ( vocab bundle-name -- vm )
dup copy-dlls
dup copy-fonts
copy-vm ;
: image-name ( vocab bundle-name -- str )
prepend-path ".image" append ;
dup "" copy-fonts
".exe" copy-vm ;
M: winnt deploy*
"." resource-path [