From 696f2ef31f587b77cc6d9fc9a05f98e588fe4021 Mon Sep 17 00:00:00 2001 From: Kye Shi Date: Mon, 21 Jun 2021 18:27:24 -0700 Subject: [PATCH 1/4] New package: dune-2.8.5 --- srcpkgs/dune/template | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 srcpkgs/dune/template diff --git a/srcpkgs/dune/template b/srcpkgs/dune/template new file mode 100644 index 000000000000..84d7e535b091 --- /dev/null +++ b/srcpkgs/dune/template @@ -0,0 +1,31 @@ +# Template file for 'dune' +pkgname=dune +version=2.8.5 +revision=1 +makedepends="ocaml" +short_desc="Composable build system for OCaml" +maintainer="Kye Shi " +license="MIT" +homepage="https://dune.build/" +distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz" +checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30" +nocross="yes" +# Dune tests depend on other packages (e.g. `ocaml-csexp`) which must be built +# using Dune; requiring checks on Dune introduces circular dependencies. +make_check="no" + +do_build() { + ocaml "bootstrap.ml" + ./dune.exe build $makejobs -p "dune" --profile="dune-bootstrap" +} + +do_install() { + ./dune.exe install \ + --destdir="$DESTDIR" \ + --prefix="/usr" \ + --libdir="/usr/lib/ocaml" \ + --mandir="/usr/share/man" \ + "dune" + mv -T "$DESTDIR/usr/doc" "$DESTDIR/usr/share/doc" + vlicense "LICENSE.md" +} From 71692d57efc7e255f96e5c849cc6048d27a8ac69 Mon Sep 17 00:00:00 2001 From: Kye Shi Date: Mon, 21 Jun 2021 18:27:45 -0700 Subject: [PATCH 2/4] common: add `dune` build style --- common/build-style/dune.sh | 34 ++++++++++++++++++++++++++ common/environment/build-style/dune.sh | 1 + 2 files changed, 35 insertions(+) create mode 100644 common/build-style/dune.sh create mode 100644 common/environment/build-style/dune.sh diff --git a/common/build-style/dune.sh b/common/build-style/dune.sh new file mode 100644 index 000000000000..e0f4c8d61b14 --- /dev/null +++ b/common/build-style/dune.sh @@ -0,0 +1,34 @@ +# +# This helper is for templates using OCaml's dune build system. +# +do_build() { + : ${make_cmd:=dune} + : ${make_build_target:=@install} + + "${make_cmd}" build --release $makejobs $make_build_args $make_build_target +} + +do_check() { + : ${make_cmd:=dune} + : ${make_check_target:=@runtest} + + "${make_cmd}" build $makejobs $make_check_args $make_check_target +} + +do_install() { + : ${make_cmd:=dune} + + "${make_cmd}" install \ + --prefix="/usr" \ + --libdir="/usr/lib/ocaml" \ + --mandir="/usr/share/man" \ + --destdir="$DESTDIR" \ + $make_install_args $make_install_target + + # patch: mv /usr/doc to /usr/share/doc because dune does not provide way to + # customize doc install path + if [ -e "$DESTDIR/usr/doc" ]; then + mkdir -p "$DESTDIR/usr/share" + mv "$DESTDIR/usr/doc" "$DESTDIR/usr/share" + fi +} diff --git a/common/environment/build-style/dune.sh b/common/environment/build-style/dune.sh new file mode 100644 index 000000000000..36cf08537c55 --- /dev/null +++ b/common/environment/build-style/dune.sh @@ -0,0 +1 @@ +hostmakedepends+=" ocaml dune" From fb213646025446f467277b4174e81587d5be4560 Mon Sep 17 00:00:00 2001 From: Kye Shi Date: Mon, 21 Jun 2021 18:27:54 -0700 Subject: [PATCH 3/4] Manual.md: document `dune` build style --- Manual.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Manual.md b/Manual.md index d743276d3f04..5f14948fd3e7 100644 --- a/Manual.md +++ b/Manual.md @@ -584,18 +584,22 @@ phase if `${build_style}` is set to `configure`, `gnu-configure` or or `gnu-makefile`, this is the target passed to `${make_cmd}` in the build phase; when unset, it defaults to `all`. If `${build_style}` is `python3-pep517`, this is the path of the package directory that should be built as a Python wheel; when unset, defaults to `.` (the current -directory with respect to the build). +directory with respect to the build). If `${build_style}` is `dune`, this is the target passed to +`dune build` in the build phase; when unset, defaults to `@install`. - `make_check_target` The target to be passed in to `${make_cmd}` at the check phase if `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile` -build methods. By default set to `check`. +build methods; by default set to `check`. If `${build_style}` is `dune`, this +is the target passed to `dune build` for running tests; when unset, defaults to `@runtest`. - `make_install_target` The installation target. When `${build_style}` is set to `configure`, `gnu-configure` or `gnu-makefile`, this is the target passed to `${make_command}` in the install phase; when unset, it defaults to `install`. If `${build_style}` is `python-pep517`, this is the path of the Python wheel produced by the build phase that will be installed; when unset, the `python-pep517` build style will look for a wheel matching the package name and version in the -current directory with respect to the install. +current directory with respect to the install. If `${build_style}` is `dune`, this is the list +of OCaml packages to install, specified as a comma-separated list; when unset, all packages +defined in the source project will be installed. - `patch_args` The arguments to be passed in to the `patch(1)` command when applying patches to the package sources during `do_patch()`. Patches are stored in @@ -914,6 +918,15 @@ the default `build`. - `configure` For packages that use non-GNU configure scripts, at least `--prefix=/usr` should be passed in via `configure_args`. +- `dune` For packages written in OCaml that use Dune for building. +Arguments to `dune build` can be passed via `make_build_args`, and the build target +(default `@install`) can be overridden via `make_build_target`. Arguments to +`dune install` can be passed via `make_install_args`, and the list of packages to +install (defaults to all packages defined in the project) can be overridden via +`make_install_target` as a comma-separated list (e.g. `containers,containers-data`). +Tests are run using `dune build @runtest`; the target (default `@runtest`) can be +overridden via `make_check_target` and arguments passed via `make_check_args`. + - `fetch` For packages that only fetch files and are installed as is via `do_install()`. - `gnu-configure` For packages that use GNU configure scripts, additional configuration From a8d817e850ada6bdc702fa4ba38eb3a6a20f8a62 Mon Sep 17 00:00:00 2001 From: Kye Shi Date: Mon, 21 Jun 2021 19:18:08 -0700 Subject: [PATCH 4/4] new package: ocaml-sexplib-0.14.0 --- srcpkgs/ocaml-sexplib0/template | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 srcpkgs/ocaml-sexplib0/template diff --git a/srcpkgs/ocaml-sexplib0/template b/srcpkgs/ocaml-sexplib0/template new file mode 100644 index 000000000000..ac4f6a150ab3 --- /dev/null +++ b/srcpkgs/ocaml-sexplib0/template @@ -0,0 +1,17 @@ +# Template file for 'ocaml-sexplib0' +pkgname=ocaml-sexplib0 +version=0.14.0 +revision=1 +wrksrc="sexplib0-$version" +build_style="dune" +short_desc="Minimal-dependency base S-expressions library for OCaml" +maintainer="Kye Shi " +license="MIT" +homepage="https://github.com/janestreet/sexplib0" +distfiles="https://github.com/janestreet/sexplib0/archive/refs/tags/v$version.tar.gz" +checksum="1e2d1c27015809d816d1c707abfbc61f6b55830dedec01de8152d10ab7d6a19e" +nocross="yes" + +post_install() { + vlicense "LICENSE.md" +}