caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mads Hartmann Jensen <mhj@issuu.com>
To: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Creating an OPAM package that wraps c functions that can be used in a non-custom utop
Date: Wed, 26 Feb 2014 22:49:57 +0100	[thread overview]
Message-ID: <E67A9E51-8D51-4369-9E57-4E826492569E@gmail.com> (raw)
In-Reply-To: <1BFC6E68C5814BADBDE735FACE53E815@erratique.ch>

Hi Daniel and Christophe,

Thanks for your help so far. I think I've gotten further but I'm not 
quite there yet. I've followed the instructions that were outlined in 
the ocaml-ctypes issue and I've also created a META and .install file.

I think what I'm missing is the actual ocamlbuild and other tool 
invocations that I need to run in order to build and move the code into 
my opam repository. I'm able to build my .cma file but I'm not sure how 
all of these things (the .install and META file) play together.

So if we forget about creating an OPAM package for now and focus on 
installing the library locally so I can use it in an ocaml toplevel 
using #use topfind followed by #require "tgeoip" what commands would I 
need to invoke?

I tried running `ocamlfind install tgeoip META` to install the package 
but that just copied the meta file to 
/Users/hartmann/.opam/issuu/lib/tgeoip/META.

I've placed the code on Github for now 
https://github.com/mads379/ocaml-geoip [1] so it's easier to discuss.

Cheers,
Mads Hartmann

[1] At the moment the actual code is very specific to what we use it for 
here at ISSUU so it makes little sense to open-source it but the 
longterm goal is to provide a more general wrapper of the geoip library 
using ctypes - but for now we just want to move our existing code into a 
separate opam package :)

On 21 Feb 2014, at 12:11, Daniel Bünzli wrote:

> Le vendredi, 21 février 2014 à 11:46, mads379@gmail.com a écrit :
>> The next thing I want to do is create an OPAM package for it that my 
>> co-
>> workers and I can use. My question is, will I be able to create the 
>> package in
>> such a way that the library can be loaded into utop using topfind so 
>> we don't
>> have to build a custom top-level in the projects that use this 
>> library?
>
> Yes.
>
>> If it is possible, do you have any pointers to where I might find 
>> some
>> information about how to do it?
>
> First for generating the correct artefacts with ocamlbuild you can 
> refer to these instructions:
>
>  
> https://github.com/ocamllabs/ocaml-ctypes/issues/51#issuecomment-30729675
>
> It uses ctypes so the stub C files is empty but ignore that, it also 
> uses pkg-config for getting the cflags but you should be able to read 
> through and simplify the myocamlbuild.ml if you don't need that.
>
> For the opam package use or generate a .install file at the toplevel 
> of your distribution that will more or less look like this [1].
>
> Feel free to ask further questions if you need to.
>
> Best,
>
> Daniel
>
> [1]
> lib: [
> "_build/META" {"META"}
> "_build/geolocalisation.mli" {"geolocalisation.mli"}
> "?_build/geolocalisation.cmti" {"geolocalisation.cmti"}
> "_build/geolocalisation.cmi" {"geolocalisation.cmi"}
> "_build/geolocalisation.cmx" {"geolocalisation.cmx"}
> "_build/geolocalisation.cma" {"geolocalisation.cma"}
> "_build/geolocalisation.a" {"geolocalisation.a"}
> "_build/geolocalisation.cmxa" {"geolocalisation.cmxa"}
> "_build/geolocalisation.cmxs" {"geolocalisation.cmxs"}
> ]
> stublibs: [
> "_build/dllgeolocalisation.so" {"dllgeolocalisation.so"}
> ]

  reply	other threads:[~2014-02-26 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21 10:46 mads379
2014-02-21 11:11 ` Daniel Bünzli
2014-02-26 21:49   ` Mads Hartmann Jensen [this message]
2014-02-26 22:33     ` Daniel Bünzli
2014-02-26 22:50     ` Daniel Bünzli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E67A9E51-8D51-4369-9E57-4E826492569E@gmail.com \
    --to=mhj@issuu.com \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).