Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style
@ 2021-06-22  0:34 kwshi
  2021-06-22  0:36 ` [PR PATCH] [Updated] " kwshi
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  0:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2175 bytes --]

There is a new pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 4750 bytes --]

From 9eed0df5792f098fa00ec811b42cb7adbab7cd33 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 14:28:15 -0700
Subject: [PATCH 1/4] new package: dune-2.8.5

---
 srcpkgs/dune/template | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 srcpkgs/dune/template

diff --git a/srcpkgs/dune/template b/srcpkgs/dune/template
new file mode 100644
index 000000000000..c8a78e86a3c3
--- /dev/null
+++ b/srcpkgs/dune/template
@@ -0,0 +1,19 @@
+# Template file for 'dune'
+pkgname=dune
+version=2.8.5
+revision=1
+build_style="gnu-makefile"
+make_build_target="release"
+makedepends="ocaml"
+short_desc="Composable build system for OCaml"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://dune.build/"
+distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz"
+checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30"
+nocross="yes"
+
+post_install() {
+	mv -t "$DESTDIR/usr/share" "$DESTDIR/usr"/{doc,man}
+	vlicense "LICENSE.md"
+}

From bd95b8dfcf6f3d42f6015c69bb9674d8ecc2bd12 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:25:26 -0700
Subject: [PATCH 2/4] common: add `dune` build-style

---
 common/build-style/dune.sh             | 22 ++++++++++++++++++++++
 common/environment/build-style/dune.sh |  1 +
 2 files changed, 23 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..9d6e0b7f1075
--- /dev/null
+++ b/common/build-style/dune.sh
@@ -0,0 +1,22 @@
+#
+# This helper is for templates using OCaml's dune build system.
+#
+do_build() {
+  dune build $make_build_args @install
+}
+
+do_check() {
+	dune runtest
+}
+
+do_install() {
+  dune install --prefix '/usr' --destdir "$DESTDIR" $make_install_args $make_install_target
+  if [ -e "$DESTDIR/usr/doc" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/doc" "$DESTDIR/usr/share"
+  fi
+  if [ -e "$DESTDIR/usr/man" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/man" "$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 2a8c7f834b08373541cb83c6f425eb03b8bbca55 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:28 -0700
Subject: [PATCH 3/4] new package: ocaml-csexp-1.5.1

---
 srcpkgs/ocaml-csexp/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/ocaml-csexp/template

diff --git a/srcpkgs/ocaml-csexp/template b/srcpkgs/ocaml-csexp/template
new file mode 100644
index 000000000000..9507f7a10ce9
--- /dev/null
+++ b/srcpkgs/ocaml-csexp/template
@@ -0,0 +1,17 @@
+# Template file for 'ocaml-csexp'
+pkgname=ocaml-csexp
+version=1.5.1
+revision=1
+wrksrc="csexp-$version"
+build_style="dune"
+short_desc="Minimal support for Canonical S-expressions"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://opam.ocaml.org/packages/csexp/"
+distfiles="https://github.com/ocaml-dune/csexp/archive/refs/tags/$version.tar.gz"
+checksum="ffab41b0b0f65ade305043205229a7649591195cbe86e24f2c254e9dc5b14a34"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

From 791ff3dc09e30e71ae5de65c0410e3f441465946 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:41 -0700
Subject: [PATCH 4/4] new package: ocaml-dune-configurator-2.8.5

---
 srcpkgs/ocaml-dune-configurator/template | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 srcpkgs/ocaml-dune-configurator/template

diff --git a/srcpkgs/ocaml-dune-configurator/template b/srcpkgs/ocaml-dune-configurator/template
new file mode 100644
index 000000000000..47de83684ab0
--- /dev/null
+++ b/srcpkgs/ocaml-dune-configurator/template
@@ -0,0 +1,20 @@
+# Template file for 'ocaml-dune-configurator'
+pkgname=ocaml-dune-configurator
+version=2.8.5
+revision=1
+wrksrc="dune-$version"
+build_style="dune"
+make_build_args="-p dune-configurator"
+make_install_target="dune-configurator"
+makedepends="ocaml-csexp"
+short_desc="Helper library for gathering system information"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://dune.build/"
+distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz"
+checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
@ 2021-06-22  0:36 ` kwshi
  2021-06-22  0:57 ` kwshi
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  0:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 4767 bytes --]

From 9eed0df5792f098fa00ec811b42cb7adbab7cd33 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 14:28:15 -0700
Subject: [PATCH 1/4] new package: dune-2.8.5

---
 srcpkgs/dune/template | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 srcpkgs/dune/template

diff --git a/srcpkgs/dune/template b/srcpkgs/dune/template
new file mode 100644
index 000000000000..c8a78e86a3c3
--- /dev/null
+++ b/srcpkgs/dune/template
@@ -0,0 +1,19 @@
+# Template file for 'dune'
+pkgname=dune
+version=2.8.5
+revision=1
+build_style="gnu-makefile"
+make_build_target="release"
+makedepends="ocaml"
+short_desc="Composable build system for OCaml"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://dune.build/"
+distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz"
+checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30"
+nocross="yes"
+
+post_install() {
+	mv -t "$DESTDIR/usr/share" "$DESTDIR/usr"/{doc,man}
+	vlicense "LICENSE.md"
+}

From 12fb7a009c88321d8231b69345d350c326d3ba0d Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:25:26 -0700
Subject: [PATCH 2/4] common: add `dune` build-style

---
 common/build-style/dune.sh             | 22 ++++++++++++++++++++++
 common/environment/build-style/dune.sh |  1 +
 2 files changed, 23 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..0aa2145a25d7
--- /dev/null
+++ b/common/build-style/dune.sh
@@ -0,0 +1,22 @@
+#
+# This helper is for templates using OCaml's dune build system.
+#
+do_build() {
+  dune build $make_build_args @install
+}
+
+do_check() {
+	dune runtest $make_check_args
+}
+
+do_install() {
+  dune install --prefix '/usr' --destdir "$DESTDIR" $make_install_args $make_install_target
+  if [ -e "$DESTDIR/usr/doc" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/doc" "$DESTDIR/usr/share"
+  fi
+  if [ -e "$DESTDIR/usr/man" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/man" "$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 61f4ca8358a4047a75371f7be5ed308df394bc3f Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:28 -0700
Subject: [PATCH 3/4] new package: ocaml-csexp-1.5.1

---
 srcpkgs/ocaml-csexp/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/ocaml-csexp/template

diff --git a/srcpkgs/ocaml-csexp/template b/srcpkgs/ocaml-csexp/template
new file mode 100644
index 000000000000..9507f7a10ce9
--- /dev/null
+++ b/srcpkgs/ocaml-csexp/template
@@ -0,0 +1,17 @@
+# Template file for 'ocaml-csexp'
+pkgname=ocaml-csexp
+version=1.5.1
+revision=1
+wrksrc="csexp-$version"
+build_style="dune"
+short_desc="Minimal support for Canonical S-expressions"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://opam.ocaml.org/packages/csexp/"
+distfiles="https://github.com/ocaml-dune/csexp/archive/refs/tags/$version.tar.gz"
+checksum="ffab41b0b0f65ade305043205229a7649591195cbe86e24f2c254e9dc5b14a34"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

From 539e9ee1209b77efe7ad526a4882c526d99bfa33 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:41 -0700
Subject: [PATCH 4/4] new package: ocaml-dune-configurator-2.8.5

---
 srcpkgs/ocaml-dune-configurator/template | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 srcpkgs/ocaml-dune-configurator/template

diff --git a/srcpkgs/ocaml-dune-configurator/template b/srcpkgs/ocaml-dune-configurator/template
new file mode 100644
index 000000000000..47de83684ab0
--- /dev/null
+++ b/srcpkgs/ocaml-dune-configurator/template
@@ -0,0 +1,20 @@
+# Template file for 'ocaml-dune-configurator'
+pkgname=ocaml-dune-configurator
+version=2.8.5
+revision=1
+wrksrc="dune-$version"
+build_style="dune"
+make_build_args="-p dune-configurator"
+make_install_target="dune-configurator"
+makedepends="ocaml-csexp"
+short_desc="Helper library for gathering system information"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://dune.build/"
+distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz"
+checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
  2021-06-22  0:36 ` [PR PATCH] [Updated] " kwshi
@ 2021-06-22  0:57 ` kwshi
  2021-06-22  1:02 ` kwshi
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  0:57 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 8186 bytes --]

From 9eed0df5792f098fa00ec811b42cb7adbab7cd33 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 14:28:15 -0700
Subject: [PATCH 1/5] new package: dune-2.8.5

---
 srcpkgs/dune/template | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 srcpkgs/dune/template

diff --git a/srcpkgs/dune/template b/srcpkgs/dune/template
new file mode 100644
index 000000000000..c8a78e86a3c3
--- /dev/null
+++ b/srcpkgs/dune/template
@@ -0,0 +1,19 @@
+# Template file for 'dune'
+pkgname=dune
+version=2.8.5
+revision=1
+build_style="gnu-makefile"
+make_build_target="release"
+makedepends="ocaml"
+short_desc="Composable build system for OCaml"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://dune.build/"
+distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz"
+checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30"
+nocross="yes"
+
+post_install() {
+	mv -t "$DESTDIR/usr/share" "$DESTDIR/usr"/{doc,man}
+	vlicense "LICENSE.md"
+}

From 3b77956449015ccc53c91657cbc94ab8e4ec8efc Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:25:26 -0700
Subject: [PATCH 2/5] common: add `dune` build-style

---
 common/build-style/dune.sh             | 24 ++++++++++++++++++++++++
 common/environment/build-style/dune.sh |  1 +
 2 files changed, 25 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..17705f8c2106
--- /dev/null
+++ b/common/build-style/dune.sh
@@ -0,0 +1,24 @@
+#
+# This helper is for templates using OCaml's dune build system.
+#
+do_build() {
+  : ${make_build_target:=@install}
+  dune build --release $make_build_args $make_build_target
+}
+
+do_check() {
+  : ${make_check_target:=@runtest}
+	dune build $make_check_args $make_check_target
+}
+
+do_install() {
+  dune install --prefix '/usr' --destdir "$DESTDIR" $make_install_args $make_install_target
+  if [ -e "$DESTDIR/usr/doc" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/doc" "$DESTDIR/usr/share"
+  fi
+  if [ -e "$DESTDIR/usr/man" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/man" "$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 f511648e973d6bc536e092f40df13a5d46321815 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:28 -0700
Subject: [PATCH 3/5] new package: ocaml-csexp-1.5.1

---
 srcpkgs/ocaml-csexp/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/ocaml-csexp/template

diff --git a/srcpkgs/ocaml-csexp/template b/srcpkgs/ocaml-csexp/template
new file mode 100644
index 000000000000..9507f7a10ce9
--- /dev/null
+++ b/srcpkgs/ocaml-csexp/template
@@ -0,0 +1,17 @@
+# Template file for 'ocaml-csexp'
+pkgname=ocaml-csexp
+version=1.5.1
+revision=1
+wrksrc="csexp-$version"
+build_style="dune"
+short_desc="Minimal support for Canonical S-expressions"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://opam.ocaml.org/packages/csexp/"
+distfiles="https://github.com/ocaml-dune/csexp/archive/refs/tags/$version.tar.gz"
+checksum="ffab41b0b0f65ade305043205229a7649591195cbe86e24f2c254e9dc5b14a34"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

From 05909a7afd529a109147372ad7737483829a8e82 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:41 -0700
Subject: [PATCH 4/5] new package: ocaml-dune-configurator-2.8.5

---
 srcpkgs/ocaml-dune-configurator/template | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 srcpkgs/ocaml-dune-configurator/template

diff --git a/srcpkgs/ocaml-dune-configurator/template b/srcpkgs/ocaml-dune-configurator/template
new file mode 100644
index 000000000000..47de83684ab0
--- /dev/null
+++ b/srcpkgs/ocaml-dune-configurator/template
@@ -0,0 +1,20 @@
+# Template file for 'ocaml-dune-configurator'
+pkgname=ocaml-dune-configurator
+version=2.8.5
+revision=1
+wrksrc="dune-$version"
+build_style="dune"
+make_build_args="-p dune-configurator"
+make_install_target="dune-configurator"
+makedepends="ocaml-csexp"
+short_desc="Helper library for gathering system information"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://dune.build/"
+distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz"
+checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

From 7e84df1877a04ce71b6fcb7230ab82f89a36dcc0 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:57:02 -0700
Subject: [PATCH 5/5] 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
  2021-06-22  0:36 ` [PR PATCH] [Updated] " kwshi
  2021-06-22  0:57 ` kwshi
@ 2021-06-22  1:02 ` kwshi
  2021-06-22  2:18 ` kwshi
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  1:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 8360 bytes --]

From 249c48d6daddcad8fd0cec4a364f154302fa2769 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 14:28:15 -0700
Subject: [PATCH 1/5] new package: dune-2.8.5

---
 srcpkgs/dune/template | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 srcpkgs/dune/template

diff --git a/srcpkgs/dune/template b/srcpkgs/dune/template
new file mode 100644
index 000000000000..872998cc2519
--- /dev/null
+++ b/srcpkgs/dune/template
@@ -0,0 +1,22 @@
+# Template file for 'dune'
+pkgname=dune
+version=2.8.5
+revision=1
+build_style="gnu-makefile"
+make_build_target="release"
+makedepends="ocaml"
+short_desc="Composable build system for OCaml"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+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"
+
+post_install() {
+	mv -t "$DESTDIR/usr/share" "$DESTDIR/usr"/{doc,man}
+	vlicense "LICENSE.md"
+}

From 19dfba7cc4e22cb6fd32fea803766ea8fd5a3130 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:25:26 -0700
Subject: [PATCH 2/5] common: add `dune` build-style

---
 common/build-style/dune.sh             | 24 ++++++++++++++++++++++++
 common/environment/build-style/dune.sh |  1 +
 2 files changed, 25 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..17705f8c2106
--- /dev/null
+++ b/common/build-style/dune.sh
@@ -0,0 +1,24 @@
+#
+# This helper is for templates using OCaml's dune build system.
+#
+do_build() {
+  : ${make_build_target:=@install}
+  dune build --release $make_build_args $make_build_target
+}
+
+do_check() {
+  : ${make_check_target:=@runtest}
+	dune build $make_check_args $make_check_target
+}
+
+do_install() {
+  dune install --prefix '/usr' --destdir "$DESTDIR" $make_install_args $make_install_target
+  if [ -e "$DESTDIR/usr/doc" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/doc" "$DESTDIR/usr/share"
+  fi
+  if [ -e "$DESTDIR/usr/man" ]; then
+    mkdir -p "$DESTDIR/usr/share"
+    mv "$DESTDIR/usr/man" "$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 05e59f045b128313fdccf2f61df93496df2075e4 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:28 -0700
Subject: [PATCH 3/5] new package: ocaml-csexp-1.5.1

---
 srcpkgs/ocaml-csexp/template | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 srcpkgs/ocaml-csexp/template

diff --git a/srcpkgs/ocaml-csexp/template b/srcpkgs/ocaml-csexp/template
new file mode 100644
index 000000000000..9507f7a10ce9
--- /dev/null
+++ b/srcpkgs/ocaml-csexp/template
@@ -0,0 +1,17 @@
+# Template file for 'ocaml-csexp'
+pkgname=ocaml-csexp
+version=1.5.1
+revision=1
+wrksrc="csexp-$version"
+build_style="dune"
+short_desc="Minimal support for Canonical S-expressions"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://opam.ocaml.org/packages/csexp/"
+distfiles="https://github.com/ocaml-dune/csexp/archive/refs/tags/$version.tar.gz"
+checksum="ffab41b0b0f65ade305043205229a7649591195cbe86e24f2c254e9dc5b14a34"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

From 0b88cd9733cd45e42e5c26adace57a4c424c7f11 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:26:41 -0700
Subject: [PATCH 4/5] new package: ocaml-dune-configurator-2.8.5

---
 srcpkgs/ocaml-dune-configurator/template | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 srcpkgs/ocaml-dune-configurator/template

diff --git a/srcpkgs/ocaml-dune-configurator/template b/srcpkgs/ocaml-dune-configurator/template
new file mode 100644
index 000000000000..47de83684ab0
--- /dev/null
+++ b/srcpkgs/ocaml-dune-configurator/template
@@ -0,0 +1,20 @@
+# Template file for 'ocaml-dune-configurator'
+pkgname=ocaml-dune-configurator
+version=2.8.5
+revision=1
+wrksrc="dune-$version"
+build_style="dune"
+make_build_args="-p dune-configurator"
+make_install_target="dune-configurator"
+makedepends="ocaml-csexp"
+short_desc="Helper library for gathering system information"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://dune.build/"
+distfiles="https://github.com/ocaml/dune/archive/refs/tags/$version.tar.gz"
+checksum="35ea0326509d6964b4b0f56b86e88cba9b3304f9b6e6322fe98257f73a57fc30"
+nocross="yes"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

From 2417ebe54d08b61134dcb626cef2772c7abfcd2f Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 17:57:02 -0700
Subject: [PATCH 5/5] 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (2 preceding siblings ...)
  2021-06-22  1:02 ` kwshi
@ 2021-06-22  2:18 ` kwshi
  2021-06-22  2:34 ` kwshi
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  2:18 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 7448 bytes --]

From d936792d351fe00d3a708fa1ea5ab32c5ac0ce14 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 18:27:24 -0700
Subject: [PATCH 1/4] New package: dune-2.8.5

---
 srcpkgs/dune/template | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 srcpkgs/dune/template

diff --git a/srcpkgs/dune/template b/srcpkgs/dune/template
new file mode 100644
index 000000000000..4ca94aece1ff
--- /dev/null
+++ b/srcpkgs/dune/template
@@ -0,0 +1,27 @@
+# Template file for 'dune'
+pkgname=dune
+version=2.8.5
+revision=1
+build_style="dune"
+make_cmd="./dune.exe" # use local bootstrapping version of dune
+make_build_args="--only-packages=dune --profile=dune-bootstrap"
+make_install_target="dune"
+makedepends="ocaml"
+short_desc="Composable build system for OCaml"
+maintainer="Kye Shi <shi.kye@gmail.com>"
+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"
+
+pre_build() {
+	ocaml "bootstrap.ml"
+}
+
+post_install() {
+	vlicense "LICENSE.md"
+}

From 2356f38abb91c02d6aa86e657ea441088d67fbee Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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..d5b9969a1b44
--- /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 $make_build_args $make_build_target
+}
+
+do_check() {
+  : ${make_cmd:=dune}
+  : ${make_check_target:=@runtest}
+
+	"${make_cmd}" build $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 7ccb7ad34bf4b2d6c745a59475bfb4e769a1e4ec Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 692db9d087a21f9696510b51bd53cb84fdad24e8 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 19:18:08 -0700
Subject: [PATCH 4/4] new package: ocaml-sexplib-0.14.0

---
 srcpkgs/ocaml-sexplib0/template | 16 ++++++++++++++++
 1 file changed, 16 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..c6a27ef3b07d
--- /dev/null
+++ b/srcpkgs/ocaml-sexplib0/template
@@ -0,0 +1,16 @@
+# 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 <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://github.com/janestreet/sexplib0"
+distfiles="https://github.com/janestreet/sexplib0/archive/refs/tags/v$version.tar.gz"
+checksum="1e2d1c27015809d816d1c707abfbc61f6b55830dedec01de8152d10ab7d6a19e"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (3 preceding siblings ...)
  2021-06-22  2:18 ` kwshi
@ 2021-06-22  2:34 ` kwshi
  2021-06-22  2:36 ` kwshi
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  2:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 7521 bytes --]

From 460094228b03b6d2e023778f9e94c1faa0b31cae Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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..01c0e2c21230
--- /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 <shi.kye@gmail.com>"
+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 -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 e903496972692174f27cc072d7be09a17187d0b1 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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..d5b9969a1b44
--- /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 $make_build_args $make_build_target
+}
+
+do_check() {
+  : ${make_cmd:=dune}
+  : ${make_check_target:=@runtest}
+
+	"${make_cmd}" build $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 f9167d6f01607b5ed566646625621fbcb35647a6 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 013dc04957304389b5f1e8d8cffaf7d615444b90 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 19:18:08 -0700
Subject: [PATCH 4/4] new package: ocaml-sexplib-0.14.0

---
 srcpkgs/ocaml-sexplib0/template | 16 ++++++++++++++++
 1 file changed, 16 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..c6a27ef3b07d
--- /dev/null
+++ b/srcpkgs/ocaml-sexplib0/template
@@ -0,0 +1,16 @@
+# 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 <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://github.com/janestreet/sexplib0"
+distfiles="https://github.com/janestreet/sexplib0/archive/refs/tags/v$version.tar.gz"
+checksum="1e2d1c27015809d816d1c707abfbc61f6b55830dedec01de8152d10ab7d6a19e"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (4 preceding siblings ...)
  2021-06-22  2:34 ` kwshi
@ 2021-06-22  2:36 ` kwshi
  2021-06-22  2:41 ` kwshi
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  2:36 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 7566 bytes --]

From cb02f6d0fef58a19e4cf9b3fad10c0f7251ab4fc Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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..fd3e919f5dcc
--- /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 <shi.kye@gmail.com>"
+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 -j "$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 1b123bb48988f825fbf479e3d68b5a40003405db Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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..b90c712987df
--- /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 -j "$makejobs" --release $make_build_args $make_build_target
+}
+
+do_check() {
+  : ${make_cmd:=dune}
+  : ${make_check_target:=@runtest}
+
+	"${make_cmd}" build -j "$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 6146fc00f1617971be01f594ac3a0d27a00ef026 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 8aa4cca3cb48f25341398684bf6591969f91c4e4 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 19:18:08 -0700
Subject: [PATCH 4/4] new package: ocaml-sexplib-0.14.0

---
 srcpkgs/ocaml-sexplib0/template | 16 ++++++++++++++++
 1 file changed, 16 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..c6a27ef3b07d
--- /dev/null
+++ b/srcpkgs/ocaml-sexplib0/template
@@ -0,0 +1,16 @@
+# 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 <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://github.com/janestreet/sexplib0"
+distfiles="https://github.com/janestreet/sexplib0/archive/refs/tags/v$version.tar.gz"
+checksum="1e2d1c27015809d816d1c707abfbc61f6b55830dedec01de8152d10ab7d6a19e"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (5 preceding siblings ...)
  2021-06-22  2:36 ` kwshi
@ 2021-06-22  2:41 ` kwshi
  2021-06-22  2:45 ` kwshi
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  2:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 7551 bytes --]

From 696f2ef31f587b77cc6d9fc9a05f98e588fe4021 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 <shi.kye@gmail.com>"
+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 e99b25b4644132b096c4a89dc480e00ee764ec51 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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..51affdc3a4ac
--- /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 766317c171df5c94e637bf0d1d6b2c730ddb3780 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 222fc3de630e42097a879ee632c17712e3d367eb Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 19:18:08 -0700
Subject: [PATCH 4/4] new package: ocaml-sexplib-0.14.0

---
 srcpkgs/ocaml-sexplib0/template | 16 ++++++++++++++++
 1 file changed, 16 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..c6a27ef3b07d
--- /dev/null
+++ b/srcpkgs/ocaml-sexplib0/template
@@ -0,0 +1,16 @@
+# 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 <shi.kye@gmail.com>"
+license="MIT"
+homepage="https://github.com/janestreet/sexplib0"
+distfiles="https://github.com/janestreet/sexplib0/archive/refs/tags/v$version.tar.gz"
+checksum="1e2d1c27015809d816d1c707abfbc61f6b55830dedec01de8152d10ab7d6a19e"
+
+post_install() {
+	vlicense "LICENSE.md"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml build system), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (6 preceding siblings ...)
  2021-06-22  2:41 ` kwshi
@ 2021-06-22  2:45 ` kwshi
  2021-06-22  2:54 ` [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml builder), " kwshi
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  2:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml build system), `dune` build-style
- new package: dune-2.8.5
- common: add `dune` build-style
- new package: ocaml-csexp-1.5.1
- new package: ocaml-dune-configurator-2.8.5

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added two packages `ocaml-csexp` and `ocaml-dune-configurator`, which build using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 7567 bytes --]

From 696f2ef31f587b77cc6d9fc9a05f98e588fe4021 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 <shi.kye@gmail.com>"
+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 e99b25b4644132b096c4a89dc480e00ee764ec51 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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..51affdc3a4ac
--- /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 766317c171df5c94e637bf0d1d6b2c730ddb3780 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 7d69b647a568971e848b26cf3b5e735610f1b90d Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 <shi.kye@gmail.com>"
+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"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml builder), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (7 preceding siblings ...)
  2021-06-22  2:45 ` kwshi
@ 2021-06-22  2:54 ` kwshi
  2021-06-22 19:56 ` kwshi
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22  2:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml builder), `dune` build-style

<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) OCaml build system, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added `ocaml-sexplib0`, which builds using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 7542 bytes --]

From 696f2ef31f587b77cc6d9fc9a05f98e588fe4021 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 <shi.kye@gmail.com>"
+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 <shi.kye@gmail.com>
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 <shi.kye@gmail.com>
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 <shi.kye@gmail.com>
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 <shi.kye@gmail.com>"
+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"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml builder), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (8 preceding siblings ...)
  2021-06-22  2:54 ` [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml builder), " kwshi
@ 2021-06-22 19:56 ` kwshi
  2021-12-30  1:46 ` kwshi
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-06-22 19:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2041 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml builder), `dune` build-style
<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) build system for OCaml projects, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added `ocaml-sexplib0`, which builds using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 7543 bytes --]

From 696f2ef31f587b77cc6d9fc9a05f98e588fe4021 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
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 <shi.kye@gmail.com>"
+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 <shi.kye@gmail.com>
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 <shi.kye@gmail.com>
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 55b5581b12f2b137beef64e377d3daf4fddffedd Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 19:18:08 -0700
Subject: [PATCH 4/4] new package: ocaml-sexplib0-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 <shi.kye@gmail.com>"
+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"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml builder), `dune` build-style
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (9 preceding siblings ...)
  2021-06-22 19:56 ` kwshi
@ 2021-12-30  1:46 ` kwshi
  2022-05-23  2:12 ` common/build-style: add `dune` (OCaml builder) github-actions
  2022-06-06  2:14 ` [PR PATCH] [Closed]: " github-actions
  12 siblings, 0 replies; 14+ messages in thread
From: kwshi @ 2021-12-30  1:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2041 bytes --]

There is an updated pull request by kwshi against master on the void-packages repository

https://github.com/kwshi/void-packages dune
https://github.com/void-linux/void-packages/pull/31601

New package: dune-2.8.5 (OCaml builder), `dune` build-style
<!-- Mark items with [x] where applicable -->

This PR adds the [Dune](https://dune.build/) build system for OCaml projects, somewhat analogous to Cargo for Rust, Stack for Haskell, etc.; it is considered "the" modern OCaml build system & most widely used for OCaml projects. I've also defined a `dune.sh` build style for simplifying OCaml source builds. To make sure it works/demo its use, I've also added `ocaml-sexplib0`, which builds using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/31601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-dune-31601.patch --]
[-- Type: text/x-diff, Size: 6062 bytes --]

From aec910eaa10edb0197de129e414e817b6c0a5238 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 18:27:45 -0700
Subject: [PATCH 1/3] 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 e2e333b378373a9d5485e8342b79161dfa06653d Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 18:27:54 -0700
Subject: [PATCH 2/3] 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 042f0e18ae5d..2a7ba1ac8c48 100644
--- a/Manual.md
+++ b/Manual.md
@@ -585,18 +585,22 @@ or `gnu-makefile`, this is the target passed to `${make_cmd}` in the build phase
 when unset the default target is used.
 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
@@ -920,6 +924,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 36477c4a54bbea1fe1080630646b1f8927675296 Mon Sep 17 00:00:00 2001
From: Kye Shi <shi.kye@gmail.com>
Date: Mon, 21 Jun 2021 19:18:08 -0700
Subject: [PATCH 3/3] new package: ocaml-sexplib0-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 <shi.kye@gmail.com>"
+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"
+}

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: common/build-style: add `dune` (OCaml builder)
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (10 preceding siblings ...)
  2021-12-30  1:46 ` kwshi
@ 2022-05-23  2:12 ` github-actions
  2022-06-06  2:14 ` [PR PATCH] [Closed]: " github-actions
  12 siblings, 0 replies; 14+ messages in thread
From: github-actions @ 2022-05-23  2:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/31601#issuecomment-1134091744

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PR PATCH] [Closed]: common/build-style: add `dune` (OCaml builder)
  2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
                   ` (11 preceding siblings ...)
  2022-05-23  2:12 ` common/build-style: add `dune` (OCaml builder) github-actions
@ 2022-06-06  2:14 ` github-actions
  12 siblings, 0 replies; 14+ messages in thread
From: github-actions @ 2022-06-06  2:14 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1860 bytes --]

There's a closed pull request on the void-packages repository

common/build-style: add `dune` (OCaml builder)
https://github.com/void-linux/void-packages/pull/31601

Description:
<!-- Mark items with [x] where applicable -->

This PR defines a `dune.sh` build style to streamline OCaml builds using the [Dune](https://dune.build) builder.  Its purpose is analogous to the `cargo` build style for Rust projects, or `python3-module` build style for Python setup.py projects, etc.

As an example showing how it works, I've also added `ocaml-sexplib0` (a common sexp library for OCaml), which builds using `build_style=dune`.

#### General

- [x] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?

- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!--
#### Does it build and run successfully?
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-06-06  2:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  0:34 [PR PATCH] New package: dune-2.8.5 (OCaml build system), `dune` build-style kwshi
2021-06-22  0:36 ` [PR PATCH] [Updated] " kwshi
2021-06-22  0:57 ` kwshi
2021-06-22  1:02 ` kwshi
2021-06-22  2:18 ` kwshi
2021-06-22  2:34 ` kwshi
2021-06-22  2:36 ` kwshi
2021-06-22  2:41 ` kwshi
2021-06-22  2:45 ` kwshi
2021-06-22  2:54 ` [PR PATCH] [Updated] New package: dune-2.8.5 (OCaml builder), " kwshi
2021-06-22 19:56 ` kwshi
2021-12-30  1:46 ` kwshi
2022-05-23  2:12 ` common/build-style: add `dune` (OCaml builder) github-actions
2022-06-06  2:14 ` [PR PATCH] [Closed]: " github-actions

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).