factor/extra/tools/deploy/deploy.factor

69 lines
1.8 KiB
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
! Copyright (C) 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: namespaces continuations.private kernel.private init
assocs kernel vocabs words sequences memory io system arrays
continuations math definitions mirrors splitting parser classes
inspector layouts vocabs.loader prettyprint.config prettyprint
debugger io.streams.c io.streams.duplex io.files io.backend
quotations io.launcher words.private tools.deploy.config
bootstrap.image ;
2007-09-20 18:09:08 -04:00
IN: tools.deploy
<PRIVATE
: boot-image-name ( -- string )
"boot." my-arch ".image" 3append ;
: stage1 ( -- )
#! If stage1 image doesn't exist, create one.
boot-image-name resource-path exists?
[ my-arch make-image ] unless ;
2007-09-20 18:09:08 -04:00
: (copy-lines) ( stream -- stream )
dup stream-readln [ print flush (copy-lines) ] when* ;
: copy-lines ( stream -- )
[ (copy-lines) ] [ stream-close ] [ ] cleanup ;
: stage2 ( vm flags -- )
2007-11-24 19:40:43 -05:00
>r "-i=" boot-image-name append 2array r> append dup .
<process-stream>
2007-10-06 13:37:47 -04:00
dup duplex-stream-out stream-close
copy-lines ;
2007-09-20 18:09:08 -04:00
2007-10-31 01:09:24 -04:00
: ?append swap [ append ] [ drop ] if ;
2007-09-20 18:09:08 -04:00
: profile-string ( config -- string )
2007-10-31 01:09:24 -04:00
[
""
deploy-math? get " math" ?append
deploy-compiler? get " compiler" ?append
deploy-ui? get " ui" ?append
native-io? " io" ?append
2007-10-31 01:09:24 -04:00
] bind ;
2007-09-20 18:09:08 -04:00
: deploy-command-line ( vm image vocab config -- vm flags )
[
2007-11-24 19:40:43 -05:00
"-include=" swap profile-string append ,
2007-09-20 18:09:08 -04:00
"-deploy-vocab=" swap append ,
2007-11-24 19:40:43 -05:00
"-output-image=" swap append ,
2007-09-20 18:09:08 -04:00
2007-11-21 03:26:13 -05:00
"-no-stack-traces" ,
2007-09-20 18:09:08 -04:00
"-no-user-init" ,
] { } make ;
PRIVATE>
: deploy* ( vm image vocab config -- )
stage1 deploy-command-line stage2 ;
2007-09-20 18:09:08 -04:00
SYMBOL: deploy-implementation
HOOK: deploy deploy-implementation ( vocab -- )
macosx? [ "tools.deploy.macosx" require ] when
winnt? [ "tools.deploy.windows" require ] when