summaryrefslogtreecommitdiffstats
path: root/build.scm
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2004-12-07 23:23:48 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:28 -0800
commit37f2f5e0bb11a18deecf48c7ad6bcbf7bd932db2 (patch)
tree692caebb60ec5f80ce528a403b69351ca756d530 /build.scm
parente21d47d7813159bb71e0671df9b52ec0470c358d (diff)
parentc7d035ae1a729232579a0fe41ed5affa131d3623 (diff)
downloadscm-37f2f5e0bb11a18deecf48c7ad6bcbf7bd932db2.tar.gz
scm-37f2f5e0bb11a18deecf48c7ad6bcbf7bd932db2.zip
Import Debian changes 5d9-4.1debian/5d9-4.1
scm (5d9-4.1) unstable; urgency=high * Non-maintainer upload. * High-urgency upload for sarge-targetted RC bugfix. * Revert upstream "CAUTIOUS" define, which causes the scm build to fail its test suite on alpha (and, it appears, powerpc as well). Closes: #245810. scm (5d9-4) unstable; urgency=low * Apply patch from 144062 to fix hppa build (Closes: #144062) * Change scm.1 section from Jan 4 200 to 1. (lintian) scm (5d9-3) unstable; urgency=low * Properly clean up info files. * Make and install Xlibscm.info. scm (5d9-2) unstable; urgency=low * Fix path problem in slibcat. Hack at mklibcat.scm. (Closes: #241510) scm (5d9-1) unstable; urgency=low * New upstream release * Merge NMU sparc changes (Closes: #191171, #191356) * SHORT_INT is defined for ia64 upstream (Closes: #141928) * Scheme imps now grouped in info file (has been for a while) (Closes: #115452)
Diffstat (limited to 'build.scm')
-rw-r--r--build.scm481
1 files changed, 358 insertions, 123 deletions
diff --git a/build.scm b/build.scm
index 63249b3..e74cfff 100644
--- a/build.scm
+++ b/build.scm
@@ -1,18 +1,36 @@
-;;; "build.scm" Build database and program -*-scheme-*-
-;;; Copyright (C) 1994-2002 Aubrey Jaffer.
-;;; See the file `COPYING' for terms applying to this program.
+;; "build.scm" Build database and program -*-scheme-*-
+;; Copyright (C) 1994-2003 Aubrey Jaffer.
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2 of the License, or (at
+;; your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program; if not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(require 'parameters)
(require 'databases)
(require 'database-commands)
+(require 'alist)
+(require 'common-list-functions)
+(require 'object->string)
+(require 'glob)
+(require 'batch)
+(require-if 'compiling 'posix-time)
+;@
(set! OPEN_WRITE "w") ; Because MS-DOS scripts need ^M
-
+;@
(define build (add-command-tables (create-database #f 'alist-table)))
-(require 'glob)
-(require 'batch)
(batch:initialize! build)
-((((build 'open-table) 'batch-dialect #t) 'row:insert)
+(((open-table! build 'batch-dialect) 'row:insert)
'(default-for-platform 0))
;;;; This first part is about SCM files and features.
@@ -98,6 +116,7 @@
("ramap.c" c-source optional "array mapping")
("dynl.c" c-source optional "dynamically load object files.")
("sc2.c" c-source linkable "procedures from R2RS and R3RS not in R4RS.")
+ ("byte.c" c-source linkable "strings as bytes.")
("rgx.c" c-source linkable "string regular expression match.")
("crs.c" c-source linkable "interactive terminal control.")
("split.scm" Scheme test "example use of crs.c. Input, output, and diagnostic output directed to separate windows.")
@@ -142,14 +161,14 @@
(documentation string))
((none () "No features"))))
-(for-each (build 'add-domain)
- '((optstring #f (lambda (x) (or (not x) (string? x))) string #f)
- (filename #f #f string #f)
- (features features #f symbol #f)
- (build-whats build-whats #f symbol #f)))
+(define-domains build
+ '(optstring #f (lambda (x) (or (not x) (string? x))) string #f)
+ '(filename #f #f string #f)
+ '(features features #f symbol #f)
+ '(build-whats build-whats #f symbol #f))
(define define-build-feature
- (let ((defeature (((build 'open-table) 'features #t) 'row:insert)))
+ (let ((defeature ((open-table! build 'features) 'row:insert)))
(lambda args
(defeature (append args (list (comment)))))))
@@ -222,7 +241,7 @@
#;array-map! and array-for-each (arrays must also be featured).
(define-build-feature
'array-for-each
- '((c-file "ramap.c") (init "init_ramap")))
+ '((c-file "ramap.c") (compiled-init "init_ramap")))
#;Use if you want floating point numbers.
(define-build-feature
@@ -268,11 +287,16 @@
'rev2-procedures
'((c-file "sc2.c") (init "init_sc2")))
+#;Treating strings as byte-vectors.
+(define-build-feature
+ 'byte
+ '((c-file "byte.c") (init "init_byte")))
+
#;The Record package provides a facility for user to define their own
#;record data types. See SLIB for documentation.
(define-build-feature
'record
- '((define "CCLO") (c-file "record.c") (init "init_record")))
+ '((define "CCLO") (c-file "record.c") (compiled-init "init_record")))
#;Use if you want to use compiled closures.
(define-build-feature
@@ -282,7 +306,7 @@
#;@code{make_gsubr} for arbitrary (< 11) arguments to C functions.
(define-build-feature
'generalized-c-arguments
- '((c-file "gsubr.c") (init "init_gsubr")))
+ '((c-file "gsubr.c") (compiled-init "init_gsubr")))
#;Use if you want the ticks and ticks-interrupt functions.
(define-build-feature
@@ -315,7 +339,7 @@
#;For the @dfn{curses} screen management package.
(define-build-feature
'curses
- '((c-file "crs.c") (c-lib curses) (init "init_crs")))
+ '((c-file "crs.c") (c-lib curses) (compiled-init "init_crs")))
#;interface to the editline or GNU readline library.
(define-build-feature
@@ -330,25 +354,25 @@
#;String regular expression matching.
(define-build-feature
'regex
- '((c-file "rgx.c") (c-lib regex) (init "init_rgx")))
+ '((c-file "rgx.c") (c-lib regex) (compiled-init "init_rgx")))
#;BSD @dfn{socket} interface.
(define-build-feature
'socket
- '((c-lib socket) (c-file "socket.c") (init "init_socket")))
+ '((c-lib socket) (c-file "socket.c") (compiled-init "init_socket")))
#;Posix functions available on all @dfn{Unix-like} systems. fork and
#;process functions, user and group IDs, file permissions, and
#;@dfn{link}.
(define-build-feature
'posix
- '((c-file "posix.c") (init "init_posix")))
+ '((c-file "posix.c") (compiled-init "init_posix")))
#;Those unix features which have not made it into the Posix specs:
#;nice, acct, lstat, readlink, symlink, mknod and sync.
(define-build-feature
'unix
- '((c-file "unix.c") (init "init_unix")))
+ '((c-file "unix.c") (compiled-init "init_unix")))
#;Microsoft Windows executable.
(define-build-feature
@@ -396,15 +420,15 @@
(define-tables build
'(processor-family
- ((family atom))
+ ((family symbol))
((also-runs processor-family))
((*unknown* #f)
- (8086 #f)
+ (i8086 #f)
(acorn #f)
(alpha #f)
(cray #f)
(hp-risc #f)
- (i386 8086)
+ (i386 i8086)
(m68000 #f)
(m68030 m68000)
(mips #f)
@@ -430,7 +454,7 @@
((*unknown* *unknown* unix cc ) ;ld
(acorn-unixlib acorn *unknown* cc ) ;link
(aix powerpc aix cc ) ;cc
- (alpha alpha osf1 cc ) ;cc
+ (osf1 alpha unix cc ) ;cc
(alpha-elf alpha unix cc ) ;cc
(alpha-linux alpha linux gcc ) ;gcc
(amiga-aztec m68000 amiga cc ) ;cc
@@ -439,8 +463,8 @@
(amiga-sas m68000 amiga lc ) ;link
(atari-st-gcc m68000 atari.st gcc ) ;gcc
(atari-st-turbo-c m68000 atari.st tcc ) ;tlink
- (borland-c 8086 ms-dos bcc ) ;bcc
- (cygwin32 i386 unix gcc ) ;gcc
+ (borland-c i8086 ms-dos bcc ) ;bcc
+ (gnu-win32 i386 unix gcc ) ;gcc
(djgpp i386 ms-dos gcc ) ;gcc
(freebsd i386 unix cc ) ;cc
(gcc *unknown* unix gcc ) ;gcc
@@ -450,10 +474,11 @@
(linux i386 linux gcc ) ;gcc
(linux-aout i386 linux gcc ) ;gcc
(darwin powerpc unix cc ) ;gcc
- (microsoft-c 8086 ms-dos cl ) ;link
+ (microsoft-c i8086 ms-dos cl ) ;link
(microsoft-c-nt i386 ms-dos cl ) ;link
- (microsoft-quick-c 8086 ms-dos qcl ) ;qlink
- (ms-dos 8086 ms-dos cc ) ;link
+ (microsoft-quick-c i8086 ms-dos qcl ) ;qlink
+ (ms-dos i8086 ms-dos cc ) ;link
+ (netbsd *unknown* unix gcc ) ;gcc
(openbsd *unknown* unix gcc ) ;gcc
(os/2-cset i386 os/2 icc ) ;link386
(os/2-emx i386 os/2 gcc ) ;gcc
@@ -461,7 +486,7 @@
(svr4-gcc-sun-ld sparc sunos gcc ) ;ld
(sunos sparc sunos cc ) ;ld
(svr4 *unknown* unix cc ) ;ld
- (turbo-c 8086 ms-dos tcc ) ;tcc
+ (turbo-c i8086 ms-dos tcc ) ;tcc
(unicos cray unicos cc ) ;cc
(unix *unknown* unix cc ) ;cc
(vms vax vms cc ) ;link
@@ -492,8 +517,9 @@
(mysql *unknown* "-I/usr/include/mysql" "-L/usr/lib/mysql -lmysqlclient"
"/usr/lib/mysql/libmysqlclient.a" () ())
- (m cygwin32 "" "" "" () ())
- (c cygwin32 "" "" "" () ())
+ (m gnu-win32 "" "" "" () ())
+ (c gnu-win32 "" "" "" () ())
+ (dlll gnu-win32 "-DSCM_DLL" "" #f () ("posix.c" "unix.c" "socket.c"))
(m linux-aout "" "-lm" "/usr/lib/libm.sa" () ())
(c linux-aout "" "-lc" "/usr/lib/libc.sa" () ())
(dlll linux-aout "-DDLD -DDLD_DYNCM" "-ldld" #f () ("findexec.c"))
@@ -505,12 +531,11 @@
(m linux "" "-lm" "/lib/libm.so" () ())
(c linux "" "-lc" "/lib/libc.so" () ())
- (regex linux "" "" "" () ())
- (termcap linux "" "-lncurses" "/usr/lib/libncurses.a" () ())
(dlll linux "-DSUN_DL" "-ldl" #f () ())
+ (regex linux "" "" "" () ())
(graphics linux "-I/usr/include/X11 -DX11" "-L/usr/X11R6/lib -lX11"
"/usr/X11R6/lib/libX11.so" () ())
- (curses linux "" "-lncurses" "/usr/lib/libncurses.so" () ())
+ (curses linux "" "-lcurses" "/lib/libncurses.so" () ())
(nostart linux "" "" #f () ())
(dump linux "" "" #f ("unexelf.c" "gmalloc.c") ())
@@ -518,8 +543,12 @@
(m acorn-unixlib "" "" #f () ())
- (nostart alpha "" "-non_shared" #f ("pre-crt0.c") ())
- (dump alpha "" "" #f ("unexalpha.c") ())
+ (nostart osf1 "" "" #f ("pre-crt0.c") ())
+ (dlll osf1 "-DSUN_DL" "" #f () ())
+ (dump osf1 "" "" #f ("unexalpha.c" "gmalloc.c") ())
+ (regex osf1 "" "" #f () ())
+ (graphics osf1 "-I/usr/include/X11 -DX11" "-lX11"
+ #f () ())
(m amiga-dice-c "" "-lm" #f () ())
(m amiga-sas "" "lcmieee.lib" #f () ())
@@ -566,13 +595,14 @@
;;; (nostart djgpp "" "-e __start -nostartfiles -static" #f ("ecrt0.c") ())
;;; (dump djgpp "" "" #f ("unexelf.c" "gmalloc.c") ())
- (c Microsoft-C "" "" #f () ("findexec.c"))
- (m Microsoft-C "" "" #f () ())
- (c Microsoft-C-nt "" "" #f () ("findexec.c"))
- (m Microsoft-C-nt "" "" #f () ())
- (debug Microsoft-C-nt "-Zi" "/debug" #f () ())
- (c Microsoft-Quick-C "" "" #f () ("findexec.c"))
- (m Microsoft-Quick-C "" "" #f () ())
+ (c microsoft-c "" "" #f () ("findexec.c"))
+ (m microsoft-c "" "" #f () ())
+ (c microsoft-c-nt "" "" #f () ("findexec.c"))
+ (m microsoft-c-nt "" "" #f () ())
+ (dlll microsoft-c-nt "-DSCM_DLL -MD" "" #f () ("posix.c" "unix.c" "socket.c"))
+ (debug microsoft-c-nt "-Zi" "/debug" #f () ())
+ (c microsoft-quick-c "" "" #f () ("findexec.c"))
+ (m microsoft-quick-c "" "" #f () ())
(c turbo-c "" "" #f () ("findexec.c"))
(m turbo-c "" "" #f () ())
@@ -592,13 +622,18 @@
(curses darwin "" "" #f () ())
(regex darwin "" "" #f () ())
+ (c freebsd "" "-export-dynamic" #f () ())
(m freebsd "" "-lm" #f () ())
(curses freebsd "" "-lncurses" "/usr/lib/libncurses.a" () ())
(regex freebsd "" "-lgnuregex" "" () ())
(editline freebsd "" "-lreadline" "" () ())
- (dlll freebsd "-DSUN_DL" "" "" () ())
+ (dlll freebsd "-DSUN_DL" "-export-dynamic" "" () ())
(nostart freebsd "" "-e start -dc -dp -Bstatic -lgnumalloc" #f ("pre-crt0.c") ())
(dump freebsd "" "/usr/lib/crt0.o" "" ("unexsunos4.c") ())
+ (curses netbsd "-I/usr/pkg/include" "-lncurses" "-Wl,-rpath -Wl,/usr/pkg/lib -L/usr/pkg/lib" () ())
+ (editline netbsd "-I/usr/pkg/include" "-lreadline" "-Wl,-rpath -Wl,/usr/pkg/lib -L/usr/pkg/lib" () ())
+ (graphics netbsd "-I/usr/X11R6/include -DX11" "-lX11" "-Wl,-rpath -Wl,/usr/X11R6/lib -L/usr/X11R6/lib" () ())
+ (m netbsd "" "-lm" #f () ())
(m openbsd "" "-lm" #f () ())
(curses openbsd "" "-lcurses" "/usr/lib/libcurses.a" () ())
))
@@ -614,7 +649,7 @@
objects))))))
(define define-compile-commands
- (let ((defcomms (((build 'open-table) 'compile-commands #t) 'row:insert)))
+ (let ((defcomms ((open-table! build 'compile-commands) 'row:insert)))
(lambda args
(defcomms args)))) ;(append args (list (comment)))
(defmacro defcommand (name platform procedure)
@@ -626,7 +661,7 @@
(apply batch:lines->file parms rsp-name files)
(and (batch:try-command
parms
- "bcc" "-d" "-O" "-Z" "-G" "-w-pro" "-ml" "-c"
+ "bcc" "-d" "-Z" "-G" "-w-pro" "-ml" "-c"
(if (member '(define "FLOATS" #t)
(c-defines parms))
"" "-f-")
@@ -650,7 +685,7 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "tcc" "-c" "-d" "-O" "-Z" "-G" "-ml" "-c"
+ "tcc" "-c" "-d" "-Z" "-G" "-ml" "-c"
"-Ic:\\turboc\\include"
(include-spec "-I" parms)
(c-includes parms)
@@ -669,7 +704,7 @@
(batch:rename-file parms exe oexe))
oexe))))
-(defcommand compile-c-files Microsoft-C
+(defcommand compile-c-files microsoft-c
(lambda (files parms)
(and (batch:try-chopped-command
parms "cl" "-c" "Oxp" "-AH"
@@ -678,7 +713,7 @@
(c-flags parms)
files)
(truncate-up-to (map c->obj files) #\\))))
-(defcommand link-c-program Microsoft-C
+(defcommand link-c-program microsoft-c
(lambda (oname objects libs parms)
(let ((exe (truncate-up-to (obj->exe (car objects)) #\\))
(oexe (string-append oname ".exe")))
@@ -691,7 +726,8 @@
(or (string-ci=? exe oexe)
(batch:rename-file parms exe oexe))
oexe))))
-(defcommand compile-c-files Microsoft-C-nt
+
+(defcommand compile-c-files microsoft-c-nt
(lambda (files parms)
(and (batch:try-chopped-command
parms
@@ -703,7 +739,47 @@
(c-flags parms)
files)
(truncate-up-to (map c->obj files) #\\))))
-(defcommand link-c-program Microsoft-C-nt
+(defcommand compile-dll-c-files microsoft-c-nt
+ (lambda (files parms)
+ (define platform (car (parameter-list-ref parms 'platform)))
+ (let ((suppressors (build:c-suppress 'dlll platform)))
+ (define c-files (remove-if (lambda (file) (member file suppressors))
+ files))
+ (and (batch:try-chopped-command
+ parms
+ "cl" "-c" "-nologo"
+ (if (memq 'stack-limit (parameter-list-ref parms 'features))
+ "-Oityb1" "-Ox")
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ c-files)
+ (let ((results
+ (map
+ (lambda (fname)
+ (and (batch:try-command
+ parms "link" "/dll" "/nologo"
+ (string-append "/out:" fname ".dll")
+ (string-append "/implib:" fname ".lib")
+ fname
+ (map (lambda (l) (build:lib-ld-flag l platform))
+ (parameter-list-ref parms 'c-lib))
+ "scm.lib")
+ (string-append fname ".dll")))
+ (map c-> c-files))))
+ (and (apply and? results) results))))))
+(defcommand make-dll-archive microsoft-c-nt
+ (lambda (oname objects libs parms) objects))
+(defcommand make-archive microsoft-c-nt
+ (lambda (oname objects libs parms)
+ (let ((aname (string-append oname ".dll")))
+ (and (batch:try-command parms
+ "link" "/dll" "/nologo"
+ (string-append "/out:" aname)
+ (string-append "/implib:" oname ".lib")
+ libs (map obj-> objects))
+ aname))))
+(defcommand link-c-program microsoft-c-nt
(lambda (oname objects libs parms)
(let ((exe (truncate-up-to (obj->exe (car objects)) #\\))
(oexe (string-append oname ".exe")))
@@ -714,7 +790,7 @@
libs)
oexe))))
-(defcommand compile-c-files Microsoft-Quick-C
+(defcommand compile-c-files microsoft-quick-c
(lambda (files parms)
(and (batch:try-chopped-command
parms
@@ -723,7 +799,7 @@
(c-flags parms)
files)
(truncate-up-to (map c->obj files) #\\))))
-(defcommand link-c-program Microsoft-Quick-C
+(defcommand link-c-program microsoft-quick-c
(lambda (oname objects libs parms)
(define crf-name (string-append oname ".crf"))
(apply batch:lines->file parms
@@ -740,7 +816,7 @@
crf-name)
(string-append oname ".exe"))))
-(defcommand compile-c-files Watcom-9.0
+(defcommand compile-c-files watcom-9.0
(lambda (files parms)
(and (batch:try-chopped-command
parms
@@ -750,7 +826,7 @@
(c-flags parms)
files)
(truncate-up-to (map c->obj files) #\\))))
-(defcommand link-c-program Watcom-9.0
+(defcommand link-c-program watcom-9.0
(lambda (oname objects libs parms)
(let ((exe (truncate-up-to (obj->exe (car objects)) #\\))
(oexe (string-append oname ".exe")))
@@ -798,7 +874,7 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "gcc" "-Wall" "-O2" "-c"
+ "gcc" "-c"
(include-spec "-I" parms)
(c-includes parms) (c-flags parms)
files)
@@ -837,7 +913,7 @@
(defcommand compile-c-files os/2-emx
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-O" "-m386" "-c"
+ "gcc" "-m386" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -907,7 +983,7 @@
(defcommand compile-c-files linux-aout
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-Wall" "-O2" "-c"
+ "gcc" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -917,7 +993,7 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "gcc" "-Wall" "-O2" "-c"
+ "gcc" "-c"
(c-includes parms)
(c-flags parms)
files)
@@ -931,7 +1007,7 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "gcc" "-O2"
+ "gcc"
;;(if (member "-g" (c-includes parms)) "" "-O2")
"-c" (c-includes parms)
(include-spec "-I" parms)
@@ -943,8 +1019,7 @@
(and
(batch:try-chopped-command
parms
- "gcc" "-O2"
- "-fpic" "-c" (c-includes parms)
+ "gcc" "-fpic" "-c" (c-includes parms)
(c-flags parms)
files)
(let* ((platform (car (parameter-list-ref parms 'platform)))
@@ -1038,7 +1113,7 @@
(defcommand compile-c-files gcc
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-O2" "-c" ; "-Wall"
+ "gcc" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1059,7 +1134,7 @@
(defcommand compile-dll-c-files gcc
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-O" "-c"
+ "gcc" "-c"
(c-includes parms)
(c-flags parms)
files)
@@ -1078,16 +1153,56 @@
(car (parameter-list-ref parms 'implvic))
oname ".so.1.0"))))
-(defcommand compile-c-files cygwin32
+(defcommand compile-dll-c-files gnu-win32
+ (lambda (files parms)
+ (define platform (car (parameter-list-ref parms 'platform)))
+ (let ((suppressors (build:c-suppress 'dlll platform)))
+ (define c-files (remove-if (lambda (file) (member file suppressors))
+ files))
+ (and (batch:try-chopped-command
+ parms
+ "gcc" "-c"
+ (include-spec "-I" parms)
+ (c-includes parms)
+ (c-flags parms)
+ c-files)
+ (let ((results
+ (map
+ (lambda (fname)
+ (and (batch:try-command
+ parms "dllwrap"
+ "--output-lib" (string-append fname ".lib")
+ "-dllname" (string-append fname ".dll")
+ "--output-def" (string-append fname ".def")
+ (string-append fname ".o")
+ (map (lambda (l) (build:lib-ld-flag l platform))
+ (parameter-list-ref parms 'c-lib))
+ "scm.lib")
+ (string-append fname ".dll")))
+ (map c-> c-files))))
+ (and (apply and? results) results))))))
+(defcommand make-dll-archive gnu-win32
+ (lambda (oname objects libs parms) objects))
+(defcommand make-archive gnu-win32
+ (lambda (oname objects libs parms)
+ (let ((aname (string-append oname ".dll")))
+ (and (batch:try-command parms
+ "dllwrap"
+ "--output-lib" (string-append oname ".lib")
+ "-dllname" aname
+ "--output-def" (string-append oname ".def")
+ libs objects)
+ aname))))
+(defcommand compile-c-files gnu-win32
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-Wall" "-O2" "-c"
+ "gcc" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
files)
(truncate-up-to (map c->o files) #\/))))
-(defcommand link-c-program cygwin32
+(defcommand link-c-program gnu-win32
(lambda (oname objects libs parms)
(batch:rename-file parms
(string-append oname ".exe")
@@ -1101,10 +1216,62 @@
(append objects libs)))
oname)))
+(defcommand compile-c-files osf1
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc" "-std1"
+ ;;(if (member "-g" (c-includes parms)) "" "-O")
+ "-c" (c-includes parms)
+ (include-spec "-I" parms)
+ (c-flags parms)
+ files)
+ (truncate-up-to (map c->o files) #\/))))
+(defcommand compile-dll-c-files osf1
+ (lambda (files parms)
+ (and
+ (batch:try-chopped-command
+ parms "cc" "-std1" "-c" (c-includes parms) (c-flags parms) files)
+ (let* ((platform (car (parameter-list-ref parms 'platform)))
+ (ld-opts
+ (map (lambda (l) (build:lib-ld-flag l platform))
+ (parameter-list-ref parms 'c-lib)))
+ (results
+ (map
+ (lambda (fname)
+ (and (batch:try-command
+ parms
+ "cc" "-shared" "-o"
+ (string-append fname ".so")
+ (string-append fname ".o")
+ ld-opts)
+ (batch:delete-file
+ parms (string-append fname ".o"))
+ (string-append fname ".so")))
+ (truncate-up-to (map c-> files) #\/))))
+ (and (apply and? results) results)))))
+(defcommand make-dll-archive osf1
+ (lambda (oname objects libs parms)
+ (let ((platform (car (parameter-list-ref
+ parms 'platform))))
+ (and (batch:try-command
+ parms
+ "cc" "-shared" "-o"
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so")
+ objects
+ (map (lambda (l) (build:lib-ld-flag l platform))
+ (parameter-list-ref parms 'c-lib)))
+ (batch:rebuild-catalog parms)
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so")))))
+
(defcommand compile-c-files svr4-gcc-sun-ld
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-O2" "-c" ; "-Wall"
+ "gcc" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1127,7 +1294,7 @@
(and
(batch:try-chopped-command
parms
- "gcc" "-O2"
+ "gcc"
"-fpic" "-c" (c-includes parms)
(c-flags parms)
files)
@@ -1153,7 +1320,7 @@
(defcommand compile-c-files svr4
(lambda (files parms)
(and (batch:try-chopped-command parms
- "cc" "-O" "-DSVR4" "-c"
+ "cc" "-DSVR4" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1163,7 +1330,7 @@
(defcommand compile-c-files aix
(lambda (files parms)
(and (batch:try-chopped-command parms
- "cc" "-O" "-Dunix" "-c"
+ "cc" "-Dunix" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1194,7 +1361,7 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "lc" "-d3" "-M" "-fi" "-O"
+ "lc" "-d3" "-M" "-fi"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1241,7 +1408,7 @@
(defcommand compile-c-files amiga-gcc
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-Wall" "-O2" "-c"
+ "gcc" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1263,7 +1430,7 @@
(defcommand compile-c-files atari-st-gcc
(lambda (files parms)
(and (batch:try-chopped-command parms
- "gcc" "-v" "-O" "-c"
+ "gcc" "-v" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1374,7 +1541,7 @@
(lambda (files parms)
(batch:try-chopped-command
parms
- "cc" "-O" "-c"
+ "cc" "-c"
(include-spec "-I" parms)
(c-includes parms)
(c-flags parms)
@@ -1401,7 +1568,7 @@
(defcommand compile-dll-c-files *unknown*
(lambda (files parms)
(and (batch:try-chopped-command parms
- "cc" "-O" "-c"
+ "cc" "-c"
(c-includes parms)
(c-flags parms)
files)
@@ -1421,7 +1588,7 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "cc" "-O" "-c"
+ "cc" "-O3 -pipe " "-c"
(c-includes parms)
(c-flags parms)
files)
@@ -1442,27 +1609,33 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "cc" "-O" "-fpic" "-c"
- (string-append
- "-I" (parameter-list-ref parms 'scm-srcdir))
- (c-includes parms)
+ "cc" "-O3 -pipe "
+ "-fPIC" "-c" (c-includes parms)
(c-flags parms)
files)
- (let ((objs (map c->o files)))
- (every
- (lambda (f)
- (and (batch:try-command
- parms "ld" "-Bshareable" f)
- (batch:try-command
- parms "mv" "a.out" f)))
- objs)
- objs))))
-
+ (let ((results
+ (map
+ (lambda (fname)
+ (and (batch:try-command
+ parms
+ "cc" "-shared"
+ (cond
+ ((equal? fname "edline") "-lreadline")
+ ((equal? fname "x") "-L/usr/X11R6/lib -lSM -lICE -lXext -lX11 -lxpg4")
+ (else ""))
+ "-o"
+ (string-append fname ".so")
+ (string-append fname ".o"))
+ (batch:delete-file
+ parms (string-append fname ".o"))
+ (string-append fname ".so")))
+ (truncate-up-to (map c-> files) #\/))))
+ (and (apply and? results) results)))))
(defcommand make-dll-archive freebsd
(lambda (oname objects libs parms)
(and (batch:try-command
parms
- "ld" "-Bshareable" "-o"
+ "cc" "-shared" "-o"
(string-append
(car (parameter-list-ref parms 'implvic))
oname ".so")
@@ -1490,11 +1663,66 @@
(append objects libs))
oname)))
+(defcommand compile-c-files netbsd
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc" "-c"
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (map c->o files))))
+(defcommand link-c-program netbsd
+ (lambda (oname objects libs parms)
+ (batch:rename-file parms
+ oname (string-append oname "~"))
+ (and (batch:try-command parms
+ "cc" "-o" oname
+ (must-be-first
+ '("-nostartfiles"
+ "pre-crt0.o" "crt0.o"
+ "/usr/lib/crt0.o")
+ (append libs objects)))
+ oname)))
+(defcommand compile-dll-c-files netbsd
+ (lambda (files parms)
+ (and (batch:try-chopped-command
+ parms
+ "cc" "-fPIC" "-c"
+ (string-append
+ "-I" (parameter-list-ref parms 'scm-srcdir))
+ (c-includes parms)
+ (c-flags parms)
+ files)
+ (let ((objs (map c->o files)))
+ (every
+ (lambda (f)
+ (and (batch:try-command
+ parms "gcc" "-shared" "-fPIC" f)
+ (batch:try-command
+ parms "mv" "a.out" f)))
+ objs)
+ objs))))
+
+(defcommand make-dll-archive netbsd
+ (lambda (oname objects libs parms)
+ (and (batch:try-command
+ parms
+ "gcc" "-shared" "-fPIC" "-o"
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so")
+ objects)
+ (batch:rebuild-catalog parms)
+ (string-append
+ (car (parameter-list-ref parms 'implvic))
+ oname ".so"))))
+
(defcommand compile-c-files openbsd
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "cc" "-O2" "-Wall" "-c"
+ "cc" "-c"
(c-includes parms)
(c-flags parms)
files)
@@ -1515,7 +1743,7 @@
(lambda (files parms)
(and (batch:try-chopped-command
parms
- "cc" "-O2" "-Wall" "-fPIC" "-c"
+ "cc" "-fPIC" "-c"
(string-append
"-I" (parameter-list-ref parms 'scm-srcdir))
(c-includes parms)
@@ -1545,8 +1773,8 @@
(car (parameter-list-ref parms 'implvic))
oname ".so"))))
-(for-each (build 'add-domain)
- '((C-libraries C-libraries #f symbol #f)))
+(define-domains build
+ '(C-libraries C-libraries #f symbol #f))
(define-tables build
@@ -1570,15 +1798,15 @@
(9 compiled-init nary string #f #f "later initialization calls")
(10 features nary features
(lambda (pl) '(arrays inexact bignums))
- (lambda (rdb) (((rdb 'open-table) 'features #f) 'get 'spec))
+ (lambda (rdb) ((open-table rdb 'features) 'get 'spec))
"features to include")
(11 what single build-whats
(lambda (pl) '(exe))
(lambda (rdb)
- (let* ((bwt ((rdb 'open-table) 'build-whats #f))
+ (let* ((bwt (open-table rdb 'build-whats))
(getclass (bwt 'get 'class))
(getspec (bwt 'get 'spec))
- (getfile (((rdb 'open-table) 'manifest #f) 'get* 'file)))
+ (getfile ((open-table rdb 'manifest) 'get* 'file)))
(lambda (what)
`((c-file ,@(getfile #f 'c-source (getclass what)))
,@(or (getspec what) '())))))
@@ -1598,6 +1826,10 @@
(18 c-includes nary expression #f #f "library induced defines for C")
(19 batch-port nary expression #f #f
"port batch file will be written to.")
+ ;; The options file is read by a fluid-let getopt-- in "build".
+ ;; This is here so the usage message will include -f <filename>.
+ (20 options-file nary filename #f #f
+ "file containing more build options.")
))
'(build-pnames
((name string))
@@ -1618,6 +1850,7 @@
("compiler options" 14)
("linker options" 15)
("scm srcdir" 16)
+ ("f" 20)
))
'(*commands*
@@ -1629,7 +1862,7 @@
((build
build-params
build-pnames
- build:build
+ build:command
"compile and link SCM programs.")
(*initialize*
no-parameters
@@ -1660,22 +1893,18 @@
(else (look '*unknown*)))))
(look plat)))
-(require 'alist)
-(require 'common-list-functions)
-(require 'object->string)
-
-(define (build:build rdb)
+(define (build:command rdb)
(lambda (parms)
(let ((expanders
(map (lambda (e) (and e (lambda (s) (e s))))
(map (lambda (f) (if f ((slib:eval f) rdb) f))
- ((((rdb 'open-table) 'build-params #f)
+ (((open-table rdb 'build-params)
'get* 'expander))))))
(parameter-list-expand expanders parms)
(set! parms
(fill-empty-parameters
(map slib:eval
- ((((rdb 'open-table) 'build-params #f)
+ (((open-table rdb 'build-params)
'get* 'defaulter)))
parms))
(parameter-list-expand expanders parms))
@@ -1715,14 +1944,14 @@
(map (lambda (l) (build:lib-cc-flag l platform))
(parameter-list-ref parms 'c-lib)))
(what (car (parameter-list-ref parms 'what)))
- (c-proc (plan-command ((((rdb 'open-table) 'build-whats #f)
+ (c-proc (plan-command (((open-table rdb 'build-whats)
'get 'c-proc)
what)
platform)))
(case (car (parameter-list-ref parms 'batch-dialect))
((default-for-platform)
- (let ((os ((((build 'open-table) 'platform #f)
+ (let ((os (((open-table build 'platform)
'get 'operating-system) platform)))
(if (not os)
(build:error "OS corresponding to " platform " unknown"))
@@ -1738,7 +1967,7 @@
(cons 'operating-system
(map platform->os (parameter-list-ref parms 'platform)))
parms))
-
+
(let ((name (parameter-list-ref parms 'who)))
(set! name (if (null? name) (current-output-port) (car name)))
(batch:call-with-output-script
@@ -1750,6 +1979,11 @@
parms
(list 'batch-port batch-port))
+ (let ((options-file (parameter-list-ref parms 'options-file)))
+ (and (not (null? options-file))
+ (batch:comment
+ parms
+ (apply string-join " " "used options from:" options-file))))
(batch:comment parms "================ Write file with C defines")
(cond
((not (apply batch:lines->file parms
@@ -1782,7 +2016,7 @@
(batch:comment parms "================ Link C object files")
(let ((ans
((plan-command
- ((((rdb 'open-table) 'build-whats #f) 'get 'o-proc) what)
+ (((open-table rdb 'build-whats) 'get 'o-proc) what)
platform)
(car (parameter-list-ref parms 'target-name))
(append o-files (parameter-list-ref parms 'o-file))
@@ -1851,16 +2085,17 @@
(define (logger . args)
(define cep (current-error-port))
- (cond ((provided? 'bignum)
- (require 'posix-time)
- (let ((ct (ctime (current-time))))
- (string-set! ct (+ -1 (string-length ct)) #\:)
- (for-each (lambda (x) (display x cep))
- (cons ct (cons #\ args)))))
- (else (for-each (lambda (x) (display x cep)) args)))
+ (for-each (lambda (x) (display #\ cep) (display x cep))
+ (cond ((provided? 'bignum)
+ (require 'posix-time)
+ (let ((ct (ctime (current-time))))
+ (string-set! ct (+ -1 (string-length ct)) #\:)
+ (cons ct args)))
+ (else args)))
(newline cep))
(define build:qacs #f)
+;@
(define (build:serve request-line query-string header)
(define query-alist (and query-string (uri:decode-query query-string)))
(if (not build:qacs)
@@ -1891,7 +2126,7 @@
(define build:initializer
(lambda (rdb)
- (set! build:c-libraries ((rdb 'open-table) 'c-libraries #f))
+ (set! build:c-libraries (open-table rdb 'c-libraries))
(set! build:lib-cc-flag
(make-defaulting-platform-lookup
(build:c-libraries 'get 'compiler-flags)))
@@ -1904,11 +2139,11 @@
(set! build:c-suppress
(make-defaulting-platform-lookup
(build:c-libraries 'get 'suppress-files)))
- (set! platform->os (((rdb 'open-table) 'platform #f)
+ (set! platform->os ((open-table rdb 'platform)
'get 'operating-system))
(set! plan-command
(let ((lookup (make-defaulting-platform-lookup
- (((rdb 'open-table) 'compile-commands #f)
+ ((open-table rdb 'compile-commands)
'get 'procedure))))
(lambda (thing plat)
;;(print 'thing thing 'plat plat)