• Stars
    star
    1,175
  • Rank 38,294 (Top 0.8 %)
  • Language
    OCaml
  • License
    Other
  • Created about 12 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.

opam - A Package Manager for OCaml

master 2.0 2.1
GH actions 2.0 GH actions 2.1 GH actions

Opam is a source-based package manager for OCaml. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.

Opam was created and is maintained by OCamlPro.

To get started, checkout the Install and Usage guides.

Compiling This Repo

Either from an existing opam installation, use opam pin add opam-devel --dev, or:

  • Make sure you have the required dependencies installed:
    • GNU make
    • OCaml >= 4.08 (or see below)
    • A C++ compiler (unless building without a solver, see ./configure --without-mccs)
  • Run ./configure. If you don't have the dependencies installed, this will locally take care of all OCaml dependencies for you (downloading them, unless you used the inclusive archive we provide for each release).
  • Run make
  • Run make install

This is all you need for installing and using opam, but if you want to use the opam-lib (to work on opam-related tools), you need to link it to installed libraries. It's easier to already have a working opam installation in this case, so you can do it as a second step.

  • Make sure to have ocamlfind, ocamlgraph, cmdliner >= 1.0.0, cudf >= 0.7, dose3 >= 6.1, re >= 1.9.0, opam-file-format installed. Or run opam install . --deps-only if you already have a working instance. Re-run ./configure once done
  • Run make libinstall at the end

Note: If you install on your system (without changing the prefix), you will need to install as root (sudo). As sudo does not propagate environment variables, so there wil be some errors. You can use `sudo -E "PATH=$PATH" in order to ensure you have a good environment for install.

Developer Mode

If you are developing opam, you may enable developer features by including the --enable-developer-mode parameter with ./configure.

Compiling on Native Windows

BUILDING ON WINDOWS IS A WORK-IN-PROGRESS AND THESE INSTRUCTIONS WILL EVOLVE!

Cygwin (https://www.cygwin.com/setup-x86_64.exe) is always required to build opam on Windows. Both the 64-bit and 32-bit versions of Cygwin may be used (you can build 32-bit opam using 64-bit Cygwin and vice versa though. Note that you must be running 64-bit Windows in order to build the 64-bit version).

The following Cygwin packages are required:

  • From Devel - make
  • From Devel - patch (not required if OCaml and all required packages are pre-installed)
  • From Devel - mingw64-i686-gcc-core & mingw64-x86_64-gcc-core (not required if building with MSVC)

Alternatively, having downloaded Cygwin's setup program, Cygwin can be installed using the following command line:

setup-x86_64 --root=C:\cygwin64 --quiet-mode --no-desktop --no-startmenu --packages=make,mingw64-i686-gcc-core,mingw64-x86_64-gcc-core,patch

The --no-desktop and --no-startmenu switches may be omitted in order to create shortcuts on the Desktop and Start Menu, respectively. Executed this way, setup will still be interactive, but the packages will have been preselected. To make setup fully unattended, choose a mirror URL from https://cygwin.com/mirrors.lst and add the --site switch to the command line (e.g., --site=http://www.mirrorservice.org/sites/sourceware.org/pub/cygwin/).

It is recommended that you set the CYGWIN environment variable to nodosfilewarning winsymlinks:native.

Cygwin is started either from a shortcut or by running:

C:\cygwin64\bin\mintty -

We recommended you build opam outside Cygwin's root (so in /cygdrive/c/...). From an elevated Cygwin shell, edit /etc/fstab and ensure that the file's content is exactly:

none /cygdrive cygdrive noacl,binary,posix=0,user 0 0

The change is the addition of the noacl option to the mount instructions for /cygdrive and this stops from Cygwin from attempting to emulate POSIX permissions over NTFS (which can result in strange and unnecessary permissions showing up in Windows Explorer). It is necessary to close and restart all Cygwin terminal windows after changing /etc/fstab.

Opam is able to be built without a preinstalled OCaml compiler. For the MSVC ports of OCaml, the Microsoft Windows SDK 7 or later or Microsoft Visual Studio is required (https://www.microsoft.com/en-gb/download/details.aspx?id=8442 - either x86 or x64 may be installed, as appropriate to your system). It is not necessary to modify PATH, INCLUDE, or LIB. Opam's build system will automatically detect the required changes.

If OCaml is not preinstalled, run:

make compiler [OCAML_PORT=mingw64|mingw|msvc64|msvc|auto]

The OCAML_PORT variable determines which flavour of Windows OCaml is compiled; auto will attempt to guess. As long as GCC is not installed in Cygwin (i.e., the native C compiler for Cygwin), OCAML_PORT does not need to be specified and auto will be assumed. Once the compiler is built, you may run:

make lib-pkg

to install the dependencies as findlib packages to the compiler. Building lib-pkg requires the ability to create native symbolic links (and the CYGWIN variable must include winsymlinks:native). This means that either Cygwin must be run elevated from an account with administrative privileges, or your user account must be granted the SeCreateSymbolicLinkPrivilege either by enabling Developer mode on Windows 10 or using Local Security Policy on earlier versions of Windows. Alternatively, you may run configure and use vendored deps, as advised.

You can then configure and build opam as above.

Compiling Without OCaml

make cold is provided as a facility to compile OCaml, then bootstrap opam. You don't need to run ./configure in that case, but you may specify CONFIGURE_ARGS if needed. E.g.,:

make cold CONFIGURE_ARGS="--prefix ~/local"
make cold-install

NOTE: You'll still need GNU make.

Bug Tracker

Have a bug or a feature request? Please open an issue on our bug-tracker. Please search for existing issues before posting and include the output of opam config report and any details that may help track down the issue.

Documentation

User Manual

The main documentation entry point to opam is the user manual, available using opam --help. To get help for a specific command, use opam <command> --help.

Guides and Tutorials

A collection of guides and tutorials is available online. They are generated from the files in doc/pages.

API, Code Documentation, and Developer Manual

A more thorough technical document describing opam and specifying the package description format is available in the developer manual. make doc will otherwise make the API documentation available under doc/.

Community

Keep track of development and community news.

  • Have a question that's not a feature request or bug report? Ask on the mailing list.

  • Chat with fellow opamers on IRC. On the irc.libera.chat server, in the #ocaml or the #opam channel.

Contributing

We welcome contributions! Please use GitHub's pull-request mechanism against the master branch of the opam repository. If that's not an option for you, you can use git format-patch and email us.

Versioning

The release cycle respects Semantic Versioning.

Related Repositories

  • ocaml/opam-repository is the official repository for opam packages and compilers. A number of unofficial repositories are also available on the interwebs, for instance on Github.
  • opam2web generates a collection of browsable HTML files for a given repository. It is used to generate http://opam.ocaml.org.
  • opam-rt is the regression framework for opam.
  • opam-publish is a tool to facilitate the creation, update, and publication of opam packages.

Copyright and license

The version comparison function in src/core/opamVersionCompare.ml is part of the Dose library and Copyright 2011 Ralf Treinen.

All other code is:

Copyright 2012-2020 OCamlPro Copyright 2012 INRIA

All rights reserved. Opam is distributed under the terms of the GNU Lesser General Public License version 2.1, with the special exception on linking described in the file LICENSE.

Opam is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

More Repositories

1

ocaml

The core OCaml system: compilers, runtime system, base libraries
OCaml
4,732
star
2

merlin

Context sensitive completion for OCaml in Vim and Emacs
OCaml
1,543
star
3

dune

A composable build system for OCaml.
OCaml
1,541
star
4

ocaml-lsp

OCaml Language Server Protocol implementation
OCaml
716
star
5

opam-repository

Main public package repository for opam, the source package manager of OCaml.
Shell
504
star
6

tuareg

Emacs OCaml mode
Emacs Lisp
346
star
7

v2.ocaml.org

Implementation of the ocaml.org website.
HTML
323
star
8

odoc

Documentation compiler for OCaml and Reason
OCaml
306
star
9

ocamlunix

Unix system programming in OCaml book
TeX
276
star
10

Zarith

The Zarith library implements arithmetic and logical operations over arbitrary-precision integers and rational numbers. The implementation, based on GMP, is very efficient.
OCaml
214
star
11

ocaml-re

Pure OCaml regular expressions, with support for Perl and POSIX-style strings
OCaml
208
star
12

setup-ocaml

GitHub Action for the OCaml programming language
TypeScript
189
star
13

omd

extensible Markdown library and tool in "pure OCaml"
OCaml
152
star
14

RFCs

Design discussions about the OCaml language
142
star
15

ocaml.org

The official OCaml website.
HTML
140
star
16

oasis

Cabal like system for OCaml
OCaml
124
star
17

ocamlbuild

The legacy OCamlbuild build manager
OCaml
121
star
18

ocaml-ci-scripts

Skeletons for CI scripts
OCaml
101
star
19

flexdll

a dlopen-like API for Windows
OCaml
96
star
20

vim-ocaml

Vim runtime files for OCaml
Vim Script
85
star
21

v3.ocaml.org-rescript

The next implementation of ocaml.org, built on OCaml, ReScript, NextJS, and Tailwind.
ReScript
75
star
22

graphics

The Graphics library from OCaml, in a standalone repository
C
51
star
23

infrastructure

WIki to hold the information about the machine resources available to OCaml.org
HTML
40
star
24

num

The legacy Num library for arbitrary-precision integer and rational arithmetic that used to be part of the OCaml core distribution
OCaml
35
star
25

MPP-language-blender

MPP: a meta preprocessor that blends programming languages
OCaml
33
star
26

obi

OCaml Build Infrastructure
OCaml
30
star
27

oasis2opam

Tool to convert OASIS metadata to OPAM package descriptions
OCaml
27
star
28

ocamlfind

The OCaml findlib library manager
OCaml
26
star
29

ocaml-logo

Official Logo for OCaml
26
star
30

caml-mode

Emacs mode to edit OCaml files
Emacs Lisp
19
star
31

code-of-conduct

Documents related to the Code of Conduct
18
star
32

ocaml-beta-repository

Opam2 remote for beta versions of the OCaml compiler
Shell
16
star
33

ocaml-manual

OBSOLETE, ARCHIVED mirror of the OCaml manual
TeX
15
star
34

opam-file-format

Parser and printer for the opam file syntax
OCaml
15
star
35

ood

OCaml.org v3 data repository
OCaml
14
star
36

camlp-streams

The Stream and Genlex libraries for use with Camlp4 and Camlp5
OCaml
14
star
37

platform-blog

Repository for the Platform blog
13
star
38

oloop

Evaluate code through the OCaml toploop for inclusion in educational material.
OCaml
12
star
39

dbm

The legacy CamlDBM library for accessing NDBM/GDBM database files
OCaml
12
star
40

ocaml-library-standard

Documenting how OCaml libraries are managed
11
star
41

dune-www

Website for dune.build
SCSS
10
star
42

stdlib-shims

Shim to substitute `Pervasives` with `Stdlib` before 4.08.
Standard ML
10
star
43

0install-tools

Tools for distributing OCaml via 0install
8
star
44

platform-dev

Dev versions of the tools used to build the upcoming platform
Shell
8
star
45

opam.ocaml.org

Scripts and documentation for the opam.ocaml.org website
Shell
7
star
46

oasis-db

Hackage like system for OCaml based on OASIS
OCaml
7
star
47

uchar

Uchar compatibility library
OCaml
6
star
48

stdlib-random

Versioned random number library
OCaml
6
star
49

oasis-website

Devel website for OASIS http://oasis.forge.ocamlcore.org
JavaScript
5
star
50

cwn-data

The data repository for the Caml Weekly News
HTML
5
star
51

ocaml-pr-repository

opam switches for all the proposed pull requests against the compiler
5
star
52

oasis2debian

Convert _oasis to debian/ directory.
OCaml
5
star
53

homebrew-ocaml

A Homebrew tap for OCaml and OPAM distribution
Ruby
5
star
54

ocaml.org-media

Media files that we don't want to include in main ocaml.org repo.
HTML
4
star
55

opam-source-archives

mirror of precious opam repository packages whose source websites have disappeared
Shell
4
star
56

subsystem-meetings

sharing documents for specialized developer meetings
4
star
57

ocaml.org-scripts

Scripts for the ocaml.org infrastructure machines
Shell
2
star
58

ocaml.org-infratest

Tests for ocaml.org websites and services.
Shell
2
star
59

release-readiness

Tracking release readiness for OCaml compiler releases
1
star
60

opam-bulk-logs

Logs of daily OPAM bulk package builds
1
star
61

obi-logs

Logs for OCaml Build Infrastructure
1
star