home *** CD-ROM | disk | FTP | other *** search
- (herald mipscobuild)
-
- #|
-
- To build a new system from sources:
-
- 1. You should be in a directory with sources and tsystem as subdirectories
- Execute the shell script in tsystem/envset
- 2. Start up tsystem/xt and load this file into orbit-env
- 3. (compile-support) and (exit)
- 4. Start up tsystem/xt again and load this file into orbit-env
- 5. (compile-sources) and (link-t '(tsystem new)) and (exit)
- 6. cd tsystem; linkt new.o new; cd ..
- 7. tsystem/new is a T without compiler. Start up new with a large heap.
- 8. ((*value t-implementation-env 'load-and-suspend-system) '(tsystem new) t)
- (exit)
- 9. cd tsystem; linkt new.o new That's it.
-
- To cross compile for a big-endian machine on a little-endian machine:
- On little-endian machine:
- cd to this directory (mipsco)
- % so envset
- In a fresh T: (load 'mipscobuild orbit-env), (compile-support), (exit).
- % (cd ../comp/primops; cp -p *.mbi boot;
- cd boot; ln -s ../{base,mipsconstants}.t .)
- T: (load 'mipscobuild orbit-env),
- (compile-primops 'boot), (compile-sources 'boot), (exit).
- T: (load 'mipscobuild orbit-env), (link-t '(tsystem new)), (exit).
- Copy resulting new.o to target machine and ./linkt new.o new
- Move all *.mb? files over to target machine
- On target big-endian machine:
- cd to this directory
- Compile *.[sc]
- % ./new: ((*value t-implementation-env 'load-and-suspend-system)
- '(tsystem xt) t), (exit)
- % ./linkt xt.o xt
-
- |#
-
-
- ;;; Build compiler early binding environment
-
- (define (set-endian x)
- (let ((new-mipsis (xcase x ((big) 'be_mipsis) ((little) 'le_mipsis)))
- (old-mipsis (xcase x ((big) 'le_mipsis) ((little) 'be_mipsis))))
- (let ((x (mem equal? `(assembler ,old-mipsis) *tas-mips-files*)))
- (if x
- (set (cadar x) new-mipsis))))
- (lset *endian* x))
-
- (define (orbit-mips-setup directory)
- (set-endian 'big)
- (set *object-file-extension* 'mbo)
- (set *information-file-extension* 'mbi)
- (set *noise-file-extension* 'mbn)
- (set *debug-file-extension* 'mbd)
- (orbit-setup directory)
- (set (table-entry *modules* 'constants) `(,directory mipsconstants))
- (set (table-entry *modules* 'primops) `(,directory mipsprimops))
- (set (table-entry *modules* 'arith) `(,directory mipsarith))
- (set (table-entry *modules* 'low) `(,directory mipslow))
- (set (table-entry *modules* 'genarith) `(,directory mipsgenarith))
- nil)
-
- (*define user-env 'compile-support
- (lambda ()
- (orbit-mips-setup 't3_primops)
- (create-support '(t3_primops mipsconstants)
- '(t3_primops mipsconstants))
- (load '(t3_primops mipsconstants t) orbit-env)
- (orbit-init 'base)
- (set (orbit-syntax-table) primop-syntax-table)
- (set *compile-primops?* nil)
- (create-support '(t3_primops mipsprimops) '(t3_primops mipsprimops))
- (create-support '(t3_primops mipsarith) '(t3_primops mipsarith))
- (create-support '(t3_primops locations) '(t3_primops locations))
- (create-support '(t3_primops mipslow) '(t3_primops mipslow))
- (create-support '(t3_primops predicates) '(t3_primops predicates))
- (orbit-init 'base
- 'constants 'primops 'arith 'locations 'low 'predicates)
- (create-support '(t3_primops open) '(t3_primops open))
- (create-support '(t3_primops aliases) '(t3_primops aliases))
- (create-support '(t3_primops carcdr) '(t3_primops carcdr))
- (create-support '(t3_primops mipsgenarith) '(t3_primops mipsgenarith))))
-
-
- ;;; compile compiler code in early binding environment, runtime system
-
- (define (compile-primops dir)
- (set (orbit-syntax-table) primop-syntax-table)
- (comfile `(,dir base))
- (compile-primop-source `(,dir mipsprimops mbi))
- (compile-primop-source `(,dir mipsarith mbi))
- (compile-primop-source `(,dir locations mbi))
- (compile-primop-source `(,dir mipslow mbi))
- (compile-primop-source `(,dir mipsgenarith mbi)))
-
- (*define user-env 'compile-sources
- (lambda boot-primops
- (comfile '(assembler be_mipsis))
- (load '(assembler be_mipsis) orbit-env)
- (orbit-mips-init (if boot-primops (car boot-primops) 't3_primops))
- (compile-primops 't3_primops)
- (set *compile-primops?* nil)
- (set (table-entry *modules* 'bignum) '(osys risc_bignum))
- (load-quietly '(t3_primops mipsconstants t) orbit-env)
- (set (orbit-syntax-table) (env-syntax-table t-implementation-env))
- (define (comsys system . start)
- (walk (lambda (file)
- (xcase (car file)
- ((osys)
- (set (tc-syntax-table) (env-syntax-table t-implementation-env))
- (comfile file))
- ((t3_primops)
- (set (tc-syntax-table) primop-syntax-table)
- (bind ((write-support-file false))
- (comfile file)))))
- (let ((files (xcase system
- ((z) *zvm-system*)
- ((t) *t-system*))))
- (if start (mem alikev? (car start) files) files))))
- (load '(osys mipsco_files) orbit-env)
- (comsys 't)
- (comfile '(link defs))
- (comfile '(link linker))
- (comfile '(link mipsco_link))
- (comfile '(link lp_table))
- (comfile '(link suspend))
- (comfile '(link mipscosuspend))
- (comfile '(tscheme scheme))
- (comfile '(tscheme syntax))
- (comfile '(tscheme system))
- (comfile '(tscheme runtime))
- (comfile '(tscheme compiler))
- (set (tc-syntax-table) (env-syntax-table orbit-env))
- (comfile '(front_end mipscofix))
- (walk comfile
- (append *orbit-files*
- *top-files*
- *front-files*
- *back-end-files*
- *orbit-mips-files*
- *tas-mips-files*))))
-
- (*define user-env 'compile-setup
- (lambda boot-primops
- ;; For hand-compiling single files with COMFILE
- (load '(assembler be_mipsis) orbit-env)
- (orbit-mips-init (if boot-primops (car boot-primops) 't3_primops))
- (set *compile-primops?* nil)
- (set (table-entry *modules* 'bignum) '(osys risc_bignum))
- (load-quietly '(t3_primops mipsconstants t) orbit-env)
- (set (orbit-syntax-table) (env-syntax-table t-implementation-env))))
-
-
- (define (load-linker . system)
- (let* ((system (if (null? system)
- ((*value t-implementation-env 'machine-type)
- ((*value t-implementation-env 'local-machine)))
- (car system)))
- (link-env (make-locale orbit-env 'link-env)))
- (*define standard-env 'link-env link-env)
- (load '(link defs) link-env)
- (load '(link linker) link-env)
- (load '(link mipsco_link) link-env)
- (load '(t3_primops mipsconstants t) link-env)
- (*define standard-env 'link
- (lambda (files outfile)
- (set (repl-results) nil)
- (gc)
- ((*value link-env 'link) files outfile)))))
-
- (*define user-env 'link-t
- (lambda (file)
- (load-linker 'mipsco)
- (load '(osys mipsco_files) orbit-env)
- (link *t-system* file)))
-