1 ! Copyright (C) 2004, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors init command-line namespaces words debugger io
4 kernel.private math memory continuations kernel io.files
5 io.backend system parser vocabs sequences prettyprint
6 vocabs.loader combinators splitting source-files strings
7 definitions assocs compiler.errors compiler.units
8 math.parser generic sets ;
11 SYMBOL: bootstrap-time
13 : default-image-name ( -- string )
14 vm file-name os windows? [ "." split1 drop ] when
15 ".image" append resource-path ;
18 "Cross-referencing..." print flush
19 H{ } clone crossref set-global
24 : load-components ( -- )
26 [ get-global " " split harvest ] bi@
28 [ "bootstrap." prepend require ] each ;
30 : count-words ( pred -- )
31 all-words swap count number>string write ;
33 : print-report ( time -- )
36 "Bootstrap completed in " write number>string write
37 " minutes and " write number>string write " seconds." print
39 [ compiled>> ] count-words " compiled words" print
40 [ symbol? ] count-words " symbol words" print
41 [ ] count-words " words total" print
43 "Bootstrapping is complete." print
44 "Now, you can run Factor:" print
45 vm write " -i=" write "output-image" get print flush ;
50 default-image-name "output-image" set-global
52 "math compiler help io random tools ui ui.tools unicode handbook" "include" set-global
53 "" "exclude" set-global
57 "-no-crossref" cli-args member? [ do-crossref ] unless
62 os wince? [ "windows.ce" require ] when
63 os winnt? [ "windows.nt" require ] when
66 "stage2: deployment mode" print
76 ] with-compiler-errors
80 f error-continuation set-global
83 "tools.deploy.shaker" run
92 output-stream get [ stream-flush ] when*
93 ] [ print-error 1 exit ] recover
96 millis r> - dup bootstrap-time set-global
99 "output-image" get save-image-and-exit