diff --git a/extra/tools/deploy/backend/backend.factor b/extra/tools/deploy/backend/backend.factor index b838654248..d4fbf1de78 100755 --- a/extra/tools/deploy/backend/backend.factor +++ b/extra/tools/deploy/backend/backend.factor @@ -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 diff --git a/extra/tools/deploy/deploy-docs.factor b/extra/tools/deploy/deploy-docs.factor index b225236249..eccb3982c7 100755 --- a/extra/tools/deploy/deploy-docs.factor +++ b/extra/tools/deploy/deploy-docs.factor @@ -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 diff --git a/extra/tools/deploy/deploy.factor b/extra/tools/deploy/deploy.factor index 893b43844a..bbeadc40cd 100755 --- a/extra/tools/deploy/deploy.factor +++ b/extra/tools/deploy/deploy.factor @@ -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 \ No newline at end of file diff --git a/extra/tools/deploy/macosx/macosx.factor b/extra/tools/deploy/macosx/macosx.factor index 3121866d94..ca710e9d28 100755 --- a/extra/tools/deploy/macosx/macosx.factor +++ b/extra/tools/deploy/macosx/macosx.factor @@ -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 ; diff --git a/extra/tools/deploy/unix/authors.txt b/extra/tools/deploy/unix/authors.txt new file mode 100644 index 0000000000..4b7af4aac0 --- /dev/null +++ b/extra/tools/deploy/unix/authors.txt @@ -0,0 +1 @@ +James Cash diff --git a/extra/tools/deploy/unix/summary.txt b/extra/tools/deploy/unix/summary.txt new file mode 100644 index 0000000000..7cd80c5e35 --- /dev/null +++ b/extra/tools/deploy/unix/summary.txt @@ -0,0 +1 @@ +Deploying minimal stand-alone binaries on *nix-like systems diff --git a/extra/tools/deploy/unix/tags.txt b/extra/tools/deploy/unix/tags.txt new file mode 100644 index 0000000000..ef1aab0d0e --- /dev/null +++ b/extra/tools/deploy/unix/tags.txt @@ -0,0 +1 @@ +tools diff --git a/extra/tools/deploy/unix/unix.factor b/extra/tools/deploy/unix/unix.factor new file mode 100644 index 0000000000..a995d66cd8 --- /dev/null +++ b/extra/tools/deploy/unix/unix.factor @@ -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 ; \ No newline at end of file diff --git a/extra/tools/deploy/windows/windows.factor b/extra/tools/deploy/windows/windows.factor index 68b106663c..4f6527a4ce 100755 --- a/extra/tools/deploy/windows/windows.factor +++ b/extra/tools/deploy/windows/windows.factor @@ -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 [