[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Getting mod_caml and perl4caml into Debian



On Sat, Nov 01, 2003 at 04:55:17PM +0000, Richard Jones wrote:
> On Sat, Nov 01, 2003 at 04:12:54PM +0100, Sven Luther wrote:
> > Could you make the whole tarball available somewhere ? you run
> > dpkg-buildpackage -S, and give the url to the directory containing the 3
> > resulting files, and i will try building it here, and tell you what you
> > did wrong. Or else you could post the log of the build attempt or
> > something, but making the source package available is the better idea.
> 
> OK I put the source packages here:
> 
> http://annexia.org/tmp/modcaml-src/modcaml_1.0.0-1.dsc
> http://annexia.org/tmp/modcaml-src/modcaml_1.0.0-1.tar.gz
> http://annexia.org/tmp/modcaml-src/modcaml_1.0.0-1_source.changes

Ok, the first remark is, since modcaml is not a native debian package
(that is one which is developed only for debian especially), it is best
to have the debian stuff in a separate .diff.gz file, even if you
maintain the debian directory in the same CVS as your upstream tarball.
Also it is best not to ship the debian directory in your released
tarballs.

Second, you must be missing all the build dependencies, in particular
one on the pcre stuff :

ocamlc -g -w s -I +pcre -c cgi.ml
File "cgi.ml", line 268, characters 19-30:
Unbound value Pcre.regexp

So add libpcre-ocaml-dev in the build-depends: entry of the
debian/control file. Later we will run modcaml trough pbuilder to catch
all the other missing build dependencies.

Next error i get is :

mod_caml.c:11788: attention : implicit declaration of function
`caml_startup_code'
apxs -c -Wc,-g -Wc,-Wall -Wc,-Wno-unused -I/usr/lib/ocaml/3.07 -o
mod_caml.so mod_caml_c.c mod_caml.o apache_c.c wrappers.c
-L/usr/lib/ocaml/3.07 -lstr -lunix -L/usr/lib/ocaml/3.07/pcre -lpcre
-lpcre_stubs -lcamlrun -ltermcap -ldl
make[1]: apxs : commande introuvable

which is given by :

$ apt-cache search apxs
apache-dev - Apache webserver development kit

But there is also apache2-dev, so i am a bit at a loss on which one to
use. I will use apache2-dev and see if it is enough, since i have
apache2 running on my box.

Mmm, not cool :

$ sudo apt-get install apache2-dev
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Les paquets supplémentaires suivants seront installés : 
  libapr0-dev libdb4.1-dev
Les paquets suivants seront ENLEVÉS :
  libcamlimages-ocaml-dev libdb3-dev libgdk-pixbuf-gnome-dev
  libglade-gnome0-dev libgnome-dev libgnomeprint-dev
liblablgtk-ocaml-dev
Les NOUVEAUX paquets suivants seront installés :
  apache2-dev libapr0-dev libdb4.1-dev

Same goes for apache-dev. I wonder if it was not an error to keep
lablgtk1, and not make lablgtk2 the default, in any case, it seems we
also need a camlimages2.

Mmm, apache2-dev has apxs2, so you would need to add both build-depends
if, as i understand, you want to support both apache versions.

Ok, that now builds libapache-ocaml_1.0.0-1_i386.deb and
libapache-ocaml-dev_1.0.0-1_i386.deb, but i guess this is not exactly
what you liked to do since you tell me it doesn't quite work. I try to
install it and get :

$ sudo dpkg -i *deb
(Lecture de la base de données... 184911 fichiers et répertoires déjà
installés.)
Préparation du remplacement de libapache-ocaml 1.0.0-1 (en utilisant
libapache-ocaml_1.0.0-1_i386.deb) ...
Dépaquetage de la mise à jour de libapache-ocaml ...
Préparation du remplacement de libapache-ocaml-dev 1.0.0-1 (en utilisant
libapache-ocaml-dev_1.0.0-1_i386.deb) ...
Dépaquetage de la mise à jour de libapache-ocaml-dev ...
Paramétrage de libapache-ocaml (1.0.0-1) ...
dpkg : des problèmes de dépendances empêchent la configuration de
libapache-ocaml-dev :
 libapache-ocaml-dev dépend de modcaml (= 1.0.0-1) ; cependant :
  Paquet modcaml n'est pas installé.
dpkg : erreur de traitement de libapache-ocaml-dev (--install) :
 problèmes de dépendances - laissé non configuré
Des erreurs ont été rencontrées pendant l'exécution :
 libapache-ocaml-dev

Looking at the log, it seems you use only apxs and not apxs2, but then i
am not really familiar with apache, and don't know which of them you
want to use.

Mmm, now, where is modcaml, let's look at debian/control ... Ok, you
have one dependency wrong, this is probably :

Package: libapache-ocaml-dev
Depends: libapache-ocaml (= ${Source-Version})

Furthermore, your sections need revisiting, but we can do that later on.
I am not sure if they have to go in libdevel or net.

BTW, you also have a warning you may want to look into :

mod_caml.c: Dans la fonction « caml_startup »:
mod_caml.c:11788: attention : implicit declaration of function `caml_startup_code'

Ok, the packages build, and install. Let's look at their content :

$ dpkg -c libapache-ocaml_1.0.0-1_i386.deb 
drwxr-xr-x root/root         0 2003-11-01 18:21:15 ./
drwxr-xr-x root/root         0 2003-11-01 18:21:13 ./usr/
drwxr-xr-x root/root         0 2003-11-01 18:21:13 ./usr/share/
drwxr-xr-x root/root         0 2003-11-01 18:21:13 ./usr/share/doc/
drwxr-xr-x root/root         0 2003-11-01 18:21:14 ./usr/share/doc/libapache-ocaml/
-rw-r--r-- root/root       921 2003-11-01 16:11:25 ./usr/share/doc/libapache-ocaml/copyright
-rw-r--r-- root/root       160 2003-11-01 13:43:32 ./usr/share/doc/libapache-ocaml/changelog.Debian.gz
l$ dpkg -c libapache-ocaml-dev_1.0.0-1_i386.deb 
drwxr-xr-x root/root         0 2003-11-01 18:21:15 ./
drwxr-xr-x root/root         0 2003-11-01 18:21:13 ./usr/
drwxr-xr-x root/root         0 2003-11-01 18:21:13 ./usr/share/
drwxr-xr-x root/root         0 2003-11-01 18:21:13 ./usr/share/doc/
drwxr-xr-x root/root         0 2003-11-01 18:21:14 ./usr/share/doc/libapache-ocaml-dev/
-rw-r--r-- root/root       477 2003-10-26 11:07:23 ./usr/share/doc/libapache-ocaml-dev/AUTHORS
-rw-r--r-- root/root       265 2003-10-06 11:25:05 ./usr/share/doc/libapache-ocaml-dev/FAQ
-rw-r--r-- root/root        64 2003-11-01 18:21:07 ./usr/share/doc/libapache-ocaml-dev/META
-rw-r--r-- root/root      1255 2003-10-26 14:08:36 ./usr/share/doc/libapache-ocaml-dev/README
-rw-r--r-- root/root        91 2003-10-26 14:06:05 ./usr/share/doc/libapache-ocaml-dev/TODO
-rw-r--r-- root/root       921 2003-11-01 16:11:25 ./usr/share/doc/libapache-ocaml-dev/copyright
-rw-r--r-- root/root       160 2003-11-01 13:43:32 ./usr/share/doc/libapache-ocaml-dev/changelog.Debian.gz

Mmm, both packages are empty.

Ok. let's have a look at the camlzip example on how to do the package.
You download the source with apt-get source camlzip. you go into the
debian directory, and you will find : 

$ ls 
changelog  copyright              libzip-ocaml-dev.docs libzip-ocaml.docs   Makefile.test.Debian  rules
control    libzip-ocaml-dev.dirs  libzip-ocaml.dirs	libzip-ocaml.files  META

Notice how there is a .docs and .dirs file for every package, but also
the interesting tidbit are the libzip-ocaml.files file :

$ cat libzip-ocaml.files
usr/lib/ocaml/3.07/stublibs/dllcamlzip.so

You see, it contains the list of files going in the runtime package,
here the dll.so only. But let's look at the rules file now :

First stop the configure target, camlzip has nothing to configure. It
seems that modcaml has also not, but you may want to keep a
debian-configured copy of Makefile.config in the debian directory and
copy it over here.

Next comes the build target, here you just do a plain make, which works
ok on x86, but may break on not native compiler supporting arches, which
is why we use :

        # Add here commands to compile the package.
        $(MAKE)
        if [ -x /usr/bin/ocamlopt ]; then \
                $(MAKE) allopt; \
        fi

And the toplevel makefile needs support for separating the native code
build from the bytecode one.

And finally the install target, where it is not going well for you. You
simply do : 

	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

While something more advanced is needed :

	# Add here commands to install the package into
        # debian/libzip-ocaml-dev
        $(MAKE) install DESTDIR=$(CURDIR)/debian/libzip-ocaml-dev
        if [ -x /usr/bin/ocamlopt ]; then \
                $(MAKE) installopt DESTDIR=$(CURDIR)/debian/libzip-ocaml-dev; \
        fi
        cp debian/META $(CURDIR)/debian/libzip-ocaml-dev/usr/lib/ocaml/$(OCAML_VERSION)/zip

        # And now move the libzip-ocaml files into their own package.
        dh_movefiles -plibzip-ocaml --sourcedir=debian/libzip-ocaml-dev

See how we install in debian/libzip-ocaml-dev, and also install the
nativecode stuff if supported. And finally see how we move the files in
the runtime package thanks to dh_movefiles which uses the
libzip-ocaml.files we spoke about earlier.

Once you have fixed all that, you should have a nice package with all
the needed stuff included. Now, i don't know anything about modcaml, but
as i understand it, there may be some things related to apache or such,
no ?

Ok, end of the first debian/ocaml packaging lesson :)))

Friendly,

Sven Luther



Reply to: