summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authordholland <dholland@pkgsrc.org>2016-07-03 17:50:31 +0000
committerdholland <dholland@pkgsrc.org>2016-07-03 17:50:31 +0000
commit7952cdf0e290436f00d97238bc67963c451db863 (patch)
tree6dba5a6137a9c0f8aefdb772dc0494704245f043 /lang
parentcbbee5be5e8637db04ae4ff6c00b5ef40c2f9157 (diff)
downloadpkgsrc-7952cdf0e290436f00d97238bc67963c451db863.tar.gz
Add a copy of smlnj from before the last update (so, 110.72) because
this version builds and runs on NetBSD/i386. (Yes, the update was years back. This is what happens with packages that don't build on amd64...)
Diffstat (limited to 'lang')
-rw-r--r--lang/smlnj11072/DESCR6
-rw-r--r--lang/smlnj11072/Makefile106
-rw-r--r--lang/smlnj11072/Makefile.common37
-rw-r--r--lang/smlnj11072/PLIST176
-rw-r--r--lang/smlnj11072/PLIST.FreeBSD2
-rw-r--r--lang/smlnj11072/distinfo81
-rw-r--r--lang/smlnj11072/files/targets15
-rw-r--r--lang/smlnj11072/patches/patch-aa79
-rw-r--r--lang/smlnj11072/patches/patch-ab29
-rw-r--r--lang/smlnj11072/patches/patch-ac24
-rw-r--r--lang/smlnj11072/patches/patch-ad25
-rw-r--r--lang/smlnj11072/patches/patch-ae187
-rw-r--r--lang/smlnj11072/patches/patch-af33
-rw-r--r--lang/smlnj11072/patches/patch-ag29
-rw-r--r--lang/smlnj11072/patches/patch-ah12
-rw-r--r--lang/smlnj11072/patches/patch-ai12
-rw-r--r--lang/smlnj11072/patches/patch-aj12
-rw-r--r--lang/smlnj11072/patches/patch-ak12
-rw-r--r--lang/smlnj11072/patches/patch-am13
-rw-r--r--lang/smlnj11072/patches/patch-an13
-rw-r--r--lang/smlnj11072/patches/patch-ao13
-rw-r--r--lang/smlnj11072/patches/patch-ap13
-rw-r--r--lang/smlnj11072/patches/patch-aq13
-rw-r--r--lang/smlnj11072/patches/patch-ar15
-rw-r--r--lang/smlnj11072/patches/patch-as15
-rw-r--r--lang/smlnj11072/patches/patch-at17
26 files changed, 989 insertions, 0 deletions
diff --git a/lang/smlnj11072/DESCR b/lang/smlnj11072/DESCR
new file mode 100644
index 00000000000..8db8aad709b
--- /dev/null
+++ b/lang/smlnj11072/DESCR
@@ -0,0 +1,6 @@
+A Standard ML implementation from Bell-Labs. Implements the SML '97
+definition including the new Basis library with a few minor omissions
+and discrepancies.
+
+If you are interested in a lighter weight implementation of ML, the
+Moscow-ML port is recommended.
diff --git a/lang/smlnj11072/Makefile b/lang/smlnj11072/Makefile
new file mode 100644
index 00000000000..fbd3152dbc8
--- /dev/null
+++ b/lang/smlnj11072/Makefile
@@ -0,0 +1,106 @@
+# $NetBSD: Makefile,v 1.1 2016/07/03 17:50:31 dholland Exp $
+#
+
+DISTNAME= boot.${BOX}-unix
+PKGNAME= smlnj-${SML_VERSION}
+CATEGORIES= lang
+MASTER_SITES= http://smlnj.cs.uchicago.edu/dist/working/${SML_VERSION}/
+DISTFILES= MLRISC.tgz \
+ boot.${BOX}-unix.tgz \
+ ckit.tgz \
+ cm.tgz \
+ cml.tgz \
+ compiler.tgz \
+ config.tgz \
+ eXene.tgz \
+ ml-burg.tgz \
+ ml-lex.tgz \
+ nlffi.tgz \
+ ml-yacc.tgz \
+ runtime.tgz \
+ smlnj-lib.tgz \
+ system.tgz \
+ ml-lpt.tgz \
+ pgraph.tgz \
+ trace-debug-profile.tgz \
+ heap2asm.tgz \
+ smlnj-c.tgz
+
+MAINTAINER= richards+netbsd@CS.Princeton.EDU
+HOMEPAGE= http://www.smlnj.org/index.html
+COMMENT= Popular functional language from Bell Labs
+
+SML_VERSION= 110.72
+
+PKG_DESTDIR_SUPPORT= user-destdir
+
+WRKSRC= ${WRKDIR}
+DIST_SUBDIR= smlnj-${SML_VERSION}
+USE_TOOLS+= gmake pax
+
+# previous versions of the package had an additional '-'
+CONFLICTS= sml-nj-[0-9]*
+
+SML_BASE= ${PREFIX}/lib/smlnj
+SML_LIBDIR= ${SML_BASE}/lib
+SML_BINDIR= ${SML_BASE}/bin
+SML_SCRIPTS= _link-sml _run-sml _ml-build _ml-makedepend
+
+.include "../../lang/smlnj/Makefile.common"
+
+# create parent directory for the runtime system
+pre-extract:
+ ${MKDIR} ${WRKDIR}/src || ${TRUE}
+
+# make it easier to patch the runtime system
+do-extract:
+ ${RUN} extract_file="${_DISTDIR}/config.tgz"; export extract_file; \
+ cd ${WRKDIR}; ${EXTRACT_CMD}
+ ${RUN} extract_file="${_DISTDIR}/runtime.tgz"; export extract_file; \
+ cd ${WRKDIR}/src; ${EXTRACT_CMD}
+ ${RUN} extract_file="${_DISTDIR}/runtime.tgz"; export extract_file; \
+ mkdir ${WRKDIR}/base; cd ${WRKDIR}/base; ${EXTRACT_CMD}
+
+# make symlinks to the dist files
+post-extract:
+ cd ${WRKDIR} && ${LN} -sf ${_DISTDIR}/* .
+
+# resolve definition of SML_BASE, CFLAGS in patched files
+do-configure:
+ if [ ${MACHINE_ARCH} = "powerpc" ]; then \
+ ${AWK} '(! /^request nlffi$$/) { print }' \
+ < ${WRKDIR}/config/targets \
+ > ${WRKDIR}/temp; \
+ ${MV} ${WRKDIR}/temp ${WRKDIR}/config/targets; \
+ fi
+ cd ${WRKDIR}/config; \
+ for f in ${SML_SCRIPTS}; do \
+ ${CP} "$${f}" "$${f}.tmp"; \
+ ${SED} -e 's|@SML_BASE@|${SML_BASE}|g' \
+ < "$${f}.tmp" > "$${f}"; \
+ done; \
+ cd ${WRKDIR}/src/runtime/objs; \
+ for f in *; do \
+ ${CP} "$${f}" "$${f}.tmp"; \
+ ${SED} -e 's|@CFLAGS@|${CFLAGS}|g' \
+ < "$${f}.tmp" > "$${f}"; \
+ done
+
+# The build target needs to run $WRKDIR/config/install.sh
+do-build:
+ cd ${WRKDIR} && unset PWD && \
+ FILESDIR="${FILESDIR}" PATCH="${PATCH}" PATCH_ARGS="${PATCH_ARGS}" \
+ SMLNJ_HOME="${WRKDIR}" ./config/install.sh
+
+# install target
+# (see ftp://ftp.research.bell-labs.com/dist/smlnj/working/110.38/INSTALL)
+# 1. create installation directories
+# 2. copy the ./bin and ./lib directories across
+# 3. install links to executables in $PREFIX/bin
+INSTALLATION_DIRS= bin
+do-install:
+ ${INSTALL_DATA_DIR} ${DESTDIR}${SML_BASE}
+ cd ${WRKDIR} && pax -rw -pam bin lib ${DESTDIR}${SML_BASE}
+ cd ${DESTDIR}${PREFIX}/bin && ${LN} -sf ../lib/smlnj/bin/* .
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/smlnj11072/Makefile.common b/lang/smlnj11072/Makefile.common
new file mode 100644
index 00000000000..7b77ff05058
--- /dev/null
+++ b/lang/smlnj11072/Makefile.common
@@ -0,0 +1,37 @@
+# $NetBSD: Makefile.common,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+# smlnj also supports hppa, sparc, ppc, mlrisc & alpha
+# pkg support for those platforms, and say, solaris-x86
+# is left as an (easy) exercise for the reader.
+ONLY_FOR_PLATFORM= NetBSD-*-i386 NetBSD-*-sparc NetBSD-*-powerpc \
+ FreeBSD-*-i386 Linux-*-i386 SunOS-*-sparc
+
+.include "../../mk/bsd.prefs.mk"
+
+# Possible values of BOX and OS must be kept in sync with the
+# currently ported platforms.
+
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "FreeBSD"
+OS= bsd
+.elif ${OPSYS} == "SunOS" || ${OPSYS} == "Linux"
+OS= ${LOWER_OPSYS}
+.endif
+
+PLIST_VARS+= nlffi # not available on all platforms
+
+.if ${MACHINE_ARCH} == "i386"
+BOX= x86
+PLIST.nlffi= yes
+.elif ${MACHINE_ARCH} == "powerpc"
+BOX= ppc
+.elif ${MACHINE_ARCH} == "sparc"
+BOX= ${MACHINE_ARCH}
+PLIST.nlffi= yes
+.else
+# for "make fetch", default to i386 instead of trying to download
+# a non-existing file
+BOX= x86
+PLIST.nlffi= yes
+.endif
+
+PLIST_SUBST+= BOX=${BOX:Q} OS=${OS:Q} NLFFI=${NLFFI}
diff --git a/lang/smlnj11072/PLIST b/lang/smlnj11072/PLIST
new file mode 100644
index 00000000000..5c5e0fc1451
--- /dev/null
+++ b/lang/smlnj11072/PLIST
@@ -0,0 +1,176 @@
+@comment $NetBSD: PLIST,v 1.1 2016/07/03 17:50:31 dholland Exp $
+bin/heap2asm
+bin/heap2exec
+bin/ml-antlr
+bin/ml-build
+bin/ml-burg
+bin/ml-lex
+bin/ml-makedepend
+${PLIST.nlffi}bin/ml-nlffigen
+bin/ml-ulex
+bin/ml-yacc
+bin/nowhere
+bin/sml
+lib/smlnj/bin/.arch-n-opsys
+lib/smlnj/bin/.heap/heap2asm.${BOX}-${OS}
+lib/smlnj/bin/.heap/ml-antlr.${BOX}-${OS}
+lib/smlnj/bin/.heap/ml-burg.${BOX}-${OS}
+lib/smlnj/bin/.heap/ml-lex.${BOX}-${OS}
+${PLIST.nlffi}lib/smlnj/bin/.heap/ml-nlffigen.${BOX}-${OS}
+lib/smlnj/bin/.heap/ml-ulex.${BOX}-${OS}
+lib/smlnj/bin/.heap/ml-yacc.${BOX}-${OS}
+lib/smlnj/bin/.heap/nowhere.${BOX}-${OS}
+lib/smlnj/bin/.heap/sml.${BOX}-${OS}
+lib/smlnj/bin/.link-sml
+lib/smlnj/bin/.run-sml
+lib/smlnj/bin/.run/run.${BOX}-${LOWER_OPSYS}
+lib/smlnj/bin/heap2asm
+lib/smlnj/bin/heap2exec
+lib/smlnj/bin/ml-antlr
+lib/smlnj/bin/ml-build
+lib/smlnj/bin/ml-burg
+lib/smlnj/bin/ml-lex
+lib/smlnj/bin/ml-makedepend
+${PLIST.nlffi}lib/smlnj/bin/ml-nlffigen
+lib/smlnj/bin/ml-ulex
+lib/smlnj/bin/ml-yacc
+lib/smlnj/bin/nowhere
+lib/smlnj/bin/sml
+lib/smlnj/lib/SMLNJ-BASIS/.cm/${BOX}-unix/basis.cm
+lib/smlnj/lib/SMLNJ-LIB/Controls/.cm/${BOX}-unix/controls-lib.cm
+lib/smlnj/lib/SMLNJ-LIB/HTML/.cm/${BOX}-unix/html-lib.cm
+lib/smlnj/lib/SMLNJ-LIB/PP/.cm/${BOX}-unix/pp-lib.cm
+lib/smlnj/lib/SMLNJ-LIB/Util/.cm/${BOX}-unix/smlnj-lib.cm
+lib/smlnj/lib/SMLNJ-ML-YACC-LIB/.cm/${BOX}-unix/ml-yacc-lib.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/ALPHA.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/AMD64-Peephole.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/AMD64.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/CCall-Vararg.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/CCall-sparc.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/CCall-x86-64.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/CCall-x86.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/CCall.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/Control.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/Graphs.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/HPPA.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/IA32-Peephole.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/IA32.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/Lib.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/MLRISC.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/MLTREE.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/PPC.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/Peephole.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/RA.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/SPARC.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/StagedAlloc.cm
+lib/smlnj/lib/SMLNJ-MLRISC/.cm/${BOX}-unix/Visual.cm
+lib/smlnj/lib/burg-ext.cm/.cm/${BOX}-unix/burg-ext.cm
+${PLIST.nlffi}lib/smlnj/lib/c/.cm/${BOX}-unix/c.cm
+${PLIST.nlffi}lib/smlnj/lib/c/internals/.cm/${BOX}-unix/c-int.cm
+${PLIST.nlffi}lib/smlnj/lib/c/memory/.cm/${BOX}-unix/memory.cm
+lib/smlnj/lib/ckit-lib.cm/.cm/${BOX}-unix/ckit-lib.cm
+lib/smlnj/lib/cml-lib/.cm/${BOX}-unix/smlnj-lib.cm
+lib/smlnj/lib/cml-lib/.cm/${BOX}-unix/trace-cml.cm
+lib/smlnj/lib/cml/.cm/${BOX}-unix/basis.cm
+lib/smlnj/lib/cml/.cm/${BOX}-unix/cml-internal.cm
+lib/smlnj/lib/cml/.cm/${BOX}-unix/cml.cm
+lib/smlnj/lib/cml/.cm/${BOX}-unix/core-cml.cm
+lib/smlnj/lib/dir-tool.cm/.cm/${BOX}-unix/dir-tool.cm
+lib/smlnj/lib/eXene.cm/.cm/${BOX}-unix/eXene.cm
+lib/smlnj/lib/grm-ext.cm/.cm/${BOX}-unix/grm-ext.cm
+lib/smlnj/lib/hash-cons-lib.cm/.cm/${BOX}-unix/hash-cons-lib.cm
+lib/smlnj/lib/inet-lib.cm/.cm/${BOX}-unix/inet-lib.cm
+lib/smlnj/lib/json-lib.cm/.cm/${BOX}-unix/json-lib.cm
+lib/smlnj/lib/lex-ext.cm/.cm/${BOX}-unix/lex-ext.cm
+lib/smlnj/lib/make-tool.cm/.cm/${BOX}-unix/make-tool.cm
+lib/smlnj/lib/ml-antlr-tool.cm/.cm/${BOX}-unix/ml-antlr-tool.cm
+lib/smlnj/lib/ml-lpt-lib.cm/.cm/${BOX}-unix/ml-lpt-lib.cm
+lib/smlnj/lib/ml-ulex-tool.cm/.cm/${BOX}-unix/ml-ulex-tool.cm
+lib/smlnj/lib/mlburg-tool.cm/.cm/${BOX}-unix/mlburg-tool.cm
+lib/smlnj/lib/mllex-tool.cm/.cm/${BOX}-unix/mllex-tool.cm
+lib/smlnj/lib/mlrisc-tools/.cm/${BOX}-unix/match-compiler.cm
+lib/smlnj/lib/mlrisc-tools/.cm/${BOX}-unix/parser.cm
+lib/smlnj/lib/mlrisc-tools/.cm/${BOX}-unix/pp.cm
+lib/smlnj/lib/mlrisc-tools/.cm/${BOX}-unix/prec-parser.cm
+lib/smlnj/lib/mlrisc-tools/.cm/${BOX}-unix/sml-ast.cm
+lib/smlnj/lib/mlrisc-tools/.cm/${BOX}-unix/source-map.cm
+lib/smlnj/lib/mlyacc-tool.cm/.cm/${BOX}-unix/mlyacc-tool.cm
+lib/smlnj/lib/noweb-tool.cm/.cm/${BOX}-unix/noweb-tool.cm
+lib/smlnj/lib/nw-ext.cm/.cm/${BOX}-unix/nw-ext.cm
+lib/smlnj/lib/pathconfig
+lib/smlnj/lib/pgraph-util.cm/.cm/${BOX}-unix/pgraph-util.cm
+lib/smlnj/lib/pgraph.cm/.cm/${BOX}-unix/pgraph.cm
+lib/smlnj/lib/pickle-lib.cm/.cm/${BOX}-unix/pickle-lib.cm
+lib/smlnj/lib/reactive-lib.cm/.cm/${BOX}-unix/reactive-lib.cm
+lib/smlnj/lib/regexp-lib.cm/.cm/${BOX}-unix/regexp-lib.cm
+lib/smlnj/lib/shell-tool.cm/.cm/${BOX}-unix/shell-tool.cm
+lib/smlnj/lib/smlnj-tdp/.cm/${BOX}-unix/back-trace.cm
+lib/smlnj/lib/smlnj-tdp/.cm/${BOX}-unix/coverage.cm
+lib/smlnj/lib/smlnj-tdp/.cm/${BOX}-unix/plugins.cm
+lib/smlnj/lib/smlnj/.cm/${BOX}-unix/cm.cm
+lib/smlnj/lib/smlnj/.cm/${BOX}-unix/cmb.cm
+lib/smlnj/lib/smlnj/.cm/${BOX}-unix/compiler.cm
+lib/smlnj/lib/smlnj/.cm/${BOX}-unix/installer.cm
+lib/smlnj/lib/smlnj/.cm/${BOX}-unix/library-install.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/ALPHA.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/AMD64.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/Control.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/Graphs.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/HPPA.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/IA32.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/Lib.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/MLRISC.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/MLTREE.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/PPC.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/SPARC.cm
+lib/smlnj/lib/smlnj/MLRISC/.cm/${BOX}-unix/Visual.cm
+lib/smlnj/lib/smlnj/basis/.cm/${BOX}-unix/basis.cm
+lib/smlnj/lib/smlnj/cm/.cm/${BOX}-unix/cm.cm
+lib/smlnj/lib/smlnj/cm/.cm/${BOX}-unix/tools.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/alpha32-unix.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/amd64-unix.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/current.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/hppa-unix.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/ppc-macos.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/ppc-unix.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/sparc-unix.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/x86-unix.cm
+lib/smlnj/lib/smlnj/cmb/.cm/${BOX}-unix/x86-win32.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/all.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/alpha32.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/amd64.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/compiler.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/current.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/hppa.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/minimal-only.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/minimal.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/ppc.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/sparc.cm
+lib/smlnj/lib/smlnj/compiler/.cm/${BOX}-unix/x86.cm
+lib/smlnj/lib/smlnj/init/.cm/${BOX}-unix/init.cmi
+lib/smlnj/lib/smlnj/installer/.cm/${BOX}-unix/util.cm
+lib/smlnj/lib/smlnj/internal/.cm/${BOX}-unix/cm-lib.cm
+lib/smlnj/lib/smlnj/internal/.cm/${BOX}-unix/cm-sig-lib.cm
+lib/smlnj/lib/smlnj/internal/.cm/${BOX}-unix/cm0.cm
+lib/smlnj/lib/smlnj/internal/.cm/${BOX}-unix/intsys.cm
+lib/smlnj/lib/smlnj/internal/.cm/${BOX}-unix/smlnj-version.cm
+lib/smlnj/lib/smlnj/internal/.cm/${BOX}-unix/srcpath-lib.cm
+lib/smlnj/lib/smlnj/ml-yacc/.cm/${BOX}-unix/ml-yacc-lib.cm
+lib/smlnj/lib/smlnj/smlnj-lib/.cm/${BOX}-unix/controls-lib.cm
+lib/smlnj/lib/smlnj/smlnj-lib/.cm/${BOX}-unix/html-lib.cm
+lib/smlnj/lib/smlnj/smlnj-lib/.cm/${BOX}-unix/pp-lib.cm
+lib/smlnj/lib/smlnj/smlnj-lib/.cm/${BOX}-unix/smlnj-lib.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/alpha32.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/amd64.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/basics.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/core.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/debugprof.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/elabdata.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/elaborate.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/execute.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/hppa.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/parser.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/ppc.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/sparc.cm
+lib/smlnj/lib/smlnj/viscomp/.cm/${BOX}-unix/x86.cm
+lib/smlnj/lib/unix-lib.cm/.cm/${BOX}-unix/unix-lib.cm
diff --git a/lang/smlnj11072/PLIST.FreeBSD b/lang/smlnj11072/PLIST.FreeBSD
new file mode 100644
index 00000000000..d4e88438ec0
--- /dev/null
+++ b/lang/smlnj11072/PLIST.FreeBSD
@@ -0,0 +1,2 @@
+lib/smlnj/bin/.run/run.${BOX}-freebsd.a
+lib/smlnj/bin/.run/run.${BOX}-freebsd.so
diff --git a/lang/smlnj11072/distinfo b/lang/smlnj11072/distinfo
new file mode 100644
index 00000000000..dddeb7f5d82
--- /dev/null
+++ b/lang/smlnj11072/distinfo
@@ -0,0 +1,81 @@
+$NetBSD: distinfo,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+SHA1 (smlnj-110.72/MLRISC.tgz) = 9bb9eb169337533304c2e0e4eb9af263d38c398a
+RMD160 (smlnj-110.72/MLRISC.tgz) = 484512df036421e216d4afed01beb978d33e16bb
+Size (smlnj-110.72/MLRISC.tgz) = 1432663 bytes
+SHA1 (smlnj-110.72/boot.x86-unix.tgz) = 799f02f3e880a829b48962994b563f7321385d87
+RMD160 (smlnj-110.72/boot.x86-unix.tgz) = bd2962ea25d6f384a3f458759a1c655960dc4208
+Size (smlnj-110.72/boot.x86-unix.tgz) = 5847908 bytes
+SHA1 (smlnj-110.72/ckit.tgz) = 0ebcdbd0a494eb051b4e6081f5e9312a0a54f03d
+RMD160 (smlnj-110.72/ckit.tgz) = 0d94d522b22b21600ad99aaf22fb671c12a6ea59
+Size (smlnj-110.72/ckit.tgz) = 199126 bytes
+SHA1 (smlnj-110.72/cm.tgz) = 0a85eaecc101c45c769e6beb8ace8a8bf0f4d32f
+RMD160 (smlnj-110.72/cm.tgz) = 821eb682bfb4e6ef6a71fe341ba018059301a233
+Size (smlnj-110.72/cm.tgz) = 201235 bytes
+SHA1 (smlnj-110.72/cml.tgz) = 9fd01c6d2d4a7cac22be75010891c1be5ab81f29
+RMD160 (smlnj-110.72/cml.tgz) = 8e3b8fd01258e74364fa1319bb8d01335aaca8d1
+Size (smlnj-110.72/cml.tgz) = 104194 bytes
+SHA1 (smlnj-110.72/compiler.tgz) = cf80dfb2150de0705fbc2b2a01fc8eefda0e9c85
+RMD160 (smlnj-110.72/compiler.tgz) = 6811090d11179312413ef789d1e292e95040606a
+Size (smlnj-110.72/compiler.tgz) = 823034 bytes
+SHA1 (smlnj-110.72/config.tgz) = a7e205a9e0753908ee3174daa5164c320c7a411f
+RMD160 (smlnj-110.72/config.tgz) = f0e8f348ec4c8b4c5860d68a0b6b554f848ca4a7
+Size (smlnj-110.72/config.tgz) = 512648 bytes
+SHA1 (smlnj-110.72/eXene.tgz) = c8b502580a719b38528f100f21f11ac1f4c2b573
+RMD160 (smlnj-110.72/eXene.tgz) = 182838ea5c6d3688f841b5edeea08f9c83b93177
+Size (smlnj-110.72/eXene.tgz) = 713820 bytes
+SHA1 (smlnj-110.72/heap2asm.tgz) = 46845fc4bed21f1c3b46540fc088936d0502e12b
+RMD160 (smlnj-110.72/heap2asm.tgz) = 24b779bdb8b21a74d0f3586f5db779e02c540253
+Size (smlnj-110.72/heap2asm.tgz) = 1308 bytes
+SHA1 (smlnj-110.72/ml-burg.tgz) = 17afacafa25d1fc33d3cbe464be66f1a7f8714fa
+RMD160 (smlnj-110.72/ml-burg.tgz) = 8b78c21f6b338baa55c9227babed4ebca10edd26
+Size (smlnj-110.72/ml-burg.tgz) = 36558 bytes
+SHA1 (smlnj-110.72/ml-lex.tgz) = 3fb5dca13de3c51ddab1c8fb95b1dfaad58fb27c
+RMD160 (smlnj-110.72/ml-lex.tgz) = 69ccfd9ba199bd4a063f1a2c2a40444e0cf9db67
+Size (smlnj-110.72/ml-lex.tgz) = 32966 bytes
+SHA1 (smlnj-110.72/ml-lpt.tgz) = 948735346b411ec5004f3294454c12bfb4176083
+RMD160 (smlnj-110.72/ml-lpt.tgz) = 86642f1b470c5f15861334072ff7543af1066881
+Size (smlnj-110.72/ml-lpt.tgz) = 258328 bytes
+SHA1 (smlnj-110.72/ml-yacc.tgz) = f7b0f53c7f676e7bb2605211d4981948c538a551
+RMD160 (smlnj-110.72/ml-yacc.tgz) = c6ce323c77b8d1ac33f6bce0a865df40e1efe310
+Size (smlnj-110.72/ml-yacc.tgz) = 101751 bytes
+SHA1 (smlnj-110.72/nlffi.tgz) = 63d043de413748fe124eb6e9f066935b4f1e96e0
+RMD160 (smlnj-110.72/nlffi.tgz) = 279741f9318b74dea838432adc21ad8f671bed6a
+Size (smlnj-110.72/nlffi.tgz) = 74688 bytes
+SHA1 (smlnj-110.72/pgraph.tgz) = 00919f8341fdcbe38ff7c908ef78fbbc4c37a5b6
+RMD160 (smlnj-110.72/pgraph.tgz) = 8341475dc03a2460799af637eeb46d3f334f451f
+Size (smlnj-110.72/pgraph.tgz) = 5417 bytes
+SHA1 (smlnj-110.72/runtime.tgz) = d9e3df41155ad9e969dd13c06f0f0fd3df177578
+RMD160 (smlnj-110.72/runtime.tgz) = 894209303d9204bae84209a8130877200251584e
+Size (smlnj-110.72/runtime.tgz) = 333396 bytes
+SHA1 (smlnj-110.72/smlnj-c.tgz) = f4bf82d695be0fca01e0f3e4075ac4d81fe3c660
+RMD160 (smlnj-110.72/smlnj-c.tgz) = 373fc5c1b0b49056bc1eb73bf9650c2f939c4540
+Size (smlnj-110.72/smlnj-c.tgz) = 10618 bytes
+SHA1 (smlnj-110.72/smlnj-lib.tgz) = 8ce9761a118569b8563f0336e010906c15943324
+RMD160 (smlnj-110.72/smlnj-lib.tgz) = fbcdc678f1c6842aaa5a2241db6564e6e81eb525
+Size (smlnj-110.72/smlnj-lib.tgz) = 258562 bytes
+SHA1 (smlnj-110.72/system.tgz) = 72f73bbbc06d23ee3c4510bb5af2fb8dec431337
+RMD160 (smlnj-110.72/system.tgz) = c6816b7c9fd57f9351b63a7ba447442c4a21fe7b
+Size (smlnj-110.72/system.tgz) = 238169 bytes
+SHA1 (smlnj-110.72/trace-debug-profile.tgz) = e80d8076d961a36e067b559c02279562856bb6ee
+RMD160 (smlnj-110.72/trace-debug-profile.tgz) = 6c85734aefd0672a645497550dacf56f503dd726
+Size (smlnj-110.72/trace-debug-profile.tgz) = 3905 bytes
+SHA1 (patch-aa) = a67e8438c0ae20c1f0fac37148158b565056e5f7
+SHA1 (patch-ab) = 3d5946b2d72dee255159afe6fb25240f8fa7e306
+SHA1 (patch-ac) = f6c30285f55a9537a785d363837ecc83cfd384b7
+SHA1 (patch-ad) = a406bde2f6f7e2d93d652135b94aefd4b7aca494
+SHA1 (patch-ae) = 5796401418fd91a795fdfe75060cf654dd315ac1
+SHA1 (patch-af) = fae22c6f367b3007bbd9b46b7a7a218710723ca4
+SHA1 (patch-ag) = dae9c89ccc7ada96bd3ac4b2bae1da6427902fb4
+SHA1 (patch-ah) = 93d7453dc82d91d29662cc02dd8ab9e8b8987393
+SHA1 (patch-ai) = 6a15a5415bd73e6618bc45b9a7eb021543e9cecd
+SHA1 (patch-aj) = 6318548da4c943c60fe63d41529803ea3fa2c96e
+SHA1 (patch-ak) = 6fb3d4444c75123dc8c5fa7bb6cea835c78ef6e3
+SHA1 (patch-am) = 06d8cb145217c46ada440e0d3e7420ea99651064
+SHA1 (patch-an) = d6e1a75d5fb68423ce3181622de919c2337db2e7
+SHA1 (patch-ao) = 1c66024c5949269291cbf6f815baf6162db47d31
+SHA1 (patch-ap) = 8e9e28548b4e58de68a11982a355a010ea96aa29
+SHA1 (patch-aq) = 7d0734b76d778d7f584d2e70d325fd72e6554b01
+SHA1 (patch-ar) = 727afe6de54eb244c48e99c661f6b8ae3f780de0
+SHA1 (patch-as) = a2e5d474876baa1dc2484dda81708ea6ac92eb0b
+SHA1 (patch-at) = 9fd22dab9def459d3305695a38d14d25c645ff30
diff --git a/lang/smlnj11072/files/targets b/lang/smlnj11072/files/targets
new file mode 100644
index 00000000000..2837dc51d82
--- /dev/null
+++ b/lang/smlnj11072/files/targets
@@ -0,0 +1,15 @@
+request ml-yacc
+request ml-lex
+request ml-burg
+request smlnj-lib
+request pgraph-util
+request cml
+request cml-lib
+request eXene
+request ckit
+#if !defined(__powerpc__)
+request ml-nlffi-lib
+request ml-nlffigen
+#endif
+request mlrisc-tools
+request nowhere
diff --git a/lang/smlnj11072/patches/patch-aa b/lang/smlnj11072/patches/patch-aa
new file mode 100644
index 00000000000..33ff4f95137
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-aa
@@ -0,0 +1,79 @@
+$NetBSD: patch-aa,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- config/targets.orig 2010-02-03 19:40:28.000000000 +0300
++++ config/targets 2010-02-07 05:56:52.000000000 +0300
+@@ -91,7 +91,7 @@
+
+ # build ML-Burg
+ #
+-#request ml-burg
++request ml-burg
+
+ # pre-compile and install the remaining components of the SML/NJ library
+ # (everything except smlnj-lib.cm, aka Util, itself)
+@@ -100,7 +100,7 @@
+
+ # pre-compile and install CM "portable graph" utility library
+ #
+-#request pgraph-util
++request pgraph-util
+
+ # pre-compile and install "Trace-Debug-Profile" utility library
+ # (provides simple back-trace- and coverage facilities)
+@@ -120,7 +120,7 @@
+ # pre-compile and install eXene, which is a library for X-Windows programming.
+ # EXene requires CML.
+ #
+-#request eXene
++request eXene
+
+ # pre-compile (certain) parts of MLRISC that are not already part of the SML/NJ
+ # compiler itself
+@@ -130,7 +130,7 @@
+ # pre-compile and install the C-Kit, which is a library for parsing and
+ # type-checking C programs
+ #
+-#request ckit
++request ckit
+
+ # pre-compile and install the ML-NLFFI Library, which is the core of
+ # a new foreign function interface (where "foreign" functions are
+@@ -140,7 +140,7 @@
+ # This preview release currently works under X86/Linux, Sparc/Solaris,
+ # PPC/MacOSX, and X86/Win32.
+ #
+-#request ml-nlffi-lib
++request ml-nlffi-lib
+
+ # build ML-NLFFI-Gen, a program generator tool used in conjunction with
+ # the new "NLFFI" foreign function interface. The tool generates ML
+@@ -149,13 +149,13 @@
+ # This preview release currently works under X86/Linux, Sparc/Solaris,
+ # PPC/MacOSX, and X86/Win32.
+ #
+-#request ml-nlffigen
++request ml-nlffigen
+
+ # pre-compile and install the MLRISC Tools library.
+ # This library is for parsing and pretty printing SML code.
+ # It's used by various MLRISC code generator generator.
+ #
+-#request mlrisc-tools
++request mlrisc-tools
+
+ # Build and install the 'nowhere' program translator.
+ # This tool translates programs with conditional patterns (where clauses)
+@@ -163,11 +163,11 @@
+ # (bad) documentation.
+ # (Requires the mlrisc-tools library!)
+ #
+-#request nowhere
++request nowhere
+
+ # Build and install 'heap2asm' - an experimental component of
+ # a new facility for producing true stand-alone executables.
+-#request heap2asm
++request heap2asm
+
+ # Note: autoloading is always enabled.
+ # In order to customize what is being pre-registered for autoloading
diff --git a/lang/smlnj11072/patches/patch-ab b/lang/smlnj11072/patches/patch-ab
new file mode 100644
index 00000000000..5c15e4fbd40
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ab
@@ -0,0 +1,29 @@
+$NetBSD: patch-ab,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- /dev/null
++++ src/runtime/objs/mk.ppc-netbsd
+@@ -0,0 +1,24 @@
++# mk.ppc-netbsd
++#
++
++SHELL = /bin/sh
++
++MAKE = gmake
++GCC = gcc
++ARFLAGS = Trcv
++CFLAGS = @CFLAGS@
++LDFLAGS=
++CPP = $(GCC) -x c -E -P
++
++#XOBJS = xmonitor.o
++#LD_LIBS = -lX11
++#BASE_DEFS = -DHEAP_MONITOR -DPOLL_DEBUG
++XOBJS =
++XLIBS =
++DEFS = $(BASE_DEFS) -DHOST_PPC -DTARGET_PPC -DOPSYS_UNIX -DOPSYS_NETBSD
++TARGET = PPC
++VERSION = v-ppc-netbsd
++RUNTIME = run.ppc-netbsd
++
++all:
++ ($(MAKE) RUNTIME="$(RUNTIME)" MAKE="$(MAKE)" VERSION="$(VERSION)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" AS="$(AS)" AR="$(AR)" RANLIB="$(RANLIB)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" $(RUNTIME))
diff --git a/lang/smlnj11072/patches/patch-ac b/lang/smlnj11072/patches/patch-ac
new file mode 100644
index 00000000000..b36f0575a39
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ac
@@ -0,0 +1,24 @@
+$NetBSD: patch-ac,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- config/_arch-n-opsys.orig 2008-08-13 22:37:59.000000000 +0400
++++ config/_arch-n-opsys 2009-01-27 17:24:34.000000000 +0300
+@@ -118,13 +118,15 @@
+ ;;
+ NetBSD)
+ case `uname -r` in
+- 2*) OPSYS=netbsd2;;
+- 3*) OPSYS=netbsd;;
+- *) exit 1;;
++ 1.*) exit 1;;
++ 2.*) OPSYS=netbsd2;;
++ *) OPSYS=netbsd;;
+ esac
+ HEAP_OPSYS=bsd
+- case `uname -m` in
++ case `uname -p` in
+ *86) ARCH=x86;;
++ powerpc) ARCH=ppc;;
++ sparc) ARCH=sparc;;
+ *) exit 1;;
+ esac
+ ;;
diff --git a/lang/smlnj11072/patches/patch-ad b/lang/smlnj11072/patches/patch-ad
new file mode 100644
index 00000000000..2150f05ffab
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ad
@@ -0,0 +1,25 @@
+$NetBSD: patch-ad,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/include/asm-base.h.orig
++++ src/runtime/include/asm-base.h
+@@ -36,6 +36,11 @@
+ # define _ASM
+ # include <sys/stack.h>
+ # include <sys/trap.h>
++# elif defined(OPSYS_NETBSD)
++# include <machine/trap.h>
++# define WINDOWSIZE (16*4)
++# define SA(x) (((x)+7)&~7)
++# define ST_INT_OVERFLOW 0x87
+ # endif
+ # define CGLOBAL(ID) .global CSYM(ID)
+ # define LABEL(ID) ID:
+@@ -104,7 +109,7 @@
+ # define DOUBLE(V) .double V
+ # define LABEL(ID) ID:
+
+-# elif (defined(OPSYS_LINUX) && defined(TARGET_PPC))
++# elif ((defined(OPSYS_LINUX) || defined(OPSYS_NETBSD)) && defined(TARGET_PPC))
+ # define CFUNSYM(ID) ID
+ # define CGLOBAL(ID) .globl CSYM(ID)
+ # define TEXT .section ".text"
diff --git a/lang/smlnj11072/patches/patch-ae b/lang/smlnj11072/patches/patch-ae
new file mode 100644
index 00000000000..a44515e210b
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ae
@@ -0,0 +1,187 @@
+$NetBSD: patch-ae,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/mach-dep/SPARC.prim.asm.orig Fri Jun 15 15:05:19 2001
++++ src/runtime/mach-dep/SPARC.prim.asm
+@@ -307,7 +307,7 @@ pending_sigs: /* there are pending signa
+ mov ALLOCPTR,LIMITPTR /* (delay slot) */
+
+
+-#if defined(OPSYS_SUNOS) || defined(OPSYS_NEXTSTEP)
++#if defined(OPSYS_SUNOS) || defined(OPSYS_NEXTSTEP) || defined(OPSYS_NETBSD)
+ /* ZeroLimitPtr:
+ *
+ * Zero the heap limit pointer so that a trap will be generated on the next limit
+@@ -622,13 +622,62 @@ _ml_mul:
+ mov %g1,%l1 /* save %g1 which may get trashed */
+ mov %g2,%l2
+ mov %g3,%l3
++#ifdef OPSYS_NETBSD
++ /* NetBSDs .mul trashes these */
++ mov %i4,%l4
++ mov %i5,%l5
++ mov %i0,%l6
++ mov %i1,%l7
++#endif
+ mov %i2,%o0
+ call .mul
+ mov %i3,%o1 /* (delay slot) */
+ mov %l1,%g1 /* restore %g1 */
+ mov %l2,%g2
+ mov %l3,%g3
++#ifdef OPSYS_NETBSD
++ mov %l4,%i4
++ mov %l5,%i5
++ mov %l6,%i0
++ mov %l7,%i1
++ /* the code below is a hack:
++ * NetBSDs .mul does a 32x32->64 bit signed multiply
++ * The SML code assumes that the multiply
++ * overflowed (over 32bit) if the Z flag is
++ * clear on return from .mul
++ * NetBSDs .mul doesn't do that, so we have to check
++ * for overflow. This is done in the following way:
++ * - If the upper 32 bits are clear:
++ * + if bit 31 is set => overflow
++ * + if bit 31 is clear => OK
++ * - If the upper 32 bits are != -1 => overflow
++ * - If the upper 32 bits are == -1:
++ * + If bit 31 is clear => overflow
++ * + If bit 31 is set => OK
++ *
++ * I should be shot for this code ...
++ */
++ cmp %o1,0
++ bnz 4f
++ nop
++ /* is bit 31 of %o0 set ? */
++ addcc %o0,%o0,%o1
++ bcc 2f
++ nop
++5: restore %o0,0,%o2 /* result in %o2 (delay slot) */
++ t ST_INT_OVERFLOW /* generate overflow trap */
++
++
++4: cmp %o1,-1 /* upper 32 bits == -1 ? */
++ bnz 5
++ nop
++ addcc %o0,%o0,%o1 /* bit 31 clear ? */
++ bcc 2f
++ nop
++#else
+ bnz 1f /* if z is clear, then overflow */
++#endif
++2:
+ restore %o0,0,%o2 /* result in %o2 (delay slot) */
+ retl
+ nop
+@@ -642,7 +691,15 @@ _ml_mul:
+ * locals of the new window, since .div is a leaf routine.
+ */
+ _ml_div:
+- save %sp,-SA(WINDOWSIZE),%sp
++#ifdef OPSYS_NETBSD
++ /* hack time again: NetBSDs .div trashes too many registers
++ * we have to store them in the stack frame, so make room
++ * for six registers (o0-o5)
++ */
++ save %sp,-SA(WINDOWSIZE+24),%sp
++#else
++ save %sp,-SA(WINDOWSIZE+24),%sp
++#endif
+ addcc %i3,%g0,%o1 /* %o1 is divisor (and check for zero) */
+ bz 1f
+ /* save %g1, %g2 and %g3 (using new window) */
+@@ -650,9 +707,30 @@ _ml_div:
+ mov %g1,%l1 /* (delay slot) */
+ mov %g2,%l2
+ mov %g3,%l3
++#ifdef OPSYS_NETBSD
++ /* save g6,g7,o0-o5, they get trashed.
++ Note that %o0-%o5 are now %i0-%i5, since we did a 'save'
++ Since %g6 is the global AllocPtr for SML, this
++ is rather bad :-)
++ */
++ mov %g6,%l4
++ mov %g7,%l5
++ std %i0,[%fp-16]
++ std %i2,[%fp-24]
++ std %i4,[%fp-32]
++#endif
++
+ call .div
+ mov %i2,%o0 /* (delay slot) */
+ /* restore %g1, %g2 and %g3 */
++#ifdef OPSYS_NETBSD
++ mov %l4,%g6
++ mov %l5,%g7
++ ldd [%fp-32],%i4
++ ldd [%fp-24],%i2
++ ldd [%fp-16],%i0
++#endif
++
+ mov %l3,%g3
+ mov %l2,%g2
+ mov %l1,%g1
+@@ -679,11 +757,24 @@ _ml_umul:
+ mov %g2,%l2
+ mov %g3,%l3
+ mov %i2,%o0
++#ifdef OPSYS_NETBSD
++ /* Save what might be trashed by NetBSDs .umul */
++ mov %i4,%l4
++ mov %i5,%l5
++ mov %i0,%l6
++ mov %i1,%l7
++#endif
+ call .umul
+ mov %i3,%o1 /* (delay slot) */
+ mov %l1,%g1 /* restore %g1 */
+ mov %l2,%g2
+ mov %l3,%g3
++#ifdef OPSYS_NETBSD
++ mov %l4,%i4
++ mov %l5,%i5
++ mov %l6,%i0
++ mov %l7,%i1
++#endif
+ ret
+ restore %o0,0,%o2 /* result in %o2 (delay slot) */
+
+@@ -694,7 +785,12 @@ _ml_umul:
+ * locals of the new window, since .div is a leaf routine.
+ */
+ _ml_udiv:
+- save %sp,-SA(WINDOWSIZE),%sp
++#ifdef OPSYS_NETBSD
++ /* see comment for _ml__div_ */
++ save %sp,-SA(WINDOWSIZE+24),%sp
++#else
++ save %sp,-SA(WINDOWSIZE+24),%sp
++#endif
+ addcc %i3,%g0,%o1 /* %o1 is divisor (and check for zero) */
+ bz 1f
+ /* save %g1, %g2 and %g3 (using new window) */
+@@ -702,9 +798,23 @@ _ml_udiv:
+ mov %g1,%l1 /* (delay slot) */
+ mov %g2,%l2
+ mov %g3,%l3
++#ifdef OPSYS_NETBSD
++ mov %g6,%l4
++ mov %g7,%l5
++ std %i0,[%fp-16]
++ std %i2,[%fp-24]
++ std %i4,[%fp-32]
++#endif
+ call .udiv
+ mov %i2,%o0 /* (delay slot) */
+ /* restore %g1, %g2 and %g3 */
++#ifdef OPSYS_NETBSD
++ mov %l4,%g6
++ mov %l5,%g7
++ ldd [%fp-32],%i4
++ ldd [%fp-24],%i2
++ ldd [%fp-16],%i0
++#endif
+ mov %l3,%g3
+ mov %l2,%g2
+ mov %l1,%g1
diff --git a/lang/smlnj11072/patches/patch-af b/lang/smlnj11072/patches/patch-af
new file mode 100644
index 00000000000..c354a1c2af8
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-af
@@ -0,0 +1,33 @@
+$NetBSD: patch-af,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/mach-dep/signal-sysdep.h.orig 2006-02-27 17:47:32.000000000 +0000
++++ src/runtime/mach-dep/signal-sysdep.h 2006-03-09 19:15:48.000000000 +0000
+@@ -171,7 +171,7 @@
+ /* disable all FP exceptions */
+ # define SIG_InitFPE() SetFSR(0)
+
+-# if defined(OPSYS_SUNOS)
++# if defined(OPSYS_SUNOS) || defined(OPSYS_NETBSD)
+ /** SPARC, SUNOS **/
+ # define USE_ZERO_LIMIT_PTR_FN
+ # define SIG_FAULT1 SIGFPE
+@@ -340,6 +340,19 @@
+ # define SIG_ResetFPE(scp) { (scp)->regs->gpr[PT_FPSCR] = 0x0; }
+ typedef void SigReturn_t;
+
++# elif (defined(TARGET_PPC) && defined(OPSYS_NETBSD))
++ /* PPC, NetBSD */
++
++# define SIG_FAULT1 SIGTRAP
++
++# define INT_DIVZERO(s, c) ((s) == SIGTRAP)
++# define INT_OVFLW(s, c) ((s) == SIGTRAP)
++# define SIG_GetPC(scp) ((scp)->sc_frame.srr0)
++# define SIG_SetPC(scp, addr) { (scp)->sc_frame.srr0 = (long)(addr); }
++# define SIG_ZeroLimitPtr(scp) { ((scp)->sc_frame.fixreg[15] = 0); } /* limitptr = 15 (see src/runtime/mach-dep/PPC.prim.asm) */
++# define SIG_GetCode(info,scp) (info)
++ typedef void SigReturn_t;
++
+ # endif /* HOST_RS6000/HOST_PPC */
+
+ #elif defined(HOST_HPPA)
diff --git a/lang/smlnj11072/patches/patch-ag b/lang/smlnj11072/patches/patch-ag
new file mode 100644
index 00000000000..f496e334df2
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ag
@@ -0,0 +1,29 @@
+$NetBSD: patch-ag,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/objs/mk.sparc-netbsd.orig Thu Sep 19 03:54:01 2002
++++ src/runtime/objs/mk.sparc-netbsd
+@@ -0,0 +1,24 @@
++# mk.sparc-netbsd
++#
++
++SHELL = /bin/sh
++
++MAKE = gmake
++GCC = gcc
++ARFLAGS = Trcv
++CFLAGS = @CFLAGS@
++LDFLAGS=
++CPP = $(GCC) -x c -E -P
++
++#XOBJS = xmonitor.o
++#LD_LIBS = -lX11
++#BASE_DEFS = -DHEAP_MONITOR -DPOLL_DEBUG
++XOBJS =
++XLIBS =
++DEFS = $(BASE_DEFS) -DHOST_SPARC -DTARGET_SPARC -DOPSYS_UNIX -DOPSYS_NETBSD -DCALLEESAVE=3 -DUNBOXEDFLOAT=1
++TARGET = SPARC
++VERSION = v-sparc-netbsd
++RUNTIME = run.sparc-netbsd
++
++all:
++ ($(MAKE) RUNTIME="$(RUNTIME)" MAKE="$(MAKE)" VERSION="$(VERSION)" CC="$(CC)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" AS="$(AS)" AR="$(AR)" RANLIB="$(RANLIB)" TARGET=$(TARGET) DEFS="$(DEFS)" XOBJS="$(XOBJS)" XLIBS="$(XLIBS)" LD_LIBS="$(LD_LIBS)" $(RUNTIME))
diff --git a/lang/smlnj11072/patches/patch-ah b/lang/smlnj11072/patches/patch-ah
new file mode 100644
index 00000000000..db8e0eb7397
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ah
@@ -0,0 +1,12 @@
+$NetBSD: patch-ah,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- config/_link-sml.orig 2005-01-03 21:13:16.000000000 +0000
++++ config/_link-sml 2005-12-24 22:04:13.000000000 +0000
+@@ -17,6 +17,7 @@
+ #
+ # SITE SPECIFIC CONFIGURATION INFO
+ #
++SMLNJ_HOME="${SMLNJ_HOME:-@SML_BASE@}"
+
+ # the path of the directory in which executables (like this file) are kept.
+ if [ x"$SMLNJ_HOME" = x ] ; then
diff --git a/lang/smlnj11072/patches/patch-ai b/lang/smlnj11072/patches/patch-ai
new file mode 100644
index 00000000000..db65307c576
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ai
@@ -0,0 +1,12 @@
+$NetBSD: patch-ai,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- config/_ml-build.orig 2007-02-13 00:05:27.000000000 +0300
++++ config/_ml-build 2009-03-18 12:37:58.000000000 +0300
+@@ -1,5 +1,7 @@
+ #!@SHELL@
+
++SMLNJ_HOME="${SMLNJ_HOME:-@SML_BASE@}"
++
+ if [ x${SMLNJ_HOME} = x ] ; then
+ BIN_DIR="@BINDIR@"
+ LIB_DIR="@LIBDIR@"
diff --git a/lang/smlnj11072/patches/patch-aj b/lang/smlnj11072/patches/patch-aj
new file mode 100644
index 00000000000..90dd2986f2d
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-aj
@@ -0,0 +1,12 @@
+$NetBSD: patch-aj,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- config/_ml-makedepend.orig 2004-12-14 23:23:38.000000000 +0000
++++ config/_ml-makedepend 2005-12-24 22:48:05.000000000 +0000
+@@ -1,5 +1,7 @@
+ #!@SHELL@
+
++SMLNJ_HOME="${SMLNJ_HOME:-@SML_BASE@}"
++
+ if [ x${SMLNJ_HOME} = x ] ; then
+ BIN_DIR="@BINDIR@"
+ else
diff --git a/lang/smlnj11072/patches/patch-ak b/lang/smlnj11072/patches/patch-ak
new file mode 100644
index 00000000000..f539166c1ff
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ak
@@ -0,0 +1,12 @@
+$NetBSD: patch-ak,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- config/_run-sml.orig 2004-12-17 21:12:23.000000000 +0000
++++ config/_run-sml 2005-12-24 22:50:18.000000000 +0000
+@@ -19,6 +19,7 @@
+ #
+ # SITE SPECIFIC CONFIGURATION INFO
+ #
++SMLNJ_HOME="${SMLNJ_HOME:-@SML_BASE@}"
+
+ # On cygwin, make sure SMLNJ_HOME is given a POSIX-style pathname.
+ if [ x"$SMLNJ_HOME" != x ] ; then
diff --git a/lang/smlnj11072/patches/patch-am b/lang/smlnj11072/patches/patch-am
new file mode 100644
index 00000000000..2128a531962
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-am
@@ -0,0 +1,13 @@
+$NetBSD: patch-am,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/objs/mk.sparc-solaris.orig Fri Jun 15 15:05:19 2001
++++ src/runtime/objs/mk.sparc-solaris
+@@ -8,7 +8,7 @@ AS = /usr/ccs/bin/as
+ AR = /usr/ccs/bin/ar
+ GCC = gcc
+ CC = $(GCC)
+-CFLAGS = -O3
++CFLAGS = @CFLAGS@
+ #CFLAGS = -g
+ CPP = $(GCC) -x c -E -P
+ RANLIB = $(AR) ts
diff --git a/lang/smlnj11072/patches/patch-an b/lang/smlnj11072/patches/patch-an
new file mode 100644
index 00000000000..c2425399e7e
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-an
@@ -0,0 +1,13 @@
+$NetBSD: patch-an,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/objs/mk.sparc-sunos.orig Thu Jun 1 14:33:52 2000
++++ src/runtime/objs/mk.sparc-sunos
+@@ -4,7 +4,7 @@
+ SHELL = /bin/sh
+
+ CC = gcc -ansi
+-CFLAGS = -O2
++CFLAGS = @CFLAGS@
+ CPP = gcc -x c -E -P -ansi
+ #XOBJS = xmonitor.o
+ #LD_LIBS = -lX11
diff --git a/lang/smlnj11072/patches/patch-ao b/lang/smlnj11072/patches/patch-ao
new file mode 100644
index 00000000000..7257c87c37d
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ao
@@ -0,0 +1,13 @@
+$NetBSD: patch-ao,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/kernel/boot.c.orig
++++ src/runtime/kernel/boot.c
+@@ -124,7 +124,7 @@
+ ml_val_t fileList;
+ # define SIZE_BUF_LEN 128 /* this should be plenty for two numbers */
+ char sizeBuf[SIZE_BUF_LEN];
+- char c;
++ int c;
+
+ numFiles = 0;
+
diff --git a/lang/smlnj11072/patches/patch-ap b/lang/smlnj11072/patches/patch-ap
new file mode 100644
index 00000000000..77d2e18d850
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ap
@@ -0,0 +1,13 @@
+$NetBSD: patch-ap,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/include/cache-flush.h.orig
++++ src/runtime/include/cache-flush.h
+@@ -40,7 +40,7 @@
+ extern FlushICache (void *addr, int nbytes);
+
+
+-#elif (defined(TARGET_PPC) && (defined(OPSYS_LINUX) || defined(OPSYS_DARWIN) ))
++#elif (defined(TARGET_PPC) && (defined(OPSYS_LINUX) || defined(OPSYS_DARWIN) || defined(OPSYS_NETBSD)))
+ extern FlushICache (void *addr, int nbytes);
+
+ #else
diff --git a/lang/smlnj11072/patches/patch-aq b/lang/smlnj11072/patches/patch-aq
new file mode 100644
index 00000000000..6932a3187f5
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-aq
@@ -0,0 +1,13 @@
+$NetBSD: patch-aq,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+--- src/runtime/mach-dep/PPC.prim.asm.orig
++++ src/runtime/mach-dep/PPC.prim.asm
+@@ -813,7 +813,7 @@
+ lfd f31, 136(r3)
+ blr
+
+-#if (defined(TARGET_PPC) && (defined(OPSYS_LINUX) || defined(OPSYS_DARWIN) ))
++#if (defined(TARGET_PPC) && (defined(OPSYS_LINUX) || defined(OPSYS_DARWIN) || defined(OPSYS_NETBSD) ))
+
+ #define CACHE_LINE_SZB 32
+ #define CACHE_LINE_MASK (CACHE_LINE_SZB-1)
diff --git a/lang/smlnj11072/patches/patch-ar b/lang/smlnj11072/patches/patch-ar
new file mode 100644
index 00000000000..1d7b7eef37e
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-ar
@@ -0,0 +1,15 @@
+$NetBSD: patch-ar,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+NetBSD has POSIX signals since 2.0 at least.
+
+--- src/runtime/include/ml-unixdep.h.orig 2008-12-05 20:57:39.000000000 +0300
++++ src/runtime/include/ml-unixdep.h 2009-03-19 00:14:35.000000000 +0300
+@@ -323,7 +323,7 @@
+ #elif defined(OPSYS_NETBSD) /* version 3.x */
+ # define OS_NAME "BSD"
+ # define HAS_POSIX_LIBRARIES
+-# define HAS_BSD_SIGS
++# define HAS_POSIX_SIGS
+ # define HAS_GETRUSAGE
+ # define HAS_SETITIMER
+ # define HAS_MMAP
diff --git a/lang/smlnj11072/patches/patch-as b/lang/smlnj11072/patches/patch-as
new file mode 100644
index 00000000000..259554a6c96
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-as
@@ -0,0 +1,15 @@
+$NetBSD: patch-as,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+NetBSD has POSIX signals since 2.0 at least.
+
+--- base/runtime/include/ml-unixdep.h.orig 2008-12-05 20:57:39.000000000 +0300
++++ base/runtime/include/ml-unixdep.h 2009-03-19 00:16:29.000000000 +0300
+@@ -323,7 +323,7 @@
+ #elif defined(OPSYS_NETBSD) /* version 3.x */
+ # define OS_NAME "BSD"
+ # define HAS_POSIX_LIBRARIES
+-# define HAS_BSD_SIGS
++# define HAS_POSIX_SIGS
+ # define HAS_GETRUSAGE
+ # define HAS_SETITIMER
+ # define HAS_MMAP
diff --git a/lang/smlnj11072/patches/patch-at b/lang/smlnj11072/patches/patch-at
new file mode 100644
index 00000000000..a26520b59fe
--- /dev/null
+++ b/lang/smlnj11072/patches/patch-at
@@ -0,0 +1,17 @@
+$NetBSD: patch-at,v 1.1 2016/07/03 17:50:31 dholland Exp $
+
+NetBSD has POSIX signals since 2.0 at least.
+Don't unpack archive, since it is hard to fix,
+unpack before patch phase instead.
+
+--- config/install.sh.orig 2007-06-12 20:43:58.000000000 +0400
++++ config/install.sh 2009-03-19 00:47:06.000000000 +0300
+@@ -316,7 +316,7 @@
+ if [ -x "$RUNDIR"/run.$ARCH-$OPSYS ]; then
+ vsay $this: Run-time system already exists.
+ else
+- "$CONFIGDIR"/unpack "$ROOT" runtime
++# "$CONFIGDIR"/unpack "$ROOT" runtime
+ cd "$BASEDIR"/runtime/objs
+ echo $this: Compiling the run-time system.
+ $MAKE -f mk.$ARCH-$OPSYS $EXTRA_DEFS