You are not logged in.

#1 2004-12-07 00:03:25

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Objective Caml packages

First of all, I'm brand new at this business of submitting packages, so I'll probably make a few mistakes. Anyway, I have packaged Objective Caml (OCaml) and several related products for your amusement.

OCaml, for those who don't know, is a high-level programming language that supports functional, imperative, and object-oriented programming. It is gaining popularity in part because it enables developers to compile fast executables from compact code.

By the way, I know someone else has submitted an OCaml package. But I created this one before I knew that. I'm submitting it anyway because:


· I did the work, so I might as well. If mine just happens to be better than the others, use it. If not, no hard feelings.
· This one is up to date (3.08.2, the latest release).
· This one incorporates a bug fix (albeit a trivial one) that hasn't made it into the official OCaml distro yet.


So anyway, see what y'all think.


Matt Gushee
Englewood, CO, USA

Offline

#2 2004-12-07 00:09:55

luisfelipe
Member
Registered: 2004-05-06
Posts: 96

Re: Objective Caml packages

I think it's great. Also, if you could tell us where to get them, it would be even better.

tongue

Offline

#3 2004-12-07 00:16:22

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Re: Objective Caml packages

Here are a PKGBUILD and a patch for ocaml-3.08.2, the Objective Caml compiler and libraries. This build requires Tk and X11, but I decided to make them build dependencies rather than runtime dependencies. This way, you should be able to use OCaml on a system without X or Tk installed.

The upstream source has a minor bug in LablTk, the Tk interface: the solid border option for widgets was omitted. I've reported this bug to the OCaml team, but they haven't fixed it yet; in the meantime, my patch will correct the problem.

PKGBUILD:

pkgname=ocaml
pkgver=3.08.2
pkgrel=1
pkgdesc="Objective Caml is a strongly-typed, high-level language that supports functional, imperative, and object-oriented programming."
url="http://caml.inria.fr/"
license="QPL, LGPL"
depends=('ncurses')
makedepends=('xfree86' 'tk' 'db')
conflicts=()
replaces=()
backup=()
install=
source=('http://caml.inria.fr/distrib/ocaml-3.08/ocaml-3.08.2.tar.bz2' 'ocaml-3.08-tk-solid.diff')
md5sums=('608319707707cf4ac3f7a13eb63260ad' 'abd375ee3c8b88d9d82cc2158dd281f0')

die() {
  echo $1
  return 1
}

build() {
  cd $startdir/src
  patch -p0 <ocaml-3.08-tk-solid.diff
  cd $pkgname-$pkgver
  ./configure -prefix /usr
  echo "%% Byte-compiling ..."
  make world >world.log 2>&1 || die "'make world' failed. See 'world.log' for details"
  echo "%% Byte-compilation complete; checking build integrity with 'make bootstrap' ..."
  make bootstrap >bootstrap.log 2>&1 || 
    die "'make bootstrap' failed. See 'bootstrap.log' for details"
  echo "%% 'make bootstrap' succeeded; compiling native code ..."
  make opt >opt.log 2>&1 || die "'make opt' failed. See 'opt.log' for details"
  echo "%% Native-code compilation succeeded; building package ..."
  make BINDIR=$startdir/pkg/usr/bin LIBDIR=$startdir/pkg/usr/lib/ocaml 
    STUBLIBDIR=$startdir/pkg/usr/lib/ocaml/stublibs MANDIR=$startdir/pkg/usr/man install
}

ocaml-3.08-tk-solid.diff:

--- ocaml-3.08.2/otherlibs/labltk/Widgets.src.orig    2004-12-06 11:25:12.000000000 -0700
+++ ocaml-3.08.2/otherlibs/labltk/Widgets.src    2004-12-06 11:25:57.000000000 -0700
@@ -61,6 +61,7 @@
    Flat   ["flat"]
    Ridge  ["ridge"]
    Groove ["groove"]
+   Solid  ["solid"]
 }
 
 type TextVariable external      % textvariable.ml

Matt Gushee
Englewood, CO, USA

Offline

#4 2004-12-07 00:26:31

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Re: Objective Caml packages

Ledit is a line editor that provides similar functionality to GNU readline.  It was developed for use with OCaml, because OCaml (due, I think to license issues) cannot be linked to readline. However, ledit is a standalone executable rather than a library, so it can be used with any interactive program, e.g.:

ledit <program> <args>

PKGBUILD:

pkgname=ledit
pkgver=1.11
pkgrel=1
pkgdesc="A line editor for OCaml and other programs that don't use GNU readline."
url="http://caml.inria.fr/distrib/bazar-ocaml/ledit.tar.gz"
license="BSD"
depends=()
makedepends=('ocaml')
conflicts=()
replaces=()
backup=()
install=
source=('http://caml.inria.fr/distrib/bazar-ocaml/ledit.tar.gz' 'ledit-1.11-mf.diff')
md5sums=('a2d38ba641682509c1e964ad699a9dd2' 'f8d64c79bcae2521093fe80b791e01cb')

build() {
  cd $startdir/src
  patch -p0 <ledit-1.11-mf.diff
  cd $pkgname-$pkgver
  make TARGET=ledit.opt || return 1
  make BINDIR=$startdir/pkg/usr/bin MANDIR=$startdir/pkg/usr/man/man1 TARGET=ledit.opt install
}

ledit-1.11-mf.diff
This patches the Makefile to build a native executable and install under /usr.

--- ledit-1.11/Makefile.orig    2004-12-06 13:29:21.000000000 -0700
+++ ledit-1.11/Makefile    2004-12-06 13:37:34.000000000 -0700
@@ -10,7 +10,7 @@
 TARGET=ledit.out
 MKDIR=mkdir -p
 
-all: pa_local.cmo $(TARGET) ledit.l
+all: pa_local.cmo $(TARGET) ledit.1
 
 $(TARGET): $(ZOFILES)
     $(COMP) -custom unix.cma $(ZOFILES) -o $(TARGET)
@@ -18,9 +18,9 @@
 $(TARGET:.out=.opt): $(ZOFILES:.cmo=.cmx)
     $(COMPOPT) unix.cmxa $(ZOFILES:.cmo=.cmx) -o $(TARGET:.out=.opt)
 
-ledit.l: ledit.l.tpl go.ml
+ledit.1: ledit.l.tpl go.ml
     VERSION=`sed -n -e 's/^.* version = "(.*)".*$$/1/p' go.ml`; 
-    sed s/LEDIT_VERSION/$$VERSION/ ledit.l.tpl > ledit.l
+    sed s/LEDIT_VERSION/$$VERSION/ ledit.l.tpl > ledit.1
 
 pa_local.cmo: pa_local.ml
     $(PP) pa_extend.cmo q_MLast.cmo pa_local.ml -o pa_local.ppo
@@ -28,12 +28,12 @@
     /bin/rm -f pa_local.ppo
 
 clean:
-    /bin/rm -f *.cm[oix] *.pp[oi] *.o *.bak $(TARGET) ledit.l
+    /bin/rm -f *.cm[oix] *.pp[oi] *.o *.bak $(TARGET) ledit.1
 
 install:
     -$(MKDIR) $(BINDIR) $(MANDIR)
-    -cp ledit.out $(BINDIR)/ledit
-    -cp ledit.l $(MANDIR)/ledit.l
+    -cp $(TARGET) $(BINDIR)/ledit
+    -cp ledit.1 $(MANDIR)/ledit.1
 
 depend:
     > .depend.new

Matt Gushee
Englewood, CO, USA

Offline

#5 2004-12-07 00:35:13

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Re: Objective Caml packages

Findlib is a widely-used package manager/build tool for OCaml. If you are serious about OCaml development, you will probably want this.

PKGBUILD:

pkgname=ocaml-findlib
pkgver=1.0.4
pkgrel=1
pkgdesc="Findlib is a package manager and build tool for OCaml."
url="http://www.ocaml-programming.de/programming/findlib.html"
license=""
depends=('ocaml')
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=('http://www.ocaml-programming.de/packages/findlib-1.0.4.tar.gz' 'findlib.conf.arch')
md5sums=('dbfabe1b3677a03bcf238ecccb36d84f' '964c7444ea6b4257f54bd779da3ea88f')

build() {
  cd $startdir/src/findlib-$pkgver
  ./configure
  cp ../findlib.conf.arch findlib.conf 
  make all || return 1
  make opt || return 1
  make prefix=$startdir/pkg install
}

findlib.conf.arch
This sets up the paths for findlib so that user-installed packages (i.e. non-Arch packages) will go under /usr/local.

destdir="/usr/local/lib/ocaml/site-lib"
path="/usr/local/lib/ocaml/site-lib:/usr/lib/ocaml/site-lib"

Matt Gushee
Englewood, CO, USA

Offline

#6 2004-12-07 00:44:19

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Re: Objective Caml packages

LablGTK2 is the OCaml interface to GTK2. A couple of quick notes about this package:


· I see that someone has already submitted a LablGTK package. However, that one is for GTK 1.x, where as this one supports GTK 2.x.
· I was unable to build this package with OpenGL support. It would require the gtkglarea library, but there is no up-to-date Arch package for gkt2-glarea, and the upstream maintainer seems to have vanished. I will research this further, but for now there is no OpenGL. All the other optional features are enabled.


PKGBUILD:

pkgname=ocaml-lablgtk2
pkgver=2.4.0
pkgrel=1
pkgdesc="LablGTK2 is an OCaml interface to the GTK2 GUI toolkit."
url="http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html"
license=""
depends=('ocaml' 'gtk2' 'libglade' 'libgnomeui' 'libgnomecanvas' 'gnome-panel')
makedepends=()
conflicts=()
replaces=()
backup=()
install=
source=('http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/dist/lablgtk-2.4.0.tar.gz')
md5sums=('faa7b28c3ad97a1a76d983d24f26f567')

build() {
  cd $startdir/src/lablgtk-$pkgver
  ./configure
  make all || return 1
  make opt || return 1
  make DESTDIR=$startdir/pkg install
}

Matt Gushee
Englewood, CO, USA

Offline

#7 2005-01-07 04:56:00

luisfelipe
Member
Registered: 2004-05-06
Posts: 96

Re: Objective Caml packages

I'm having problems with the diff you provided for the ledit package.
Could you please put the file somewhere so I can download it ?

I tried to copy and paste it, but it screws up the file.

Offline

#8 2005-01-08 00:03:22

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Re: Objective Caml packages

Okay. I was trying to avoid doing this, because I'm getting ready to overhaul my Web site, and haven't completely figured out the new structure yet. But here's a download page for you:

  http://matt.gushee.net/software/


Matt Gushee
Englewood, CO, USA

Offline

#9 2005-01-14 17:59:35

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Re: Objective Caml packages

tracer wrote:

I'm glad to see some ocaml packages.  I'm planning on developing some that install findlib based packages.  Any ideas on the best way to handle this?  Maybe doing something like

dir=`ocamlfind printconf destdir`
ocamlfind install -destdir $startdir/pkg$dir .....

Ah, good point. I was thinking that findlib automatically selects the installation directory--
but of course you need a directory in the build tree for making an Arch package. At first glance, your solution looks good. I'll try it out.

tracer wrote:

I see that the findlib package sets the destination directory to /usr/local/lib/ocaml/site-lib.  When I tried to do ocamlfind install I get an error that the directory doesn't exist.

I agree that this is problematic. My rationale for doing it the way I did was that:


· User-installed packages (i.e. non-Arch Linux packages) should always be under /usr/local (or some other tree not managed by pacman). This would apply, of course, to anything that the user installs directly with ocamlfind.

· The distribution should never touch the trees where the user installs non-distribution packages.


Thus I built the findlib package so as to enable (a) without creating a necessary directory (I think in politics this would be called an "unfunded mandate" ;-)). I agree this is inconvenient, maybe even annoying, but I would still like to honor principle (b) if possible, so I am reluctant to use your solution. Here are some other possibilities:


· Leave the install paths alone (i.e., findlib packages will be installed by default under /usr/lib/ocaml/site-lib); leave it to the user to set up /usr/local/lib/... if they want to. It's really not hard to do, and I'm sure anybody who can handle Arch Linux can handle this.

· Set up /usr/local/lib/ocaml/site-lib as the default package directory; don't create it, but at installation time output a message warning the user that they should create it ... hmm, now that I write that down it seems kinda bogus, doesn't it?


I'd be interested to hear other opinions on this.

Thanks for the suggestions.


Matt Gushee
Englewood, CO, USA

Offline

#10 2005-01-31 19:26:36

mgushee
Member
From: Englewood, CO, USA
Registered: 2004-11-28
Posts: 59
Website

Re: Objective Caml packages

Okay, Findlib is fixed! It no longer alters the paths, so by default Findlib packages will be installed  under /usr/lib/ocaml/site-lib. However, there is now a post-install message suggesting that users set up a separate package directory if they wish to install their own Findlib packages.

I have also created an Arch package of a Findlib package. I agree with tracer that ExtLib would be a good choice; however, since I haven't gotten around to using ExtLib myself, I'll leave it for later or for someone else. Instead, I packaged GD4O (an interface to the GD graphics library), since I maintain the OCaml code. It's probably a good thing I did, because I ran into an unexpected twist:

If an OCaml package includes a C shared library, the path to the package needs to be entered in the OCaml shared library config file (e.g. /usr/lib/ocaml/ld.conf -- similar to /etc/ld.so.conf). Normally, Findlib handles this automatically when you install the package. But since we're building Arch packages, Findlib needs to install to the package build directory, so we don't know the correct path at build time. Thus, when you Archify a Findlib package that includes C shared libraries, you need to do the following:

· Run ocamlfind install with the option -ldconf ignore.
· Provide a post_install function that adds the package's runtime path to the OCaml shared-lib config file.
· Provide a pre_remove function that removes the path from the shared lib config.


For a working example, note the Makefile patch and the install script I have created for ocaml-gd4o. My PKGBUILDs and related files can be found at http://matt.gushee.net/software/


Matt Gushee
Englewood, CO, USA

Offline

Board footer

Powered by FluxBB