home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t3_1 / risc_src.lha / risc_sources / mipsco / mipscobuild.t < prev   
Encoding:
Text File  |  1990-10-16  |  6.4 KB  |  178 lines

  1. (herald mipscobuild)
  2.  
  3. #|
  4.  
  5. To build a new system from sources:
  6.  
  7. 1. You should be in a directory with sources and tsystem as subdirectories
  8.    Execute the shell script in tsystem/envset
  9. 2. Start up tsystem/xt and load this file into orbit-env
  10. 3. (compile-support) and (exit)
  11. 4. Start up tsystem/xt again and load this file into orbit-env
  12. 5. (compile-sources) and (link-t '(tsystem new)) and (exit)
  13. 6. cd tsystem; linkt new.o new; cd ..
  14. 7. tsystem/new is a T without compiler. Start up new with a large heap.
  15. 8. ((*value t-implementation-env 'load-and-suspend-system) '(tsystem new) t)
  16.    (exit)
  17. 9. cd tsystem; linkt new.o new    That's it.
  18.  
  19. To cross compile for a big-endian machine on a little-endian machine:
  20.   On little-endian machine:
  21.     cd to this directory (mipsco)
  22.     % so envset
  23.     In a fresh T: (load 'mipscobuild orbit-env), (compile-support), (exit).
  24.     % (cd ../comp/primops; cp -p *.mbi boot;
  25.        cd boot; ln -s ../{base,mipsconstants}.t .)
  26.     T: (load 'mipscobuild orbit-env),
  27.        (compile-primops 'boot), (compile-sources 'boot), (exit).
  28.     T: (load 'mipscobuild orbit-env), (link-t '(tsystem new)), (exit).
  29.     Copy resulting new.o to target machine and ./linkt new.o new
  30.     Move all *.mb? files over to target machine
  31.   On target big-endian machine:
  32.     cd to this directory
  33.     Compile *.[sc]
  34.     % ./new: ((*value t-implementation-env 'load-and-suspend-system)
  35.         '(tsystem xt) t), (exit)
  36.     % ./linkt xt.o xt
  37.  
  38. |#
  39.  
  40.  
  41. ;;; Build compiler early binding environment
  42.  
  43. (define (set-endian x)
  44.     (let ((new-mipsis (xcase x ((big) 'be_mipsis) ((little) 'le_mipsis)))
  45.       (old-mipsis (xcase x ((big) 'le_mipsis) ((little) 'be_mipsis))))
  46.     (let ((x (mem equal? `(assembler ,old-mipsis) *tas-mips-files*)))
  47.         (if x
  48.         (set (cadar x) new-mipsis))))
  49.     (lset *endian* x))
  50.  
  51. (define (orbit-mips-setup directory)
  52.     (set-endian 'big)
  53.     (set *object-file-extension* 'mbo)
  54.     (set *information-file-extension* 'mbi)
  55.     (set *noise-file-extension* 'mbn)
  56.     (set *debug-file-extension* 'mbd)
  57.     (orbit-setup directory)
  58.     (set (table-entry *modules* 'constants) `(,directory mipsconstants))
  59.     (set (table-entry *modules* 'primops)   `(,directory mipsprimops))
  60.     (set (table-entry *modules* 'arith)     `(,directory mipsarith))
  61.     (set (table-entry *modules* 'low)       `(,directory mipslow))
  62.     (set (table-entry *modules* 'genarith)     `(,directory mipsgenarith))
  63.     nil)
  64.  
  65. (*define user-env 'compile-support
  66.     (lambda ()
  67.     (orbit-mips-setup 't3_primops)
  68.     (create-support '(t3_primops mipsconstants)
  69.             '(t3_primops mipsconstants))
  70.     (load '(t3_primops mipsconstants t) orbit-env)
  71.     (orbit-init 'base)
  72.     (set (orbit-syntax-table) primop-syntax-table)
  73.     (set *compile-primops?* nil)
  74.     (create-support '(t3_primops mipsprimops)  '(t3_primops mipsprimops))
  75.     (create-support '(t3_primops mipsarith)    '(t3_primops mipsarith))
  76.     (create-support '(t3_primops locations)    '(t3_primops locations))
  77.     (create-support '(t3_primops mipslow)      '(t3_primops mipslow))
  78.     (create-support '(t3_primops predicates)   '(t3_primops predicates))
  79.     (orbit-init 'base
  80.             'constants 'primops 'arith 'locations 'low 'predicates)
  81.     (create-support '(t3_primops open)         '(t3_primops open))
  82.     (create-support '(t3_primops aliases)      '(t3_primops aliases))
  83.     (create-support '(t3_primops carcdr)       '(t3_primops carcdr))
  84.     (create-support '(t3_primops mipsgenarith) '(t3_primops mipsgenarith))))
  85.  
  86.  
  87. ;;; compile compiler code in early binding environment, runtime system
  88.  
  89. (define (compile-primops dir)
  90.     (set (orbit-syntax-table) primop-syntax-table)
  91.     (comfile `(,dir base))
  92.     (compile-primop-source `(,dir mipsprimops mbi))
  93.     (compile-primop-source `(,dir mipsarith mbi))
  94.     (compile-primop-source `(,dir locations mbi))
  95.     (compile-primop-source `(,dir mipslow mbi))
  96.     (compile-primop-source `(,dir mipsgenarith mbi)))
  97.  
  98. (*define user-env 'compile-sources
  99.     (lambda boot-primops
  100.     (comfile '(assembler be_mipsis))
  101.     (load '(assembler be_mipsis) orbit-env)
  102.     (orbit-mips-init (if boot-primops (car boot-primops) 't3_primops))
  103.     (compile-primops 't3_primops)
  104.     (set *compile-primops?* nil)
  105.     (set (table-entry *modules* 'bignum) '(osys risc_bignum))
  106.     (load-quietly '(t3_primops mipsconstants t) orbit-env)
  107.     (set (orbit-syntax-table) (env-syntax-table t-implementation-env))
  108.     (define (comsys system . start)
  109.         (walk (lambda (file)
  110.               (xcase (car file)
  111.                  ((osys)
  112.                   (set (tc-syntax-table) (env-syntax-table t-implementation-env))
  113.                   (comfile file))
  114.                  ((t3_primops)
  115.                   (set (tc-syntax-table) primop-syntax-table)
  116.                   (bind ((write-support-file false))
  117.                   (comfile file)))))
  118.           (let ((files (xcase system
  119.                       ((z) *zvm-system*)
  120.                       ((t) *t-system*))))
  121.               (if start (mem alikev? (car start) files) files))))
  122.     (load '(osys mipsco_files) orbit-env)
  123.     (comsys 't)
  124.     (comfile '(link defs))
  125.     (comfile '(link linker))
  126.     (comfile '(link mipsco_link))
  127.     (comfile '(link lp_table))
  128.     (comfile '(link suspend))
  129.     (comfile '(link mipscosuspend))
  130.     (comfile '(tscheme scheme))
  131.     (comfile '(tscheme syntax))
  132.     (comfile '(tscheme system))
  133.     (comfile '(tscheme runtime))
  134.     (comfile '(tscheme compiler))
  135.     (set (tc-syntax-table) (env-syntax-table orbit-env))
  136.     (comfile '(front_end mipscofix))
  137.     (walk comfile
  138.           (append *orbit-files*
  139.               *top-files*
  140.               *front-files*
  141.               *back-end-files*
  142.               *orbit-mips-files*
  143.               *tas-mips-files*))))
  144.  
  145. (*define user-env 'compile-setup
  146.     (lambda boot-primops
  147.     ;; For hand-compiling single files with COMFILE
  148.     (load '(assembler be_mipsis) orbit-env)
  149.     (orbit-mips-init (if boot-primops (car boot-primops) 't3_primops))
  150.     (set *compile-primops?* nil)
  151.     (set (table-entry *modules* 'bignum) '(osys risc_bignum))
  152.     (load-quietly '(t3_primops mipsconstants t) orbit-env)
  153.     (set (orbit-syntax-table) (env-syntax-table t-implementation-env))))
  154.  
  155.  
  156. (define (load-linker . system)
  157.     (let* ((system (if (null? system) 
  158.                ((*value t-implementation-env 'machine-type) 
  159.             ((*value t-implementation-env 'local-machine)))
  160.                (car system)))
  161.        (link-env (make-locale orbit-env 'link-env)))
  162.     (*define standard-env 'link-env link-env)
  163.     (load '(link defs) link-env)
  164.     (load '(link linker) link-env)
  165.     (load '(link mipsco_link) link-env)
  166.     (load '(t3_primops mipsconstants t) link-env)
  167.     (*define standard-env 'link
  168.         (lambda (files outfile)
  169.         (set (repl-results) nil)
  170.         (gc)
  171.         ((*value link-env 'link) files outfile)))))
  172.  
  173. (*define user-env 'link-t
  174.     (lambda (file)
  175.     (load-linker 'mipsco)
  176.     (load '(osys mipsco_files) orbit-env)
  177.     (link *t-system* file)))
  178.