From 361361a5560ec1ba8b68660b75ee9ee60a270045 Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 14:28:28 -0400 Subject: [PATCH 01/10] Adding deployment for Linux --- extra/tools/deploy/linux/authors.txt | 1 + extra/tools/deploy/linux/linux.factor | 31 +++++++++++++++++++++++++++ extra/tools/deploy/linux/summary.txt | 1 + extra/tools/deploy/linux/tags.txt | 1 + 4 files changed, 34 insertions(+) create mode 100644 extra/tools/deploy/linux/authors.txt create mode 100644 extra/tools/deploy/linux/linux.factor create mode 100644 extra/tools/deploy/linux/summary.txt create mode 100644 extra/tools/deploy/linux/tags.txt diff --git a/extra/tools/deploy/linux/authors.txt b/extra/tools/deploy/linux/authors.txt new file mode 100644 index 0000000000..4b7af4aac0 --- /dev/null +++ b/extra/tools/deploy/linux/authors.txt @@ -0,0 +1 @@ +James Cash diff --git a/extra/tools/deploy/linux/linux.factor b/extra/tools/deploy/linux/linux.factor new file mode 100644 index 0000000000..fdbb67ef15 --- /dev/null +++ b/extra/tools/deploy/linux/linux.factor @@ -0,0 +1,31 @@ +USING: io io.files io.backend kernel namespaces sequences +system tools.deploy.backend tools.deploy.config assocs +hashtables prettyprint ; +IN: tools.deploy.linux + +: copy-vm ( executable bundle-name -- vm ) + prepend-path "" append + vm over copy-file ; + +: copy-fonts ( name -- ) + "fonts/" resource-path swap copy-tree-into ; + +: create-app-dir ( vocab bundle-name -- vm ) + dup copy-fonts + copy-vm ; + +: image-name ( vocab bundle-name -- str ) + prepend-path ".image" append ; + +: 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 write + ] bind + ] with-directory ; \ No newline at end of file diff --git a/extra/tools/deploy/linux/summary.txt b/extra/tools/deploy/linux/summary.txt new file mode 100644 index 0000000000..4e2e8fbac4 --- /dev/null +++ b/extra/tools/deploy/linux/summary.txt @@ -0,0 +1 @@ +Deploying minimal stand-alone Linux binaries diff --git a/extra/tools/deploy/linux/tags.txt b/extra/tools/deploy/linux/tags.txt new file mode 100644 index 0000000000..ef1aab0d0e --- /dev/null +++ b/extra/tools/deploy/linux/tags.txt @@ -0,0 +1 @@ +tools From e5c880fcc2b2d2b86b468156efaf73a62d81ee01 Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 14:38:18 -0400 Subject: [PATCH 02/10] Adding information to deploy-docs regarding deployment on Linux --- extra/tools/deploy/deploy-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/tools/deploy/deploy-docs.factor b/extra/tools/deploy/deploy-docs.factor index b225236249..ec9d933f8b 100755 --- a/extra/tools/deploy/deploy-docs.factor +++ b/extra/tools/deploy/deploy-docs.factor @@ -7,7 +7,7 @@ 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." +"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 Linux, 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 From bfbedfaac31f79515488a7aa8f45d4fcdbb73383 Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 14:38:47 -0400 Subject: [PATCH 03/10] Minor change to linux deployment, print instead of write --- extra/tools/deploy/linux/linux.factor | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extra/tools/deploy/linux/linux.factor b/extra/tools/deploy/linux/linux.factor index fdbb67ef15..05cb0cddc1 100644 --- a/extra/tools/deploy/linux/linux.factor +++ b/extra/tools/deploy/linux/linux.factor @@ -1,3 +1,5 @@ +! 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 ; @@ -26,6 +28,6 @@ M: linux deploy* ( vocab -- ) [ bundle-name create-app-dir ] keep [ bundle-name image-name ] keep namespace make-deploy-image - bundle-name normalize-path [ "Binary deployed to " % % "." % ] "" make write + bundle-name normalize-path [ "Binary deployed to " % % "." % ] "" make print ] bind ] with-directory ; \ No newline at end of file From 9d5b65ff74283ac1add60f5be9da72e99c4e14d2 Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 18:08:25 -0400 Subject: [PATCH 04/10] Fixing deploy-docs --- extra/tools/deploy/deploy-docs.factor | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extra/tools/deploy/deploy-docs.factor b/extra/tools/deploy/deploy-docs.factor index ec9d933f8b..5135332955 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" } ". On Linux, 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." +{ $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 Linux, 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 From 738a59ee45cd60af79520247594777b26796606a Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 22:17:59 -0400 Subject: [PATCH 05/10] Adding requisite require for linux deployment --- extra/tools/deploy/deploy.factor | 1 + 1 file changed, 1 insertion(+) diff --git a/extra/tools/deploy/deploy.factor b/extra/tools/deploy/deploy.factor index 893b43844a..6a91fab798 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 linux? [ "tools.deploy.linux" require ] when \ No newline at end of file From 0426ca274dea4d1b215e654a58e1d01aeecdf162 Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 22:35:58 -0400 Subject: [PATCH 06/10] Refactoring common functions out of platform-specific deployment --- extra/tools/deploy/backend/backend.factor | 9 +++++++++ extra/tools/deploy/linux/linux.factor | 14 ++------------ extra/tools/deploy/macosx/macosx.factor | 11 ++--------- extra/tools/deploy/windows/windows.factor | 11 ++--------- 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/extra/tools/deploy/backend/backend.factor b/extra/tools/deploy/backend/backend.factor index b838654248..ee904105be 100755 --- a/extra/tools/deploy/backend/backend.factor +++ b/extra/tools/deploy/backend/backend.factor @@ -105,5 +105,14 @@ DEFER: ?make-staging-image : make-deploy-image ( vm image vocab config -- ) make-boot-image deploy-command-line run-factor ; + +: copy-vm ( executable bundle-name extension -- vm ) + [ prepend-path ] dip append vm over copy-file ; + +: copy-fonts ( name dir -- ) + "fonts/" resource-path swap append-path copy-tree-into ; + +: image-name ( vocab bundle-name -- str ) + prepend-path ".image" append ; HOOK: deploy* os ( vocab -- ) diff --git a/extra/tools/deploy/linux/linux.factor b/extra/tools/deploy/linux/linux.factor index 05cb0cddc1..a995d66cd8 100644 --- a/extra/tools/deploy/linux/linux.factor +++ b/extra/tools/deploy/linux/linux.factor @@ -4,20 +4,10 @@ USING: io io.files io.backend kernel namespaces sequences system tools.deploy.backend tools.deploy.config assocs hashtables prettyprint ; IN: tools.deploy.linux - -: copy-vm ( executable bundle-name -- vm ) - prepend-path "" append - vm over copy-file ; - -: copy-fonts ( name -- ) - "fonts/" resource-path swap copy-tree-into ; : create-app-dir ( vocab bundle-name -- vm ) - dup copy-fonts - copy-vm ; - -: image-name ( vocab bundle-name -- str ) - prepend-path ".image" append ; + dup "" copy-fonts + "" copy-vm ; : bundle-name ( -- str ) deploy-name get ; 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/windows/windows.factor b/extra/tools/deploy/windows/windows.factor index 68b106663c..5fc3e92c2b 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,8 +12,8 @@ IN: tools.deploy.windows : create-exe-dir ( vocab bundle-name -- vm ) dup copy-dlls - dup copy-fonts - copy-vm ; + dup "" copy-fonts + ".exe" copy-vm ; : image-name ( vocab bundle-name -- str ) prepend-path ".image" append ; From c99b76b2f690c5736cba6dfbe8e7263b5851a58f Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 23:24:35 -0400 Subject: [PATCH 07/10] Got copy-fonts working properly (on Linux, at least) --- extra/tools/deploy/backend/backend.factor | 2 +- extra/tools/deploy/linux/linux.factor | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/extra/tools/deploy/backend/backend.factor b/extra/tools/deploy/backend/backend.factor index ee904105be..e8ca00cc8d 100755 --- a/extra/tools/deploy/backend/backend.factor +++ b/extra/tools/deploy/backend/backend.factor @@ -110,7 +110,7 @@ DEFER: ?make-staging-image [ prepend-path ] dip append vm over copy-file ; : copy-fonts ( name dir -- ) - "fonts/" resource-path swap append-path copy-tree-into ; + append-path "fonts/" resource-path swap copy-tree-into ; : image-name ( vocab bundle-name -- str ) prepend-path ".image" append ; diff --git a/extra/tools/deploy/linux/linux.factor b/extra/tools/deploy/linux/linux.factor index a995d66cd8..5f3d41c443 100644 --- a/extra/tools/deploy/linux/linux.factor +++ b/extra/tools/deploy/linux/linux.factor @@ -1,8 +1,7 @@ ! 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 ; +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 ) From d7ddf9ad4276f271f372b3e5c18b53f70d47fc08 Mon Sep 17 00:00:00 2001 From: James Cash Date: Fri, 11 Apr 2008 23:25:53 -0400 Subject: [PATCH 08/10] Factor image-name out of windows deployment --- extra/tools/deploy/windows/windows.factor | 3 --- 1 file changed, 3 deletions(-) diff --git a/extra/tools/deploy/windows/windows.factor b/extra/tools/deploy/windows/windows.factor index 5fc3e92c2b..4f6527a4ce 100755 --- a/extra/tools/deploy/windows/windows.factor +++ b/extra/tools/deploy/windows/windows.factor @@ -15,9 +15,6 @@ IN: tools.deploy.windows dup "" copy-fonts ".exe" copy-vm ; -: image-name ( vocab bundle-name -- str ) - prepend-path ".image" append ; - M: winnt deploy* "." resource-path [ dup deploy-config [ From dca8d463beb1a6d7e9a3ce3891aead0e976cc12c Mon Sep 17 00:00:00 2001 From: James Cash Date: Sat, 12 Apr 2008 00:09:57 -0400 Subject: [PATCH 09/10] Minor moving stuff around in files --- extra/tools/deploy/backend/backend.factor | 18 +++++++++--------- extra/tools/deploy/linux/linux.factor | 5 +++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/extra/tools/deploy/backend/backend.factor b/extra/tools/deploy/backend/backend.factor index e8ca00cc8d..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 @@ -105,14 +114,5 @@ DEFER: ?make-staging-image : make-deploy-image ( vm image vocab config -- ) make-boot-image deploy-command-line run-factor ; - -: 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 ; HOOK: deploy* os ( vocab -- ) diff --git a/extra/tools/deploy/linux/linux.factor b/extra/tools/deploy/linux/linux.factor index 5f3d41c443..a995d66cd8 100644 --- a/extra/tools/deploy/linux/linux.factor +++ b/extra/tools/deploy/linux/linux.factor @@ -1,7 +1,8 @@ ! 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 ; +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 ) From ef29f46537443d1c2b50a2f70a1f596833ce8490 Mon Sep 17 00:00:00 2001 From: James Cash Date: Sun, 13 Apr 2008 00:27:59 -0400 Subject: [PATCH 10/10] Changing names for linux deployment to unix --- extra/tools/deploy/deploy-docs.factor | 2 +- extra/tools/deploy/deploy.factor | 2 +- extra/tools/deploy/linux/summary.txt | 1 - extra/tools/deploy/{linux => unix}/authors.txt | 0 extra/tools/deploy/unix/summary.txt | 1 + extra/tools/deploy/{linux => unix}/tags.txt | 0 extra/tools/deploy/{linux/linux.factor => unix/unix.factor} | 0 7 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 extra/tools/deploy/linux/summary.txt rename extra/tools/deploy/{linux => unix}/authors.txt (100%) create mode 100644 extra/tools/deploy/unix/summary.txt rename extra/tools/deploy/{linux => unix}/tags.txt (100%) rename extra/tools/deploy/{linux/linux.factor => unix/unix.factor} (100%) diff --git a/extra/tools/deploy/deploy-docs.factor b/extra/tools/deploy/deploy-docs.factor index 5135332955..eccb3982c7 100755 --- a/extra/tools/deploy/deploy-docs.factor +++ b/extra/tools/deploy/deploy-docs.factor @@ -10,7 +10,7 @@ $nl { $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 Linux, it yields a directory named " { $snippet "Hello world" } " containing a program named " { $snippet "hello-ui" } "." } + { "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 diff --git a/extra/tools/deploy/deploy.factor b/extra/tools/deploy/deploy.factor index 6a91fab798..bbeadc40cd 100755 --- a/extra/tools/deploy/deploy.factor +++ b/extra/tools/deploy/deploy.factor @@ -7,4 +7,4 @@ IN: tools.deploy os macosx? [ "tools.deploy.macosx" require ] when os winnt? [ "tools.deploy.windows" require ] when -os linux? [ "tools.deploy.linux" require ] when \ No newline at end of file +os unix? [ "tools.deploy.unix" require ] when \ No newline at end of file diff --git a/extra/tools/deploy/linux/summary.txt b/extra/tools/deploy/linux/summary.txt deleted file mode 100644 index 4e2e8fbac4..0000000000 --- a/extra/tools/deploy/linux/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Deploying minimal stand-alone Linux binaries diff --git a/extra/tools/deploy/linux/authors.txt b/extra/tools/deploy/unix/authors.txt similarity index 100% rename from extra/tools/deploy/linux/authors.txt rename to extra/tools/deploy/unix/authors.txt 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/linux/tags.txt b/extra/tools/deploy/unix/tags.txt similarity index 100% rename from extra/tools/deploy/linux/tags.txt rename to extra/tools/deploy/unix/tags.txt diff --git a/extra/tools/deploy/linux/linux.factor b/extra/tools/deploy/unix/unix.factor similarity index 100% rename from extra/tools/deploy/linux/linux.factor rename to extra/tools/deploy/unix/unix.factor