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 ESMTPS id 1A6F35D5 for ; Fri, 22 Feb 2019 06:13:33 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.58,398,1544482800"; d="scan'208,217";a="370429717" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 22 Feb 2019 07:13:31 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id A4A40825EF; Fri, 22 Feb 2019 07:13:31 +0100 (CET) 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 908DE7F61F for ; Fri, 22 Feb 2019 07:13:22 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=murthy.chet@gmail.com; spf=Pass smtp.mailfrom=murthy.chet@gmail.com; spf=None smtp.helo=postmaster@mail-lj1-f179.google.com IronPort-PHdr: =?us-ascii?q?9a23=3Aofd2AB1H+MG0a3eXsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?se0TKvad9pjvdHbS+e9qxAeQG9mDu7Qc06L/iOPJYSQ4+5GPsXQPItRndiQuro?= =?us-ascii?q?EopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZv?= =?us-ascii?q?JuTyB4Xek9m72/q99pHPYAhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+?= =?us-ascii?q?VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfM?= =?us-ascii?q?QA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7S60/Vza/4KdxUBLnhy?= =?us-ascii?q?cJOTA6/m/KlMJ/kLlWrwi9qxFl2YPYfJ2ZOfh4c6jAfd0aX21BXsNJWiFfAoOz?= =?us-ascii?q?cZcPBPcGM+ZFtYn9u1sOrBujDgSrAePv1yVIhmP23aw6yeguDQHG0xI8H98Vv3?= =?us-ascii?q?TUqc/6NKYWUeyv0KbIyjDDYupQ1Dzg5obIdRUhruuNXbJ2acfRxkgvFx/FjlWN?= =?us-ascii?q?soPpJS+a1uMIs2Wd8uFuVvqvhnY5pw1tpjWj3MQhh4nTio4L1lzJ9j91zJs3KN?= =?us-ascii?q?C8TkNwfMSqH4FKty6AMot7WsMiTH9suCY90rAGvIS0fCkOyJg+wx7faeGLf5GG?= =?us-ascii?q?4h7+VuucJS10hH1ieLK4iBay9VavxvfgWcmz1VZGtitFkt/SuXARzxHf9NSLR/?= =?us-ascii?q?9n8kqi2TuDzR7f5v1HLEwuiKbWKZoszqY1lpUJsETDGiH2mF/xjK+Tbkgk//Wo?= =?us-ascii?q?6/77YrXmpp6QLZN7igHgPaQygcG/DuE4PRIPX2if4+izyLrj/UjhTLVQkvI2ir?= =?us-ascii?q?XZsIzdJckDuqG2GQpV0oI65xa7Djemy8gYkGIcLFNFfRKHl5LmN0vPIPD+F/e/?= =?us-ascii?q?gk6jnC1lx/DcbfXdBcDGJ33H1bPgZqo1v0VVzQ52ydFE+7pVDKsAKbT9QBmims?= =?us-ascii?q?bfC0oSMwGoi8P6Esl9x8tKXH+VHq+IdqjSvEOg6ecmIu3Kb4gQ7mWuY8M57uLj?= =?us-ascii?q?2Cdq0WQWerOkiMNOOSKIW89+KkDcWkLCx9IIEGMEpA07FbW4h1iLUDoVbHG3Df?= =?us-ascii?q?tlumMLTbm+BIKGfbiDxaSb1X7iTJJTb2FCTFuLFCWwLtjWa7I3cCuXZ/RZvHkE?= =?us-ascii?q?WLymEdFz0BivsEr+yeMiILOLq2sXspXs0NUz7OrWx0k/?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AmCQCskW9chrPQVdFlHAEBAR8EAQEFA?= =?us-ascii?q?QGBToJpgQMnhAeBHYJej3aMPI9qDQUehEmDfBoHAQQ0EgEDAQECAQEBAQETAQE?= =?us-ascii?q?BCAsLCCkjDII6IoMYHQEbHgMSEDcCJAERAQUBIoMzAYFZAQMVD5xhgx88iVsag?= =?us-ascii?q?SaBEgUBF4J5BYQ/ChknDV+BNwIBBRKMNoIWh0ECgg6CXIJXAooKLocdkX8HAoF?= =?us-ascii?q?3hUeLIRlokiSQGYxVDyGBPYF3MxojgQGCO4I2HIM4inQhMJALAQE?= X-IPAS-Result: =?us-ascii?q?A0AmCQCskW9chrPQVdFlHAEBAR8EAQEFAQGBToJpgQMnhAe?= =?us-ascii?q?BHYJej3aMPI9qDQUehEmDfBoHAQQ0EgEDAQECAQEBAQETAQEBCAsLCCkjDII6I?= =?us-ascii?q?oMYHQEbHgMSEDcCJAERAQUBIoMzAYFZAQMVD5xhgx88iVsagSaBEgUBF4J5BYQ?= =?us-ascii?q?/ChknDV+BNwIBBRKMNoIWh0ECgg6CXIJXAooKLocdkX8HAoF3hUeLIRlokiSQG?= =?us-ascii?q?YxVDyGBPYF3MxojgQGCO4I2HIM4inQhMJALAQE?= X-IronPort-AV: E=Sophos;i="5.58,398,1544482800"; d="scan'208,217";a="296960923" Received: from mail-lj1-f179.google.com ([209.85.208.179]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 22 Feb 2019 07:13:21 +0100 Received: by mail-lj1-f179.google.com with SMTP id d14so742563ljl.9 for ; Thu, 21 Feb 2019 22:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7jmlhvqApqTzF29fTn195znxpHf/y6Y98tLfdEz1iBM=; b=Ciefqa0yjydzmbA+q6NLxDPnMRBTX12Bkj03rdGI+cHXdcyhEui09Ia4AOVS6gXSwM VY2RdEOZ5AeouxcHYUnSS/Da6rNPq6xNw87g35wECQg/CzZ/fMOws9oY/+tZVXJ6yngp eptU5fSLPwBmj6/Y74PBdJe4zX7N1BtZakWzMG1eGubi6rlZDhNY2uMq1ewY1S1NRXrO FPlzcxhB4eBOwA5WeXmSzGnQZuB4NmjuOv3KXKUdXb5YUcHjjTdQTisnvXl3SSF8VDFS png2WblUWUhFO2DSC/nTI83vlyoEzjIZHS8sd4hKfZij/uyrzL+eNapt46lDYjLZAiwp JUHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7jmlhvqApqTzF29fTn195znxpHf/y6Y98tLfdEz1iBM=; b=AFJmBhtWNrZg8u4q4MjXYba6GrJteHgS4hGClhRieP93fotEa2X5LxYbbTBUVeHLeH YOJ6lNc8tWFYTlPVmyGIyKFnzKd4rHUD0YZ05+lVnsXyDdPFfB50ADOr8hZ8CEGbjNiT c0acINgp1k3KUak5J6sguVAbuUAPr3rqP3TdXEuYPSamz7PPReNNf+ofUNb055MjCBxu lLqhFQJpi7+rx3JuNghGs0YUDEyhnEokhc1YaZwjS/E45r2NvRio8TDHTRwDBehhXwUB ycpVJwNkSuusXjeZmD+rXPsabQyhmHAucyiqu6cwf0qIk0bkdO2Paw9sw9n6+5coz4h0 HdBg== X-Gm-Message-State: AHQUAuZIsPEHsAiXxkmWcLEsR7I8m0JbePeGYfPMpIaO/p5q1HdHERAR nHwGkZNJ8WNdbsNH0FgsTKdi4Xma8yPkB1TECO2TVdU+ X-Google-Smtp-Source: AHgI3Ia7cELrkfGrNNL8apFWHBMAojoB1PrNzc8KFaMSvc/7n59gi5FO/hbbkxbHUsfmAATMkqTe/SEXimqiNLqwJVo= X-Received: by 2002:a2e:2285:: with SMTP id i127mr1332959lji.40.1550815999975; Thu, 21 Feb 2019 22:13:19 -0800 (PST) MIME-Version: 1.0 From: Chet Murthy Date: Thu, 21 Feb 2019 22:13:08 -0800 Message-ID: To: caml-list Content-Type: multipart/alternative; boundary="000000000000ca65180582757ce9" Subject: [Caml-list] Getting started with opam and "opam switch" (or: use "opam switch", you won't regret it) Reply-To: Chet Murthy X-Loop: caml-list@inria.fr X-Sequence: 17361 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: --000000000000ca65180582757ce9 Content-Type: text/plain; charset="UTF-8" I've been using Ocaml (and before that, cam-light) for .... decades. I've always built the compiler+runtime from sources, and have a "BUILD-INSTALL" script, lovingly maintained and updated over the years, to download-and-install ocaml, findlib, oasis, other libraries, and recently, opam too. I've seen opam's "switch" command, but never used it. It wasn't obvious to me how to use it, so I just stuck to my old way of doing this sort of setup, every time a new ocaml version came out. Until today. Today I decided to figure out how to use "opam switch". And just in case there are other people who are reluctant, I figured I'd document my experience, so others could cut-and-paste. I'm sure inveterate opam users will just skip past, but I figured, there might be some who still haven't taken the plunge, so hey, here's a crib-sheet. (1) install "opam" on Ubuntu % sudo apt-get install opam (2) install Ocaml 4.07.1 -------------------------------------------------------------------------------- export VERSION=4.07.1 export OPAMROOT=$HOME/Hack/Ocaml/$VERSION mkdir -p $OPAMROOT echo "export OPAMROOT=$OPAMROOT" >> $OPAMROOT/dot.bashrc opam init --dot-profile=$OPAMROOT/dot.bashrc \ -j 32 \ --yes \ --bare \ --inplace-build \ --enable-completion \ --enable-shell-hook \ --shell-setup eval $(opam env) opam switch create ocaml-base-compiler.$VERSION --repositories=default,beta=git+ https://github.com/ocaml/ocaml-beta-repository.git -------------------------------------------------------------------------------- (2) install the latest beta (4.08.0+beta1) -------------------------------------------------------------------------------- export VERSION=4.08.0+beta1 export OPAMROOT=$HOME/Hack/Ocaml/$VERSION mkdir -p $OPAMROOT echo "export OPAMROOT=$OPAMROOT" >> $OPAMROOT/dot.bashrc opam init --dot-profile=$OPAMROOT/dot.bashrc \ -j 32 \ --yes \ --bare \ --inplace-build \ --enable-completion \ --enable-shell-hook \ --shell-setup eval $(opam env) opam switch create ocaml-variants.$VERSION --repositories=default,beta=git+ https://github.com/ocaml/ocaml-beta-repository.git -------------------------------------------------------------------------------- And to set up the environment in a shell for each of these installs, just source the dot.bashrc in $OPAMROOT/dot.bashrc I must say, this is ... *much* easier than "ocamlbrew", and that was already pretty fricken' easy. --000000000000ca65180582757ce9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

I've been using Ocaml (and before t= hat, cam-light) for .... decades.=C2=A0 I've always built the compiler+= runtime from sources, and have a "BUILD-INSTALL" script, lovingly= maintained and updated over the years, to download-and-install ocaml, find= lib, oasis, other libraries, and recently, opam too.=C2=A0 I've seen op= am's "switch" command, but never used it.=C2=A0 It wasn't= obvious to me how to use it, so I just stuck to my old way of doing this s= ort of setup, every time a new ocaml version came out.

=
Until today.=C2=A0 Today I decided to figure out how to use "opam= switch". And just in case there are other people who are reluctant, I= figured I'd document my experience, so others could cut-and-paste.=C2= =A0 I'm sure inveterate opam users will just skip past, but I figured, = there might be some who still haven't taken the plunge, so hey, here= 9;s a crib-sheet.

(1) install "opam" on = Ubuntu

=C2=A0 % sudo apt-get install opam

(2) install Ocaml 4.07.1
-----------------------= ---------------------------------------------------------
export VERSION=3D4.07.1

export OPAMRO= OT=3D$HOME/Hack/Ocaml/$VERSION

mkdir -p $OPAMROOT<= /div>
echo "export OPAMROOT=3D$OPAMROOT" >> $OPAMROOT/d= ot.bashrc

opam init --dot-profile=3D$OPAMROOT/dot.= bashrc \
=C2=A0 =C2=A0 -j 32 \
=C2=A0 =C2=A0 --yes \
=C2=A0 =C2=A0 --bare \
=C2=A0 =C2=A0 --inplace-build \
=C2=A0 =C2=A0 --enable-completion \
=C2=A0 =C2=A0 --enabl= e-shell-hook \
=C2=A0 =C2=A0 --shell-setup

eval $(opam env)

opam switch create ocaml-base-= compiler.$VERSION --repositories=3Ddefault,beta=3Dgit+https://github.com/ocaml/ocaml-be= ta-repository.git
-------------------------------------= -------------------------------------------
(2) install the l= atest beta (4.08.0+beta1)
---------------------------------------= -----------------------------------------
export VERSION= =3D4.08.0+beta1

export OPAMROOT=3D$HOME= /Hack/Ocaml/$VERSION

mkdir -p $OPAMROOT
= echo "export OPAMROOT=3D$OPAMROOT" >> $OPAMROOT/dot.bashrc<= /div>

opam init --dot-profile=3D$OPAMROOT/dot.bashrc \
=C2=A0 =C2=A0 -j 32 \
=C2=A0 =C2=A0 --yes \
= =C2=A0 =C2=A0 --bare \
=C2=A0 =C2=A0 --inplace-build \
= =C2=A0 =C2=A0 --enable-completion \
=C2=A0 =C2=A0 --enable-shell-= hook \
=C2=A0 =C2=A0 --shell-setup

eval = $(opam env)

opam switch create ocaml-va= riants.$VERSION --repositories=3Ddefault,beta=3Dgit+https://github.com/ocaml/ocaml-beta= -repository.git
---------------------------------------= -----------------------------------------

And = to set up the environment in a shell for each of these installs, just sourc= e the dot.bashrc in $OPAMROOT/dot.bashrc

I must sa= y, this is ... *much* easier than "ocamlbrew", and that was alrea= dy pretty fricken' easy.


--000000000000ca65180582757ce9--