aboutsummaryrefslogtreecommitdiff
path: root/lang/schemetoc
diff options
context:
space:
mode:
authorThomas Gellekum <tg@FreeBSD.org>2000-03-01 09:57:06 +0000
committerThomas Gellekum <tg@FreeBSD.org>2000-03-01 09:57:06 +0000
commit2b54222fb3fd1ea5953bd9cbcc0d6d1fd1a32aae (patch)
tree12eba4b78e3b87550e718b44da0860acf9709d7d /lang/schemetoc
parentd220a7403ad576cfce3e5c769b71ba5d3e5d698b (diff)
downloadports-2b54222fb3fd1ea5953bd9cbcc0d6d1fd1a32aae.tar.gz
ports-2b54222fb3fd1ea5953bd9cbcc0d6d1fd1a32aae.zip
Notes
Diffstat (limited to 'lang/schemetoc')
-rw-r--r--lang/schemetoc/Makefile33
-rw-r--r--lang/schemetoc/files/Makefile36
-rw-r--r--lang/schemetoc/files/README.FreeBSD6
-rw-r--r--lang/schemetoc/files/makefile-head6
-rw-r--r--lang/schemetoc/files/patch-aa16
-rw-r--r--lang/schemetoc/files/patch-ab14
-rw-r--r--lang/schemetoc/files/patch-ac46
-rw-r--r--lang/schemetoc/files/patch-ad34
-rw-r--r--lang/schemetoc/files/patch-ae44
-rw-r--r--lang/schemetoc/files/patch-af131
-rw-r--r--lang/schemetoc/files/patch-ag53
-rw-r--r--lang/schemetoc/files/patch-ah126
-rw-r--r--lang/schemetoc/files/patch-ai11
-rw-r--r--lang/schemetoc/files/patch-aj121
-rw-r--r--lang/schemetoc/files/x86.s4
-rw-r--r--lang/schemetoc/pkg-plist33
16 files changed, 668 insertions, 46 deletions
diff --git a/lang/schemetoc/Makefile b/lang/schemetoc/Makefile
index 04053041b533..6467042fd854 100644
--- a/lang/schemetoc/Makefile
+++ b/lang/schemetoc/Makefile
@@ -1,25 +1,38 @@
-# New ports collection makefile for: Scheme-to-C
-# Version required: 15mar93
-# Date created: 28 Dec 1994
-# Whom: jmacd@uclink.berkeley.edu
+# New ports collection makefile for: Scheme-to-C
+# Version required: 15mar93
+# Date created: 28 Dec 1994
+# Whom: jmacd@uclink.berkeley.edu
#
# $FreeBSD$
#
-DISTNAME= schemetoc-93.3.15
-PKGNAME= schemetoc-93.3.15
+DISTNAME= 15mar93
+PKGNAME= schemetoc-93.3.15
CATEGORIES= lang
MASTER_SITES= ftp://gatekeeper.dec.com/pub/DEC/Scheme-to-C/
-DISTFILES= 15mar93.tar.Z
+EXTRACT_SUFX= .tar.Z
MAINTAINER= jmacd@FreeBSD.org
-BROKEN_ELF= yes
-
USE_XLIB= yes
NO_WRKSUBDIR= yes
+MAN1= scc.1 sci.1
+
+post-extract:
+ @${CP} ${FILESDIR}/Makefile ${WRKSRC}
+ @${CP} ${FILESDIR}/README.FreeBSD ${WRKSRC}
+ @${MV} ${WRKDIR}/scsc/main.c ${WRKSRC}/scsc/main.c.orig
+ @${CP} ${FILESDIR}/main.c ${WRKSRC}/scsc/main.c
+ @${MKDIR} ${WRKDIR}/ports/FREEBSD
+.for file in makefile-head options-server.h options.h x86.s
+ @${CP} ${FILESDIR}/${file} ${WRKSRC}/ports/FREEBSD
+.endfor
+
+post-patch:
+ @${PERL} -pi -e 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/scsc/*.sc
+ @${PERL} -pi -e 's|%%X11BASE%%|${X11BASE}|g' ${WRKSRC}/scsc/*.sc
post-install:
- ${LDCONFIG} -m ${PREFIX}/lib
+ ${SETENV} OBJFORMAT=${PORTOBJFORMAT} ${LDCONFIG} -m ${PREFIX}/lib
.include <bsd.port.mk>
diff --git a/lang/schemetoc/files/Makefile b/lang/schemetoc/files/Makefile
index d09825914d72..4a2312dc1d28 100644
--- a/lang/schemetoc/files/Makefile
+++ b/lang/schemetoc/files/Makefile
@@ -1,4 +1,8 @@
# Makefile for FreeBSD Scheme-to-C port
+#
+# give this a CVS ID to satisfy commit_prep.pl --tg
+# $FreeBSD$
+#
MAN_DIR = ${PREFIX}/man/man1
BIN_DIR = ${PREFIX}/bin
@@ -6,32 +10,28 @@ LIB_DIR = ${PREFIX}/lib
SCHEME_DIR = ${LIB_DIR}/schemetoc
all:
- make -f makefile forFREEBSD
- (cd FREEBSD;make port)
- (cd FREEBSD/cdecl; make all)
- (cd FREEBSD/xlib; make all)
+ ${MAKE} -f makefile forFREEBSD
+ (cd FREEBSD; ${MAKE} port)
+ (cd FREEBSD/cdecl; ${MAKE} all)
+ (cd FREEBSD/xlib; ${MAKE} all)
install:
mkdir -p ${SCHEME_DIR}/doc
- (cd FREEBSD/scrt; make "LIBDIR = ${LIB_DIR}" \
+ (cd FREEBSD/scrt; ${MAKE} "LIBDIR = ${LIB_DIR}" \
"BINDIR = ${BIN_DIR}" install)
- (cd FREEBSD/scsc; make "LIBDIR = ${LIB_DIR}" \
+ (cd FREEBSD/scsc; ${MAKE} "LIBDIR = ${LIB_DIR}" \
"BINDIR = ${BIN_DIR}" install)
- (cd FREEBSD/xlib; make "LIBDIR = ${LIB_DIR}" \
+ (cd FREEBSD/xlib; ${MAKE} "LIBDIR = ${LIB_DIR}" \
"BINDIR = ${BIN_DIR}" install)
- (cd doc; install -c -m 444 index.psf \
+ (cd doc; ${BSD_INSTALL_DATA} index.psf \
embedded.psf \
intro.psf \
r4rs.psf \
smithnotes.psf \
${SCHEME_DIR}/doc)
- cp test/test51.sc ${SCHEME_DIR}/doc/test.sc
- cp xlib/hello.sc ${SCHEME_DIR}/doc
- cp xlib/puzzle.sc ${SCHEME_DIR}/doc
- cp README.FreeBSD ${SCHEME_DIR}/doc
- cp doc/scc.l ${MAN_DIR}/scc.1
- cp doc/sci.l ${MAN_DIR}/sci.1
- gzip -f ${MAN_DIR}/sci.1 ${MAN_DIR}/scc.1
- chmod 444 ${LIB_DIR}/libsc.so.1.0 ${LIB_DIR}/libscxl.so.1.0
- chown -R bin:bin ${SCHEME_DIR}
- strip ${BIN_DIR}/sccomp ${BIN_DIR}/sci ${BIN_DIR}/scixl
+ ${BSD_INSTALL_DATA} test/test51.sc ${SCHEME_DIR}/doc/test.sc
+ ${BSD_INSTALL_DATA} xlib/hello.sc ${SCHEME_DIR}/doc
+ ${BSD_INSTALL_DATA} xlib/puzzle.sc ${SCHEME_DIR}/doc
+ ${BSD_INSTALL_DATA} README.FreeBSD ${SCHEME_DIR}/doc
+ ${BSD_INSTALL_DATA} doc/scc.l ${MAN_DIR}/scc.1
+ ${BSD_INSTALL_DATA} doc/sci.l ${MAN_DIR}/sci.1
diff --git a/lang/schemetoc/files/README.FreeBSD b/lang/schemetoc/files/README.FreeBSD
index 1f47985fe968..b5ce58b47a54 100644
--- a/lang/schemetoc/files/README.FreeBSD
+++ b/lang/schemetoc/files/README.FreeBSD
@@ -4,7 +4,7 @@ The documentation provided on the X library interface for Scheme-to-C
was very limited and as a result I'm not sure if I've got it right.
Instead of using having the compiler link the library archives libsc.a
(the standard schemetoc library) or scxl.a (the x library), two shared
-libraries are included, libsc.so.1.0 and libscxl.so.1.0.
+libraries are included, libsc.so.1 and libscxl.so.1.
The syntax of the scc compiler has been extended to automatically
use dynamic linking unless the -static flag is specified on the scc
@@ -22,8 +22,8 @@ include -lX11.
Those not wishing to use the X library support can delete the following
files:
-libscxl.so.1.0 The shared lib.
-schemetoc/scxl.a The library archive.
+libscxl.so.1 The shared lib.
+schemetoc/libscxl.a The library archive.
bin/scixl The X lib interpreter.
Each is about 1.4 megabytes.
diff --git a/lang/schemetoc/files/makefile-head b/lang/schemetoc/files/makefile-head
index cc72d71f0e55..14944c6a593e 100644
--- a/lang/schemetoc/files/makefile-head
+++ b/lang/schemetoc/files/makefile-head
@@ -4,8 +4,8 @@
# Default flags to use when invoking the C compiler.
-CFLAGS = -O2
-CC = gcc
+CFLAGS ?= -O2
+CC ?= gcc
# Assembly language object files.
@@ -24,7 +24,7 @@ CPP = cpp
# X library
-XLIB = -L/usr/X11R6/lib -lX11
+XLIB = -L${X11BASE}/lib -lX11
XLIBCFLAGS =
PICFLAGS = -fpic -DPIC
diff --git a/lang/schemetoc/files/patch-aa b/lang/schemetoc/files/patch-aa
new file mode 100644
index 000000000000..d56757c241c1
--- /dev/null
+++ b/lang/schemetoc/files/patch-aa
@@ -0,0 +1,16 @@
+--- makefile.orig Wed Feb 17 04:20:09 1993
++++ makefile Wed Feb 2 22:22:22 2000
+@@ -92,6 +92,13 @@
+ cp ports/VAX/vax.s VAX/server
+ cp ports/VAX/options-server.h VAX/server/options.h
+
++forFREEBSD:
++ make "CPU=FREEBSD" forANY
++ cp ports/FREEBSD/x86.s FREEBSD/scrt
++ cp ports/FREEBSD/options.h FREEBSD/scrt
++ cp ports/FREEBSD/x86.s FREEBSD/server
++ cp ports/FREEBSD/options-server.h FREEBSD/server/options.h
++
+ forWIN16:
+ make "CPU=WIN16" forANY
+ rm -r WIN16/scsc
diff --git a/lang/schemetoc/files/patch-ab b/lang/schemetoc/files/patch-ab
new file mode 100644
index 000000000000..6459763854ab
--- /dev/null
+++ b/lang/schemetoc/files/patch-ab
@@ -0,0 +1,14 @@
+--- doc/scc.l.orig Tue Jan 12 10:43:14 1993
++++ doc/scc.l Wed Feb 2 22:22:22 2000
+@@ -66,6 +66,11 @@
+ .B -Ot
+ Optimize code by omitting type error checks.
+ .TP 18
++.B -static
++Use static linking instead of shared libraries. This will result in an executable
++which is about 300k larger than the dynamic executable. For xlib programs the
++executable will be about 1400k larger.
++.TP 18
+ .B -pg
+ Produce profiled code for run-time measurement using
+ .I gprof(1).
diff --git a/lang/schemetoc/files/patch-ac b/lang/schemetoc/files/patch-ac
new file mode 100644
index 000000000000..790f18a3cf29
--- /dev/null
+++ b/lang/schemetoc/files/patch-ac
@@ -0,0 +1,46 @@
+--- scrt/callcc.c.orig Wed Feb 24 08:25:41 1993
++++ scrt/callcc.c Wed Feb 2 22:22:22 2000
+@@ -91,6 +91,11 @@
+ #define SETJMP( x ) sc_setjmp( x )
+ #endif
+
++#ifdef FREEBSD
++#define LONGJMP( x, y ) longjmp( x, y )
++#define SETJMP( x ) setjmp( x )
++#endif
++
+ TSCP sc_clink; /* Pointer to inner most continuation on stack. */
+
+ /* Static declarations for data structures internal to the module. These
+@@ -192,6 +197,17 @@
+ STACKPTR( tos );
+ count = (((STACK_BYTES (bfp, tos)) + ((sizeof (S2CINT)) - 1))
+ / (sizeof (S2CINT)));
++#ifdef LAZY_STACK_POP
++ /* NOTE WELL!
++ * For machines that must pop arguments after a function call,
++ * the compiler may let arguments accumulate on the stack for several
++ * function calls and pop them all at once.
++ * If your compiler uses this optimization, 'count' must be incremented
++ * by the number of S2CINTs pushed as arguments between this point and
++ * the point where 'bcount' is computed.
++ */
++ count += LAZY_STACK_INCREMENT;
++#endif
+ save_fp = (S2CINT*)bfp;
+ cp = sc_allocateheap( NULLCONTINUATIONSIZE+count+2+sc_maxdisplay,
+ CONTINUATIONTAG,
+@@ -199,6 +215,13 @@
+ STACKPTR( tos );
+ fp = save_fp;
+ bcount = (STACK_BYTES (fp, tos));
++ if (bcount > count*sizeof(S2CINT))
++ /* If you get this error, look above at LAZY_STACK_POP */
++ sc_error( "CALL-WITH-CURRENT-CONTINUATION",
++ "internal error: want to write ~s bytes of stack, "
++ "but only ~s bytes allocated.",
++ LIST2( C_FIXED( bcount ),
++ C_FIXED( count*sizeof(S2CINT) ) ) );
+ cp->continuation.continuation = sc_clink;
+ cp->continuation.stackbytes = bcount;
+ cp->continuation.stacktrace = sc_stacktrace;
diff --git a/lang/schemetoc/files/patch-ad b/lang/schemetoc/files/patch-ad
new file mode 100644
index 000000000000..63c55fb67eb8
--- /dev/null
+++ b/lang/schemetoc/files/patch-ad
@@ -0,0 +1,34 @@
+--- scrt/cio.c.orig Wed Feb 24 08:26:58 1993
++++ scrt/cio.c Wed Feb 2 22:22:22 2000
+@@ -143,6 +143,10 @@
+ #define HAVE_RUSAGE
+ #endif
+
++#ifdef FREEBSD
++#define HAVE_RUSAGE
++#endif
++
+ #ifdef SYSV
+ #define HAVE_TIMES
+ #else
+@@ -467,7 +471,11 @@
+ struct timeval timeout;
+
+ stream = (FILE*)TSCP_POINTER( file );
++#ifdef FREEBSD
++ if (((stream)->_r) <= 0) {
++#else
+ if (((stream)->_cnt) <= 0) {
++#endif
+ FD_ZERO( &readfds );
+ FD_SET( fileno( stream ), &readfds );
+ timeout.tv_sec = 0;
+@@ -549,7 +557,7 @@
+ break;
+
+ case 3:
+-#ifdef MAC
++#if defined(MAC) || defined(FREEBSD)
+ sprintf( format, "%%.%lilg", (long)TSCP_S2CINT( length ) );
+ sprintf( buffer, format, TSCP_DOUBLE( number ) );
+ #else
diff --git a/lang/schemetoc/files/patch-ae b/lang/schemetoc/files/patch-ae
new file mode 100644
index 000000000000..4b0b4a4cfc47
--- /dev/null
+++ b/lang/schemetoc/files/patch-ae
@@ -0,0 +1,44 @@
+--- scrt/heap.c.orig Tue Feb 23 01:11:33 1993
++++ scrt/heap.c Wed Feb 2 22:22:22 2000
+@@ -66,6 +66,9 @@
+ #ifdef VAX
+ extern sc_r2tor11( );
+ #endif
++#ifdef FREEBSD
++extern sc_geti386regs( S2CINT* a );
++#endif
+
+ /* Forward declarations */
+
+@@ -368,6 +371,31 @@
+ S2CINT r2tor11[10], *pp;
+
+ sc_r2tor11( r2tor11 );
++ STACKPTR( pp );
++ while (pp != sc_stackbase) move_continuation_ptr( ((SCP)*pp++) );
++}
++#endif
++
++#ifdef FREEBSD
++/* The following code is used to read the stack pointer. The register
++ number is passed in to force an argument to be on the stack, which in
++ turn can be used to find the address of the top of stack.
++*/
++
++S2CINT *sc_processor_register( S2CINT reg )
++{
++ return( &reg );
++}
++
++/* All processor registers which might contain pointers are traced by the
++ following procedure.
++*/
++
++static trace_stack_and_registers()
++{
++ S2CINT i386regs[6], *pp;
++
++ sc_geti386regs( i386regs );
+ STACKPTR( pp );
+ while (pp != sc_stackbase) move_continuation_ptr( ((SCP)*pp++) );
+ }
diff --git a/lang/schemetoc/files/patch-af b/lang/schemetoc/files/patch-af
new file mode 100644
index 000000000000..65605e44f15b
--- /dev/null
+++ b/lang/schemetoc/files/patch-af
@@ -0,0 +1,131 @@
+--- scrt/makefile.orig Wed Feb 17 10:55:48 1993
++++ scrt/makefile Wed Feb 2 22:22:22 2000
+@@ -5,7 +5,9 @@
+ #
+
+ .SUFFIXES:
+-.SUFFIXES: .o .c .sc .s
++.SUFFIXES: .o .c .sc .s .so
++
++SOVER = 1
+
+ SCC = ../scsc/scc
+ SCCFLAGS =
+@@ -14,6 +16,8 @@
+
+ Cruntime = scinit.o apply.o callcc.o cio.o heap.o objects.o mtraps.o
+
++SCruntime = scinit.so apply.so callcc.so cio.so heap.so objects.so mtraps.so
++
+ Cruntimec = scinit.c apply.c callcc.c cio.c heap.c objects.c mtraps.c
+
+ Chfiles = scinit.h apply.h callcc.h cio.h heap.h objects.h options.h
+@@ -22,6 +26,11 @@
+ scqquote.o screp.o \
+ scrt1.o scrt2.o scrt3.o scrt4.o scrt5.o scrt6.o scrt7.o scrtuser.o
+
++SSruntime = scdebug.so sceval.so scexpand.so scexpnd1.so scexpnd2.so \
++ scqquote.so screp.so \
++ scrt1.so scrt2.so scrt3.so scrt4.so scrt5.so scrt6.so scrt7.so \
++ scrtuser.so
++
+ Sruntimec = scdebug.c sceval.c scexpand.c scexpnd1.c scexpnd2.c \
+ scqquote.c screp.c \
+ scrt1.c scrt2.c scrt3.c scrt4.c scrt5.c scrt6.c scrt7.c scrtuser.c
+@@ -43,17 +52,27 @@
+ ${SCC} -C ${SCCFLAGS} $*.sc
+
+ .c.o:
+- ${CC} -c ${CFLAGS} -I. $*.c
++ ${CC} ${CFLAGS} -c ${.IMPSRC} -I. -o ${.TARGET}
++
++.c.so:
++ ${CC} ${PICFLAGS} ${CFLAGS} -c ${.IMPSRC} -I. -o ${.TARGET}
+
+ .s.o:
+ ${CC} -c $*.s
+
++.s.so:
++ ${CPP} -E -DPIC ${CFLAGS:M-[ID]*} ${.IMPSRC} | \
++ ${AS} -k -o ${.TARGET}
++
+ sc-to-c: ${Sruntimec} sci.c
+
+ c-to-o: ${Sruntimec} ${Sruntime} ${Cruntime}
+
+ s-to-o: ${Aruntime}
+
++OBJS = ${Sruntime} ${Cruntime} ${Aruntime}
++SHAREDOBJS = ${OBJS:.o=.so}
++
+ Xlibsc.a: ${Sruntimec} ${Sruntime} ${Cruntime} ${Aruntime}
+ rm -f Xlibsc.a
+ ar q Xlibsc.a ${Cruntime} ${Sruntime} ${Aruntime}
+@@ -75,36 +94,42 @@
+ Xmv: Xsci Xlibsc.a
+ mv Xsci sci
+ mv Xlibsc.a libsc.a
+-
++
+ port:
+- make "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = echo" \
+- Xlibsc.a Xsci Xmv ${Plib}
++ ${MAKE} "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = echo" \
++ Xlibsc.a Xsci Xmv ${Plib} libsc.so.${SOVER}
+
+ libsc_p.a: libsc.a
+ mkdir saveobj
+ mv ${Sruntime} ${Cruntime} ${Aruntime} saveobj
+ rm -f libsc_p.a
+- make "CC = ${CC}" "CFLAGS = ${CFLAGS} -pg" ${Sruntime} ${Cruntime} \
++ ${MAKE} "CC = ${CC}" "CFLAGS = ${CFLAGS} -pg" ${Sruntime} ${Cruntime} \
+ ${Aruntime}
+ ar q libsc_p.a ${Cruntime} ${Sruntime} ${Aruntime}
+ ${RANLIB} libsc_p.a
+ mv saveobj/* .
+ rmdir saveobj
+
++libsc.so.${SOVER}: ${SCruntime} ${SSruntime} ${SAruntime}
++ rm -f libsc.so.${SOVER}
++ ${CC} -shared -Wl,-x -Wl,-assert -Wl,pure-text -Wl,-soname,$@ -o $@ \
++ ${SCruntime} ${SSruntime} ${SAruntime}
++
+ install-private:
+- make "LIBDIR = ${DESTDIR}" "BINDIR = ${DESTDIR}" \
++ ${MAKE} "LIBDIR = ${DESTDIR}" "BINDIR = ${DESTDIR}" \
+ "OWNER = -o `whoami`" install
+
+ install:
+- -mkdir ${LIBDIR}/schemetoc
+- cp libsc.a ${LIBDIR}/schemetoc/libsc.a
+- ${RANLIB} ${LIBDIR}/schemetoc/libsc.a
+- -cp libsc_p.a ${LIBDIR}/schemetoc/libsc_p.a
+- -${RANLIB} ${LIBDIR}/schemetoc/libsc_p.a
+- cp objects.h ${LIBDIR}/schemetoc
+- cp options.h ${LIBDIR}/schemetoc
+- cp predef.sc ${LIBDIR}/schemetoc
+- cp sci ${BINDIR}/sci
++ ${BSD_INSTALL_DATA} libsc.a ${LIBDIR}
++ -${RANLIB} ${LIBDIR}/libsc.a
++ ${BSD_INSTALL_DATA} libsc_p.a ${LIBDIR}
++ -${RANLIB} ${LIBDIR}/libsc_p.a
++ ${BSD_INSTALL_DATA} objects.h ${LIBDIR}/schemetoc
++ ${BSD_INSTALL_DATA} options.h ${LIBDIR}/schemetoc
++ ${BSD_INSTALL_DATA} predef.sc ${LIBDIR}/schemetoc
++ ${BSD_INSTALL_PROGRAM} sci ${BINDIR}
++ ${BSD_INSTALL_DATA} libsc.so.${SOVER} ${LIBDIR}
++ ln -sf libsc.so.${SOVER} ${LIBDIR}/libsc.so
+
+ clean:
+ rm -f ${Sruntime} ${Cruntime} ${Aruntime} sci.o embedded.o \
+@@ -124,8 +149,8 @@
+ libsc.a ${Plib} sci ${destdir}
+
+ all:
+- make "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = ${SCC}" \
+- "SCCFLAGS = ${SCCFLAGS}" Xlibsc.a Xsci Xmv ${Plib}
++ ${MAKE} "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = ${SCC}" \
++ "SCCFLAGS = ${SCCFLAGS}" Xlibsc.a Xsci Xmv ${Plib} libsc.so.${SOVER}
+
+ srclinks:
+ for x in ${Cruntimec} ${Chfiles} ${Sruntimec} ${Sruntimesc} ${Smisc}; \
diff --git a/lang/schemetoc/files/patch-ag b/lang/schemetoc/files/patch-ag
new file mode 100644
index 000000000000..646fa1c15742
--- /dev/null
+++ b/lang/schemetoc/files/patch-ag
@@ -0,0 +1,53 @@
+--- scrt/options.h.orig Tue Feb 23 01:14:40 1993
++++ scrt/options.h Wed Feb 2 22:22:22 2000
+@@ -71,6 +71,7 @@
+ MC680X0 HP 9000/300, Sun 3, Next
+ MIPS DECstation, SGI, Sony News
+ VAX Vax ULTRIX
++ FREEBSD x86 FreeBSD
+ WIN16 Microsoft Windows 3.1
+ */
+
+@@ -80,6 +81,7 @@
+ #define MC680X0 1
+ #define MIPS 1
+ #define VAX 1
++#define FREEBSD 1
+ #define WIN16 1
+
+ /* Attributes of the selected architecture:
+@@ -369,6 +371,34 @@
+ */
+
+ #define STACKPTR( x ) x = sc_processor_register( 14 )
++#endif
++
++/***************/
++/* FREEBSD */
++/***************/
++
++#ifdef FREEBSD
++#define IMPLEMENTATION_MACHINE "Generic PC"
++#define IMPLEMENTATION_CPU "Intelx86"
++#define IMPLEMENTATION_OS "FreeBSD"
++#undef IMPLEMENTATION_FS
++
++typedef int S2CINT; /* Signed pointer size integer */
++typedef unsigned S2CUINT; /* Unsigned pointer size interger */
++
++typedef int PAGELINK; /* 32-bit sc_pagelink values */
++#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */
++#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */
++
++#define STACKPTR( x ) x = sc_processor_register( 0 )
++
++#include <setjmp.h>
++typedef jmp_buf sc_jmp_buf;
++
++/* Horrid kludge. See callcc.c for the full story: */
++#define LAZY_STACK_POP 1
++#define LAZY_STACK_INCREMENT 4
++
+ #endif
+
+ /***************/
diff --git a/lang/schemetoc/files/patch-ah b/lang/schemetoc/files/patch-ah
new file mode 100644
index 000000000000..b35797872119
--- /dev/null
+++ b/lang/schemetoc/files/patch-ah
@@ -0,0 +1,126 @@
+--- scsc/main.sc.orig Tue Feb 23 00:59:07 1993
++++ scsc/main.sc Wed Feb 2 22:22:22 2000
+@@ -59,7 +59,9 @@
+ readtext
+ transform))
+
+-(define SCC-VERSION "15mar93jfb")
++(define scheme_dir "%%PREFIX%%/lib/schemetoc/")
++
++(define SCC-VERSION "15mar93-FreeBSD")
+ ; Compiler version string.
+
+ (define FORCE-LD-OF-REP read-eval-print)
+@@ -69,23 +71,28 @@
+ ;;; The following top-level variables define the implementation dependent
+ ;;; information:
+
+-(define PREDEF-DEFAULT "../scrt/predef.sc")
++(define PREDEF-DEFAULT (string-append scheme_dir "predef.sc"))
++
+ ; File holding the declarations for predefined
+ ; functions.
+
+ (define C-INCLUDE-FILE "objects.h")
+ ; #include file for the predefined functions.
+
+-(define C-INCLUDE-DIR "../scrt")
++(define C-INCLUDE-DIR scheme_dir)
+ ; directory containing #include file for
+ ; predefined functions.
+
+-(define SC-LIBRARY "../scrt/libsc.a")
++(define SC-LIBRARY (string-append scheme_dir "libsc.a"))
+ ; Scheme->C library file.
+
+-(define SC-LIBRARY_P "../scrt/libsc_p.a")
++(define SCXL-LIBRARY (string-append scheme_dir "scxl.a"))
++
++(define SC-LIBRARY_P (string-append scheme_dir "libsc_p.a"))
+ ; Scheme->C profiled library file.
+
++(define compile-static #f)
++
+ ;;; When the compiler is invoked directly from the shell, the following
+ ;;; function is invoked to control compilation. It will interprete the flags,
+ ;;; invoke the compiler and then exit. Any compilation errors or Scheme errors
+@@ -123,6 +130,8 @@
+ ;;;
+ ;;; -Ot optimize C code by omitting type checks.
+ ;;;
++;;; -static compile static executable.
++;;;
+ ;;; -pg compile for gprof profiling.
+ ;;;
+ ;;; -LIBDIR directory
+@@ -161,13 +170,9 @@
+ (c-flags '())
+ (sc-to-c.c "SC-TO-C.c")
+ (sc-to-c.o "SC-TO-C.o")
+- (directory-separator
+- (if (equal? (list-ref (implementation-information) 5)
+- "Microsoft Windows 3.x")
+- "\\"
+- "/"))
++ (directory-separator "/")
+ (log '())
+- (cc "cc"))
++ (cc "gcc"))
+
+ ;;; 1. Pick up the command line arguments.
+
+@@ -233,6 +238,9 @@
+ (cons "(define-constant *type-check* #f)"
+ flags))
+ (loop (cdr args)))
++ ((equal? arg "-static")
++ (set! compile-static #t)
++ (loop (cdr args)))
+ ((equal? arg "-Ob")
+ (set! flags
+ (cons "(define-constant *bounds-check* #f)"
+@@ -295,20 +303,27 @@
+ ;;; C compiler to do the rest.
+
+ (unless (eq? 0
+- (system (apply string-append
+- `(,cc " -I" ,c-include-dir
+- ,@(map (lambda (x)
+- (string-append " " x))
+- (append (reverse c-flags)
+- (if (member "-pg"
+- c-flags)
+- `(,sc-library_p
+- "-lm")
+- `(,sc-library
+- "-lm"))))))))
++ (system (apply string-append
++ `(,cc " -I" ,c-include-dir
++ ,@(map (lambda (x)
++ (string-append " " x))
++ (append (reverse c-flags)
++ (if compile-static
++ (if (member "-pg" c-flags)
++ (list sc-library_p "-lm")
++ (if (member "-c" c-flags)
++ '()
++ (if (member "xlib" with-modules)
++ (list "-lm" sc-library scxl-library "-L%%X11BASE%%/lib -lX11")
++ (list "-lm" sc-library))))
++ (if (member "-c" c-flags)
++ '()
++ (if (member "xlib" with-modules)
++ (list "-L%%X11BASE%%/lib -lm -lsc -lscxl -lX11")
++ (list "-lm -lsc"))))))))))
+ (reset))
+ (catch-error
+- (lambda ()
++ (lambda ()
+ (remove-file sc-to-c.c)
+ (remove-file sc-to-c.o)))))
+
+@@ -351,3 +366,4 @@
+ root.c)
+ ;;; Pass argument to C.
+ (else arg))))
++
diff --git a/lang/schemetoc/files/patch-ai b/lang/schemetoc/files/patch-ai
new file mode 100644
index 000000000000..cbfe864a16cd
--- /dev/null
+++ b/lang/schemetoc/files/patch-ai
@@ -0,0 +1,11 @@
+--- scsc/makefile.orig Sat Jan 30 08:17:02 1993
++++ scsc/makefile Wed Feb 2 22:22:22 2000
+@@ -82,7 +82,7 @@
+ done
+ echo '#! /bin/csh -f' > scc
+ echo `pwd`'/sccomp -scl ${SCL} -scmh ${SCMH} \
+- -cc ${CC} -LIBDIR ' `pwd`'/${RTDIR} $$argv' >> scc
++ -cc ${CC} -static -LIBDIR ' `pwd`'/${RTDIR} $$argv' >> scc
+ chmod +x scc
+ echo '#! /bin/csh -f' > Xscc
+ echo `pwd`'/Xsccomp -scl ${SCL} -scmh ${SCMH} \
diff --git a/lang/schemetoc/files/patch-aj b/lang/schemetoc/files/patch-aj
new file mode 100644
index 000000000000..2cc386354c2c
--- /dev/null
+++ b/lang/schemetoc/files/patch-aj
@@ -0,0 +1,121 @@
+--- xlib/makefile.orig Tue Mar 2 02:24:36 1993
++++ xlib/makefile Wed Feb 2 22:22:22 2000
+@@ -1,5 +1,7 @@
+ .SUFFIXES:
+-.SUFFIXES: .sc .cdecl .o .c
++.SUFFIXES: .sc .cdecl .o .c .so
++
++SOVER = 1
+
+ CDECL = ../cdecl/cdecl
+ SIZEOF = ../cdecl/sizeof
+@@ -58,6 +60,16 @@
+ xvisualinfo.o xwindowattributes.o xwindowchanges.o xwmhints.o \
+ xpixmapformatvalues.o xtextproperty.o
+
++sxdo = depth.so screen.so visual.so xarc.so xchar2b.so xcharstruct.so \
++ xclasshint.so xcomposestatus.so xcolor.so xlibCONSTANTS.so xevent.so \
++ xfontprop.so xfontstruct.so xgcvalues.so xhostaddress.so xiconsize.so \
++ ximage.so xkeyboardcontrol.so xkeyboardstate.so xmodifierkeymap.so \
++ xpoint.so xrectangle.so xrmoptiondescrec.so xrmvalue.so xsegment.so \
++ xsetwindowattributes.so xsizehints.so xstandardcolormap.so \
++ xlibSTUBS.so xtextitem.so xtextitem16.so xtimecoord.so xlibTYPES.so \
++ xvisualinfo.so xwindowattributes.so xwindowchanges.so xwmhints.so \
++ xpixmapformatvalues.so xtextproperty.so
++
+ xdpsc = xws2.sc xws3.sc xws4.sc xws5.sc xws6.sc xws7.sc \
+ xws8.sc xws9.sc xws10.sc xwsr4.sc
+
+@@ -76,6 +88,10 @@
+ xwso = xwss.o xws2.o xws3.o xws4.o xws5.o xws6.o xws7.o xws8.o xws9.o xws10.o \
+ xlib.o xwsr4.o
+
++sxwso = xwss.so xws2.so xws3.so xws4.so xws5.so xws6.so xws7.so xws8.so \
++ xws9.so xws10.so xlib.so xwsr4.so
++
++
+ sizeof.cdecl:
+ ${SIZEOF} > sizeof.cdecl
+
+@@ -101,28 +117,52 @@
+ .c.o:
+ ${SCC} -c ${XLIBCFLAGS} $*.c
+
++.c.so:
++ ${CC} ${PICFLAGS} ${CFLAGS} -c ${XLIBCFLAGS} -I../scrt ${.IMPSRC} -o ${.TARGET}
++
+ scixl: xlibTYPES.o ${xwssc} ${xwsc} ${xwso}
+ ${SCC} -o scixl -i -m xlib ${xwso} ${xdo} ${XLIB}
+-
+-scxl.a: xlibTYPES.o ${xwssc} ${xwsc} ${xwso}
+- rm -f scxl.a
+- ar q scxl.a ${xdo} ${xwso}
+- ${RANLIB} scxl.a
++
++libscxl.a: xlibTYPES.o ${xwssc} ${xwsc} ${xwso}
++ rm -f libscxl.a
++ mv -f xmodifierkeymap.o xmodifier.o
++ mv -f xstandardcolormap.o xstandard.o
++ mv -f xwindowattributes.o xwindowatt.o
++ mv -f xpixmapformatvalues.o xpixmap.o
++ ar q libscxl.a depth.o screen.o visual.o xarc.o xchar2b.o xcharstruct.o \
++ xclasshint.o xcomposestatus.o xcolor.o xlibCONSTANTS.o xevent.o \
++ xfontprop.o xfontstruct.o xgcvalues.o xhostaddress.o xiconsize.o \
++ ximage.o xkeyboardcontrol.o xkeyboardstate.o xmodifier.o \
++ xpoint.o xrectangle.o xrmoptiondescrec.o xrmvalue.o xsegment.o \
++ xsetwindowattributes.o xsizehints.o xstandard.o \
++ xlibSTUBS.o xtextitem.o xtextitem16.o xtimecoord.o xlibTYPES.o \
++ xvisualinfo.o xwindowatt.o xwindowchanges.o xwmhints.o \
++ xpixmap.o xtextproperty.o \
++ xwss.o xws2.o xws3.o xws4.o xws5.o xws6.o xws7.o xws8.o \
++ xws9.o xws10.o xlib.o xwsr4.o
++ ${RANLIB} libscxl.a
++
++Xlibscxl.so.${SOVER}: xlibTYPES.so ${xwssc} ${xwsc} ${xwso} ${sxdo} ${sxwso}
++ rm -f libscxl.so.${SOVER}
++ ${CC} -shared -Wl,-x -Wl,-assert -Wl,pure-text -Wl,-soname,libscxl.so.${SOVER} -o libscxl.so.${SOVER} ${sxdo} ${sxwso}
++
++libscxl.so.${SOVER}:
++ ${MAKE} Xlibscxl.so.${SOVER}
+
+ clear:
+- ${SCC} -o clear clear.sc scxl.a ${XLIB}
++ ${SCC} -o clear clear.sc libscxl.a ${XLIB}
+
+ hello:
+- ${SCC} -o hello hello.sc scxl.a ${XLIB}
++ ${SCC} -o hello hello.sc libscxl.a ${XLIB}
+
+ puzzle:
+- ${SCC} -o puzzle puzzle.sc scxl.a ${XLIB}
++ ${SCC} -o puzzle puzzle.sc libscxl.a ${XLIB}
+
+ clean:
+ rm -f *.BAK *.CKP core
+
+ noprogs:
+- rm -f *.o scixl scxl.a hello puzzle clear
++ rm -f *.o scixl libscxl.a hello puzzle clear
+
+ clean-cdecl:
+ rm -f ${xdsc} ${xdsch} ${xdc} ${xdpsc} ${xdpsch} ${xdpc} sizeof.cdecl
+@@ -132,10 +172,17 @@
+ puzzle.c npuzzle.c
+
+ all:
+- make scixl scxl.a
++ ${MAKE} scixl libscxl.a libscxl.so.${SOVER}
++
++install:
++ ${BSD_INSTALL_DATA} libscxl.a ${LIBDIR}
++ -${RANLIB} ${LIBDIR}/libscxl.a
++ ${BSD_INSTALL_PROGRAM} scixl ${BINDIR}
++ ${BSD_INSTALL_DATA} libscxl.so.${SOVER} ${LIBDIR}
++ ln -sf libscxl.so.${SOVER} ${LIBDIR}/libscxl.so
+
+ gensource:
+- make ${xwssc} ${xwsc}
++ ${MAKE} ${xwssc} ${xwsc}
+
+ srclinks:
+ for x in ${XD} ${XDP} ${XMISC}; \
diff --git a/lang/schemetoc/files/x86.s b/lang/schemetoc/files/x86.s
index 1cedbc50ce29..1e742f3cd13f 100644
--- a/lang/schemetoc/files/x86.s
+++ b/lang/schemetoc/files/x86.s
@@ -13,9 +13,9 @@
#else
.align 2
#endif
-.globl _sc_geti386regs
+.globl sc_geti386regs
-_sc_geti386regs:
+sc_geti386regs:
pushl %ebp
movl %esp,%ebp
pushl %ecx
diff --git a/lang/schemetoc/pkg-plist b/lang/schemetoc/pkg-plist
index 0d8f6318edda..aec4a73d3ac9 100644
--- a/lang/schemetoc/pkg-plist
+++ b/lang/schemetoc/pkg-plist
@@ -2,13 +2,26 @@ bin/sci
bin/scc
bin/sccomp
bin/scixl
-man/man1/sci.1.gz
-man/man1/scc.1.gz
-lib/schemetoc
-lib/libsc.so.1.0
-lib/libscxl.so.1.0
-@exec /sbin/ldconfig -m %B
-@unexec /sbin/ldconfig -R
-@exec /usr/bin/ranlib %D/lib/schemetoc/libsc.a
-@exec /usr/bin/ranlib %D/lib/schemetoc/libsc_p.a
-@exec /usr/bin/ranlib %D/lib/schemetoc/scxl.a
+lib/libsc.a
+lib/libsc_p.a
+lib/libsc.so
+lib/libsc.so.1
+lib/libscxl.a
+lib/libscxl.so
+lib/libscxl.so.1
+@exec /usr/bin/env OBJFORMAT=%%PORTOBJFORMAT%% /sbin/ldconfig -m %B
+@unexec /usr/bin/env OBJFORMAT=%%PORTOBJFORMAT%% /sbin/ldconfig -R
+lib/schemetoc/doc/README.FreeBSD
+lib/schemetoc/doc/embedded.psf
+lib/schemetoc/doc/hello.sc
+lib/schemetoc/doc/index.psf
+lib/schemetoc/doc/intro.psf
+lib/schemetoc/doc/puzzle.sc
+lib/schemetoc/doc/r4rs.psf
+lib/schemetoc/doc/smithnotes.psf
+lib/schemetoc/doc/test.sc
+lib/schemetoc/objects.h
+lib/schemetoc/options.h
+lib/schemetoc/predef.sc
+@dirrm lib/schemetoc/doc
+@dirrm lib/schemetoc