caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Ocaml and OpenBSD's port system
@ 2007-02-08 10:53 Bruce O'Neel
  2007-02-08 11:07 ` Anil Madhavapeddy
  0 siblings, 1 reply; 2+ messages in thread
From: Bruce O'Neel @ 2007-02-08 10:53 UTC (permalink / raw)
  To: caml-list, Anil Madhavapeddy

Hi,

Ocaml installs very nicely from the OpenBSD ports system, with one small glitch.

ocaml believes that it can't load dynamic librarys in OpenBSD and therefore 
doesn't let you load .cma files.  `This is slightly annoying just because I 
wanted to play around with sockets and this means I can't do it interactivly
at the ocaml prompt.

It turns out this is quite easy to solve.  Ocaml doesn't think it can load 
dynamic librarys on it's own because it hasn't been told so.  Around line 486 of
configure the list of OSes that can do dynamic loading is checked, and 
OpenBDS just has to be added.  I changed my line to:  

case "$host" in
      *-*-linux-gnu|*-*-linux|*-*-openbsd[3-9]*|*-*-gnu*)

but it might be better to say:

case "$host" in
      *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-openbsd[3-4]*|*-*-gnu*)

The whole sequence for my installation from ports is more complex than needed
just because I don't understand ports very well yet:

make fetch
make checksum
make depends
make extract
make patch

vi w-ocaml-3.09.2/ocaml-3.09.2/configure 

Change around line 486 from freebsd to openbsd  

if test $withsharedlibs = "yes"; then
  case "$host" in
      *-*-linux-gnu|*-*-linux|*-*-openbsd[3-9]*|*-*-gnu*)


make configure
make build
make fake
make package
make install

ln ./w-ocaml-3.09.2/fake-macppc/usr/local/lib/ocaml/stublibs/dll* /usr/local/lib
/ocaml/stublibs/

Note that the stublibs won't be known by the package system.

tar czvf /usr/ports/packages/powerpc/all/ocaml-3.09.2-stublibs.tgz /usr/local/li
b/ocaml/stublibs/

I tested this on sparc, macppc, and sparc64.  I assume that it works on x86 as well. 

Thanks for ocaml and thanks for a nice OpenBSD port of it!

cheers

bruce


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Ocaml and OpenBSD's port system
  2007-02-08 10:53 Ocaml and OpenBSD's port system Bruce O'Neel
@ 2007-02-08 11:07 ` Anil Madhavapeddy
  0 siblings, 0 replies; 2+ messages in thread
From: Anil Madhavapeddy @ 2007-02-08 11:07 UTC (permalink / raw)
  To: Bruce O'Neel; +Cc: caml-list, ports

[-- Attachment #1: Type: text/plain, Size: 1014 bytes --]

On Thu, Feb 08, 2007 at 11:53:02AM +0100, Bruce O'Neel wrote:
> 
> Ocaml installs very nicely from the OpenBSD ports system, with one small glitch.
> 
> ocaml believes that it can't load dynamic librarys in OpenBSD and therefore 
> doesn't let you load .cma files.  `This is slightly annoying just because I 
> wanted to play around with sockets and this means I can't do it interactivly
> at the ocaml prompt.

Woops, I've had this patch in my outgoing OpenBSD queue for a month
now.  Just re-testing it on sparc64 (which has shared libs but no
native code) to check for regression.  It's attached against
OpenBSD-current and fixes a string termination error in yacc which
Ray Lai found as well.

Incidentally, you can just do 'make clean && make patch' and skip
all the intermediate steps when messing around with the port.  Some
good comes from using make :-)

-- 
Anil Madhavapeddy                                 http://anil.recoil.org
XenSource Inc.                                  http://www.xensource.com

[-- Attachment #2: patch-ocaml-shared-yacc --]
[-- Type: text/plain, Size: 3113 bytes --]

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/ocaml/Makefile,v
retrieving revision 1.37
diff -u -r1.37 Makefile
--- Makefile	26 Dec 2006 22:07:18 -0000	1.37
+++ Makefile	8 Feb 2007 10:57:40 -0000
@@ -6,6 +6,7 @@
 
 BASENAME=	ocaml-3.09
 DISTNAME=	${BASENAME}.3
+PKGNAME=	${DISTNAME}p0
 CATEGORIES=	lang
 MASTER_SITES=	http://caml.inria.fr/distrib/${BASENAME}/
 DOCFILES=	${BASENAME}-refman.html.tar.gz
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/lang/ocaml/patches/patch-configure,v
retrieving revision 1.9
diff -u -r1.9 patch-configure
--- patches/patch-configure	28 May 2006 15:28:54 -0000	1.9
+++ patches/patch-configure	8 Feb 2007 10:57:40 -0000
@@ -1,6 +1,15 @@
 $OpenBSD: patch-configure,v 1.9 2006/05/28 15:28:54 avsm Exp $
---- configure.orig	Thu Mar 30 11:00:19 2006
-+++ configure	Tue May  2 12:02:42 2006
+--- configure.orig	Tue Dec 26 23:30:01 2006
++++ configure	Tue Dec 26 23:29:28 2006
+@@ -483,7 +483,7 @@ mksharedlibrpath=''
+ 
+ if test $withsharedlibs = "yes"; then
+   case "$host" in
+-    *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-gnu*)
++    *-*-linux-gnu|*-*-linux|*-*-freebsd[3-9]*|*-*-openbsd*|*-*-gnu*)
+       sharedcccompopts="-fPIC"
+       mksharedlib="$bytecc -shared -o"
+       bytecclinkopts="$bytecclinkopts -Wl,-E"
 @@ -566,6 +566,7 @@ case "$host" in
    alpha*-*-freebsd*)            arch=alpha; system=freebsd;;
    alpha*-*-netbsd*)             arch=alpha; system=netbsd;;
Index: patches/patch-yacc_reader_c
===================================================================
RCS file: patches/patch-yacc_reader_c
diff -N patches/patch-yacc_reader_c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-yacc_reader_c	8 Feb 2007 10:57:40 -0000
@@ -0,0 +1,11 @@
+$OpenBSD$
+--- yacc/reader.c.orig	Fri Dec 29 21:32:48 2006
++++ yacc/reader.c	Fri Dec 29 21:36:44 2006
+@@ -163,6 +163,7 @@ char *substring (char *str, int start, i
+   for (i = 0; i < len; i++){
+     buf[i] = str[start+i];
+   }
++  buf[i] = '\0';
+   return buf;
+ }
+ 
Index: pkg/PFRAG.shared
===================================================================
RCS file: pkg/PFRAG.shared
diff -N pkg/PFRAG.shared
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg/PFRAG.shared	8 Feb 2007 10:57:40 -0000
@@ -0,0 +1,11 @@
+@comment $OpenBSD$
+lib/ocaml/stublibs/dllbigarray.so
+lib/ocaml/stublibs/dllgraphics.so
+lib/ocaml/stublibs/dlllabltk.so
+lib/ocaml/stublibs/dllmldbm.so
+lib/ocaml/stublibs/dllnums.so
+lib/ocaml/stublibs/dllstr.so
+lib/ocaml/stublibs/dllthreads.so
+lib/ocaml/stublibs/dlltkanim.so
+lib/ocaml/stublibs/dllunix.so
+lib/ocaml/stublibs/dllvmthreads.so
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/lang/ocaml/pkg/PLIST,v
retrieving revision 1.17
diff -u -r1.17 PLIST
--- pkg/PLIST	26 Dec 2006 22:07:18 -0000	1.17
+++ pkg/PLIST	8 Feb 2007 10:57:40 -0000
@@ -1,4 +1,5 @@
 @comment $OpenBSD: PLIST,v 1.17 2006/12/26 22:07:18 avsm Exp $
+%%SHARED%%
 bin/camlp4
 bin/camlp4o
 bin/camlp4r

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-08 11:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-08 10:53 Ocaml and OpenBSD's port system Bruce O'Neel
2007-02-08 11:07 ` Anil Madhavapeddy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).