Merge branch 'master' of git://factorcode.org/git/jamesnvc
commit
b9c8667cee
|
@ -9,6 +9,15 @@ quotations io.launcher words.private tools.deploy.config
|
||||||
bootstrap.image io.encodings.utf8 accessors ;
|
bootstrap.image io.encodings.utf8 accessors ;
|
||||||
IN: tools.deploy.backend
|
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 -- )
|
: (copy-lines) ( stream -- )
|
||||||
dup stream-readln dup
|
dup stream-readln dup
|
||||||
[ print flush (copy-lines) ] [ 2drop ] if ;
|
[ print flush (copy-lines) ] [ 2drop ] if ;
|
||||||
|
|
|
@ -7,7 +7,12 @@ ARTICLE: "tools.deploy" "Application deployment"
|
||||||
$nl
|
$nl
|
||||||
"For example, we can deploy the " { $vocab-link "hello-world" } " demo which comes with Factor:"
|
"For example, we can deploy the " { $vocab-link "hello-world" } " demo which comes with Factor:"
|
||||||
{ $code "\"hello-ui\" deploy" }
|
{ $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
|
$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."
|
"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
|
$nl
|
||||||
|
|
|
@ -7,3 +7,4 @@ IN: tools.deploy
|
||||||
|
|
||||||
os macosx? [ "tools.deploy.macosx" require ] when
|
os macosx? [ "tools.deploy.macosx" require ] when
|
||||||
os winnt? [ "tools.deploy.windows" require ] when
|
os winnt? [ "tools.deploy.windows" require ] when
|
||||||
|
os unix? [ "tools.deploy.unix" require ] when
|
|
@ -14,13 +14,6 @@ IN: tools.deploy.macosx
|
||||||
bundle-dir over append-path -rot
|
bundle-dir over append-path -rot
|
||||||
"Contents" prepend-path append-path copy-tree ;
|
"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 )
|
: app-plist ( executable bundle-name -- assoc )
|
||||||
[
|
[
|
||||||
"6.0" "CFBundleInfoDictionaryVersion" set
|
"6.0" "CFBundleInfoDictionaryVersion" set
|
||||||
|
@ -40,8 +33,8 @@ IN: tools.deploy.macosx
|
||||||
: create-app-dir ( vocab bundle-name -- vm )
|
: create-app-dir ( vocab bundle-name -- vm )
|
||||||
dup "Frameworks" copy-bundle-dir
|
dup "Frameworks" copy-bundle-dir
|
||||||
dup "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
|
dup "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir
|
||||||
dup copy-fonts
|
dup "Contents/Resources/" copy-fonts
|
||||||
2dup create-app-plist copy-vm ;
|
2dup create-app-plist "Contents/MacOS/" append-path "" copy-vm ;
|
||||||
|
|
||||||
: deploy.app-image ( vocab bundle-name -- str )
|
: deploy.app-image ( vocab bundle-name -- str )
|
||||||
[ % "/Contents/Resources/" % % ".image" % ] "" make ;
|
[ % "/Contents/Resources/" % % ".image" % ] "" make ;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
James Cash
|
|
@ -0,0 +1 @@
|
||||||
|
Deploying minimal stand-alone binaries on *nix-like systems
|
|
@ -0,0 +1 @@
|
||||||
|
tools
|
|
@ -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 ;
|
|
@ -5,13 +5,6 @@ tools.deploy.backend tools.deploy.config assocs hashtables
|
||||||
prettyprint windows.shell32 windows.user32 ;
|
prettyprint windows.shell32 windows.user32 ;
|
||||||
IN: tools.deploy.windows
|
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 -- )
|
: copy-dlls ( bundle-name -- )
|
||||||
{ "freetype6.dll" "zlib1.dll" "factor.dll" }
|
{ "freetype6.dll" "zlib1.dll" "factor.dll" }
|
||||||
[ resource-path ] map
|
[ resource-path ] map
|
||||||
|
@ -19,11 +12,8 @@ IN: tools.deploy.windows
|
||||||
|
|
||||||
: create-exe-dir ( vocab bundle-name -- vm )
|
: create-exe-dir ( vocab bundle-name -- vm )
|
||||||
dup copy-dlls
|
dup copy-dlls
|
||||||
dup copy-fonts
|
dup "" copy-fonts
|
||||||
copy-vm ;
|
".exe" copy-vm ;
|
||||||
|
|
||||||
: image-name ( vocab bundle-name -- str )
|
|
||||||
prepend-path ".image" append ;
|
|
||||||
|
|
||||||
M: winnt deploy*
|
M: winnt deploy*
|
||||||
"." resource-path [
|
"." resource-path [
|
||||||
|
|
Loading…
Reference in New Issue