| 1 |
|
| 2 |
:;exec ./scmlit -no-init-file -f $0 -e"(bi)" build "$@" |
| 3 |
;;;; "build" Script for compiling SCM. |
| 4 |
;; Copyright (C) 1994-2006 Free Software Foundation, Inc. |
| 5 |
;; |
| 6 |
;; This program is free software: you can redistribute it and/or modify |
| 7 |
;; it under the terms of the GNU General Public License as |
| 8 |
;; published by the Free Software Foundation, either version 3 of the |
| 9 |
;; License, or (at your option) any later version. |
| 10 |
;; |
| 11 |
;; This program is distributed in the hope that it will be useful, but |
| 12 |
;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
;; General Public License for more details. |
| 15 |
;; |
| 16 |
;; You should have received a copy of the GNU General Public |
| 17 |
;; License along with this program. If not, see |
| 18 |
;; <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
(require 'getopt) |
| 21 |
(require 'getopt-parameters) |
| 22 |
(require-if 'compiling 'posix) |
| 23 |
(require-if 'compiling 'fluid-let) |
| 24 |
(require-if 'compiling 'read-command) |
| 25 |
(require-if 'compiling 'common-list-functions) |
| 26 |
|
| 27 |
(load (in-vicinity (program-vicinity) "build.scm")) |
| 28 |
;@ |
| 29 |
(define (make-features-txi) |
| 30 |
(call-with-output-file "features.txi" |
| 31 |
(lambda (port) |
| 32 |
(((open-table build 'features) 'for-each-row-in-order) |
| 33 |
(lambda (row) |
| 34 |
(apply (lambda (name spec documentation) |
| 35 |
(display "@item " port) (display name port) (newline port) |
| 36 |
(display "@cindex " port) (display name port) (newline port) |
| 37 |
(display documentation port) (newline port) (newline port)) |
| 38 |
row)))))) |
| 39 |
;@ |
| 40 |
(define (print-manifest port) |
| 41 |
(display "@multitable @columnfractions .22 .78" port) (newline port) |
| 42 |
(((open-table build 'manifest) 'for-each-row-in-order) |
| 43 |
(lambda (row) |
| 44 |
(apply (lambda (file format category documentation) |
| 45 |
(display (string-append "@item @code{" file) port) |
| 46 |
(display "}" port) (newline port) |
| 47 |
(display (string-append "@tab " documentation) port) |
| 48 |
(newline port)) |
| 49 |
row))) |
| 50 |
(display "@end multitable" port) (newline port)) |
| 51 |
|
| 52 |
(define (append-info-node path node afile) |
| 53 |
(let ((cat (open-file afile "a"))) |
| 54 |
(do ((n (+ -1 2) (+ -1 n))) |
| 55 |
((negative? n) (close-port cat)) |
| 56 |
(newline cat))) |
| 57 |
(system (string-append "info -f " path " -n '" node "' -o - >> " afile))) |
| 58 |
;@ |
| 59 |
(define (make-readme) |
| 60 |
(require 'posix) |
| 61 |
(let ((pipe (open-output-pipe "makeinfo --no-headers -o README")) |
| 62 |
(scm-info (read-version |
| 63 |
(in-vicinity (implementation-vicinity) "patchlvl.h")))) |
| 64 |
(if (not pipe) (slib:error 'make-readme 'couldn't 'open 'pipe)) |
| 65 |
(display "\ |
| 66 |
This directory contains the distribution of scm" pipe) |
| 67 |
(display scm-info pipe) |
| 68 |
(display ". SCM conforms to |
| 69 |
Revised^5 Report on the Algorithmic Language Scheme and the IEEE P1178 |
| 70 |
specification. SCM runs under Amiga, Atari-ST, MacOS, MS-DOS, OS/2, |
| 71 |
NOS/VE, Unicos, VMS, Unix and similar systems. SCM supports the SLIB |
| 72 |
Scheme library; both SCM and SLIB are GNU packages. |
| 73 |
|
| 74 |
@center @url{http://people.csail.mit.edu/jaffer/SCM} |
| 75 |
|
| 76 |
@section Manifest |
| 77 |
" |
| 78 |
pipe) |
| 79 |
(print-manifest pipe) |
| 80 |
(close-port pipe) |
| 81 |
(set! scm-info (string-append "scm-" scm-info ".info")) |
| 82 |
(append-info-node scm-info "Distributions" "README") |
| 83 |
(append-info-node scm-info "GNU configure and make" "README") |
| 84 |
(append-info-node scm-info "Making scmlit" "README") |
| 85 |
(append-info-node scm-info "Makefile targets" "README") |
| 86 |
(append-info-node scm-info "Building SCM" "README") |
| 87 |
(append-info-node scm-info "Invoking Build" "README") |
| 88 |
(append-info-node scm-info "Build Options" "README") |
| 89 |
(append-info-node scm-info "Saving Executable Images" "README") |
| 90 |
(append-info-node scm-info "Installation" "README") |
| 91 |
(append-info-node scm-info "Problems Compiling" "README") |
| 92 |
(append-info-node scm-info "Problems Linking" "README") |
| 93 |
(append-info-node scm-info "Problems Starting" "README") |
| 94 |
(append-info-node scm-info "Problems Running" "README") |
| 95 |
(append-info-node scm-info "Reporting Problems" "README") |
| 96 |
(append-info-node scm-info "Editing Scheme Code" "README"))) |
| 97 |
|
| 98 |
(define build:csv (make-command-server build '*commands*)) |
| 99 |
(define (build-from-argv) |
| 100 |
(define command (string->symbol (list-ref *argv* *optind*))) |
| 101 |
(define getopt- getopt--) |
| 102 |
(require 'fluid-let) |
| 103 |
(fluid-let ((getopt-- |
| 104 |
(lambda (optstring) |
| 105 |
(let* ((opt (getopt- (string-append optstring "f:-:")))) |
| 106 |
(cond ((eqv? |
| 107 |
(let () |
| 108 |
(require 'read-command) |
| 109 |
(require 'common-list-functions) |
| 110 |
(set! *argv* (append (butnthcdr *optind* *argv*) |
| 111 |
(read-options-file *optarg*) |
| 112 |
(nthcdr *optind* *argv*)))))) |
| 113 |
opt)))) |
| 114 |
(cond |
| 115 |
((pair? *argv*) |
| 116 |
(set! *optind* (+ 1 *optind*)) |
| 117 |
(build:csv |
| 118 |
command |
| 119 |
(lambda (comname comval options positions arities types |
| 120 |
defaulters checks aliases) |
| 121 |
(let* ((params (getopt->parameter-list options arities types aliases)) |
| 122 |
(fparams (and params (fill-empty-parameters defaulters params)))) |
| 123 |
(cond ((not (list? params)) |
| 124 |
;;(slib:warn 'build-from-argv 'not-parameters? fparams) |
| 125 |
|
| 126 |
((not (check-parameters checks fparams)) |
| 127 |
(slib:warn 'build-from-argv 'check-parameters 'failed) |
| 128 |
#f) |
| 129 |
((not (check-arities (map arity->arity-spec arities) fparams)) |
| 130 |
(slib:error 'build-from-argv 'bad 'arity fparams) |
| 131 |
(else (comval fparams)))))))))) |
| 132 |
;@ |
| 133 |
(define (build-from-whole-argv argv) |
| 134 |
(if (string? argv) |
| 135 |
(let () |
| 136 |
(require 'read-command) |
| 137 |
(set! argv (call-with-input-string argv read-command)))) |
| 138 |
(set! *optind* 0) |
| 139 |
(set! *optarg* #f) |
| 140 |
(set! *argv* argv) |
| 141 |
(build-from-argv)) |
| 142 |
|
| 143 |
;;;@ Used when invoked as script |
| 144 |
(define (bi) (exit (and (build-from-argv) #t))) |
| 145 |
;@ |
| 146 |
(define b build-from-whole-argv) |
| 147 |
;@ |
| 148 |
(define (b*) |
| 149 |
(require 'read-command) |
| 150 |
(do ((e (read-command) (read-command))) |
| 151 |
((eof-object? e)) |
| 152 |
(cond ((null? e)) |
| 153 |
(else |
| 154 |
(cond ((not (string-ci=? (car e) "build")) |
| 155 |
(set! e (cons "build" e)))) |
| 156 |
(write (build-from-whole-argv e)) |
| 157 |
(newline))) |
| 158 |
(display "build> ") |
| 159 |
(force-output))) |
| 160 |
|
| 161 |
(cond (*interactive* |
| 162 |
(display "type (b \"build <command-line>\") to build") (newline) |
| 163 |
(display "type (b*) to enter build command loop") (newline))) |
| 164 |
|
| 165 |
;;; Local Variables: |
| 166 |
;;; mode:scheme |
| 167 |
;;; End: |