From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 2D573BC37 for ; Sat, 28 Nov 2009 19:59:16 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlACAP4BEUtV2gB4h2dsb2JhbACER5RngmMBAQEKCwgHFYhCnkuPY4Evgi5UBIkT X-IronPort-AV: E=Sophos;i="4.47,306,1257116400"; d="scan'208";a="41007581" Received: from emailfrontal1.citycable.ch ([85.218.0.120]) by mail1-smtp-roc.national.inria.fr with SMTP; 28 Nov 2009 19:59:15 +0100 Received: from [192.168.0.12] (unknown [85.218.92.99]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal1.citycable.ch (Postfix) with ESMTPA id C382F12C101; Sat, 28 Nov 2009 19:59:14 +0100 (CET) Message-ID: <4B117309.5090703@citycable.ch> Date: Sat, 28 Nov 2009 19:59:21 +0100 From: Guillaume Yziquel Reply-To: guillaume.yziquel@citycable.ch User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707) MIME-Version: 1.0 To: Sylvain Le Gall Cc: caml-list@inria.fr Subject: Re: [Caml-list] Re: Simple ocamlbuild example for C stubs? References: <4B114C99.9000501@citycable.ch> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; guillaume:01 guillaume:01 stubs:01 stubs:01 non-standard:01 wiki:01 ocamlfind:01 makefiles:01 stub:01 usr:01 usr:01 lib:01 lib:01 makefiles:01 makefile:01 Sylvain Le Gall a =C3=A9crit : > On 28-11-2009, Guillaume Yziquel wrote= : >> Hello. >> >> I'm trying to build a .cma with C stubs with ocamlbuild. Linking and=20 >> includes are supposed to be set to non-standard directories. >> >=20 > You probably need to add some 'A"-ccopt"; A"your-option"' to the good > tag.=20 >=20 > Can you give more details/actual layout of your myocamlbuild.ml ? OK. Yes, I could meddle with my myocamlbuild.ml file. My myocamlbuild.ml=20 file is the same as the one on the wiki: http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild But I mean, if I'm supposed to write a myocamlbuild.ml for every project=20 I make, I might as well use Makefiles, as below. I was wondering if there was a myocamlbuild.ml that would solve the C=20 stub problem and bottleneck. For instance, being able to _tag in the=20 tags file for a given .c file the directories in which to look for=20 headers (here /usr/share/R/include), and for .o files, all linking=20 information (here, /usr/lib/R/lib/libR.so). The ideal would be to have all that available only from _tags. Because if you need to write a myocamlbuild.ml for each and every=20 project, you might as well write Makefiles... That's the point of a=20 generic plugin. > yziquel@seldon:~/git/ocaml-r$ cat Makefile=20 > RLIBDIR=3D/usr/lib/R/lib > RINCLUDES=3D-I . -I /usr/share/R/include > INCLUDES=3D -I +ocamldoc -I `ocamlc -where`/caml $(RINCLUDES) >=20 > COMPFLAGS=3D$(INCLUDES) > LINKFLAGS=3D$(INCLUDES) -ccopt -L$(RLIBDIR) -cclib -lR > LINKFLAGS_BYTE=3D$(INCLUDES) -ccopt -L$(RLIBDIR) -cclib -lR >=20 > all: build >=20 > #build: r.cma r.cmxa oCamlR.cma oCamlR.cmxa > build: r.cma r.cmxa >=20 > r.cma: dllr_stubs.so camlobjs > ocamlc -a -dllpath /usr/lib/R/lib -dllib dllr_stubs.so -dllib libR.so = -o r.cma r.cmo >=20 > r.cmxa: dllr_stubs.so camlobjs > ocamlopt -a -ccopt -L/usr/lib/R/lib -cclib -lr_stubs -cclib -lR -o r.c= mxa r.cmx >=20 > oCamlR.cma: camlobjs > ocamlc -a -o oCamlR.cma oCamlR.cmo >=20 > oCamlR.cmxa: camlobjs > ocamlopt -a -o oCamlR.cmxa oCamlR.cmx >=20 > camlobjs: standard.ml > # ocamlbuild -classic-display r.cmo r.cmx oCamlR.cmo oCamlR.cmx > ocamlbuild -classic-display r.cmo r.cmx > cp _build/r.cmi . > cp _build/r.cmo . > cp _build/r.cmx . > cp _build/r.o . > # cp _build/oCamlR.cmi . > # cp _build/oCamlR.cmo . > # cp _build/oCamlR.cmx . >=20 > standard.ml: r/standard.R > R --silent --vanilla --slave < r/standard.R > r/standard.ml >=20 > r_stubs.o: r_stubs.c > ocamlopt -ccopt -Wall $(COMPFLAGS) -ccopt -fPIC -c $< >=20 > libr_stubs.a: r_stubs.o > ar rcs libr_stubs.a r_stubs.o >=20 > dllr_stubs.so: libr_stubs.a r_stubs.o > ocamlmklib -o r_stubs r_stubs.o >=20 > clean: > rm -f r/tandard.ml > rm -f *.o *.so *.a *.cmi *.cmo *.cmx *.cma *.cmxa > ocamlbuild -clean >=20 > test: build > ocaml -init ocamlinit >=20 > install: > cp META *.a *.cm[ai] *.cmxa /usr/lib/ocaml/R/ > cp dllr_stubs.so /usr/lib/ocaml/stublibs/ All the best, --=20 Guillaume Yziquel http://yziquel.homelinux.org/