summaryrefslogtreecommitdiff
path: root/lang/caml-light
diff options
context:
space:
mode:
authordholland <dholland>2008-09-05 02:07:51 +0000
committerdholland <dholland>2008-09-05 02:07:51 +0000
commit029aef575803569b027a1fa89e404ff3b1954f2f (patch)
tree0aa170bed0c2128d3038543c1812f561fd14f61b /lang/caml-light
parentc47c932964b6cf1838db0772b04a26df6ee736bc (diff)
downloadpkgsrc-029aef575803569b027a1fa89e404ff3b1954f2f.tar.gz
Fix broken 64-bit build. Add destdir support.
PKGREVISION++, because I changed some things around.
Diffstat (limited to 'lang/caml-light')
-rw-r--r--lang/caml-light/Makefile9
-rw-r--r--lang/caml-light/distinfo25
-rw-r--r--lang/caml-light/patches/patch-aa46
-rw-r--r--lang/caml-light/patches/patch-ab16
-rw-r--r--lang/caml-light/patches/patch-ac35
-rw-r--r--lang/caml-light/patches/patch-ad15
-rw-r--r--lang/caml-light/patches/patch-ae15
-rw-r--r--lang/caml-light/patches/patch-af14
-rw-r--r--lang/caml-light/patches/patch-ag14
-rw-r--r--lang/caml-light/patches/patch-ah15
-rw-r--r--lang/caml-light/patches/patch-ai14
-rw-r--r--lang/caml-light/patches/patch-aj13
-rw-r--r--lang/caml-light/patches/patch-ak21
-rw-r--r--lang/caml-light/patches/patch-al15
-rw-r--r--lang/caml-light/patches/patch-am31
-rw-r--r--lang/caml-light/patches/patch-an38
-rw-r--r--lang/caml-light/patches/patch-ao15
-rw-r--r--lang/caml-light/patches/patch-ap15
-rw-r--r--lang/caml-light/patches/patch-aq17
-rw-r--r--lang/caml-light/patches/patch-ar25
-rw-r--r--lang/caml-light/patches/patch-as17
-rw-r--r--lang/caml-light/patches/patch-at17
-rw-r--r--lang/caml-light/patches/patch-au15
23 files changed, 438 insertions, 19 deletions
diff --git a/lang/caml-light/Makefile b/lang/caml-light/Makefile
index b7fad411f1f..206625ef1fc 100644
--- a/lang/caml-light/Makefile
+++ b/lang/caml-light/Makefile
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.9 2008/05/25 21:42:21 joerg Exp $
+# $NetBSD: Makefile,v 1.10 2008/09/05 02:07:51 dholland Exp $
#
DISTNAME= cl74unix
PKGNAME= caml-light-0.74
+PKGREVISION= 1
CATEGORIES= lang
MASTER_SITES= ftp://ftp.inria.fr/lang/caml-light/
@@ -10,14 +11,16 @@ MAINTAINER= bouyer@NetBSD.org
HOMEPAGE= http://caml.inria.fr/caml-light/index.en.html
COMMENT= Another implementation of Caml
+PKG_DESTDIR_SUPPORT= user-destdir
+
WRKSRC= ${WRKDIR}/cl74/src
BUILD_TARGET= world
-MAKE_FLAGS+= MANDIR=${PREFIX}/${PKGMANDIR}/man1
+INSTALLATION_DIRS+= bin lib/caml-light ${PKGMANDIR}/man1
USE_TOOLS+= pax
do-configure:
- cd ${WRKSRC} && make configure
+ cd ${WRKSRC} && ${MAKE} configure
post-configure:
${ECHO} '#define HAS_STRERROR' >> ${WRKDIR}/cl74/config/s.h
diff --git a/lang/caml-light/distinfo b/lang/caml-light/distinfo
index a6eca5b9f47..6447525b10f 100644
--- a/lang/caml-light/distinfo
+++ b/lang/caml-light/distinfo
@@ -1,7 +1,26 @@
-$NetBSD: distinfo,v 1.5 2007/02/15 14:33:56 rillig Exp $
+$NetBSD: distinfo,v 1.6 2008/09/05 02:07:51 dholland Exp $
SHA1 (cl74unix.tar.gz) = feae4a53af78b6c500a03c618dc11444e8b5dc47
RMD160 (cl74unix.tar.gz) = a00a8de15e042080041076fcf3ad2592d9deb469
Size (cl74unix.tar.gz) = 999170 bytes
-SHA1 (patch-aa) = e9a564183d445a61c00e0f6e134dee9029856bea
-SHA1 (patch-ab) = de97223ec671c8b04313c80fe4275c7ade087030
+SHA1 (patch-aa) = 6d3bc6249267789806ad4eef1b36aa809277a930
+SHA1 (patch-ab) = 3098db9faa0cd60931c781b4b24f796ac23ef52d
+SHA1 (patch-ac) = 6b268ddd007f73a8bb4085df4826627425eb9658
+SHA1 (patch-ad) = 22c97a5a2ee4a45cd85ae4c886b61cdcf833703a
+SHA1 (patch-ae) = 8de237bfb4b9a1c17e1cf4ad9c4abb7b1b456698
+SHA1 (patch-af) = 196fb2ace8ab078bccb2c8dba8b8cff211e6e95c
+SHA1 (patch-ag) = fce329f96d369f86c6fe7e3a30d78bed003d7043
+SHA1 (patch-ah) = 6a83f924ba49ae7121e070dc75432b2009643d9a
+SHA1 (patch-ai) = d9b663b4be634ccb64259c6fe0ddcda193dbbe50
+SHA1 (patch-aj) = 0e9ebfb02fb5efa06e393cf3e0ea3db6acd56acd
+SHA1 (patch-ak) = c24484f6dc1978c8bd04ff125f6fd86812fe68bc
+SHA1 (patch-al) = d4274b118eacf8f6f2a61ddaa8fde7468f45aefc
+SHA1 (patch-am) = a158d8553a85467955394b169ace0081eab65317
+SHA1 (patch-an) = 1bb3d4a32ae15f5639ab7575f50452764cf1d9a5
+SHA1 (patch-ao) = 59ec322fd19a9139fd329a9a36c0640a12306adf
+SHA1 (patch-ap) = e573c67efe96d159b3ab5bedc2ca1a319633a227
+SHA1 (patch-aq) = 00285a3f4cd6beea7a5b1b8f9c7c6810540dc5d8
+SHA1 (patch-ar) = aba9a829916af887d1115b51a57b449aced8535f
+SHA1 (patch-as) = 5d462ae1a1bf72ae1a0f19ff73d4b1b4226dbb32
+SHA1 (patch-at) = 83c69c1635a0c8f038bcd23d00acc4dc406c0684
+SHA1 (patch-au) = 4fe5ac20d7526e782143874b0ce9c7367716dbce
diff --git a/lang/caml-light/patches/patch-aa b/lang/caml-light/patches/patch-aa
index a1e19ae37fc..d69c50fca08 100644
--- a/lang/caml-light/patches/patch-aa
+++ b/lang/caml-light/patches/patch-aa
@@ -1,8 +1,11 @@
-$NetBSD: patch-aa,v 1.2 2004/03/20 22:35:04 bouyer Exp $
+$NetBSD: patch-aa,v 1.3 2008/09/05 02:07:51 dholland Exp $
---- Makefile.orig 1997-04-24 16:51:03.000000000 +0200
-+++ Makefile 2004-03-08 01:07:53.010550000 +0100
-@@ -7,7 +7,7 @@
+Config fixes.
+Destdir support.
+
+--- Makefile.orig 1997-04-24 10:51:03.000000000 -0400
++++ Makefile 2008-09-04 21:28:01.000000000 -0400
+@@ -7,7 +7,7 @@ CC=gcc
# Additional options to $(CC).
# If you are using gcc, add -fno-defer-pop.
# This option circumvents a gcc bug on some platforms (680x0, 80386).
@@ -11,7 +14,7 @@ $NetBSD: patch-aa,v 1.2 2004/03/20 22:35:04 bouyer Exp $
# Extra libraries that have to be linked with the runtime system.
# The math library "-lm" is linked by default.
-@@ -24,19 +24,19 @@
+@@ -24,19 +24,19 @@ LIBS=
# not all Unix C preprocessors define it.
# If your cpp is too fussy, make tools/clprepro and use this:
# CPP=../../src/tools/clprepro -Dunix
@@ -31,11 +34,11 @@ $NetBSD: patch-aa,v 1.2 2004/03/20 22:35:04 bouyer Exp $
# The directory where the manual pages will be installed
-MANDIR=/usr/local/man/man$(MANEXT)
-+MANDIR=${PREFIX}/man/man$(MANEXT)
++MANDIR=${PREFIX}/${PKGMANDIR}/man$(MANEXT)
# Some "make"s need this to ensure that they call the Bourne shell,
# not the C shell. Seems harmless on most other "make"s.
-@@ -49,7 +49,7 @@
+@@ -49,7 +49,7 @@ SUBDIRS=runtime launch lib compiler link
# Configure the system
configure:
@@ -44,3 +47,32 @@ $NetBSD: patch-aa,v 1.2 2004/03/20 22:35:04 bouyer Exp $
# Build the system for the first time
world:
+@@ -118,8 +118,8 @@ compile:
+
+ # Install the Caml Light system
+ install:
+- if test -d $(BINDIR); then : ; else mkdir $(BINDIR); fi
+- if test -d $(LIBDIR); then : ; else mkdir $(LIBDIR); fi
++ if test -d $(DESTDIR)$(BINDIR); then : ; else mkdir $(DESTDIR)$(BINDIR); fi
++ if test -d $(DESTDIR)$(LIBDIR); then : ; else mkdir $(DESTDIR)$(LIBDIR); fi
+ cd runtime; make BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) install
+ cd launch; make BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) install
+ cd lib; make BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) install
+@@ -130,13 +130,13 @@ install:
+ cd lex; make BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) install
+ cd yacc; make BINDIR=$(BINDIR) LIBDIR=$(LIBDIR) install
+ cd man; make MANDIR=$(MANDIR) MANEXT=$(MANEXT) install
+- cp camlmsgs.txt $(LIBDIR)
++ cp camlmsgs.txt $(DESTDIR)$(LIBDIR)
+
+ # Remove the Caml Light system after installation
+ uninstall:
+- rm -rf $(LIBDIR)
+- rm -f $(BINDIR)/camlrun $(BINDIR)/camlc $(BINDIR)/camllight
+- rm -f $(BINDIR)/camlyacc $(BINDIR)/camllex $(BINDIR)/camlmktop
++ rm -rf $(DESTDIR)$(LIBDIR)
++ rm -f $(DESTDIR)$(BINDIR)/camlrun $(DESTDIR)$(BINDIR)/camlc $(DESTDIR)$(BINDIR)/camllight
++ rm -f $(DESTDIR)$(BINDIR)/camlyacc $(DESTDIR)$(BINDIR)/camllex $(DESTDIR)$(BINDIR)/camlmktop
+
+ # Remove all generated files
+ clean:
diff --git a/lang/caml-light/patches/patch-ab b/lang/caml-light/patches/patch-ab
index addf43abdb7..0f9788e4af8 100644
--- a/lang/caml-light/patches/patch-ab
+++ b/lang/caml-light/patches/patch-ab
@@ -1,15 +1,19 @@
-$NetBSD: patch-ab,v 1.1 2007/02/15 14:34:09 rillig Exp $
+$NetBSD: patch-ab,v 1.2 2008/09/05 02:07:51 dholland Exp $
cp(1) cannot overwrite read-only files.
---- lib/Makefile.orig 1997-11-12 17:49:46.000000000 +0100
-+++ lib/Makefile 2007-01-18 21:05:00.000000000 +0100
-@@ -31,7 +31,7 @@ clean:
+Add destdir support.
+
+--- lib/Makefile.orig 1997-11-12 11:49:46.000000000 -0500
++++ lib/Makefile 2008-09-04 21:39:14.000000000 -0400
+@@ -31,8 +31,8 @@ clean:
rm -f filename.ml genlex.ml
install:
- cp stdlib.zo *.zi *.zix *.mli *.ml $(LIBDIR)
-+ pax -wr stdlib.zo *.zi *.zix *.mli *.ml $(LIBDIR)
- rm $(LIBDIR)/iparsing.mli
+- rm $(LIBDIR)/iparsing.mli
++ pax -wr stdlib.zo *.zi *.zix *.mli *.ml $(DESTDIR)$(LIBDIR)
++ rm $(DESTDIR)$(LIBDIR)/iparsing.mli
.SUFFIXES :
+ .SUFFIXES : .ml .mli .zi .zo .mlp
diff --git a/lang/caml-light/patches/patch-ac b/lang/caml-light/patches/patch-ac
new file mode 100644
index 00000000000..954ad56e92e
--- /dev/null
+++ b/lang/caml-light/patches/patch-ac
@@ -0,0 +1,35 @@
+$NetBSD: patch-ac,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+Fix build with gcc4.
+
+--- runtime/main.c~ 1997-04-24 10:51:06.000000000 -0400
++++ runtime/main.c 2008-09-04 21:09:25.000000000 -0400
+@@ -1,6 +1,7 @@
+ /* Start-up code */
+
+ #include <stdio.h>
++#include <unistd.h>
+ #ifdef __MWERKS__
+ #include "myfcntl.h"
+ #else
+@@ -125,6 +126,7 @@ Algorithm:
+
+ */
+
++int
+ #ifdef HAS_UI
+ caml_main(argc, argv)
+ #else
+@@ -133,9 +135,9 @@ main(argc, argv)
+ int argc;
+ char * argv[];
+ {
+- int fd;
++ volatile int fd;
+ struct exec_trailer trail;
+- int i;
++ volatile int i;
+ struct longjmp_buffer raise_buf;
+ struct channel * chan;
+ int verbose_init = 0, percent_free_init = Percent_free_def;
diff --git a/lang/caml-light/patches/patch-ad b/lang/caml-light/patches/patch-ad
new file mode 100644
index 00000000000..94deae722a0
--- /dev/null
+++ b/lang/caml-light/patches/patch-ad
@@ -0,0 +1,15 @@
+$NetBSD: patch-ad,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- runtime/signals.c~ 1995-11-10 10:10:32.000000000 -0500
++++ runtime/signals.c 2008-09-04 21:10:48.000000000 -0400
+@@ -5,6 +5,8 @@
+ #include "signals.h"
+ #include "stacks.h"
+
++value callback(value closure, value argument);
++
+ Volatile int async_signal_mode = 0;
+ Volatile code_t pending_signal_handler;
+ Volatile int pending_signal = 0;
diff --git a/lang/caml-light/patches/patch-ae b/lang/caml-light/patches/patch-ae
new file mode 100644
index 00000000000..b8b90d30256
--- /dev/null
+++ b/lang/caml-light/patches/patch-ae
@@ -0,0 +1,15 @@
+$NetBSD: patch-ae,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- runtime/debugcom.c~ 1997-06-27 09:59:02.000000000 -0400
++++ runtime/debugcom.c 2008-09-04 21:11:39.000000000 -0400
+@@ -2,6 +2,8 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <unistd.h>
++#include <arpa/inet.h> /* for inet_addr() */
+ #include "misc.h"
+ #include "debugger.h"
+ #include "mlvalues.h"
diff --git a/lang/caml-light/patches/patch-af b/lang/caml-light/patches/patch-af
new file mode 100644
index 00000000000..bb221870c05
--- /dev/null
+++ b/lang/caml-light/patches/patch-af
@@ -0,0 +1,14 @@
+$NetBSD: patch-af,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- runtime/io.c~ 1997-04-24 10:51:06.000000000 -0400
++++ runtime/io.c 2008-09-04 21:13:01.000000000 -0400
+@@ -1,6 +1,7 @@
+ /* Buffered input/output. */
+
+ #include <errno.h>
++#include <unistd.h>
+ #ifdef __MWERKS__
+ #include "myfcntl.h"
+ #else
diff --git a/lang/caml-light/patches/patch-ag b/lang/caml-light/patches/patch-ag
new file mode 100644
index 00000000000..7b1d20dc1f3
--- /dev/null
+++ b/lang/caml-light/patches/patch-ag
@@ -0,0 +1,14 @@
+$NetBSD: patch-ag,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- runtime/sys.c~ 1997-10-16 09:36:19.000000000 -0400
++++ runtime/sys.c 2008-09-04 21:13:32.000000000 -0400
+@@ -1,6 +1,7 @@
+ /* Basic system calls */
+
+ #include <errno.h>
++#include <unistd.h>
+ #ifdef __MWERKS__
+ #include "myfcntl.h"
+ #else
diff --git a/lang/caml-light/patches/patch-ah b/lang/caml-light/patches/patch-ah
new file mode 100644
index 00000000000..2fe694a2ba3
--- /dev/null
+++ b/lang/caml-light/patches/patch-ah
@@ -0,0 +1,15 @@
+$NetBSD: patch-ah,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- runtime/lexing.c~ 1994-11-01 12:36:10.000000000 -0500
++++ runtime/lexing.c 2008-09-04 21:13:59.000000000 -0400
+@@ -4,6 +4,8 @@
+ #include "stacks.h"
+ #include "str.h"
+
++value callback(value closure, value argument);
++
+ struct lexer_buffer {
+ value refill_buff;
+ value lex_buffer;
diff --git a/lang/caml-light/patches/patch-ai b/lang/caml-light/patches/patch-ai
new file mode 100644
index 00000000000..2d164420288
--- /dev/null
+++ b/lang/caml-light/patches/patch-ai
@@ -0,0 +1,14 @@
+$NetBSD: patch-ai,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- yacc/defs.h~ 1995-05-02 10:47:38.000000000 -0400
++++ yacc/defs.h 2008-09-04 21:21:25.000000000 -0400
+@@ -3,6 +3,7 @@
+ #include <stdio.h>
+ #ifdef __STDC__
+ #include <stdlib.h>
++#include <string.h>
+ #endif
+
+ #ifdef macintosh
diff --git a/lang/caml-light/patches/patch-aj b/lang/caml-light/patches/patch-aj
new file mode 100644
index 00000000000..80b04852db1
--- /dev/null
+++ b/lang/caml-light/patches/patch-aj
@@ -0,0 +1,13 @@
+$NetBSD: patch-aj,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- launch/camlexec.c~ 1996-11-25 10:03:46.000000000 -0500
++++ launch/camlexec.c 2008-09-04 21:22:57.000000000 -0400
+@@ -1,3 +1,6 @@
++#include <string.h>
++#include <unistd.h>
++
+ #ifdef MSDOS
+ char * runtime_name = "camlrun.exe";
+ char * errmsg = "Cannot exec camlrun.exe.\n";
diff --git a/lang/caml-light/patches/patch-ak b/lang/caml-light/patches/patch-ak
new file mode 100644
index 00000000000..5a43e951856
--- /dev/null
+++ b/lang/caml-light/patches/patch-ak
@@ -0,0 +1,21 @@
+$NetBSD: patch-ak,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix build with gcc4.
+
+--- runtime/interp.c~ 1997-06-27 09:59:03.000000000 -0400
++++ runtime/interp.c 2008-09-04 20:53:27.000000000 -0400
+@@ -177,10 +177,10 @@ value interprete(prog)
+ register value * asp;
+ register value * rsp;
+ #else
+- register code_t pc;
+- register value accu;
+- register value * asp;
+- register value * rsp;
++ register volatile code_t pc;
++ register volatile value accu;
++ register value * volatile asp;
++ register value * volatile rsp;
+ #endif
+ #endif
+ #endif
diff --git a/lang/caml-light/patches/patch-al b/lang/caml-light/patches/patch-al
new file mode 100644
index 00000000000..666eacc9c2c
--- /dev/null
+++ b/lang/caml-light/patches/patch-al
@@ -0,0 +1,15 @@
+$NetBSD: patch-al,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+Fix 64-bit build.
+
+--- runtime/config.h~ 1995-10-03 09:55:32.000000000 -0400
++++ runtime/config.h 2008-09-04 21:04:48.000000000 -0400
+@@ -12,6 +12,8 @@
+
+ /* Library dependencies */
+
++#include <string.h>
++
+ #ifdef HAS_MEMMOVE
+ #define bcopy(src,dst,len) memmove((dst), (src), (len))
+ #else
diff --git a/lang/caml-light/patches/patch-am b/lang/caml-light/patches/patch-am
new file mode 100644
index 00000000000..9b2a7d9d8fe
--- /dev/null
+++ b/lang/caml-light/patches/patch-am
@@ -0,0 +1,31 @@
+$NetBSD: patch-am,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- runtime/Makefile~ 1997-06-10 08:24:35.000000000 -0400
++++ runtime/Makefile 2008-09-04 21:29:09.000000000 -0400
+@@ -50,17 +50,17 @@ clean:
+ rm -f primitives prims.c opnames.h jumptbl.h
+
+ install:
+- cp camlrun $(BINDIR)
+- strip $(BINDIR)/camlrun
+- cp libcaml.a $(LIBDIR)
+- if $(RANLIBTEST); then cd $(LIBDIR); $(RANLIB) libcaml.a; else true; fi
+- cp mlvalues.h alloc.h misc.h $(LIBDIR)
++ cp camlrun $(DESTDIR)$(BINDIR)
++ strip $(DESTDIR)$(BINDIR)/camlrun
++ cp libcaml.a $(DESTDIR)$(LIBDIR)
++ if $(RANLIBTEST); then cd $(DESTDIR)$(LIBDIR); $(RANLIB) libcaml.a; else true; fi
++ cp mlvalues.h alloc.h misc.h $(DESTDIR)$(LIBDIR)
+ sed -e '/#include ".*\/m.h/r ../../config/m.h' \
+ -e '/#include ".*\/s.h/r ../../config/s.h' \
+- -e '/#include "/d' config.h > $(LIBDIR)/config.h
++ -e '/#include "/d' config.h > $(DESTDIR)$(LIBDIR)/config.h
+ sed -e '/#include ".*gc\.h"/d' \
+ -e '/#define Alloc_small/,/^}/d' \
+- -e '/Modify/,/^}/d' memory.h > $(LIBDIR)/memory.h
++ -e '/Modify/,/^}/d' memory.h > $(DESTDIR)$(LIBDIR)/memory.h
+
+ primitives : $(PRIMS)
+ sed -n -e '/\/\* ML \*\//s/.* \([a-z0-9_][a-z0-9_]*\) *(.*/\1/p' \
diff --git a/lang/caml-light/patches/patch-an b/lang/caml-light/patches/patch-an
new file mode 100644
index 00000000000..13b2f386456
--- /dev/null
+++ b/lang/caml-light/patches/patch-an
@@ -0,0 +1,38 @@
+$NetBSD: patch-an,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- launch/Makefile~ 1995-02-22 04:33:26.000000000 -0500
++++ launch/Makefile 2008-09-04 21:32:35.000000000 -0400
+@@ -10,19 +10,20 @@ all: camlc camllight camlmktop camlexec
+ # Also, "make install" is done with root permissions, meaning that we don't
+ # have write permission in the current directory if NFS-mounted...
+
++# (echo "#!$(BINDIR)/camlrun"; \
++# echo "exit 2"; \
++# cat testprog) > /tmp/testscr
++# chmod a+x /tmp/testscr
++# sh -c 'if sh -c /tmp/testscr 2>/dev/null; \
++# then echo "#!$(BINDIR)/camlrun" > $(LIBDIR)/header; \
++# else cp camlexec $(LIBDIR)/header; \
++# fi'
++# rm -f /tmp/testscr
+ install:
+- (echo "#!$(BINDIR)/camlrun"; \
+- echo "exit 2"; \
+- cat testprog) > /tmp/testscr
+- chmod a+x /tmp/testscr
+- sh -c 'if sh -c /tmp/testscr 2>/dev/null; \
+- then echo "#!$(BINDIR)/camlrun" > $(LIBDIR)/header; \
+- else cp camlexec $(LIBDIR)/header; \
+- fi'
+- rm -f /tmp/testscr
++ echo "#!$(BINDIR)/camlrun" > $(DESTDIR)$(LIBDIR)/header
+ for script in camlc camllight camlmktop; do \
+- cp $$script $(BINDIR)/$$script; \
+- chmod a+x $(BINDIR)/$$script; \
++ cp $$script $(DESTDIR)$(BINDIR)/$$script; \
++ chmod a+x $(DESTDIR)$(BINDIR)/$$script; \
+ done
+
+ SEDCOMMANDS=\
diff --git a/lang/caml-light/patches/patch-ao b/lang/caml-light/patches/patch-ao
new file mode 100644
index 00000000000..77f0607f565
--- /dev/null
+++ b/lang/caml-light/patches/patch-ao
@@ -0,0 +1,15 @@
+$NetBSD: patch-ao,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- compiler/Makefile~ 1997-11-12 11:48:14.000000000 -0500
++++ compiler/Makefile 2008-09-04 21:34:41.000000000 -0400
+@@ -32,7 +32,7 @@ clean:
+ rm -f $(GENSOURCES) lexer.mll
+
+ install:
+- cp camlcomp $(LIBDIR)/camlcomp
++ cp camlcomp $(DESTDIR)$(LIBDIR)/camlcomp
+
+ opcodes.ml: ../runtime/instruct.h
+ sed -n -e '/^enum/p' -e 's/,//' -e '/^ /p' ../runtime/instruct.h | \
diff --git a/lang/caml-light/patches/patch-ap b/lang/caml-light/patches/patch-ap
new file mode 100644
index 00000000000..e490440eb99
--- /dev/null
+++ b/lang/caml-light/patches/patch-ap
@@ -0,0 +1,15 @@
+$NetBSD: patch-ap,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- linker/Makefile~ 1997-11-12 11:50:21.000000000 -0500
++++ linker/Makefile 2008-09-04 21:35:03.000000000 -0400
+@@ -24,7 +24,7 @@ clean:
+ rm -f $(GENSOURCES)
+
+ install:
+- cp camllink $(LIBDIR)/camllink
++ cp camllink $(DESTDIR)$(LIBDIR)/camllink
+
+ prim_c.ml : ../runtime/primitives
+ (echo 'let primitives_table = [|'; \
diff --git a/lang/caml-light/patches/patch-aq b/lang/caml-light/patches/patch-aq
new file mode 100644
index 00000000000..a11a9ebbc4c
--- /dev/null
+++ b/lang/caml-light/patches/patch-aq
@@ -0,0 +1,17 @@
+$NetBSD: patch-aq,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- librar/Makefile~ 1997-11-12 11:50:13.000000000 -0500
++++ librar/Makefile 2008-09-04 21:35:38.000000000 -0400
+@@ -23,8 +23,8 @@ clean:
+ rm -f $(GENSOURCES)
+
+ install:
+- cat $(LIBDIR)/header camllibr > $(BINDIR)/camllibr
+- chmod a+x $(BINDIR)/camllibr
++ cat $(DESTDIR)$(LIBDIR)/header camllibr > $(DESTDIR)$(BINDIR)/camllibr
++ chmod a+x $(DESTDIR)$(BINDIR)/camllibr
+
+ .SUFFIXES :
+ .SUFFIXES : .mli .ml .zi .zo .mlp
diff --git a/lang/caml-light/patches/patch-ar b/lang/caml-light/patches/patch-ar
new file mode 100644
index 00000000000..4927950c65a
--- /dev/null
+++ b/lang/caml-light/patches/patch-ar
@@ -0,0 +1,25 @@
+$NetBSD: patch-ar,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- toplevel/Makefile~ 1997-11-12 11:50:29.000000000 -0500
++++ toplevel/Makefile 2008-09-04 21:36:13.000000000 -0400
+@@ -57,12 +57,12 @@ clean:
+ rm -f $(GENSOURCES)
+
+ install:
+- cp camltop $(LIBDIR)/camltop
+- cp toplevel.mli toplevel.zi $(LIBDIR)
+- cp provide $(LIBDIR)/provide
+- cp expunge $(LIBDIR)/expunge
+- cp toplib.zo $(LIBDIR)/toplib.zo
+- cp topmain.zo $(LIBDIR)/topmain.zo
++ cp camltop $(DESTDIR)$(LIBDIR)/camltop
++ cp toplevel.mli toplevel.zi $(DESTDIR)$(LIBDIR)
++ cp provide $(DESTDIR)$(LIBDIR)/provide
++ cp expunge $(DESTDIR)$(LIBDIR)/expunge
++ cp toplib.zo $(DESTDIR)$(LIBDIR)/toplib.zo
++ cp topmain.zo $(DESTDIR)$(LIBDIR)/topmain.zo
+
+ .SUFFIXES :
+ .SUFFIXES : .mli .ml .zi .zo .mlp
diff --git a/lang/caml-light/patches/patch-as b/lang/caml-light/patches/patch-as
new file mode 100644
index 00000000000..c0e8151a688
--- /dev/null
+++ b/lang/caml-light/patches/patch-as
@@ -0,0 +1,17 @@
+$NetBSD: patch-as,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- lex/Makefile~ 1997-11-12 11:48:29.000000000 -0500
++++ lex/Makefile 2008-09-04 21:36:39.000000000 -0400
+@@ -21,8 +21,8 @@ clean:
+ rm -f grammar.ml grammar.mli scanner.ml
+
+ install:
+- cat $(LIBDIR)/header camllex > $(BINDIR)/camllex
+- chmod a+x $(BINDIR)/camllex
++ cat $(DESTDIR)$(LIBDIR)/header camllex > $(DESTDIR)$(BINDIR)/camllex
++ chmod a+x $(DESTDIR)$(BINDIR)/camllex
+
+ grammar.ml grammar.mli: grammar.mly
+ $(CAMLYACC) grammar.mly
diff --git a/lang/caml-light/patches/patch-at b/lang/caml-light/patches/patch-at
new file mode 100644
index 00000000000..67296340360
--- /dev/null
+++ b/lang/caml-light/patches/patch-at
@@ -0,0 +1,17 @@
+$NetBSD: patch-at,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- yacc/Makefile~ 1994-11-01 12:36:18.000000000 -0500
++++ yacc/Makefile 2008-09-04 21:36:59.000000000 -0400
+@@ -16,8 +16,8 @@ clean:
+ rm -f *.o camlyacc
+
+ install:
+- cp camlyacc $(BINDIR)/camlyacc
+- strip $(BINDIR)/camlyacc
++ cp camlyacc $(DESTDIR)$(BINDIR)/camlyacc
++ strip $(DESTDIR)$(BINDIR)/camlyacc
+
+ depend:
+
diff --git a/lang/caml-light/patches/patch-au b/lang/caml-light/patches/patch-au
new file mode 100644
index 00000000000..e78afc89642
--- /dev/null
+++ b/lang/caml-light/patches/patch-au
@@ -0,0 +1,15 @@
+$NetBSD: patch-au,v 1.1 2008/09/05 02:07:51 dholland Exp $
+
+destdir support.
+
+--- man/Makefile~ 1994-11-01 12:36:06.000000000 -0500
++++ man/Makefile 2008-09-04 21:37:35.000000000 -0400
+@@ -1,6 +1,6 @@
+ MAN=camlc.m camllex.m camllibr.m camllight.m camlmktop.m camlrun.m camlyacc.m
+ MANEXT=1
+-MANDIR=/usr/man/man$(MANEXT)
++MANDIR=$(PREFIX)/$(PKGMANDIR)/man$(MANEXT)
+
+ install:
+- for f in $(MAN); do cp $$f $(MANDIR)/`basename $$f .m`.$(MANEXT); done
++ for f in $(MAN); do cp $$f $(DESTDIR)$(MANDIR)/`basename $$f .m`.$(MANEXT); done