From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 3E0627F84F for ; Wed, 26 Feb 2014 22:50:02 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of mhj@issuu.com) identity=pra; client-ip=209.85.215.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mhj@issuu.com"; x-sender="mhj@issuu.com"; x-conformance=sidf_compatible Received-SPF: Neutral (mail2-smtp-roc.national.inria.fr: domain of mhj@issuu.com does not assert whether or not 209.85.215.45 is permitted sender) identity=mailfrom; client-ip=209.85.215.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mhj@issuu.com"; x-sender="mhj@issuu.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-la0-f45.google.com) identity=helo; client-ip=209.85.215.45; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="mhj@issuu.com"; x-sender="postmaster@mail-la0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuABAFRgDlPRVdctlGdsb2JhbABag0GDWr14gR0WDgEBAQEHCwsJEiqCJwEBBAEjDwEFQQULCwsPAh8HAgIhEwEFARwGE4dlAwkIBAEInG+MDJkeDYczF4EpixWCFgeCbjWBFASUSwEFgXiBbYEyhReGGINaQYMbgT8 X-IPAS-Result: AuABAFRgDlPRVdctlGdsb2JhbABag0GDWr14gR0WDgEBAQEHCwsJEiqCJwEBBAEjDwEFQQULCwsPAh8HAgIhEwEFARwGE4dlAwkIBAEInG+MDJkeDYczF4EpixWCFgeCbjWBFASUSwEFgXiBbYEyhReGGINaQYMbgT8 X-IronPort-AV: E=Sophos;i="4.97,550,1389740400"; d="scan'208";a="60488694" Received: from mail-la0-f45.google.com ([209.85.215.45]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 26 Feb 2014 22:50:01 +0100 Received: by mail-la0-f45.google.com with SMTP id hr17so1093382lab.32 for ; Wed, 26 Feb 2014 13:50:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=7yonb/6PJOskjbB+aWHwdaBFEXdzlwcm55R3QF4wPwI=; b=g/woOc8mgeqklS/fZ4hz43ixjTiyTpCA2I7ZeD4HhKc80i0aUbVCQfBjkePp4oXofw byFy31Ujo2zNccNa8cafXlNdmkcmZz7Pg11Yld5LTOKB0IG63W0g/RQXR0UdrLDPqe/J PS3mMaZjiKVLSS3q/h1olBotAAY0HuLR8MDVJbrxlSQRKTDSDP+NAKnV5ERsG131A2hw FbByndU7/5GC6lJphdzyiC5CGc1+CHOV8Ze9u73egxyjzYvLhaGxC++ftm28+F6Cvs6X 5dBlu0sHK1gYbdMQiv/+RyE/w3Xd8FagZXhkFiFdPuDuibnxy44wPpE+m+Y2BP/AA3Zt ymDQ== X-Gm-Message-State: ALoCoQn9BL1BFqVv8xcfKst4042+UFrDIqQfsXuVwHzI/+Etgd/dKzCOf8+/P7S/RND6bMZBegKb X-Received: by 10.152.6.132 with SMTP id b4mr17548laa.64.1393451400418; Wed, 26 Feb 2014 13:50:00 -0800 (PST) Received: from [10.0.0.6] (port483.ds1-vbr.adsl.cybercity.dk. [217.157.134.50]) by mx.google.com with ESMTPSA id pz10sm2865308lbb.10.2014.02.26.13.49.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 26 Feb 2014 13:49:59 -0800 (PST) From: Mads Hartmann Jensen To: "Daniel =?utf-8?q?B=C3=BCnzli?=" Cc: caml-list@inria.fr Date: Wed, 26 Feb 2014 22:49:57 +0100 Message-ID: In-Reply-To: <1BFC6E68C5814BADBDE735FACE53E815@erratique.ch> References: <1BFC6E68C5814BADBDE735FACE53E815@erratique.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate Trial (1.7.2r3905) X-Validation-by: mhj@issuu.com Subject: Re: [Caml-list] Creating an OPAM package that wraps c functions that can be used in a non-custom utop 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"} > ]