From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTP id 058B21E5 for ; Thu, 15 Aug 2019 08:25:43 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.64,388,1559512800"; d="asc'?scan'208";a="395470484" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 15 Aug 2019 10:25:43 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 4532D7EF18; Thu, 15 Aug 2019 10:25:43 +0200 (CEST) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id B1F957EF07 for ; Thu, 15 Aug 2019 10:25:33 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=mmatalka@gmail.com; spf=Pass smtp.mailfrom=mmatalka@gmail.com; spf=None smtp.helo=postmaster@mail-lj1-f195.google.com IronPort-PHdr: =?us-ascii?q?9a23=3AYl3r8BLSdwnYDdmkmNmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgeK/zxwZ3uMQTl6Ol3ixeRBMOHsqgC0rGP+Pi5EUU7or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRp?= =?us-ascii?q?OOv1BpTSj8Oq3Oyu5pHfeQpFiCejbb9oMRm7oxjdusYKjYd/N6081gbHrnxUdu?= =?us-ascii?q?pM2GhmP0iTnxHy5sex+J5s7SFdsO8/+sBDTKv3Yb02QaRXAzo6PW814tbrtQTY?= =?us-ascii?q?QguU+nQcSGQWnQFWDAXD8Rr3Q43+sir+tup6xSmaIcj7Rq06VDi+86tmTgLjhS?= =?us-ascii?q?EaPDA77W7XkNR9jKxVrxyhuRJx3ozbbo+WOvVxYqzQZt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ii?q?Tw=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DUEgCLFVVdWMPQVdFlHAEBAQQBAQcEA?= =?us-ascii?q?QGBZwKBZy8mR1JcjRuIIAKJYX6QKwkBAwEHAwEBIwoCAQGBS4J0AoMRGwcBBDQ?= =?us-ascii?q?TAgQBAQQBAQEEAQMDBAEGARcMCgYphTAMQgEQAYFmIoJvAQQBJxkBGxANAQMBC?= =?us-ascii?q?wYFCxYlDwETEQEFAQgUGRkCgwiBaQEDDg8EC54uPIwiFgUBF4J7BYEzAYEUgXc?= =?us-ascii?q?KGScNXwOBNgcCBwkBCIEiAYFQgyOFWIEdF4FAP4ERghR+PoJWCwOHQwSMKEGHW?= =?us-ascii?q?JcMCT6BYYIhhEOJBIRLG4IwLz6KIDmKSJNtgUmNL1uCGwIKBwYPIYFGgXkzGgg?= =?us-ascii?q?bFTsxgjsJCYIwg3KKVT0zAYECJhOCEotbAQE?= X-IPAS-Result: =?us-ascii?q?A0DUEgCLFVVdWMPQVdFlHAEBAQQBAQcEAQGBZwKBZy8mR1J?= =?us-ascii?q?cjRuIIAKJYX6QKwkBAwEHAwEBIwoCAQGBS4J0AoMRGwcBBDQTAgQBAQQBAQEEA?= =?us-ascii?q?QMDBAEGARcMCgYphTAMQgEQAYFmIoJvAQQBJxkBGxANAQMBCwYFCxYlDwETEQE?= =?us-ascii?q?FAQgUGRkCgwiBaQEDDg8EC54uPIwiFgUBF4J7BYEzAYEUgXcKGScNXwOBNgcCB?= =?us-ascii?q?wkBCIEiAYFQgyOFWIEdF4FAP4ERghR+PoJWCwOHQwSMKEGHWJcMCT6BYYIhhEO?= =?us-ascii?q?JBIRLG4IwLz6KIDmKSJNtgUmNL1uCGwIKBwYPIYFGgXkzGggbFTsxgjsJCYIwg?= =?us-ascii?q?3KKVT0zAYECJhOCEotbAQE?= X-IronPort-AV: E=Sophos;i="5.64,388,1559512800"; d="asc'?scan'208";a="316429433" X-MGA-submission: =?us-ascii?q?MDF2xoR3iNUV5mdnxwpJXCbhICvL9FsgYmWMr9?= =?us-ascii?q?YAvX23bdJPMczLg0x1Ih2RMTDRbcIZyIGOj1iB88VnrEv4vifm2XWZ9b?= =?us-ascii?q?zJS6ZDWKdgKbZRRe+cOFDO3N1G6xi6qzoqfw/6Z/8tw4OzB8jXSlqWPH?= =?us-ascii?q?44LqjHrosSbIlfM5FsM3ZQ/g=3D=3D?= Received: from mail-lj1-f195.google.com ([209.85.208.195]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 15 Aug 2019 10:25:32 +0200 Received: by mail-lj1-f195.google.com with SMTP id r9so1544284ljg.5 for ; Thu, 15 Aug 2019 01:25:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=B+ECKY1p2VHh4LtEqUnTlQTB3c2/0NMzRTuFzQF/fvU=; b=i174BSGbtB/KMv2+wra9KkYSKWsiGjBMj0Rax7aPf0Ld3Jk6RhIsSUz+1o+Y/Q+7ig UFX3KT9s2u65bqBVCIGqWNgaergD+3hUgdOOE2E5WwJr0WYhRMi8FzYhHAooF27beDew bCQNTlvbqIzHK0m7FP2GNyfV0VOF8D9a0S5STTNR19EiqYhn7o8ZJIlsdT6O7vfVDXTl dDZlh196G6H+8ES0Q0NZW/duMUSfVsmLPViBQCbps2bLdVCzjNNRYkZuFLH30Yg3o+Ml XJPyVhqHY82njeXGWrl5AI9zH3mayqXKRoQwQ6DFIYtmCSXyjhoCyoLBVwFnxb3PHpNk smCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=B+ECKY1p2VHh4LtEqUnTlQTB3c2/0NMzRTuFzQF/fvU=; b=XZjpj3HJoxI/dMLS06FSEWJ3tu49z+fPA5KjzmZ/d3uMvQquDHffTNSsDPHuUtuV5W K8A1+kaejt64m5vEYg73AHaXnRBSD9Kxn/SwqqnOHwC9GUlXQ6YHmlrAWpEZYZ3t/dMj cohRH4SSQVJsMTnRwbasQPQ2YjiODyuCxffbHzDaTRqePyi+h602HNRSaalXILoVQCu9 9vHQaULmBtqgIoAXDbQWw1Kgjox81eyoMGCAWqee+6Bw/LXcZWFtnQl3Wx0/Yt1Gmz9d HHf0r5Y5oFQtAu/ocDgjnYks1dVIJCP0igxroksFRYMAp0YVsFEkl6gNCd5ZWMFRMBTv iMOA== X-Gm-Message-State: APjAAAV+J4eQqcB7XUjZ7Yr1CxJvO7BxNmXVieOSNNlNzoz3It9IZvVN xP3YNLln0qYwTczS9Bpm8R8mEqEw X-Google-Smtp-Source: APXvYqx4CuRgApzEFtQUDQXHO7MyYX/xMvAf3JRnbs3QzXxACOuah+X3Ps4VEZs4Ol2ObxLhHpaX8Q== X-Received: by 2002:a2e:9149:: with SMTP id q9mr2057884ljg.228.1565857531462; Thu, 15 Aug 2019 01:25:31 -0700 (PDT) Received: from localhost (host-217-214-149-250.mobileonline.telia.com. [217.214.149.250]) by smtp.gmail.com with ESMTPSA id r89sm365275ljr.75.2019.08.15.01.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2019 01:25:30 -0700 (PDT) References: <8D32A371-FD47-434F-928A-C07D002BB712@uca.fr> <04bdbadb-82bb-4539-9b42-03ea96e5aabd@www.fastmail.com> User-agent: mu4e 1.0; emacs 26.2 From: Malcolm Matalka To: rixed@happyleptic.org Cc: caml-list@inria.fr In-reply-to: <04bdbadb-82bb-4539-9b42-03ea96e5aabd@www.fastmail.com> Date: Thu, 15 Aug 2019 10:25:12 +0200 Message-ID: <864l2idedz.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Subject: Re: [Caml-list] A (silly ?) question about opam and ocamlfind Reply-To: Malcolm Matalka X-Loop: caml-list@inria.fr X-Sequence: 17770 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain rixed@happyleptic.org writes: > Hello! > > The more tools are added on top of each others to make life easier for newcomers, and the harder it is to understand what's happening. > > So let's get back to the beginning. I'm assuming you know already most of this but I'd rather give a picture of the whole stack so that you know which documentation you need to read to learn the details about various steps. > > OCaml compiler without any other helper tool knows very little about where to find the files it needs. > Following the tradition, it just knows one directory, where the system libraries are located. And it takes everything else from the command line: the inputs (some .ml, .cmx, .cmxa, .o, .a, etc files, some additional paths where to look for libraries if more are needed), and the single output (-o somefile). > > You can work only with this, that's very simple, but also quickly cumbersome as the number of libraries you need grow, each requiring other libraries and special options for the compiler, recursively. > So at some point, you want a package manager: something that organise libraries in your local disk with some additional metadata about what depends on what, so that you only have to say "I want to link with the foobar, preferably the lwt variant". > This is ocamlfind. To play by the rules, you have to install all the package in a given directory, with an additional small META file that contains the dependencies and various options and other meta data such as a unique name and a description. > If library authors play by the rules and provide that META file and install their libraries in a standardized manner (which is greatly simplified by ocamlfind command line tool) then everything become as easy as `ocamlfind ocamlc -package 'foo bar baz' my_source.ml`. > > This is great and nice, and by and large OCaml library authors have played by the rules for a very long time now (such a tool, to be successful, have to be reliable and _stable_ for a long time ; ocamlfind have been very successful and essential to OCaml popularity, because it has stayed the same for many years ; thank you so much to its maintainers to resist the need to break backward compatibility). > > There is still an important annoyance though: for the above to work, you still need libraries foo, bar and baz to be downloaded, compiled, and installed on your local machine. For this, you need a standard package repository. This is OPAM. Opam also have it's small file with metainfo about each package, except this one is called "opam" (or "$package.opam") and states where to get the package from, what command to run to build it, and how to install it. > Sounds familiar? Yes that's exactly what your Linux distribution does, but it works also on non-linux systems and is also updated much quicker, as there are less bureaucracy involved (notice it solves a human problem not a technical problem here). > > There is a bit of redundancy between ocamlfind and opam, because, despite ocamlfind being used by >90% of packages, opam is ocamlfind agnostic and can work, in theory, for non-ocamlfind packages (indeed, it can also be used to deploy about anything not only OCaml packages). So you have to give names, description, dependencies both to ocamlfind and opam. > But that's only a minor annoyance. > > If it really bothers you, then you can use another tool on top of all that, such as dune, that will not only build your project but also write the META and the opam file for you (and more). With the risk that, if something fails at this point, you have all the above stack to unfold to understand what's happening. > > If you have read this far then maybe you are interested in the topic of software packaging and deployment. > Then it must be mentioned that better, more sophisticated package managers do exist, which solve this whole problem once and for all, such as nix or guix, and that hopefully one day we will all abandon our compartmentalised solutions that are popular today and move on to the next level. Another option is to use pds and hll which I wrote a few years ago and use for all of my own projects. A tutorial can be found here: http://blog.appliedcompscilab.com/2016-Q4/index.html It's gained some features since that post. The idea is that pds can transform a TOML file into a Makefile to build and hll can turn the TOML file into an opam package. Other tools to create a .merlin file. It's pretty simple (pds is implemented in about 800 lines of code currently + a few dependencies vendored in the repo). pds supports parallel builds, incremental builds, building differently based on environment, and works fine within a monorepo (I've only tested it against my monorepo where I do all my development so YMMV). It also supports building non-ocaml sourcetrees assuming the sourcetree implements some Makefile targets. I use this to jump through the Ocaml -> C -> Ocaml hoops needed to build OCaml bindings with ctypes. It definitely has some rough edges since it only works for what I care about. It looks like dune has and will have the majority of mindshare, but pds/hll might be useful to someone who doesn't want to take that leap. Presumably it should be fairly straightforwad to turn the pds TOML file into a Dune file as well. I haven't kept the opam package up-to-date since I didn't think it'd be that interesting to anyone else but I can push the latest package this week. /Malcolm --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEQP2ClpgOfnguJZS++DiEc/oMrtcFAl1VFukACgkQ+DiEc/oM rtfSDQgAqUfYNHbmrRWtl7+h4E1I0hYGKpt7vD9DHw507f9gbvI2wNmzPeBqQAzm AIRJ475DxSUB9FOafSV+9dNFnusWWzvpi67efqx4zLaGGjXaLw0U3JEE2Sn2a6VP lZPZ3xMAv13pK6fHMW33JFvXtwiz0cH9XBjPm4srsB0EisyKUSgjKYDtMUd5oVIq 2RUv8T5TD4kCoH+ftJf7jwYsvTOoVbcRe4loxhtWN/+T5QMX7vJOzmx5BzA9SEdG I9LE4Es+JTEvx1eJTrPZ/V93pozzTnf1UoUiglG++YcQNvf1cywJCujMtDLidQ1U p80TlT/m2CLCxU6vZYyfm1ry9XUCUg== =iKo3 -----END PGP SIGNATURE----- --=-=-=--