caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Whitington <john@coherentgraphics.co.uk>
To: Anthony Tavener <anthony.tavener@gmail.com>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Library installation procedure (for use with OPAM)?
Date: Mon, 09 Dec 2013 11:13:10 +0000	[thread overview]
Message-ID: <52A5A5C6.6060503@coherentgraphics.co.uk> (raw)
In-Reply-To: <CAN=ouMTAy5naYKR3aNSqT_k1q5vpN=Mxf-VDrSed2bpjeO2DuQ@mail.gmail.com>

Hi Anthony,

Anthony Tavener wrote:
> For local libraries, my "make install" amounts to copying the relevant
> files into the system OCaml directory (ie. /usr/local/lib64/ocaml).
> Terrible, I know.
>
> Now I'm switching to using OPAM for general use, and packaging up local
> libraries so that OPAM can be aware of them and install them in its
> managed environment. But I figure OPAM will be expecting a more sane,
> environment-sensitive install... right? Otherwise it must do some voodoo.
>
> Is there a simple example of an appropriate install process suitable for
> use with OPAM? I've tried looking at a few existing packages and the
> build+install process, as usual, is convoluted... not as obscure as
> autotools, but different for each project. Is findlib still applicable?
> Or some other means to query the system install directory?

OCamlMakefile knows how to use ocamlfind for installation. I assume the 
other popular build systems do too.

For example, here's the makefile for "cpdf", providing "make" and "make 
install" targets. The "PACKS" line tells OCamlMakefile which ocamlfind 
packages to depend on. "install : libinstall" tells it to install things 
as an ocamlfind package.


# Build the cpdf command line tools and top level
MODS = cpdfstrftime cpdf cpdfcommand

SOURCES = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml

RESULT = cpdf
ANNOTATE = true
PACKS = camlpdf

OCAMLNCFLAGS = -g
OCAMLBCFLAGS = -g
OCAMLLDFLAGS = -g

all : native-code native-code-library byte-code-library top htdoc

LIBINSTALL_FILES = cpdf.a cpdf.cma cpdf.cmxa \
$(foreach x,$(MODS),$x.mli) $(foreach x,$(MODS),$x.cmi)

install : libinstall

-include OCamlMakefile


The 'opam' file is then easy:


opam-version: "1"
maintainer: "contact@coherentgraphics.co.uk"
build: [
   [make]
   [make "install"]
]
remove: [["ocamlfind" "remove" "cpdf"]]
depends: [
   "ocamlfind"
   "camlpdf"
]

-- 
John Whitington

  parent reply	other threads:[~2013-12-09 11:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-08 20:55 Anthony Tavener
2013-12-09  9:23 ` Stéphane Glondu
2013-12-09 11:13 ` John Whitington [this message]
2013-12-09 15:04 ` Daniel Bünzli
2013-12-09 15:23   ` Sebastien Mondet
2013-12-09 15:57     ` Daniel Bünzli
2013-12-09 16:39       ` Sebastien Mondet
2013-12-09 17:37         ` Daniel Bünzli
2013-12-09 19:41           ` Stéphane Glondu
2013-12-09 20:04             ` Daniel Bünzli
2013-12-09 20:22               ` Stéphane Glondu
2013-12-09 21:04                 ` Daniel Bünzli
2013-12-09 21:36                   ` Anthony Tavener
2013-12-10  1:12                     ` Francois Berenger
2013-12-10 14:50       ` Daniel Bünzli
2013-12-10 16:49         ` [Caml-list] [ANN] opam-installer (beta) (was Re: Library installation procedure (for use with OPAM)?) Louis Gesbert

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=52A5A5C6.6060503@coherentgraphics.co.uk \
    --to=john@coherentgraphics.co.uk \
    --cc=anthony.tavener@gmail.com \
    --cc=caml-list@inria.fr \
    /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).