[compile scripts update atsmyles@earthlink.net**20090429201453 Broke up the compile scripts into 2. The first script creates the r6rs.o1 dynamically loaded library which includes the core library. The second script creates the standard libraries included in the release. ] hunk ./compile 1 -#!/usr/bin/gsc-script -i -; vim: syntax=scheme -(load "~~lib/syntax-case") -(current-readtable (readtable-eval-allowed?-set (current-readtable) #t)) -(define CC "gcc") -;directories -(define tmp-dir (string-append "/tmp/r6rs-expand-" (number->string (inexact->exact (floor (time->seconds (current-time))))))) -;prefix is just the directory it's under. -(define gambit-libraries-prefix "gambit") -(define srfi-libraries-prefix "srfi") -(define standard-libraries-prefix "rnrs") -(define misc-libraries-prefix "") -(define core-library-name "r6rs") -(define standard-library-name "r6rs-stdlib") -(define result-path "~/.gambit/lib") - -(define (display* . args) - (for-each (lambda (x) (display x)) args) - (newline)) - -(define (path-expand* dir . files) - (map (lambda (x) (path-expand x dir)) files)) - -(define core-libraries (path-expand* "libs/core" "core.scm" "r5rs.scm" "records.scm" "hashtables.scm")) - -(define gambit-libraries - (path-expand* "libs/gambit/" "records.scm" "io.readtable.scm" "io.scm" "threads.scm" "time.scm" "hashing.scm" "will.scm" "table.scm" "exceptions.scm" "files.scm" "programs.scm" "extensions.scm" "bytevectors.scm" "debug.scm")) - -(define srfi-libraries - (path-expand* "libs/srfi/" "srfi-0.scm" "srfi-2.scm" "srfi-21.scm" "srfi-18.scm" "srfi-23.scm" "srfi-27.scm" "srfi-39.scm" "srfi-4.scm" "srfi-6.scm" "srfi-69.scm" "srfi-8.scm" "srfi-88.scm" "srfi-89.scm" "srfi-99.scm" "srfi-9.scm")) - -(define standard-libraries0 - (path-expand* "libs/rnrs/" "exceptions.scm" "conditions.scm" "base.scm" "records.scm" "syntax-case.scm" "control.scm" "hashtables.scm" "lists.scm" "enumerations.scm" "arithmetic.scm" "bytevectors.scm" "eval.scm" "r5rs.scm" "mutable.scm")) - -(define standard-libraries - (path-expand* "libs/rnrs/" "io.scm" "files.scm" "sorting.scm" "programs.scm" "rnrs.scm" "load.scm")) - -(define unicode-libraries - (path-expand* "libs/rnrs/unicode/" "unicode0.scm" "unicode1.scm" "unicode2.scm" "unicode3.scm" "unicode4.scm" "unicode.scm")) - -(define misc-libraries (path-expand* "libs/" "ieee.scm" "renaming.scm")) - - -(define (expand-all files from-dir prefix to-dir) - (let ((to-files (map (lambda (x) (path-expand (string-append prefix "-" x) to-dir)) files)) - (from-files (map (lambda (x) (path-expand x from-dir)) files))) - (for-each ex:expand-file from-files to-files) - to-files)) - - (define (compile-r6rs-base . files) - (let* [(filenames (map path-strip-extension (map path-strip-directory files))) - (link-file (string-append core-library-name ".o1.c")) - (object-file (string-append core-library-name ".o1")) - (gcc (string-append CC " " - (if (memq 'apple (system-type)) "-bundle" "-shared") - " -D___DYNAMIC -I" - (path-expand "~~/include") - " " (apply string-append (map (lambda (file) (string-append " " file ".c")) filenames)) - " " link-file - " -o " (path-expand object-file result-path)))] - (for-each (lambda (file) - (compile-file-to-c file options: '(debug) output: tmp-dir)) files) - (parameterize [(current-directory tmp-dir)] - (link-flat filenames output: link-file) - (display* "executing command: " gcc) - (shell-command gcc)))) - -(create-directory tmp-dir) -(display* "generating r6rs. This may take a while. Coffee break!") -(load "err5rs-records-inspection.scm") -(load "err5rs-records-procedural.scm") -(load "error.scm") -(load "srfi-69") -(load "compat-gambit.scm") -(load "runtime.scm") -(load "expander.scm") -(load "primitives.scm") - -(let ( - (core-file (path-expand "core.exp" tmp-dir)) - (expander-file (path-expand "expander.scm" tmp-dir)) - (result-file (path-expand "r6rs.exp" tmp-dir)) - (files->string (lambda (files) (apply string-append - (map (lambda (file) (string-append file " ")) files))))) - (display* "expanding core libraries") - (apply ex:expand-file* core-file core-libraries) - -(display* "compiling libraries") - (for-each (lambda (filename) - (display* "compiling " filename) - (ex:compile-file filename options: '(debug))) - (append gambit-libraries standard-libraries0 unicode-libraries standard-libraries srfi-libraries misc-libraries)) - - - - (display* "expanding expander") - ;TODO expand expander.scm with r5rs library instead of rnrs base - (ex:expand-r5rs-file "expander.scm" expander-file (ex:environment '(except (r5rs) eval))) - - (display* "creating core") - (compile-r6rs-base - (path-expand "err5rs-records-inspection.scm") - (path-expand "err5rs-records-procedural.scm") - (path-expand "error.scm") - (path-expand "srfi-69") - (path-expand "compat-gambit.scm") - (path-expand "runtime.scm") - core-file - expander-file - (path-expand "primitives.scm")) - -) -(display* "done") - rmfile ./compile addfile ./compile-r6rs hunk ./compile-r6rs 1 +#!/usr/bin/gsc-script -i +; vim: syntax=scheme + +(current-readtable (readtable-eval-allowed?-set (current-readtable) #t)) +(define CC "gcc") +;directories +(define tmp-dir (string-append "/tmp/r6rs-expand-" (number->string (inexact->exact (floor (time->seconds (current-time))))))) +;prefix is just the directory it's under. +(define gambit-libraries-prefix "gambit") +(define srfi-libraries-prefix "srfi") +(define standard-libraries-prefix "rnrs") +(define misc-libraries-prefix "") +(define core-library-name "r6rs") +(define standard-library-name "r6rs-stdlib") + + +(define (display* . args) + (for-each (lambda (x) (display x)) args) + (newline)) + +(define (path-expand* dir . files) + (map (lambda (x) (path-expand x dir)) files)) + +(define core-libraries (path-expand* "libs/core" "core.scm" "r5rs.scm" "records.scm" "hashtables.scm")) + +(define (compile-files-to-c . files) + (for-each (lambda (file) + (compile-file-to-c file options: '(debug) output: tmp-dir)) files)) + +(define (expand-all files from-dir prefix to-dir) + (let ((to-files (map (lambda (x) (path-expand (string-append prefix "-" x) to-dir)) files)) + (from-files (map (lambda (x) (path-expand x from-dir)) files))) + (for-each ex:expand-file from-files to-files) + to-files)) + +(define (compile-r6rs-base . files) + (define result-path "~/.gambit/lib") + (let* [(filenames (map path-strip-extension (map path-strip-directory files))) + (link-file (string-append core-library-name ".o1.c")) + (object-file (string-append core-library-name ".o1")) + (gcc (string-append CC " " + (if (memq 'apple (system-type)) "-bundle" "-shared") + " -D___DYNAMIC -I" + (path-expand "~~/include") + " " (apply string-append (map (lambda (file) (string-append " " file ".c")) filenames)) + " " link-file + " -o " (path-expand object-file result-path)))] + (parameterize [(current-directory tmp-dir)] + (link-flat filenames output: link-file) + (display* "executing command: " gcc) + (shell-command gcc)))) + +(create-directory tmp-dir) +(display* "generating r6rs. This may take a while. Coffee break!") +(display* "creating stage") + +(define stage-files (list + (path-expand "err5rs-records-inspection.scm") + (path-expand "err5rs-records-procedural.scm") + (path-expand "error.scm") + (path-expand "srfi-69.scm") + (path-expand "compat-gambit.scm") + (path-expand "runtime.scm"))) + +(define play-files (list (path-expand "core.exp" tmp-dir) (path-expand "expander.scm" tmp-dir) (path-expand "primitives.scm"))) + +(apply compile-files-to-c stage-files) + +(display* "creating expander") +(for-each (lambda (file) (load file)) stage-files) +(load "~~lib/syntax-case") +(load "expander.scm") +(load "primitives.scm") + + (apply ex:expand-file* (car play-files) core-libraries) + (ex:expand-r5rs-file "expander.scm" (cadr play-files) (ex:environment '(except (r5rs) eval))) + (apply compile-files-to-c play-files) + +(apply compile-r6rs-base (append stage-files play-files)) + + +(display* "done") + addfile ./compile-r6rs-libs hunk ./compile-r6rs-libs 1 +#!/usr/bin/gsc-script -i +; vim: syntax=scheme + +(r6rs) +;prefix is just the directory it's under. +(define gambit-libraries-prefix "gambit") +(define srfi-libraries-prefix "srfi") +(define standard-libraries-prefix "rnrs") +(define misc-libraries-prefix "") +(define standard-library-name "r6rs-stdlib") +(define result-path "~/.gambit/lib") + +(define (display* . args) + (for-each (lambda (x) (display x)) args) + (newline)) + +(define (path-expand* dir . files) + (map (lambda (x) (path-expand x dir)) files)) + + +(define gambit-libraries + (path-expand* "libs/gambit/" "records.scm" "io.readtable.scm" "io.scm" "threads.scm" "time.scm" "hashing.scm" "will.scm" "table.scm" "exceptions.scm" "files.scm" "programs.scm" "extensions.scm" "bytevectors.scm" "debug.scm")) + +(define srfi-libraries + (path-expand* "libs/srfi/" "srfi-0.scm" "srfi-2.scm" "srfi-21.scm" "srfi-18.scm" "srfi-23.scm" "srfi-27.scm" "srfi-39.scm" "srfi-4.scm" "srfi-6.scm" "srfi-69.scm" "srfi-8.scm" "srfi-88.scm" "srfi-89.scm" "srfi-99.scm" "srfi-9.scm")) + +(define standard-libraries0 + (path-expand* "libs/rnrs/" "exceptions.scm" "conditions.scm" "base.scm" "records.scm" "syntax-case.scm" "control.scm" "hashtables.scm" "lists.scm" "enumerations.scm" "arithmetic.scm" "bytevectors.scm" "eval.scm" "r5rs.scm" "mutable.scm")) + +(define standard-libraries + (path-expand* "libs/rnrs/" "io.scm" "files.scm" "sorting.scm" "programs.scm" "rnrs.scm" "load.scm")) + +(define unicode-libraries + (path-expand* "libs/rnrs/unicode/" "unicode0.scm" "unicode1.scm" "unicode2.scm" "unicode3.scm" "unicode4.scm" "unicode.scm")) + +(define misc-libraries (path-expand* "libs/" "ieee.scm" "renaming.scm")) + + + + + +(display* "compiling libraries") +(for-each (lambda (filename) + (display* "compiling " filename) + (ex:compile-file filename options: '(debug))) + (append gambit-libraries standard-libraries0 unicode-libraries standard-libraries srfi-libraries misc-libraries)) + + +(display* "done") +