Skip to content

Commit

Permalink
Merge branch 'main' into ps/rr/feature_coq___composition_of_installed…
Browse files Browse the repository at this point in the history
…_theories
  • Loading branch information
Alizter authored Apr 20, 2023
2 parents 46b1503 + be6f666 commit 4d0c4bc
Show file tree
Hide file tree
Showing 39 changed files with 463 additions and 222 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ Unreleased
would not be included whenever `(generate_opam_files true)` was set and the
`.install` file wasn't yet generated. (#7547, @rgrinberg)

- Fix regression where Merlin was unable to handle filenames with uppercase
letters under Windows. (#7577, @nojb)

- On nix+macos, pass `-f` to the codesign hook to avoid errors when the binary
is already signed (#7183, fixes #6265, @greedy)

3.7.1 (2023-04-04)
------------------

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ core_bench \
"csexp>=1.3.0" \
js_of_ocaml \
js_of_ocaml-compiler \
"mdx>=2.1.0" \
"mdx>=2.3.0" \
menhir \
ocamlfind \
ocamlformat.$$(awk -F = '$$1 == "version" {print $$2}' .ocamlformat) \
Expand Down
11 changes: 4 additions & 7 deletions bin/ocaml/ocaml_merlin.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ end = struct
Cygwin environment both paths are lowarcased before the comparison *)
let make_relative_to_root p =
let p = Path.to_absolute_filename p in
let prefix, p =
let prefix = Path.(to_absolute_filename root) in
if Sys.win32 || Sys.cygwin then
(String.lowercase_ascii prefix, String.lowercase_ascii p)
else (prefix, p)
in
String.drop_prefix ~prefix p
let prefix = Path.(to_absolute_filename root) in
(if Sys.win32 || Sys.cygwin then String.Caseless.drop_prefix
else String.drop_prefix)
~prefix p
(* After dropping the prefix we need to remove the leading path separator *)
|> Option.map ~f:(fun s -> String.drop s 1)

Expand Down
2 changes: 1 addition & 1 deletion boot/libs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ let local_libraries =
; ("otherlibs/dune-glob/src", Some "Dune_glob", false, None)
; ("otherlibs/xdg", Some "Xdg", false, None)
; ("otherlibs/dune-rpc/private", Some "Dune_rpc_private", false, None)
; ("src/dune_lang", Some "Dune_lang", false, None)
; ("vendor/build_path_prefix_map/src", Some "Build_path_prefix_map", false,
None)
; ("src/dune_config", Some "Dune_config", false, None)
; ("src/dune_util", Some "Dune_util", false, None)
; ("src/dune_lang", Some "Dune_lang", false, None)
; ("src/fiber_util", Some "Fiber_util", false, None)
; ("src/dune_cache_storage", Some "Dune_cache_storage", false, None)
; ("src/dune_cache", Some "Dune_cache", false, None)
Expand Down
30 changes: 0 additions & 30 deletions doc/advanced/findlib-integration.rst

This file was deleted.

26 changes: 0 additions & 26 deletions doc/advanced/meta-file-generation.rst

This file was deleted.

2 changes: 2 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@

from sphinx.highlighting import lexers
from dune_lexer import DuneLexer
from opam_lexer import OpamLexer

lexers[DuneLexer.name] = DuneLexer(startinline=True)
lexers[OpamLexer.name] = OpamLexer()

# -- General configuration ------------------------------------------------

Expand Down
48 changes: 22 additions & 26 deletions doc/explanation/opam-integration.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
How Dune integrates with opam
=============================

When instructed to do so (see :doc:`../howto/opam-file-generation`), Dune generates opam files with the following instructions:

.. code::
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
.. highlight:: opam

When instructed to do so (see :doc:`../howto/opam-file-generation`), Dune generates opam files with the following instructions::

build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]

Let's see what this means in detail.

Expand Down Expand Up @@ -61,9 +61,7 @@ The ``-p`` flag, shorthand for ``--release-of-packages``, is Dune's public inter
The Targets We're Building
--------------------------

The targets are specified as:

.. code::
The targets are specified as::

"@install"
"@runtest" {with-test}
Expand All @@ -88,12 +86,10 @@ Concretely, in the next table, if the opam command on the left is executed, the

This filtering mechanism is also used to declare dependencies.
If a package is using ``lwt`` and ``alcotest``, but the latter only in its test
suite, its ``depends:`` field is:

.. code::
suite, its ``depends:`` field is::

"lwt"
"alcotest" {with-test}
"lwt"
"alcotest" {with-test}

This is expanded to just ``"lwt"`` in ``opam install pkg``, but to ``"lwt"
"alcotest"`` in ``opam install pkg --with-test``.
Expand Down
26 changes: 26 additions & 0 deletions doc/exts/opam_lexer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from pygments.lexer import RegexLexer
from pygments.token import (
Keyword,
Number,
Punctuation,
String,
Text,
Whitespace,
)


ident = r"[-\w]+"


class OpamLexer(RegexLexer):
name = "opam"
tokens = {
"root": [
(r"\d\.\d", Number),
(r"^" + ident + ":", Keyword),
(ident, Text),
(r"[\[\]{}>=]", Punctuation),
(r"\s+", Whitespace),
(r'"[^\"]*"', String),
]
}
6 changes: 4 additions & 2 deletions doc/howto/opam-file-generation.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
How to Generate Opam Files from ``dune-project``
================================================

.. highlight:: dune

This guide will show you how to configure Dune so that it generates opam files.

Declaring Package Dependencies
Expand Down Expand Up @@ -33,7 +35,7 @@ You can declare the package as::

(package
(name frobnitz)
(depends lwt fmt)
(depends lwt fmt))

Also add common metadata using ``(authors)``, ``(maintainers)``, ``(license)``,
``(source)``, as well as a ``(synopsis)`` and a ``(description)`` for
Expand All @@ -46,7 +48,7 @@ following the rules in :ref:`package`.

For example, if your opam file looks like:

.. code::
.. code:: opam
opam-version: 2.0
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
Expand Down
3 changes: 1 addition & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Welcome to Dune's Documentation!
reference/cli
reference/preprocessing-spec
reference/packages
reference/findlib
concepts/scopes
concepts/variables
concepts/dependency-spec
Expand Down Expand Up @@ -71,8 +72,6 @@ Welcome to Dune's Documentation!
.. toctree::
:caption: Advanced topics

advanced/meta-file-generation
advanced/findlib-integration
advanced/findlib-dynamic
advanced/profiling-dune
advanced/package-version
Expand Down
60 changes: 60 additions & 0 deletions doc/reference/findlib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Findlib Integration
===================

Dune integrates with `findlib`_ so that it is possible to use a dependency
built with Dune in a project that does not use Dune, or vice versa.

.. _findlib: https://github.com/ocaml/ocamlfind

.. seealso:: :doc:`../explanation/ocaml-ecosystem` explains the role of
findlib and its relation with Dune.

To do so, Dune both interprets and generates ``META`` files.

How Dune Interprets ``META`` files
----------------------------------

``META`` files use the concept of *predicates*, which can be used to change the
interpretation of the directives the files contain. However, Dune does not
expose this to the user.

Instead, Dune interprets ``META`` files assuming the following set of
predicates:

- ``mt``: refers to a library that can be used with or without threads. Dune
will force the threaded version.

- ``mt_posix``: forces the use of POSIX threads rather than VM threads. VM
threads are deprecated and will soon be obsolete.

- ``ppx_driver``: when a library acts differently depending on whether
it's linked as part of a driver or meant to add a ``-ppx`` argument
to the compiler, choose the former behavior.

The Special Case of the OCaml Compiler
--------------------------------------

Libraries installed by the compiler are a special case: when the OCaml compiler
is older than version 5.0, it does not include ``META`` files. In that
situation, Dune uses its own internal database.

How Dune Generates ``META`` Files
---------------------------------

When Dune builds a library, it generates a corresponding ``META`` file
automatically. Usually, there is nothing to do. However, for the rare cases
where a specific ``META`` file is needed, or to ease the transition of a
project to Dune, it is possible to write/generate a specific one.

If a ``META.<package>.template`` is found in the same directory as
``<package>.OPAM``, the generated ``META.<package>`` file will be produced by
starting from the contents of ``META.<package>.template`` and replacing lines
of the form ``# DUNE_GEN`` with the contents of the ``META`` it would normally
generate.

For instance, to add ``field = "..."`` to the generated ``META`` file of
package ``pkg``, you can create a file named ``META.pkg.template`` with the
following contents::

# DUNE_GEN
blah = "..."
2 changes: 1 addition & 1 deletion otherlibs/stdune/src/io.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ let copy_channels =
loop

let setup_copy ?(chmod = Fun.id) ~src ~dst () =
let ic = open_in src in
let ic = Stdlib.open_in_bin src in
let oc =
try
let perm = (Unix.fstat (Unix.descr_of_in_channel ic)).st_perm |> chmod in
Expand Down
Loading

0 comments on commit 4d0c4bc

Please sign in to comment.