Extracted the configuration of the files to use for bootstrap image compilation into...
authorBrian T. Rice <briantrice@gmail.com>
Tue, 13 Apr 2010 05:12:47 +0000 (22:12 -0700)
committerBrian T. Rice <briantrice@gmail.com>
Tue, 13 Apr 2010 05:30:50 +0000 (22:30 -0700)
Makefile
common.mk
src/mobius/bootstrap-files.txt [new file with mode: 0644]
src/mobius/build.slate

index 4f36b67..577e911 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ i18n-support:
 
 bootstrap: src/mobius/init.slate
        $(info Bootstrapping new images)
-       $(SILENT) $(VM) $(QUIETNESS) -i $(DEFAULT_IMAGE) --load src/mobius/init.slate --eval "Image bootstrap &littleEndian: $(LITTLE_ENDIAN_SLATE) &wordSize: $(WORD_SIZE)." --eval "quit"
+       $(SILENT) $(VM) $(QUIETNESS) -i $(DEFAULT_IMAGE) --load src/mobius/init.slate --eval "Image bootstrap &bootstrapDirectory: '$(BOOTSTRAP_DIR)' &littleEndian: $(LITTLE_ENDIAN_SLATE) &wordSize: $(WORD_SIZE)." --eval "quit"
 
 backup: superclean
        tar  '--exclude=*.git*' -jcvf ../slate-backup.tar.bz2 .
index dce06cc..727a33e 100644 (file)
--- a/common.mk
+++ b/common.mk
@@ -113,6 +113,7 @@ VM          := $(VMDIR)/$(VMNAME)
 DEFAULT_IMAGE ?= slate.image
 KERNEL_IMAGES := kernel.new.*.$(WORD_SIZE).*.image
 DEFAULT_KERNEL_IMAGE ?= $(shell ls -t $(KERNEL_IMAGES) | head -1)
+BOOTSTRAP_DIR := $(slateroot)
 
 CFLAGS_x-windows.c=`pkg-config --cflags x11` `pkg-config --cflags cairo` -Werror
 LDFLAGS_x-windows.lo=`pkg-config --libs x11` `pkg-config --libs cairo`
diff --git a/src/mobius/bootstrap-files.txt b/src/mobius/bootstrap-files.txt
new file mode 100644 (file)
index 0000000..bf41c47
--- /dev/null
@@ -0,0 +1,45 @@
+src/mobius/pre-bootstrap.slate
+src/core/root.slate
+src/core/nil.slate
+src/core/boolean.slate
+src/core/namespace.slate
+src/core/derivable.slate
+src/core/numeric.slate
+src/core/association.slate
+src/core/method.slate
+src/core/collection.slate
+src/core/collection-extensible.slate
+src/core/set.slate
+src/core/mapping.slate
+src/core/sequence.slate
+src/core/arrayed.slate
+src/core/integer.slate
+src/core/dictionary.slate
+src/core/string.slate
+src/core/symbol.slate
+src/core/range.slate
+src/core/sequence-extensible.slate
+src/core/sorted.slate
+src/core/mixin.slate
+src/core/stack.slate
+src/core/condition.slate
+src/core/condition-epilogue.slate
+src/core/stream.slate
+src/core/stream-collections.slate
+src/core/stream-transforms.slate
+src/core/external.slate
+src/core/console.slate
+src/core/file.slate
+src/core/print.slate
+src/core/types.slate
+src/syntax/init.slate
+src/syntax/node.slate
+src/syntax/token.slate
+src/syntax/lexer.slate
+src/syntax/parser.slate
+src/core/debugger.slate
+src/syntax/macro.slate
+src/syntax/inference.slate
+src/mobius/compiler.slate
+src/mobius/debug.slate
+src/mobius/post-bootstrap.slate
index 914a090..632f661 100644 (file)
@@ -1,59 +1,11 @@
 Image define: #Definition &parents: {Cloneable} &slots:
-  {#bootstrapFilenames ->
-"The names of the sources used to build the kernel REPL image, in necessary
-load-order."
-    ({'mobius/pre-bootstrap'.
-     'core/root'.
-     'core/nil'.
-     'core/boolean'.
-     'core/namespace'.
-     'core/derivable'.
-     'core/numeric'.
-     'core/association'.
-     'core/method'.
-     'core/collection'.
-     'core/collection-extensible'.
-     'core/set'.
-     'core/mapping'.
-     'core/sequence'.
-     'core/arrayed'.
-     'core/integer'.
-     'core/dictionary'.
-     'core/string'.
-     'core/symbol'.
-     'core/range'.
-     'core/sequence-extensible'.
-     'core/sorted'.
-     'core/mixin'.
-     'core/stack'. "Used by the conditionStack."
-     'core/condition'. "Essential error-handling logic."
-     'core/condition-epilogue'. "Error types for previous libraries."
-     'core/stream'. "Basic Streams, only depends on condition.slate."
-     'core/stream-collections'. "Streams over previous collection libraries."
-     'core/stream-transforms'. "Stream operation types."
-     'core/external'. "Abstract type for external resources and streams."
-     'core/console'. "Console I/O."
-     'core/file'. "File I/O."
-     'core/print'. "Print methods, pretty-printing (of objects, not source)."
-     'core/types'. "The object-based type system."
-     'syntax/init'.
-     'syntax/node'.
-     'syntax/token'.
-     'syntax/lexer'.
-     'syntax/parser'.
-     'core/debugger'.
-     'syntax/macro'.
-     'syntax/inference'.
-     'mobius/compiler'.
-     'mobius/debug'.
-     'mobius/post-bootstrap'.
-    } collect: [| :name | 'src/' ; name ; '.slate']).
-    #filename -> Nil. "The filename for the image."
-    #wordSize -> (Platform Current bytesPerWord * 8). "The size of a word in bits of the image"
-    #primitives -> ExtensibleArray new.
-    #littleEndian -> True. "Whether to have a little-endian byte-word format."
-    #bootstrapDirectory -> '.' "Where the source filename paths relate to."
-  }.
+  {#bootstrapDirectory -> '.'. "Where the source filename paths relate to."
+   #bootstrapFilenames -> {}. "The names of the sources used to build the kernel REPL image, in necessary load-order."
+   #filename -> Nil. "The filename for the image."
+   #wordSize -> (Platform Current bytesPerWord * 8). "The size of a word in bits of the image"
+   #primitives -> ExtensibleArray new.
+   #endianness -> #LittleEndian. "Whether to have a little-endian byte-word format."
+}.
 
 Image Definition primitives clear.
 
@@ -242,37 +194,42 @@ inform: 'Adding primitives'.
 
 Image Definition traits define: #cached &builder: [Dictionary new].
 
-Image Definition cached at: 'bare' put: (Image Definition clone `setting: #(bootstrapFilenames)
- to: {{'src/mobius/pre-bootstrap.slate'}}).
+Image Definition cached at: 'bare' put: (Image Definition clone `>> [bootstrapFilenames: {'src/mobius/pre-bootstrap.slate'}. ]).
 "An Image Definition consisting of the bare minimum to run some primitive call,
 like adding 3 + 4, say."
 "TODO: refactor Image Definition so that we can just supply a block here."
 
-def@(Image Definition traits) newNamed: filename littleEndian: littleEndian wordSize: wordSize
+def@(Image Definition traits) newNamed: filename endianness: endianness wordSize: wordSize
 [
-  (def clone `setting: #(littleEndian wordSize) to: {littleEndian. wordSize})
+  (def clone `setting: #(endianness wordSize) to: {endianness. wordSize})
    `>> [| :newDef | filename: (newDef defaultFilename &base: filename). ]
 ].
 
 def@(Image Definition traits) defaultFilename &base: base
 "Generates a unique and descriptive image filename based on the definition."
 [
-  base `defaultsTo: 'kernel'.
-  base
-    ; '.' ; (def littleEndian ifTrue: ['little'] ifFalse: ['big']) "endianness"
-    ; '.' ; def wordSize printString "size of a word in bits"
-    ; '.' ; (lobby timeSinceEpoch as: Integer) printString "timestamp"
-    ; '.image'
+  '%s.%s.%d.%d.image' sprintf*,
+    (base ifNil: ['kernel']),
+    (def endianness caseOf: {#LittleEndian -> ['little']. #BigEndian -> ['big']}),
+    def wordSize,
+    lobby ticksSinceEpoch
 ].
 
 def@(Image Definition traits) generate
-[| builder bootBlock dir |
-  builder: (Image Bootstrap Generator new &littleEndian: def littleEndian &wordSize: def wordSize).
-  def filename ifNil: [def filename: def defaultFilename].
-  dir: (Directory newNamed: def bootstrapDirectory).
+[| builder bootBlock |
+  builder: (Image Bootstrap Generator new &endianness: def endianness &wordSize: def wordSize).
+  def filename `defaultsTo: def defaultFilename.
+  def bootstrapFilenames isEmpty ifTrue:
+    [def bootstrapFilenames:
+       ([| :out |
+         (File newNamed: def bootstrapDirectory ; '/src/mobius/bootstrap-files.txt') sessionDo:
+           [| :filelist |
+            filelist ASCIIReader lines do:
+              [| :line | line isEmpty ifFalse: [out nextPut: line]]].
+        ] writingAs: def bootstrapFilenames)].
   bootBlock: Syntax Block new.
   bootBlock statements: ([| :out |
-    (def bootstrapFilenames collect: [| :each | dir / each]) do:
+    (def bootstrapFilenames collect: [| :each | File newNamed: def bootstrapDirectory ; '/' ; each]) do:
       [| :file |
        inform: 'Parsing: %r', file locator.
        file mode: file Read.
@@ -288,22 +245,23 @@ def@(Image Definition traits) generate
 
 i@Image generateAmd64Test
 [
-  ((i Definition cached at: 'bare') newNamed: 'k64' littleEndian: True wordSize: 64) generate.
+  ((i Definition cached at: 'bare') newNamed: 'k64' endianness: #LittleEndian wordSize: 64) generate.
 ].
 
 i@Image generateAmd64
 [
-  (i Definition newNamed: 'amd64' littleEndian: True wordSize: 64) generate.
+  (i Definition newNamed: 'amd64' endianness: #LittleEndian wordSize: 64) generate.
 ].
 
-i@Image bootstrap &littleEndian: littleEndian &wordSize: wordSize
+i@Image bootstrap &bootstrapDirectory: dir &endianness: endianness &wordSize: wordSize
 "Only to be called during or after fullCleanBootstrap to build new images
 based on the new VM Definition."
 [| def |
   wordSize `defaultsTo: Platform Current bytesPerWord * 8.
-  littleEndian `defaultsTo: (Platform Current endianness == #LittleEndian).
-  def: (i Definition newNamed: 'kernel.new' littleEndian: littleEndian wordSize: wordSize).
-  def cached at: {'new'. littleEndian ifTrue: ['little'] ifFalse: ['big']. wordSize} put: def.
+  endianness `defaultsTo: Platform Current endianness.
+  def: (i Definition newNamed: 'kernel.new' endianness: endianness wordSize: wordSize).
+  dir ifNotNil: [def bootstrapDirectory: dir].
+  def cached at: {'new'. endianness. wordSize} put: def.
   def generate.
   inform: 'Generated new kernel image at: %r', def filename.
   inform: 'Suggested next command: %s -i %s', StartupArguments first, def filename.