• Stars
    star
    1,541
  • Rank 29,253 (Top 0.6 %)
  • Language
    OCaml
  • License
    MIT License
  • Created over 7 years ago
  • Updated 3 days ago

Reviews

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

Repository Details

A composable build system for OCaml.

Dune

A Composable Build System for OCaml

Main Workflow Release Coverage License Contributors

Dune is a build system for OCaml. It provides a consistent experience and takes care of the low-level details of OCaml compilation. You need only to provide a description of your project, and Dune will do the rest.

Dune implements a scheme that's inspired from the one used inside Jane Street and adapted to the open source world. It has matured over a long time and is used daily by hundreds of developers, meaning it's highly tested and productive.

Dune comes with a manual. If you want to get started without reading too much, look at the quick start guide or watch this introduction video.

The example directory contains examples of projects using Dune.

How does it work?

Dune reads project metadata from dune files, which are static files with a simple S-expression syntax. It uses this information to setup build rules, generate configuration files for development tools such as Merlin, handle installation, etc.

Dune itself is fast, has very little overhead, and supports parallel builds on all platforms. It has no system dependencies. OCaml is all you need to build Dune and packages using Dune.

In particular, one can install OCaml on Windows with a binary installer and then use only the Windows Console to build Dune and packages using Dune.

Strengths

Composable

Dune is composable, meaning that multiple Dune projects can be arranged together, leading to a single build that Dune knows how to execute. This allows for monorepos of projects.

Dune makes simultaneous development on multiple packages a trivial task.

Gracefully Handles Multi-Package Repositories

Dune knows how to handle repositories containing several packages. When building via opam, it is able to correctly use libraries that were previously installed, even if they are already present in the source tree.

The magic invocation is:

$ dune build --only-packages <package-name> @install

Build Against Several Configurations at Once

Dune can build a given source code repository against several configurations simultaneously. This helps maintaining packages across several versions of OCaml, as you can test them all at once without hassle.

In particular, this makes it easy to handle cross-compilation. This feature requires opam.

Installation

Requirements

Dune requires OCaml version 4.08.0 to build itself and can build OCaml projects using OCaml 4.02.3 or greater.

Installation

We recommended installing Dune via the opam package manager:

$ opam install dune

If you are new to opam, make sure to run eval $(opam config env) to make dune available in your PATH. The dune binary is self-contained and relocatable, so you can safely copy it somewhere else to make it permanently available.

You can also build it manually with:

$ make release
$ make install

If you do not have make, you can do the following:

$ ocaml boot/bootstrap.ml
$ ./dune.exe build -p dune --profile dune-bootstrap
$ ./dune.exe install dune

The first command builds the dune.exe binary. The second builds the additional files installed by Dune, such as the man pages, and the last simply installs all of that on the system.

Please note: unless you ran the optional ./configure script, you can simply copy dune.exe anywhere and it will just work. dune is fully relocatable and discovers its environment at runtime rather than hard-coding it at compilation time.

Support

Issues Discussions Discuss OCaml Discord

If you have questions or issues about Dune, you can ask in our GitHub discussions page or open a ticket on GitHub.

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

opam

opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
OCaml
1,175
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