Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] New package: rundird-0.1.0
@ 2021-03-07 10:59 ifreund
  2021-03-07 11:01 ` [PR PATCH] [Updated] " ifreund
                   ` (69 more replies)
  0 siblings, 70 replies; 71+ messages in thread
From: ifreund @ 2021-03-07 10:59 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 60fac88bf6291c26a5502f6d2cb708b09471d50a Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH] New package: rundird-0.1.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 00000000000..df06fdb0fc8
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 00000000000..09f95024f0b
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,25 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.0
+revision=1
+hostmakedepends="zig"
+makedepends="pam-devel"
+depends=""
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=abee60719b1904db3a127b7a3f054ab5fa7b17a968107127ced494230d1718af
+
+do_build() {
+	zig build -Drelease-safe
+}
+
+do_install() {
+	zig build -Drelease-safe --prefix "${DESTDIR}/usr" install
+}
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
@ 2021-03-07 11:01 ` ifreund
  2021-03-08  6:34 ` ericonr
                   ` (68 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-03-07 11:01 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 2637207057ed5a7f1511ca5479b1377bf75168a9 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH] New package: rundird-0.1.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..68466c31d229
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,24 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.0
+revision=1
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=abee60719b1904db3a127b7a3f054ab5fa7b17a968107127ced494230d1718af
+
+do_build() {
+	zig build -Drelease-safe
+}
+
+do_install() {
+	zig build -Drelease-safe --prefix "${DESTDIR}/usr" install
+}
+
+post_install() {
+	vsv rundird
+}

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
  2021-03-07 11:01 ` [PR PATCH] [Updated] " ifreund
@ 2021-03-08  6:34 ` ericonr
  2021-03-11  9:15 ` travankor
                   ` (67 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-03-08  6:34 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-792507274

Comment:
It would be nice if it could do cross :)

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
  2021-03-07 11:01 ` [PR PATCH] [Updated] " ifreund
  2021-03-08  6:34 ` ericonr
@ 2021-03-11  9:15 ` travankor
  2021-03-11  9:16 ` travankor
                   ` (66 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: travankor @ 2021-03-11  9:15 UTC (permalink / raw)
  To: ml

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

New comment by travankor on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-796590192

Comment:
>It would be nice if it could do cross :)

blocked on #25004 ?

hopefully, not a blocker for initial packaging

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (2 preceding siblings ...)
  2021-03-11  9:15 ` travankor
@ 2021-03-11  9:16 ` travankor
  2021-03-11 13:10 ` ericonr
                   ` (65 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: travankor @ 2021-03-11  9:16 UTC (permalink / raw)
  To: ml

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

New comment by travankor on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-796590192

Comment:
>It would be nice if it could do cross :)

blocked on #25004 ?

hopefully, cross is not a blocker for initial packaging

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (3 preceding siblings ...)
  2021-03-11  9:16 ` travankor
@ 2021-03-11 13:10 ` ericonr
  2021-03-11 13:39 ` travankor
                   ` (64 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-03-11 13:10 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-796724400

Comment:
I don't think so. That PR is about cross compiling the compiler, not projects using zig...

And the template here isn't trying to pass any targets or anything, so the fix might even be a simple one.

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (4 preceding siblings ...)
  2021-03-11 13:10 ` ericonr
@ 2021-03-11 13:39 ` travankor
  2021-03-11 13:45 ` travankor
                   ` (63 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: travankor @ 2021-03-11 13:39 UTC (permalink / raw)
  To: ml

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

New comment by travankor on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-796742186

Comment:
oh woops, sorry

This is what happens when you only look at the PR title.

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (5 preceding siblings ...)
  2021-03-11 13:39 ` travankor
@ 2021-03-11 13:45 ` travankor
  2021-03-11 13:45 ` travankor
                   ` (62 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: travankor @ 2021-03-11 13:45 UTC (permalink / raw)
  To: ml

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

New comment by travankor on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-796742186

Comment:
oh woops, sorry

This is what happens when you only look at the PR title.

edit: maybe `zig build -target ${XBPS_CROSS_TRIPLET -Drelease-safe` ?

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (6 preceding siblings ...)
  2021-03-11 13:45 ` travankor
@ 2021-03-11 13:45 ` travankor
  2021-05-24 19:07 ` [PR PATCH] [Updated] " ifreund
                   ` (61 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: travankor @ 2021-03-11 13:45 UTC (permalink / raw)
  To: ml

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

New comment by travankor on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-796742186

Comment:
oh woops, sorry

This is what happens when you only look at the PR title.

edit: maybe `zig build -target ${XBPS_CROSS_TRIPLET} -Drelease-safe` ?

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (7 preceding siblings ...)
  2021-03-11 13:45 ` travankor
@ 2021-05-24 19:07 ` ifreund
  2021-06-07 20:39 ` ifreund
                   ` (60 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-05-24 19:07 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 8daabc3a415d669f211fd99fde4d91d295eed57f Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH 1/2] New package: rundird-0.1.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..68466c31d229
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,24 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.0
+revision=1
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=abee60719b1904db3a127b7a3f054ab5fa7b17a968107127ced494230d1718af
+
+do_build() {
+	zig build -Drelease-safe
+}
+
+do_install() {
+	zig build -Drelease-safe --prefix "${DESTDIR}/usr" install
+}
+
+post_install() {
+	vsv rundird
+}

From 2e5ca32400983250cc13fcfa030cec34246f4279 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Mon, 24 May 2021 21:06:48 +0200
Subject: [PATCH 2/2] rundird: update to 0.1.1.

---
 srcpkgs/rundird/template | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
index 68466c31d229..45ea6b0d0ac4 100644
--- a/srcpkgs/rundird/template
+++ b/srcpkgs/rundird/template
@@ -1,15 +1,18 @@
 # Template file for 'rundird'
 pkgname=rundird
-version=0.1.0
+_commit=6a1889eeb807f8062b27c7befd14f092c19a887d
+version=0.1.1
 revision=1
+wrksrc="rundird-${_commit}"
 hostmakedepends="zig"
 makedepends="pam-devel"
 short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
 maintainer="Isaac Freund <ifreund@ifreund.xyz>"
 license="GPL-3.0-or-later"
 homepage="https://github.com/ifreund/rundird"
-distfiles="${homepage}/archive/v${version}.tar.gz"
-checksum=abee60719b1904db3a127b7a3f054ab5fa7b17a968107127ced494230d1718af
+#distfiles="${homepage}/archive/v${version}.tar.gz"
+distfiles="${homepage}/archive/${_commit}.tar.gz"
+checksum=2c7da32d9f783a96e218c54cce4c64600d9d0d959682968996462090e87fca19
 
 do_build() {
 	zig build -Drelease-safe

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (8 preceding siblings ...)
  2021-05-24 19:07 ` [PR PATCH] [Updated] " ifreund
@ 2021-06-07 20:39 ` ifreund
  2021-06-10  2:19 ` ifreund
                   ` (59 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-07 20:39 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From f45c4fc2865eb21468883c6aba305196c51fa9bb Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH] New package: rundird-0.1.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..2f0113459e4b
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,24 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+do_build() {
+	zig build -Drelease-safe
+}
+
+do_install() {
+	DESTDIR="${DESTDIR}" zig build -Drelease-safe --prefix /usr install
+}
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (9 preceding siblings ...)
  2021-06-07 20:39 ` ifreund
@ 2021-06-10  2:19 ` ifreund
  2021-06-10  3:10 ` ifreund
                   ` (58 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-10  2:19 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 8576b493acc684eaf104100d62710e45953cba41 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH] New package: rundird-0.1.1

cross
---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c7586a81b7b7
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,23 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+do_install() {
+	DESTDIR="${DESTDIR}" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		-Dtarget="${XBPS_TARGET_MACHINE%-musl}-linux-${XBPS_LIBC}" \
+		-Drelease-safe --prefix /usr install
+}
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (10 preceding siblings ...)
  2021-06-10  2:19 ` ifreund
@ 2021-06-10  3:10 ` ifreund
  2021-06-10  4:26 ` ifreund
                   ` (57 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-10  3:10 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 2cec37708ad22fefa7ecfb29add5b7a8de5dd221 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH] New package: rundird-0.1.1

---
 common/build-style/zig.sh         | 22 ++++++++++++++++++++++
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 common/build-style/zig.sh
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/common/build-style/zig.sh b/common/build-style/zig.sh
new file mode 100644
index 000000000000..2fa0426debbd
--- /dev/null
+++ b/common/build-style/zig.sh
@@ -0,0 +1,22 @@
+do_build() {
+	local zig_target_abi
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_target_abi="gnu";;
+		musl) zig_target_abi="musl";;
+	esac
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		-Dtarget="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_target_abi}" \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5c7ab5408adf
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (11 preceding siblings ...)
  2021-06-10  3:10 ` ifreund
@ 2021-06-10  4:26 ` ifreund
  2021-06-10  4:31 ` ifreund
                   ` (56 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-10  4:26 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From c4dca57a5191dd6b3f63444b61899c8980b2251e Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH] New package: rundird-0.1.1

---
 common/build-style/zig.sh         | 22 ++++++++++++++++++++++
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 common/build-style/zig.sh
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/common/build-style/zig.sh b/common/build-style/zig.sh
new file mode 100644
index 000000000000..2fa0426debbd
--- /dev/null
+++ b/common/build-style/zig.sh
@@ -0,0 +1,22 @@
+do_build() {
+	local zig_target_abi
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_target_abi="gnu";;
+		musl) zig_target_abi="musl";;
+	esac
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		-Dtarget="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_target_abi}" \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5c7ab5408adf
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (12 preceding siblings ...)
  2021-06-10  4:26 ` ifreund
@ 2021-06-10  4:31 ` ifreund
  2021-06-17  1:40 ` ifreund
                   ` (55 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-10  4:31 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 191fd5ffb2646811e27e1f6e1228068faacdd10c Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Sun, 7 Mar 2021 11:48:45 +0100
Subject: [PATCH] New package: rundird-0.1.1

---
 common/build-style/zig.sh         | 30 ++++++++++++++++++++++++++++++
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 3 files changed, 49 insertions(+)
 create mode 100644 common/build-style/zig.sh
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/common/build-style/zig.sh b/common/build-style/zig.sh
new file mode 100644
index 000000000000..49d7aea742b4
--- /dev/null
+++ b/common/build-style/zig.sh
@@ -0,0 +1,30 @@
+do_build() {
+	local zig_target
+	local zig_cpu
+	case $XBPS_TARGET_MACHINE in
+		aarch64-musl|i686-musl|x86_64-musl)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-musl" zig_cpu="generic";;
+		aarch64|i686|x86_64)
+			zig_target="${XBPS_TARGET_MACHINE}-linux-gnu" zig_cpu="generic";;
+		armv6l-musl) zig_target="arm-linux-musl" zig_cpu="generic+v6";;
+		armv6l) zig_target="arm-linux-gnu" zig_cpu="generic+v6";;
+		armv7l-musl) zig_target="arm-linux-musl" zig_cpu="generic+v7a";;
+		armv7l) zig_target="arm-linux-gnu" zig_cpu="generic+v7a";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5c7ab5408adf
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (13 preceding siblings ...)
  2021-06-10  4:31 ` ifreund
@ 2021-06-17  1:40 ` ifreund
  2021-06-17  1:49 ` ifreund
                   ` (54 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-17  1:40 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From e70cec021058e226ab38d1cd37309c90af918f41 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:38:36 +0000
Subject: [PATCH 1/2] build-styles: add zig build

This requires backporting a patch to upstream zig that has been landed
in the 0.8.x branch upstream and will be included in the 0.8.1 release
in order to get zig cross-compilation integrated with xbps-src.
---
 common/build-style/zig-build.sh               | 41 ++++++++++++
 ...01-zig-build-add-libc-general-option.patch | 65 +++++++++++++++++++
 srcpkgs/zig/template                          |  3 +-
 3 files changed, 108 insertions(+), 1 deletion(-)
 create mode 100644 common/build-style/zig-build.sh
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..97918c4808d2
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target
+	local zig_cpu
+	case $XBPS_TARGET_MACHINE in
+		aarch64-musl|i686-musl|x86_64-musl)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-musl" zig_cpu="baseline";;
+		aarch64|i686|x86_64)
+			zig_target="${XBPS_TARGET_MACHINE}-linux-gnu" zig_cpu="baseline";;
+		armv6l-musl) zig_target="arm-linux-musl" zig_cpu="generic+v6";;
+		armv6l) zig_target="arm-linux-gnu" zig_cpu="generic+v6";;
+		armv7l-musl) zig_target="arm-linux-musl" zig_cpu="generic+v7a";;
+		armv7l) zig_target="arm-linux-gnu" zig_cpu="generic+v7a";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > /tmp/zig_libc.txt <<EOF
+include_dir=${XBPS_CROSS_BASE}/usr/include
+sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+crt_dir=${XBPS_CROSS_BASE}/usr/lib
+msvc_lib_dir=
+kernel32_lib_dir=
+gcc_dir=
+EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		--libc /tmp/zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..04a8e7adfb10
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From fd3c7ba42ec021917951a57e2f20f45ffe677368 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..366444235 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..4af7c098c384 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
@@ -14,6 +14,7 @@ distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
 nopie=yes
 nocross=yes
+patch_args=-Np1
 
 export CMAKE_GENERATOR="Unix Makefiles"
 

From 8544b340d9cabf943f85a93059b2e9a6c5c6a694 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 2/2] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (14 preceding siblings ...)
  2021-06-17  1:40 ` ifreund
@ 2021-06-17  1:49 ` ifreund
  2021-06-17  3:07 ` [PR REVIEW] " ericonr
                   ` (53 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-17  1:49 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From c374e4ef1cd6a68621d86d89cf085a49ea223e28 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:38:36 +0000
Subject: [PATCH 1/2] build-styles: add zig build

This requires backporting a patch to upstream zig that has been landed
in the 0.8.x branch upstream and will be included in the 0.8.1 release
in order to get zig cross-compilation integrated with xbps-src.
---
 common/build-style/zig-build.sh               | 41 ++++++++++++
 ...01-zig-build-add-libc-general-option.patch | 65 +++++++++++++++++++
 srcpkgs/zig/template                          |  3 +-
 3 files changed, 108 insertions(+), 1 deletion(-)
 create mode 100644 common/build-style/zig-build.sh
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..97918c4808d2
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target
+	local zig_cpu
+	case $XBPS_TARGET_MACHINE in
+		aarch64-musl|i686-musl|x86_64-musl)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-musl" zig_cpu="baseline";;
+		aarch64|i686|x86_64)
+			zig_target="${XBPS_TARGET_MACHINE}-linux-gnu" zig_cpu="baseline";;
+		armv6l-musl) zig_target="arm-linux-musl" zig_cpu="generic+v6";;
+		armv6l) zig_target="arm-linux-gnu" zig_cpu="generic+v6";;
+		armv7l-musl) zig_target="arm-linux-musl" zig_cpu="generic+v7a";;
+		armv7l) zig_target="arm-linux-gnu" zig_cpu="generic+v7a";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > /tmp/zig_libc.txt <<EOF
+include_dir=${XBPS_CROSS_BASE}/usr/include
+sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+crt_dir=${XBPS_CROSS_BASE}/usr/lib
+msvc_lib_dir=
+kernel32_lib_dir=
+gcc_dir=
+EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		--libc /tmp/zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..04a8e7adfb10
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From fd3c7ba42ec021917951a57e2f20f45ffe677368 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..366444235 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..4af7c098c384 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
@@ -14,6 +14,7 @@ distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
 nopie=yes
 nocross=yes
+patch_args=-Np1
 
 export CMAKE_GENERATOR="Unix Makefiles"
 

From 09cc749015d2427cc7cec9a9d025f808e50d6a4d Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 2/2] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (19 preceding siblings ...)
  2021-06-17  3:07 ` ericonr
@ 2021-06-17  3:07 ` ericonr
  2021-06-17  3:07 ` ericonr
                   ` (48 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-06-17  3:07 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653191844

Comment:
Following how this is done for other build styles, should probably be a `xbps_zig_libc.txt` file in the current directory, not `/tmp`

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (16 preceding siblings ...)
  2021-06-17  3:07 ` [PR REVIEW] " ericonr
@ 2021-06-17  3:07 ` ericonr
  2021-06-17  3:07 ` ericonr
                   ` (51 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-06-17  3:07 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653191576

Comment:
I wonder if for all archs you couldn't do something like `armv7l*)` then have a conditional for `XBPS_TARGET_LIBC` to append `-linux-gnu` or `-linux-musl`?

Would be a tad cleaner.

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (17 preceding siblings ...)
  2021-06-17  3:07 ` ericonr
@ 2021-06-17  3:07 ` ericonr
  2021-06-17  3:07 ` ericonr
                   ` (50 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-06-17  3:07 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653191676

Comment:
Why not add ppc already? Not supported upstream yet or just not implemented?

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (15 preceding siblings ...)
  2021-06-17  1:49 ` ifreund
@ 2021-06-17  3:07 ` ericonr
  2021-06-17  3:07 ` ericonr
                   ` (52 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-06-17  3:07 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653192066

Comment:
`zig` package fixes should be a separate commit.

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (18 preceding siblings ...)
  2021-06-17  3:07 ` ericonr
@ 2021-06-17  3:07 ` ericonr
  2021-06-17  3:07 ` ericonr
                   ` (49 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-06-17  3:07 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653191106

Comment:
Can use `<<-EOF` to allow the block to be indented.

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (20 preceding siblings ...)
  2021-06-17  3:07 ` ericonr
@ 2021-06-17  3:07 ` ericonr
  2021-06-17 17:41 ` [PR PATCH] [Updated] " ifreund
                   ` (47 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-06-17  3:07 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653192230

Comment:
Why `zig-build` and not just `zig`? Because the command used is `zig build`?

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (21 preceding siblings ...)
  2021-06-17  3:07 ` ericonr
@ 2021-06-17 17:41 ` ifreund
  2021-06-17 17:43 ` [PR REVIEW] " ifreund
                   ` (46 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-17 17:41 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 7b4b59733cef0929a4afc3e9617ee6c50b2146e9 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport upstream commit fb0ecdb

This patch is required in order to integrate zig's crosscompilation
features with xbps when using the zig build system. It has also landed
in the 0.8.x branch upstream and will be included in the 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch | 65 +++++++++++++++++++
 srcpkgs/zig/template                          |  3 +-
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..04a8e7adfb10
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From fd3c7ba42ec021917951a57e2f20f45ffe677368 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..366444235 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..4af7c098c384 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
@@ -14,6 +14,7 @@ distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
 nopie=yes
 nocross=yes
+patch_args=-Np1
 
 export CMAKE_GENERATOR="Unix Makefiles"
 

From 20a4b9b0c3b708bedf5c9b01d44c7f21ed1beddb Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..91bf52443d66
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From 3f114b56cc9a8b94bcdb79dc099a98509cd8d5eb Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (22 preceding siblings ...)
  2021-06-17 17:41 ` [PR PATCH] [Updated] " ifreund
@ 2021-06-17 17:43 ` ifreund
  2021-06-17 17:43 ` ifreund
                   ` (45 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-17 17:43 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653800499

Comment:
I was just being lazy. Upstream zig has at least some level of support for everything xbps can target. Added the ppc variants to this switch and will add others when I have time though I don't have a good way to test them.

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (23 preceding siblings ...)
  2021-06-17 17:43 ` [PR REVIEW] " ifreund
@ 2021-06-17 17:43 ` ifreund
  2021-06-17 19:23 ` ericonr
                   ` (44 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-17 17:43 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653801105

Comment:
From the new commit message:

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.

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

* Re: [PR REVIEW] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (24 preceding siblings ...)
  2021-06-17 17:43 ` ifreund
@ 2021-06-17 19:23 ` ericonr
  2021-06-17 20:16 ` [PR PATCH] [Updated] " ifreund
                   ` (43 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-06-17 19:23 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r653870476

Comment:
That makes sense, thanks :)

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (25 preceding siblings ...)
  2021-06-17 19:23 ` ericonr
@ 2021-06-17 20:16 ` ifreund
  2021-06-17 20:22 ` ifreund
                   ` (42 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-17 20:16 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 7b4b59733cef0929a4afc3e9617ee6c50b2146e9 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/4] zig: backport upstream commit fb0ecdb

This patch is required in order to integrate zig's crosscompilation
features with xbps when using the zig build system. It has also landed
in the 0.8.x branch upstream and will be included in the 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch | 65 +++++++++++++++++++
 srcpkgs/zig/template                          |  3 +-
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..04a8e7adfb10
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From fd3c7ba42ec021917951a57e2f20f45ffe677368 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..366444235 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..4af7c098c384 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
@@ -14,6 +14,7 @@ distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
 nopie=yes
 nocross=yes
+patch_args=-Np1
 
 export CMAKE_GENERATOR="Unix Makefiles"
 

From 20a4b9b0c3b708bedf5c9b01d44c7f21ed1beddb Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/4] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..91bf52443d66
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix $XBPS_CROSS_BASE \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From 3f114b56cc9a8b94bcdb79dc099a98509cd8d5eb Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/4] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

From 08427c7c8eed0f5fc02c05435255f92902ba877a Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 20:16:28 +0000
Subject: [PATCH 4/4] f

---
 common/build-style/zig-build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
index 91bf52443d66..9cf4a66a6a3d 100644
--- a/common/build-style/zig-build.sh
+++ b/common/build-style/zig-build.sh
@@ -38,7 +38,7 @@ do_build() {
 	# We use zig-out to avoid path conflicts as it is the default install
 	# prefix used by the zig build system.
 	DESTDIR="zig-out" zig build \
-		--search-prefix $XBPS_CROSS_BASE \
+		--search-prefix "${XBPS_CROSS_BASE}/usr" \
 		--libc xbps_zig_libc.txt \
 		-Dtarget=$zig_target -Dcpu=$zig_cpu \
 		-Drelease-safe --prefix /usr install

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (26 preceding siblings ...)
  2021-06-17 20:16 ` [PR PATCH] [Updated] " ifreund
@ 2021-06-17 20:22 ` ifreund
  2021-06-18  0:21 ` ifreund
                   ` (41 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-17 20:22 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 7b4b59733cef0929a4afc3e9617ee6c50b2146e9 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport upstream commit fb0ecdb

This patch is required in order to integrate zig's crosscompilation
features with xbps when using the zig build system. It has also landed
in the 0.8.x branch upstream and will be included in the 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch | 65 +++++++++++++++++++
 srcpkgs/zig/template                          |  3 +-
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..04a8e7adfb10
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From fd3c7ba42ec021917951a57e2f20f45ffe677368 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..366444235 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..4af7c098c384 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
@@ -14,6 +14,7 @@ distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
 nopie=yes
 nocross=yes
+patch_args=-Np1
 
 export CMAKE_GENERATOR="Unix Makefiles"
 

From 2c382a3b61b67c9b64a2a47bc752bc300681be67 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..9cf4a66a6a3d
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix "${XBPS_CROSS_BASE}/usr" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From e81d98f4509563dacdf6bf8e107b71df097813fd Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (27 preceding siblings ...)
  2021-06-17 20:22 ` ifreund
@ 2021-06-18  0:21 ` ifreund
  2021-06-21 21:08 ` ifreund
                   ` (40 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-18  0:21 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 7b4b59733cef0929a4afc3e9617ee6c50b2146e9 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/4] zig: backport upstream commit fb0ecdb

This patch is required in order to integrate zig's crosscompilation
features with xbps when using the zig build system. It has also landed
in the 0.8.x branch upstream and will be included in the 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch | 65 +++++++++++++++++++
 srcpkgs/zig/template                          |  3 +-
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..04a8e7adfb10
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From fd3c7ba42ec021917951a57e2f20f45ffe677368 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..366444235 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..4af7c098c384 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
@@ -14,6 +14,7 @@ distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
 nopie=yes
 nocross=yes
+patch_args=-Np1
 
 export CMAKE_GENERATOR="Unix Makefiles"
 

From 2c382a3b61b67c9b64a2a47bc752bc300681be67 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/4] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..9cf4a66a6a3d
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--search-prefix "${XBPS_CROSS_BASE}/usr" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From e81d98f4509563dacdf6bf8e107b71df097813fd Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/4] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

From 83dda10d956f4c8df5b37d930316109348f37b01 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Fri, 18 Jun 2021 00:20:39 +0000
Subject: [PATCH 4/4] Make zig build verbose for debugging

---
 common/build-style/zig-build.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
index 9cf4a66a6a3d..9c68826994e1 100644
--- a/common/build-style/zig-build.sh
+++ b/common/build-style/zig-build.sh
@@ -40,6 +40,7 @@ do_build() {
 	DESTDIR="zig-out" zig build \
 		--search-prefix "${XBPS_CROSS_BASE}/usr" \
 		--libc xbps_zig_libc.txt \
+		--verbose --verbose-link \
 		-Dtarget=$zig_target -Dcpu=$zig_cpu \
 		-Drelease-safe --prefix /usr install
 }

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (28 preceding siblings ...)
  2021-06-18  0:21 ` ifreund
@ 2021-06-21 21:08 ` ifreund
  2021-06-21 21:09 ` ifreund
                   ` (39 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-21 21:08 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From dab3b916fe2680fb22049d464f698093bc4fb348 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport 3 upstream commits

These patches are required in order to integrate zig's crosscompilation
features with xbps when using the zig build system.

FIXME: following is only true for the --libc patch

It has also landed in the 0.8.x branch upstream and will be included in the 0.8.1 release.
---
 .../0001-stage2-add-sysroot-link-option.patch | 120 ++++++++++++++++++
 ...std-build-add-sysroot-general-option.patch |  61 +++++++++
 ...03-zig-build-add-libc-general-option.patch |  65 ++++++++++
 srcpkgs/zig/template                          |   3 +-
 4 files changed, 248 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
 create mode 100644 srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
 create mode 100644 srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
new file mode 100644
index 000000000000..76a4e8c90029
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
@@ -0,0 +1,120 @@
+From 4f5376c9f934cba8172ba623f3e29792bf40f6bd Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:45:43 +0200
+Subject: [PATCH 1/3] stage2: add --sysroot link option
+
+---
+ src/Compilation.zig |  2 ++
+ src/link.zig        |  1 +
+ src/link/Elf.zig    |  5 +++++
+ src/main.zig        | 11 ++++++++++-
+ 4 files changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/src/Compilation.zig b/src/Compilation.zig
+index 4c015cb58..c89bf49e7 100644
+--- a/src/Compilation.zig
++++ b/src/Compilation.zig
+@@ -613,6 +613,7 @@ pub const InitOptions = struct {
+     output_mode: std.builtin.OutputMode,
+     thread_pool: *ThreadPool,
+     dynamic_linker: ?[]const u8 = null,
++    sysroot: ?[]const u8 = null,
+     /// `null` means to not emit a binary file.
+     emit_bin: ?EmitLoc,
+     /// `null` means to not emit a C header file.
+@@ -1271,6 +1272,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .module = module,
+             .target = options.target,
+             .dynamic_linker = options.dynamic_linker,
++            .sysroot = options.sysroot,
+             .output_mode = options.output_mode,
+             .link_mode = link_mode,
+             .object_format = ofmt,
+diff --git a/src/link.zig b/src/link.zig
+index fcb263f03..bb45d5d0e 100644
+--- a/src/link.zig
++++ b/src/link.zig
+@@ -37,6 +37,7 @@ pub const Options = struct {
+     /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`.
+     module: ?*Module,
+     dynamic_linker: ?[]const u8,
++    sysroot: ?[]const u8,
+     /// Used for calculating how much space to reserve for symbols in case the binary file
+     /// does not already have a symbol table.
+     symbol_count_hint: u64 = 32,
+diff --git a/src/link/Elf.zig b/src/link/Elf.zig
+index 5d99a4c3f..ee705bc1a 100644
+--- a/src/link/Elf.zig
++++ b/src/link/Elf.zig
+@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.tsan);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+ 
+         try argv.append("-error-limit=0");
+ 
++        if (self.base.options.sysroot) |sysroot| {
++            try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot}));
++        }
++
+         if (self.base.options.lto) {
+             switch (self.base.options.optimize_mode) {
+                 .Debug => {},
+diff --git a/src/main.zig b/src/main.zig
+index 9245f5fd8..662f3f64a 100644
+--- a/src/main.zig
++++ b/src/main.zig
+@@ -371,6 +371,7 @@ const usage_build_generic =
+     \\  -T[script], --script [script]  Use a custom linker script
+     \\  --version-script [path]        Provide a version .map file
+     \\  --dynamic-linker [path]        Set the dynamic interpreter path (usually ld.so)
++    \\  --sysroot [path]               Set the system root directory (usually /)
+     \\  --version [ver]                Dynamic library semver
+     \\  -fsoname[=name]                (Linux) Override the default SONAME value
+     \\  -fno-soname                    (Linux) Disable emitting a SONAME
+@@ -599,6 +600,7 @@ fn buildOutputType(
+     var link_eh_frame_hdr = false;
+     var link_emit_relocs = false;
+     var each_lib_rpath: ?bool = null;
++    var sysroot: ?[]const u8 = null;
+     var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC");
+     var machine_code_model: std.builtin.CodeModel = .default;
+     var runtime_args_start: ?usize = null;
+@@ -856,6 +858,10 @@ fn buildOutputType(
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+                         target_dynamic_linker = args[i];
++                    } else if (mem.eql(u8, arg, "--sysroot")) {
++                        if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
++                        i += 1;
++                        sysroot = args[i];
+                     } else if (mem.eql(u8, arg, "--libc")) {
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+@@ -1596,7 +1602,9 @@ fn buildOutputType(
+             want_native_include_dirs = true;
+     }
+ 
+-    if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
++    if (sysroot == null and cross_target.isNativeOs() and
++        (system_libs.items.len != 0 or want_native_include_dirs))
++    {
+         const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
+             fatal("unable to detect native system paths: {s}", .{@errorName(err)});
+         };
+@@ -1873,6 +1881,7 @@ fn buildOutputType(
+         .is_native_os = cross_target.isNativeOs(),
+         .is_native_abi = cross_target.isNativeAbi(),
+         .dynamic_linker = target_info.dynamic_linker.get(),
++        .sysroot = sysroot,
+         .output_mode = output_mode,
+         .root_pkg = root_pkg,
+         .emit_bin = emit_bin_loc,
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
new file mode 100644
index 000000000000..a2c6d4a9f047
--- /dev/null
+++ b/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
@@ -0,0 +1,61 @@
+From 86604ddfc99e39fdb15a36c176d07b3bc0092c5d Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:52:52 +0200
+Subject: [PATCH 2/3] std/build: add --sysroot general option
+
+---
+ lib/std/build.zig                | 5 +++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..e28ca9485 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -57,6 +57,7 @@ pub const Builder = struct {
+     exe_dir: []const u8,
+     h_dir: []const u8,
+     install_path: []const u8,
++    sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+@@ -2597,6 +2598,10 @@ pub const LibExeObjStep = struct {
+             }
+         }
+ 
++        if (builder.sysroot) |sysroot| {
++            try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
++        }
++
+         for (builder.search_prefixes.items) |search_prefix| {
+             try zig_args.append("-L");
+             try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..5c259b22a 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -87,6 +87,12 @@ pub fn main() !void {
+                     warn("Expected argument after {s}\n\n", .{arg});
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
++            } else if (mem.eql(u8, arg, "--sysroot")) {
++                const sysroot = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --sysroot\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.sysroot = sysroot;
+             } else if (mem.eql(u8, arg, "--search-prefix")) {
+                 const search_prefix = nextArg(args, &arg_idx) orelse {
+                     warn("Expected argument after --search-prefix\n\n", .{});
+@@ -189,6 +195,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -h, --help                  Print this help and exit
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
++        \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..edc8fde3ca63
--- /dev/null
+++ b/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From 7fc2e41f158b1ef65f80fb94abd35871e36c2b9c Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH 3/3] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index e28ca9485..c8f02d8a7 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -59,6 +59,7 @@ pub const Builder = struct {
+     install_path: []const u8,
+     sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2378,6 +2379,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index 5c259b22a..d1154add0 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -99,6 +99,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -197,6 +203,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..4af7c098c384 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
@@ -14,6 +14,7 @@ distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
 checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
 nopie=yes
 nocross=yes
+patch_args=-Np1
 
 export CMAKE_GENERATOR="Unix Makefiles"
 

From 96e728b572c966840870d8a2c4165774ae4f19ca Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..69dea4ca555a
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From fb852ac1b9c3b0abb739531e5e34e64e2be895eb Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (29 preceding siblings ...)
  2021-06-21 21:08 ` ifreund
@ 2021-06-21 21:09 ` ifreund
  2021-06-21 21:10 ` [PR PATCH] [Updated] " ifreund
                   ` (38 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-21 21:09 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-865345778

Comment:
2 of the patches have not yet been upstreamed, I'll be doing that shortly. As such, I'd like to hold off on merging this until they are upstreamed.

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (30 preceding siblings ...)
  2021-06-21 21:09 ` ifreund
@ 2021-06-21 21:10 ` ifreund
  2021-06-21 21:12 ` ifreund
                   ` (37 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-21 21:10 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From ee3b57a21f0eb89d1dce14d0bcc9f922dced189e Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport 3 upstream commits

These patches are required in order to integrate zig's crosscompilation
features with xbps when using the zig build system.

FIXME: following is only true for the --libc patch

It has also landed in the 0.8.x branch upstream and will be included in the 0.8.1 release.
---
 .../0001-stage2-add-sysroot-link-option.patch | 120 ++++++++++++++++++
 ...std-build-add-sysroot-general-option.patch |  61 +++++++++
 ...03-zig-build-add-libc-general-option.patch |  65 ++++++++++
 srcpkgs/zig/template                          |   2 +-
 4 files changed, 247 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
 create mode 100644 srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
 create mode 100644 srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
new file mode 100644
index 000000000000..76a4e8c90029
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
@@ -0,0 +1,120 @@
+From 4f5376c9f934cba8172ba623f3e29792bf40f6bd Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:45:43 +0200
+Subject: [PATCH 1/3] stage2: add --sysroot link option
+
+---
+ src/Compilation.zig |  2 ++
+ src/link.zig        |  1 +
+ src/link/Elf.zig    |  5 +++++
+ src/main.zig        | 11 ++++++++++-
+ 4 files changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/src/Compilation.zig b/src/Compilation.zig
+index 4c015cb58..c89bf49e7 100644
+--- a/src/Compilation.zig
++++ b/src/Compilation.zig
+@@ -613,6 +613,7 @@ pub const InitOptions = struct {
+     output_mode: std.builtin.OutputMode,
+     thread_pool: *ThreadPool,
+     dynamic_linker: ?[]const u8 = null,
++    sysroot: ?[]const u8 = null,
+     /// `null` means to not emit a binary file.
+     emit_bin: ?EmitLoc,
+     /// `null` means to not emit a C header file.
+@@ -1271,6 +1272,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .module = module,
+             .target = options.target,
+             .dynamic_linker = options.dynamic_linker,
++            .sysroot = options.sysroot,
+             .output_mode = options.output_mode,
+             .link_mode = link_mode,
+             .object_format = ofmt,
+diff --git a/src/link.zig b/src/link.zig
+index fcb263f03..bb45d5d0e 100644
+--- a/src/link.zig
++++ b/src/link.zig
+@@ -37,6 +37,7 @@ pub const Options = struct {
+     /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`.
+     module: ?*Module,
+     dynamic_linker: ?[]const u8,
++    sysroot: ?[]const u8,
+     /// Used for calculating how much space to reserve for symbols in case the binary file
+     /// does not already have a symbol table.
+     symbol_count_hint: u64 = 32,
+diff --git a/src/link/Elf.zig b/src/link/Elf.zig
+index 5d99a4c3f..ee705bc1a 100644
+--- a/src/link/Elf.zig
++++ b/src/link/Elf.zig
+@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.tsan);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+ 
+         try argv.append("-error-limit=0");
+ 
++        if (self.base.options.sysroot) |sysroot| {
++            try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot}));
++        }
++
+         if (self.base.options.lto) {
+             switch (self.base.options.optimize_mode) {
+                 .Debug => {},
+diff --git a/src/main.zig b/src/main.zig
+index 9245f5fd8..662f3f64a 100644
+--- a/src/main.zig
++++ b/src/main.zig
+@@ -371,6 +371,7 @@ const usage_build_generic =
+     \\  -T[script], --script [script]  Use a custom linker script
+     \\  --version-script [path]        Provide a version .map file
+     \\  --dynamic-linker [path]        Set the dynamic interpreter path (usually ld.so)
++    \\  --sysroot [path]               Set the system root directory (usually /)
+     \\  --version [ver]                Dynamic library semver
+     \\  -fsoname[=name]                (Linux) Override the default SONAME value
+     \\  -fno-soname                    (Linux) Disable emitting a SONAME
+@@ -599,6 +600,7 @@ fn buildOutputType(
+     var link_eh_frame_hdr = false;
+     var link_emit_relocs = false;
+     var each_lib_rpath: ?bool = null;
++    var sysroot: ?[]const u8 = null;
+     var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC");
+     var machine_code_model: std.builtin.CodeModel = .default;
+     var runtime_args_start: ?usize = null;
+@@ -856,6 +858,10 @@ fn buildOutputType(
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+                         target_dynamic_linker = args[i];
++                    } else if (mem.eql(u8, arg, "--sysroot")) {
++                        if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
++                        i += 1;
++                        sysroot = args[i];
+                     } else if (mem.eql(u8, arg, "--libc")) {
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+@@ -1596,7 +1602,9 @@ fn buildOutputType(
+             want_native_include_dirs = true;
+     }
+ 
+-    if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
++    if (sysroot == null and cross_target.isNativeOs() and
++        (system_libs.items.len != 0 or want_native_include_dirs))
++    {
+         const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
+             fatal("unable to detect native system paths: {s}", .{@errorName(err)});
+         };
+@@ -1873,6 +1881,7 @@ fn buildOutputType(
+         .is_native_os = cross_target.isNativeOs(),
+         .is_native_abi = cross_target.isNativeAbi(),
+         .dynamic_linker = target_info.dynamic_linker.get(),
++        .sysroot = sysroot,
+         .output_mode = output_mode,
+         .root_pkg = root_pkg,
+         .emit_bin = emit_bin_loc,
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
new file mode 100644
index 000000000000..a2c6d4a9f047
--- /dev/null
+++ b/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
@@ -0,0 +1,61 @@
+From 86604ddfc99e39fdb15a36c176d07b3bc0092c5d Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:52:52 +0200
+Subject: [PATCH 2/3] std/build: add --sysroot general option
+
+---
+ lib/std/build.zig                | 5 +++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..e28ca9485 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -57,6 +57,7 @@ pub const Builder = struct {
+     exe_dir: []const u8,
+     h_dir: []const u8,
+     install_path: []const u8,
++    sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+@@ -2597,6 +2598,10 @@ pub const LibExeObjStep = struct {
+             }
+         }
+ 
++        if (builder.sysroot) |sysroot| {
++            try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
++        }
++
+         for (builder.search_prefixes.items) |search_prefix| {
+             try zig_args.append("-L");
+             try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..5c259b22a 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -87,6 +87,12 @@ pub fn main() !void {
+                     warn("Expected argument after {s}\n\n", .{arg});
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
++            } else if (mem.eql(u8, arg, "--sysroot")) {
++                const sysroot = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --sysroot\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.sysroot = sysroot;
+             } else if (mem.eql(u8, arg, "--search-prefix")) {
+                 const search_prefix = nextArg(args, &arg_idx) orelse {
+                     warn("Expected argument after --search-prefix\n\n", .{});
+@@ -189,6 +195,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -h, --help                  Print this help and exit
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
++        \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..edc8fde3ca63
--- /dev/null
+++ b/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From 7fc2e41f158b1ef65f80fb94abd35871e36c2b9c Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH 3/3] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index e28ca9485..c8f02d8a7 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -59,6 +59,7 @@ pub const Builder = struct {
+     install_path: []const u8,
+     sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2378,6 +2379,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index 5c259b22a..d1154add0 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -99,6 +99,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -197,6 +203,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..f9a4c61839aa 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make

From e96a2192703f9d826c8c8fb212fc6534d0b48f06 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..69dea4ca555a
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From 706f9dcc89c96d2455e7f7cc8791bef831e97f72 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (31 preceding siblings ...)
  2021-06-21 21:10 ` [PR PATCH] [Updated] " ifreund
@ 2021-06-21 21:12 ` ifreund
  2021-06-26 11:06 ` ifreund
                   ` (36 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-21 21:12 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From cfecb71f82d3ed4879569fe4c9882ea6673b784d Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport 3 upstream commits

These patches are required in order to integrate zig's crosscompilation
features with xbps when using the zig build system.

FIXME: following is only true for the --libc patch:

It has also landed in the 0.8.x branch upstream and will be included in
the 0.8.1 release.
---
 .../0001-stage2-add-sysroot-link-option.patch | 120 ++++++++++++++++++
 ...std-build-add-sysroot-general-option.patch |  61 +++++++++
 ...03-zig-build-add-libc-general-option.patch |  65 ++++++++++
 srcpkgs/zig/template                          |   2 +-
 4 files changed, 247 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
 create mode 100644 srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
 create mode 100644 srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
new file mode 100644
index 000000000000..76a4e8c90029
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-stage2-add-sysroot-link-option.patch
@@ -0,0 +1,120 @@
+From 4f5376c9f934cba8172ba623f3e29792bf40f6bd Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:45:43 +0200
+Subject: [PATCH 1/3] stage2: add --sysroot link option
+
+---
+ src/Compilation.zig |  2 ++
+ src/link.zig        |  1 +
+ src/link/Elf.zig    |  5 +++++
+ src/main.zig        | 11 ++++++++++-
+ 4 files changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/src/Compilation.zig b/src/Compilation.zig
+index 4c015cb58..c89bf49e7 100644
+--- a/src/Compilation.zig
++++ b/src/Compilation.zig
+@@ -613,6 +613,7 @@ pub const InitOptions = struct {
+     output_mode: std.builtin.OutputMode,
+     thread_pool: *ThreadPool,
+     dynamic_linker: ?[]const u8 = null,
++    sysroot: ?[]const u8 = null,
+     /// `null` means to not emit a binary file.
+     emit_bin: ?EmitLoc,
+     /// `null` means to not emit a C header file.
+@@ -1271,6 +1272,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .module = module,
+             .target = options.target,
+             .dynamic_linker = options.dynamic_linker,
++            .sysroot = options.sysroot,
+             .output_mode = options.output_mode,
+             .link_mode = link_mode,
+             .object_format = ofmt,
+diff --git a/src/link.zig b/src/link.zig
+index fcb263f03..bb45d5d0e 100644
+--- a/src/link.zig
++++ b/src/link.zig
+@@ -37,6 +37,7 @@ pub const Options = struct {
+     /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`.
+     module: ?*Module,
+     dynamic_linker: ?[]const u8,
++    sysroot: ?[]const u8,
+     /// Used for calculating how much space to reserve for symbols in case the binary file
+     /// does not already have a symbol table.
+     symbol_count_hint: u64 = 32,
+diff --git a/src/link/Elf.zig b/src/link/Elf.zig
+index 5d99a4c3f..ee705bc1a 100644
+--- a/src/link/Elf.zig
++++ b/src/link/Elf.zig
+@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.tsan);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+ 
+         try argv.append("-error-limit=0");
+ 
++        if (self.base.options.sysroot) |sysroot| {
++            try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot}));
++        }
++
+         if (self.base.options.lto) {
+             switch (self.base.options.optimize_mode) {
+                 .Debug => {},
+diff --git a/src/main.zig b/src/main.zig
+index 9245f5fd8..662f3f64a 100644
+--- a/src/main.zig
++++ b/src/main.zig
+@@ -371,6 +371,7 @@ const usage_build_generic =
+     \\  -T[script], --script [script]  Use a custom linker script
+     \\  --version-script [path]        Provide a version .map file
+     \\  --dynamic-linker [path]        Set the dynamic interpreter path (usually ld.so)
++    \\  --sysroot [path]               Set the system root directory (usually /)
+     \\  --version [ver]                Dynamic library semver
+     \\  -fsoname[=name]                (Linux) Override the default SONAME value
+     \\  -fno-soname                    (Linux) Disable emitting a SONAME
+@@ -599,6 +600,7 @@ fn buildOutputType(
+     var link_eh_frame_hdr = false;
+     var link_emit_relocs = false;
+     var each_lib_rpath: ?bool = null;
++    var sysroot: ?[]const u8 = null;
+     var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC");
+     var machine_code_model: std.builtin.CodeModel = .default;
+     var runtime_args_start: ?usize = null;
+@@ -856,6 +858,10 @@ fn buildOutputType(
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+                         target_dynamic_linker = args[i];
++                    } else if (mem.eql(u8, arg, "--sysroot")) {
++                        if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
++                        i += 1;
++                        sysroot = args[i];
+                     } else if (mem.eql(u8, arg, "--libc")) {
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+@@ -1596,7 +1602,9 @@ fn buildOutputType(
+             want_native_include_dirs = true;
+     }
+ 
+-    if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
++    if (sysroot == null and cross_target.isNativeOs() and
++        (system_libs.items.len != 0 or want_native_include_dirs))
++    {
+         const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
+             fatal("unable to detect native system paths: {s}", .{@errorName(err)});
+         };
+@@ -1873,6 +1881,7 @@ fn buildOutputType(
+         .is_native_os = cross_target.isNativeOs(),
+         .is_native_abi = cross_target.isNativeAbi(),
+         .dynamic_linker = target_info.dynamic_linker.get(),
++        .sysroot = sysroot,
+         .output_mode = output_mode,
+         .root_pkg = root_pkg,
+         .emit_bin = emit_bin_loc,
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
new file mode 100644
index 000000000000..a2c6d4a9f047
--- /dev/null
+++ b/srcpkgs/zig/patches/0002-std-build-add-sysroot-general-option.patch
@@ -0,0 +1,61 @@
+From 86604ddfc99e39fdb15a36c176d07b3bc0092c5d Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:52:52 +0200
+Subject: [PATCH 2/3] std/build: add --sysroot general option
+
+---
+ lib/std/build.zig                | 5 +++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 572f2b2be..e28ca9485 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -57,6 +57,7 @@ pub const Builder = struct {
+     exe_dir: []const u8,
+     h_dir: []const u8,
+     install_path: []const u8,
++    sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+@@ -2597,6 +2598,10 @@ pub const LibExeObjStep = struct {
+             }
+         }
+ 
++        if (builder.sysroot) |sysroot| {
++            try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
++        }
++
+         for (builder.search_prefixes.items) |search_prefix| {
+             try zig_args.append("-L");
+             try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..5c259b22a 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -87,6 +87,12 @@ pub fn main() !void {
+                     warn("Expected argument after {s}\n\n", .{arg});
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
++            } else if (mem.eql(u8, arg, "--sysroot")) {
++                const sysroot = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --sysroot\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.sysroot = sysroot;
+             } else if (mem.eql(u8, arg, "--search-prefix")) {
+                 const search_prefix = nextArg(args, &arg_idx) orelse {
+                     warn("Expected argument after --search-prefix\n\n", .{});
+@@ -189,6 +195,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -h, --help                  Print this help and exit
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
++        \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..edc8fde3ca63
--- /dev/null
+++ b/srcpkgs/zig/patches/0003-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From 7fc2e41f158b1ef65f80fb94abd35871e36c2b9c Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH 3/3] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index e28ca9485..c8f02d8a7 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -59,6 +59,7 @@ pub const Builder = struct {
+     install_path: []const u8,
+     sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2378,6 +2379,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index 5c259b22a..d1154add0 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -99,6 +99,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -197,6 +203,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..f9a4c61839aa 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make

From 008aa260ba5c737905ef004e10a706f1118db773 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..69dea4ca555a
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From 9302c24d4738bc1e4c3111f860d4629ea6ff55da Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (32 preceding siblings ...)
  2021-06-21 21:12 ` ifreund
@ 2021-06-26 11:06 ` ifreund
  2021-07-25 20:55 ` [PR REVIEW] New package: rundird-0.1.1, Add zig-build build style ericonr
                   ` (35 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-06-26 11:06 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.0
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 2cfc919e3f33266ed287a24271589bbb8f435e1b Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport 3 upstream commits

These patches are required in order to integrate zig's crosscompilation
features with xbps when using the zig build system.

All 3 of these commits have landed in the 0.8.x branch upstream and will
be included in the upcoming 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch |  65 +++++
 .../0002-stage2-add-sysroot-link-option.patch | 245 ++++++++++++++++++
 ...std-build-add-sysroot-general-option.patch |  61 +++++
 srcpkgs/zig/template                          |   2 +-
 4 files changed, 372 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
 create mode 100644 srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
 create mode 100644 srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..6c6d894c8e41
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From 3e4f3a1924150e22e0ca87e906681ebadcf8433e Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH 1/3] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 7628a18c5..e433ec386 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
new file mode 100644
index 000000000000..947a4aae1df0
--- /dev/null
+++ b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
@@ -0,0 +1,245 @@
+From 16228e87d6d7d8929305083e8c76168603780f5f Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:45:43 +0200
+Subject: [PATCH 2/3] stage2: add --sysroot link option
+
+This feature is necessary for cross-compiling code that dynamically
+links system libraries, at least with the current feature set of lld.
+---
+ src/Compilation.zig | 42 +++++++++++++++++++++++++-----------------
+ src/link.zig        |  4 ++--
+ src/link/Elf.zig    |  5 +++++
+ src/link/MachO.zig  |  8 ++++----
+ src/main.zig        | 11 ++++++++++-
+ 5 files changed, 46 insertions(+), 24 deletions(-)
+
+diff --git a/src/Compilation.zig b/src/Compilation.zig
+index 977c9f4b8..5f5c1c5dd 100644
+--- a/src/Compilation.zig
++++ b/src/Compilation.zig
+@@ -612,6 +612,7 @@ pub const InitOptions = struct {
+     output_mode: std.builtin.OutputMode,
+     thread_pool: *ThreadPool,
+     dynamic_linker: ?[]const u8 = null,
++    sysroot: ?[]const u8 = null,
+     /// `null` means to not emit a binary file.
+     emit_bin: ?EmitLoc,
+     /// `null` means to not emit a C header file.
+@@ -868,25 +869,32 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             break :blk false;
+         };
+ 
+-        const DarwinOptions = struct {
+-            syslibroot: ?[]const u8 = null,
+-            system_linker_hack: bool = false,
++        const darwin_can_use_system_linker_and_sdk =
++            // comptime conditions
++            ((build_options.have_llvm and comptime std.Target.current.isDarwin()) and
++            // runtime conditions
++            (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()));
++
++        const darwin_system_linker_hack = blk: {
++            if (darwin_can_use_system_linker_and_sdk) {
++                break :blk std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
++            } else {
++                break :blk false;
++            }
+         };
+ 
+-        const darwin_options: DarwinOptions = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {
+-            const opts: DarwinOptions = if (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()) inner: {
++        const sysroot = blk: {
++            if (options.sysroot) |sysroot| {
++                break :blk sysroot;
++            } else if (darwin_can_use_system_linker_and_sdk) {
+                 // TODO Revisit this targeting versions lower than macOS 11 when LLVM 12 is out.
+                 // See https://github.com/ziglang/zig/issues/6996
+                 const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11;
+-                const syslibroot = if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
+-                const system_linker_hack = std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
+-                break :inner .{
+-                    .syslibroot = syslibroot,
+-                    .system_linker_hack = system_linker_hack,
+-                };
+-            } else .{};
+-            break :outer opts;
+-        } else .{};
++                break :blk if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
++            } else {
++                break :blk null;
++            }
++        };
+ 
+         const lto = blk: {
+             if (options.want_lto) |explicit| {
+@@ -897,7 +905,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+                 break :blk false;
+             } else if (options.c_source_files.len == 0) {
+                 break :blk false;
+-            } else if (darwin_options.system_linker_hack) {
++            } else if (darwin_system_linker_hack) {
+                 break :blk false;
+             } else switch (options.output_mode) {
+                 .Lib, .Obj => break :blk false,
+@@ -1273,13 +1281,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .module = module,
+             .target = options.target,
+             .dynamic_linker = options.dynamic_linker,
++            .sysroot = sysroot,
+             .output_mode = options.output_mode,
+             .link_mode = link_mode,
+             .object_format = ofmt,
+             .optimize_mode = options.optimize_mode,
+             .use_lld = use_lld,
+             .use_llvm = use_llvm,
+-            .system_linker_hack = darwin_options.system_linker_hack,
++            .system_linker_hack = darwin_system_linker_hack,
+             .link_libc = link_libc,
+             .link_libcpp = link_libcpp,
+             .link_libunwind = link_libunwind,
+@@ -1287,7 +1296,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .frameworks = options.frameworks,
+             .framework_dirs = options.framework_dirs,
+             .system_libs = system_libs,
+-            .syslibroot = darwin_options.syslibroot,
+             .lib_dirs = options.lib_dirs,
+             .rpath_list = options.rpath_list,
+             .strip = strip,
+diff --git a/src/link.zig b/src/link.zig
+index fcb263f03..2d2c1ebea 100644
+--- a/src/link.zig
++++ b/src/link.zig
+@@ -37,6 +37,8 @@ pub const Options = struct {
+     /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`.
+     module: ?*Module,
+     dynamic_linker: ?[]const u8,
++    /// The root path for the dynamic linker and system libraries (as well as frameworks on Darwin)
++    sysroot: ?[]const u8,
+     /// Used for calculating how much space to reserve for symbols in case the binary file
+     /// does not already have a symbol table.
+     symbol_count_hint: u64 = 32,
+@@ -103,8 +105,6 @@ pub const Options = struct {
+     llvm_cpu_features: ?[*:0]const u8,
+     /// Extra args passed directly to LLD. Ignored when not linking with LLD.
+     extra_lld_args: []const []const u8,
+-    /// Darwin-only. Set the root path to the system libraries and frameworks.
+-    syslibroot: ?[]const u8,
+ 
+     objects: []const []const u8,
+     framework_dirs: []const []const u8,
+diff --git a/src/link/Elf.zig b/src/link/Elf.zig
+index 5bf20fdd2..981211151 100644
+--- a/src/link/Elf.zig
++++ b/src/link/Elf.zig
+@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.tsan);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+ 
+         try argv.append("-error-limit=0");
+ 
++        if (self.base.options.sysroot) |sysroot| {
++            try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot}));
++        }
++
+         if (self.base.options.lto) {
+             switch (self.base.options.optimize_mode) {
+                 .Debug => {},
+diff --git a/src/link/MachO.zig b/src/link/MachO.zig
+index 24dfa2c32..1e11a3258 100644
+--- a/src/link/MachO.zig
++++ b/src/link/MachO.zig
+@@ -590,7 +590,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.system_linker_hack);
+-        man.hash.addOptionalBytes(self.base.options.syslibroot);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -720,7 +720,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             for (self.base.options.lib_dirs) |path| {
+                 if (fs.path.isAbsolute(path)) {
+                     var candidates = std.ArrayList([]const u8).init(arena);
+-                    if (self.base.options.syslibroot) |syslibroot| {
++                    if (self.base.options.sysroot) |syslibroot| {
+                         const full_path = try fs.path.join(arena, &[_][]const u8{ syslibroot, path });
+                         try candidates.append(full_path);
+                     }
+@@ -813,7 +813,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+                 try argv.append("zig");
+                 try argv.append("ld");
+ 
+-                if (self.base.options.syslibroot) |syslibroot| {
++                if (self.base.options.sysroot) |syslibroot| {
+                     try argv.append("-syslibroot");
+                     try argv.append(syslibroot);
+                 }
+@@ -959,7 +959,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             }
+         }
+ 
+-        if (self.base.options.syslibroot) |dir| {
++        if (self.base.options.sysroot) |dir| {
+             try argv.append("-syslibroot");
+             try argv.append(dir);
+         }
+diff --git a/src/main.zig b/src/main.zig
+index f5bda4379..b136a05bd 100644
+--- a/src/main.zig
++++ b/src/main.zig
+@@ -377,6 +377,7 @@ const usage_build_generic =
+     \\  -T[script], --script [script]  Use a custom linker script
+     \\  --version-script [path]        Provide a version .map file
+     \\  --dynamic-linker [path]        Set the dynamic interpreter path (usually ld.so)
++    \\  --sysroot [path]               Set the system root directory (usually /)
+     \\  --version [ver]                Dynamic library semver
+     \\  -fsoname[=name]                (Linux) Override the default SONAME value
+     \\  -fno-soname                    (Linux) Disable emitting a SONAME
+@@ -602,6 +603,7 @@ fn buildOutputType(
+     var link_eh_frame_hdr = false;
+     var link_emit_relocs = false;
+     var each_lib_rpath: ?bool = null;
++    var sysroot: ?[]const u8 = null;
+     var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC");
+     var machine_code_model: std.builtin.CodeModel = .default;
+     var runtime_args_start: ?usize = null;
+@@ -859,6 +861,10 @@ fn buildOutputType(
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+                         target_dynamic_linker = args[i];
++                    } else if (mem.eql(u8, arg, "--sysroot")) {
++                        if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
++                        i += 1;
++                        sysroot = args[i];
+                     } else if (mem.eql(u8, arg, "--libc")) {
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+@@ -1621,7 +1627,9 @@ fn buildOutputType(
+             want_native_include_dirs = true;
+     }
+ 
+-    if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
++    if (sysroot == null and cross_target.isNativeOs() and
++        (system_libs.items.len != 0 or want_native_include_dirs))
++    {
+         const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
+             fatal("unable to detect native system paths: {s}", .{@errorName(err)});
+         };
+@@ -1898,6 +1906,7 @@ fn buildOutputType(
+         .is_native_os = cross_target.isNativeOs(),
+         .is_native_abi = cross_target.isNativeAbi(),
+         .dynamic_linker = target_info.dynamic_linker.get(),
++        .sysroot = sysroot,
+         .output_mode = output_mode,
+         .root_pkg = root_pkg,
+         .emit_bin = emit_bin_loc,
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
new file mode 100644
index 000000000000..fbb579d44b06
--- /dev/null
+++ b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
@@ -0,0 +1,61 @@
+From e75dfbcb3f1892f67fa9a86157bc503fad300772 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Fri, 25 Jun 2021 14:04:38 +0200
+Subject: [PATCH 3/3] std/build: add --sysroot general option
+
+---
+ lib/std/build.zig                | 5 +++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index e433ec386..9b7ebb1f4 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -57,6 +57,7 @@ pub const Builder = struct {
+     exe_dir: []const u8,
+     h_dir: []const u8,
+     install_path: []const u8,
++    sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
+     libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct {
+             }
+         }
+ 
++        if (builder.sysroot) |sysroot| {
++            try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
++        }
++
+         for (builder.search_prefixes.items) |search_prefix| {
+             try zig_args.append("-L");
+             try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index 2a0ca86d7..d1154add0 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -87,6 +87,12 @@ pub fn main() !void {
+                     warn("Expected argument after {s}\n\n", .{arg});
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
++            } else if (mem.eql(u8, arg, "--sysroot")) {
++                const sysroot = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --sysroot\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.sysroot = sysroot;
+             } else if (mem.eql(u8, arg, "--search-prefix")) {
+                 const search_prefix = nextArg(args, &arg_idx) orelse {
+                     warn("Expected argument after --search-prefix\n\n", .{});
+@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -h, --help                  Print this help and exit
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
++        \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
+         \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..f9a4c61839aa 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make

From 79c42debada0cf99491fc9531c9525a9a0ade7ca Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code as well. Furthermore, the
zig build system may be used to build C/C++ code as well, not just zig.
---
 common/build-style/zig-build.sh | 49 +++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..69dea4ca555a
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,49 @@
+do_build() {
+	local zig_abi
+	local zig_target
+	local zig_cpu
+
+	case $XBPS_TARGET_LIBC in
+		glibc) zig_abi="gnu";;
+		musl) zig_abi="musl";;
+		*) broken="Unknown target libc";;
+	esac
+
+	case $XBPS_TARGET_MACHINE in
+		aarch64*|i686*|x86_64*)
+			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
+		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
+		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
+		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
+		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
+		*) broken="TODO: support more target machines for the zig build style";;
+	esac
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}

From c0897fe6957c1682fbfaf2aa71dbdbe34e72bd0d Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.1.1

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..df06fdb0fc88
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec /usr/bin/rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..c2c855164783
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.1.1
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=d3a848fba0016841385aab57298164ba8f30377799c217b6b6abf83ce1d2ca91
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR REVIEW] New package: rundird-0.1.1, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (33 preceding siblings ...)
  2021-06-26 11:06 ` ifreund
@ 2021-07-25 20:55 ` ericonr
  2021-07-25 20:55 ` ericonr
                   ` (34 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-07-25 20:55 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r676201141

Comment:
I would still make this simpler, will make a diff in a bit.

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

* Re: [PR REVIEW] New package: rundird-0.1.1, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (34 preceding siblings ...)
  2021-07-25 20:55 ` [PR REVIEW] New package: rundird-0.1.1, Add zig-build build style ericonr
@ 2021-07-25 20:55 ` ericonr
  2021-07-25 20:59 ` ericonr
                   ` (33 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-07-25 20:55 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r676201003

Comment:
I don't think we spell out the full path for most services, and it shouldn't be necessary. No need for `OPTS`?

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

* Re: New package: rundird-0.1.1, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (35 preceding siblings ...)
  2021-07-25 20:55 ` ericonr
@ 2021-07-25 20:59 ` ericonr
  2021-07-25 22:30 ` [PR REVIEW] " ifreund
                   ` (32 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-07-25 20:59 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-886256921

Comment:
```
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
index 69dea4ca55..8c11822b70 100644
--- a/common/build-style/zig-build.sh
+++ b/common/build-style/zig-build.sh
@@ -1,7 +1,5 @@
 do_build() {
-	local zig_abi
-	local zig_target
-	local zig_cpu
+	local zig_abi zig_target zig_cpu zig_arch
 
 	case $XBPS_TARGET_LIBC in
 		glibc) zig_abi="gnu";;
@@ -11,16 +9,18 @@ do_build() {
 
 	case $XBPS_TARGET_MACHINE in
 		aarch64*|i686*|x86_64*)
-			zig_target="${XBPS_TARGET_MACHINE%-musl}-linux-${zig_abi}" zig_cpu="baseline";;
+			zig_arch="${XBPS_TARGET_MACHINE%-musl}" zig_cpu="baseline";;
 		armv6l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v6";;
 		armv7l*) zig_target="arm-linux-${zig_abi}" zig_cpu="generic+v7a";;
 		ppc64le*) zig_target="powerpc64le-linux-${zig_abi}" zig_cpu="baseline";;
 		ppc64*) zig_target="powerpc64-linux-${zig_abi}" zig_cpu="baseline";;
 		ppcle*) zig_target="powerpcle-linux-${zig_abi}" zig_cpu="baseline";;
 		ppc*) zig_target="powerpc-linux-${zig_abi}" zig_cpu="baseline";;
-		*) broken="TODO: support more target machines for the zig build style";;
+		*) msg_error "TODO: support more target machines for the zig build style\n";;
 	esac
 
+	zig_target="${zig_arch}-linux-${zig_abi}"
+
 	# Inform zig of the required libc include paths.
 	cat > xbps_zig_libc.txt <<-EOF
 		include_dir=${XBPS_CROSS_BASE}/usr/include
```

Do for all archs what I did for x86; and broken is checked during template parsing time, not during `do_build`. This is "better" but still breaks builds; you need something in an environment file to set `broken` so XBPS doesn't error out. To avoid duplicating the logic, could create `XBPS_ZIG_ABI` ... and use those instead of local variables.

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

* Re: [PR REVIEW] New package: rundird-0.1.1, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (36 preceding siblings ...)
  2021-07-25 20:59 ` ericonr
@ 2021-07-25 22:30 ` ifreund
  2021-07-27  1:02 ` [PR PATCH] [Updated] " ifreund
                   ` (31 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-07-25 22:30 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r676210928

Comment:
rundird doesn't have any options, I'll get rid of the unnecessary full path.

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.1, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (37 preceding siblings ...)
  2021-07-25 22:30 ` [PR REVIEW] " ifreund
@ 2021-07-27  1:02 ` ifreund
  2021-07-27  1:07 ` ifreund
                   ` (30 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-07-27  1:02 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.1, Add zig-build build style
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From ea3975a0c400493253abeedef4900a2299423954 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport 3 upstream commits

These patches are required in order to integrate zig's crosscompilation
features with xbps when using the zig build system.

All 3 of these commits have landed in the 0.8.x branch upstream and will
be included in the upcoming 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch |  65 +++++
 .../0002-stage2-add-sysroot-link-option.patch | 245 ++++++++++++++++++
 ...std-build-add-sysroot-general-option.patch |  61 +++++
 srcpkgs/zig/template                          |   2 +-
 4 files changed, 372 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
 create mode 100644 srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
 create mode 100644 srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..6c6d894c8e41
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From 3e4f3a1924150e22e0ca87e906681ebadcf8433e Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH 1/3] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 7628a18c5..e433ec386 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
new file mode 100644
index 000000000000..947a4aae1df0
--- /dev/null
+++ b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
@@ -0,0 +1,245 @@
+From 16228e87d6d7d8929305083e8c76168603780f5f Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:45:43 +0200
+Subject: [PATCH 2/3] stage2: add --sysroot link option
+
+This feature is necessary for cross-compiling code that dynamically
+links system libraries, at least with the current feature set of lld.
+---
+ src/Compilation.zig | 42 +++++++++++++++++++++++++-----------------
+ src/link.zig        |  4 ++--
+ src/link/Elf.zig    |  5 +++++
+ src/link/MachO.zig  |  8 ++++----
+ src/main.zig        | 11 ++++++++++-
+ 5 files changed, 46 insertions(+), 24 deletions(-)
+
+diff --git a/src/Compilation.zig b/src/Compilation.zig
+index 977c9f4b8..5f5c1c5dd 100644
+--- a/src/Compilation.zig
++++ b/src/Compilation.zig
+@@ -612,6 +612,7 @@ pub const InitOptions = struct {
+     output_mode: std.builtin.OutputMode,
+     thread_pool: *ThreadPool,
+     dynamic_linker: ?[]const u8 = null,
++    sysroot: ?[]const u8 = null,
+     /// `null` means to not emit a binary file.
+     emit_bin: ?EmitLoc,
+     /// `null` means to not emit a C header file.
+@@ -868,25 +869,32 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             break :blk false;
+         };
+ 
+-        const DarwinOptions = struct {
+-            syslibroot: ?[]const u8 = null,
+-            system_linker_hack: bool = false,
++        const darwin_can_use_system_linker_and_sdk =
++            // comptime conditions
++            ((build_options.have_llvm and comptime std.Target.current.isDarwin()) and
++            // runtime conditions
++            (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()));
++
++        const darwin_system_linker_hack = blk: {
++            if (darwin_can_use_system_linker_and_sdk) {
++                break :blk std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
++            } else {
++                break :blk false;
++            }
+         };
+ 
+-        const darwin_options: DarwinOptions = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {
+-            const opts: DarwinOptions = if (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()) inner: {
++        const sysroot = blk: {
++            if (options.sysroot) |sysroot| {
++                break :blk sysroot;
++            } else if (darwin_can_use_system_linker_and_sdk) {
+                 // TODO Revisit this targeting versions lower than macOS 11 when LLVM 12 is out.
+                 // See https://github.com/ziglang/zig/issues/6996
+                 const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11;
+-                const syslibroot = if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
+-                const system_linker_hack = std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
+-                break :inner .{
+-                    .syslibroot = syslibroot,
+-                    .system_linker_hack = system_linker_hack,
+-                };
+-            } else .{};
+-            break :outer opts;
+-        } else .{};
++                break :blk if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
++            } else {
++                break :blk null;
++            }
++        };
+ 
+         const lto = blk: {
+             if (options.want_lto) |explicit| {
+@@ -897,7 +905,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+                 break :blk false;
+             } else if (options.c_source_files.len == 0) {
+                 break :blk false;
+-            } else if (darwin_options.system_linker_hack) {
++            } else if (darwin_system_linker_hack) {
+                 break :blk false;
+             } else switch (options.output_mode) {
+                 .Lib, .Obj => break :blk false,
+@@ -1273,13 +1281,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .module = module,
+             .target = options.target,
+             .dynamic_linker = options.dynamic_linker,
++            .sysroot = sysroot,
+             .output_mode = options.output_mode,
+             .link_mode = link_mode,
+             .object_format = ofmt,
+             .optimize_mode = options.optimize_mode,
+             .use_lld = use_lld,
+             .use_llvm = use_llvm,
+-            .system_linker_hack = darwin_options.system_linker_hack,
++            .system_linker_hack = darwin_system_linker_hack,
+             .link_libc = link_libc,
+             .link_libcpp = link_libcpp,
+             .link_libunwind = link_libunwind,
+@@ -1287,7 +1296,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .frameworks = options.frameworks,
+             .framework_dirs = options.framework_dirs,
+             .system_libs = system_libs,
+-            .syslibroot = darwin_options.syslibroot,
+             .lib_dirs = options.lib_dirs,
+             .rpath_list = options.rpath_list,
+             .strip = strip,
+diff --git a/src/link.zig b/src/link.zig
+index fcb263f03..2d2c1ebea 100644
+--- a/src/link.zig
++++ b/src/link.zig
+@@ -37,6 +37,8 @@ pub const Options = struct {
+     /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`.
+     module: ?*Module,
+     dynamic_linker: ?[]const u8,
++    /// The root path for the dynamic linker and system libraries (as well as frameworks on Darwin)
++    sysroot: ?[]const u8,
+     /// Used for calculating how much space to reserve for symbols in case the binary file
+     /// does not already have a symbol table.
+     symbol_count_hint: u64 = 32,
+@@ -103,8 +105,6 @@ pub const Options = struct {
+     llvm_cpu_features: ?[*:0]const u8,
+     /// Extra args passed directly to LLD. Ignored when not linking with LLD.
+     extra_lld_args: []const []const u8,
+-    /// Darwin-only. Set the root path to the system libraries and frameworks.
+-    syslibroot: ?[]const u8,
+ 
+     objects: []const []const u8,
+     framework_dirs: []const []const u8,
+diff --git a/src/link/Elf.zig b/src/link/Elf.zig
+index 5bf20fdd2..981211151 100644
+--- a/src/link/Elf.zig
++++ b/src/link/Elf.zig
+@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.tsan);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+ 
+         try argv.append("-error-limit=0");
+ 
++        if (self.base.options.sysroot) |sysroot| {
++            try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot}));
++        }
++
+         if (self.base.options.lto) {
+             switch (self.base.options.optimize_mode) {
+                 .Debug => {},
+diff --git a/src/link/MachO.zig b/src/link/MachO.zig
+index 24dfa2c32..1e11a3258 100644
+--- a/src/link/MachO.zig
++++ b/src/link/MachO.zig
+@@ -590,7 +590,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.system_linker_hack);
+-        man.hash.addOptionalBytes(self.base.options.syslibroot);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -720,7 +720,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             for (self.base.options.lib_dirs) |path| {
+                 if (fs.path.isAbsolute(path)) {
+                     var candidates = std.ArrayList([]const u8).init(arena);
+-                    if (self.base.options.syslibroot) |syslibroot| {
++                    if (self.base.options.sysroot) |syslibroot| {
+                         const full_path = try fs.path.join(arena, &[_][]const u8{ syslibroot, path });
+                         try candidates.append(full_path);
+                     }
+@@ -813,7 +813,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+                 try argv.append("zig");
+                 try argv.append("ld");
+ 
+-                if (self.base.options.syslibroot) |syslibroot| {
++                if (self.base.options.sysroot) |syslibroot| {
+                     try argv.append("-syslibroot");
+                     try argv.append(syslibroot);
+                 }
+@@ -959,7 +959,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             }
+         }
+ 
+-        if (self.base.options.syslibroot) |dir| {
++        if (self.base.options.sysroot) |dir| {
+             try argv.append("-syslibroot");
+             try argv.append(dir);
+         }
+diff --git a/src/main.zig b/src/main.zig
+index f5bda4379..b136a05bd 100644
+--- a/src/main.zig
++++ b/src/main.zig
+@@ -377,6 +377,7 @@ const usage_build_generic =
+     \\  -T[script], --script [script]  Use a custom linker script
+     \\  --version-script [path]        Provide a version .map file
+     \\  --dynamic-linker [path]        Set the dynamic interpreter path (usually ld.so)
++    \\  --sysroot [path]               Set the system root directory (usually /)
+     \\  --version [ver]                Dynamic library semver
+     \\  -fsoname[=name]                (Linux) Override the default SONAME value
+     \\  -fno-soname                    (Linux) Disable emitting a SONAME
+@@ -602,6 +603,7 @@ fn buildOutputType(
+     var link_eh_frame_hdr = false;
+     var link_emit_relocs = false;
+     var each_lib_rpath: ?bool = null;
++    var sysroot: ?[]const u8 = null;
+     var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC");
+     var machine_code_model: std.builtin.CodeModel = .default;
+     var runtime_args_start: ?usize = null;
+@@ -859,6 +861,10 @@ fn buildOutputType(
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+                         target_dynamic_linker = args[i];
++                    } else if (mem.eql(u8, arg, "--sysroot")) {
++                        if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
++                        i += 1;
++                        sysroot = args[i];
+                     } else if (mem.eql(u8, arg, "--libc")) {
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+@@ -1621,7 +1627,9 @@ fn buildOutputType(
+             want_native_include_dirs = true;
+     }
+ 
+-    if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
++    if (sysroot == null and cross_target.isNativeOs() and
++        (system_libs.items.len != 0 or want_native_include_dirs))
++    {
+         const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
+             fatal("unable to detect native system paths: {s}", .{@errorName(err)});
+         };
+@@ -1898,6 +1906,7 @@ fn buildOutputType(
+         .is_native_os = cross_target.isNativeOs(),
+         .is_native_abi = cross_target.isNativeAbi(),
+         .dynamic_linker = target_info.dynamic_linker.get(),
++        .sysroot = sysroot,
+         .output_mode = output_mode,
+         .root_pkg = root_pkg,
+         .emit_bin = emit_bin_loc,
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
new file mode 100644
index 000000000000..fbb579d44b06
--- /dev/null
+++ b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
@@ -0,0 +1,61 @@
+From e75dfbcb3f1892f67fa9a86157bc503fad300772 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Fri, 25 Jun 2021 14:04:38 +0200
+Subject: [PATCH 3/3] std/build: add --sysroot general option
+
+---
+ lib/std/build.zig                | 5 +++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index e433ec386..9b7ebb1f4 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -57,6 +57,7 @@ pub const Builder = struct {
+     exe_dir: []const u8,
+     h_dir: []const u8,
+     install_path: []const u8,
++    sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
+     libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct {
+             }
+         }
+ 
++        if (builder.sysroot) |sysroot| {
++            try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
++        }
++
+         for (builder.search_prefixes.items) |search_prefix| {
+             try zig_args.append("-L");
+             try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index 2a0ca86d7..d1154add0 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -87,6 +87,12 @@ pub fn main() !void {
+                     warn("Expected argument after {s}\n\n", .{arg});
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
++            } else if (mem.eql(u8, arg, "--sysroot")) {
++                const sysroot = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --sysroot\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.sysroot = sysroot;
+             } else if (mem.eql(u8, arg, "--search-prefix")) {
+                 const search_prefix = nextArg(args, &arg_idx) orelse {
+                     warn("Expected argument after --search-prefix\n\n", .{});
+@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -h, --help                  Print this help and exit
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
++        \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
+         \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..f9a4c61839aa 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make

From a9488781b2dba586df87362d7fc705b748a1839f Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 39 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 45 files changed, 127 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..91ab9d2d27b6
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,39 @@
+do_build() {
+	local zig_target zig_cpu
+#
+	# TODO: This duplication between build-profiles cross-profiles is totally
+	# unnecessary. It would be nice if there was some way to avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target=$XBPS_CROSS_ZIG_TARGET
+		zig_cpu=$XBPS_CROSS_ZIG_CPU
+	else
+		zig_target=$XBPS_ZIG_TARGET
+		zig_cpu=$XBPS_ZIG_CPU
+    fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget=$zig_target -Dcpu=$zig_cpu \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From 11f2c3a9fcca684c3937a24e1125422f463a17b4 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..3d4dc8b75d59
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.1.1, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (38 preceding siblings ...)
  2021-07-27  1:02 ` [PR PATCH] [Updated] " ifreund
@ 2021-07-27  1:07 ` ifreund
  2021-07-27  1:11 ` ifreund
                   ` (29 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-07-27  1:07 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.1.1, Add zig-build build style
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From ea3975a0c400493253abeedef4900a2299423954 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport 3 upstream commits

These patches are required in order to integrate zig's crosscompilation
features with xbps when using the zig build system.

All 3 of these commits have landed in the 0.8.x branch upstream and will
be included in the upcoming 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch |  65 +++++
 .../0002-stage2-add-sysroot-link-option.patch | 245 ++++++++++++++++++
 ...std-build-add-sysroot-general-option.patch |  61 +++++
 srcpkgs/zig/template                          |   2 +-
 4 files changed, 372 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
 create mode 100644 srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
 create mode 100644 srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..6c6d894c8e41
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From 3e4f3a1924150e22e0ca87e906681ebadcf8433e Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH 1/3] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 7628a18c5..e433ec386 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
new file mode 100644
index 000000000000..947a4aae1df0
--- /dev/null
+++ b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
@@ -0,0 +1,245 @@
+From 16228e87d6d7d8929305083e8c76168603780f5f Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:45:43 +0200
+Subject: [PATCH 2/3] stage2: add --sysroot link option
+
+This feature is necessary for cross-compiling code that dynamically
+links system libraries, at least with the current feature set of lld.
+---
+ src/Compilation.zig | 42 +++++++++++++++++++++++++-----------------
+ src/link.zig        |  4 ++--
+ src/link/Elf.zig    |  5 +++++
+ src/link/MachO.zig  |  8 ++++----
+ src/main.zig        | 11 ++++++++++-
+ 5 files changed, 46 insertions(+), 24 deletions(-)
+
+diff --git a/src/Compilation.zig b/src/Compilation.zig
+index 977c9f4b8..5f5c1c5dd 100644
+--- a/src/Compilation.zig
++++ b/src/Compilation.zig
+@@ -612,6 +612,7 @@ pub const InitOptions = struct {
+     output_mode: std.builtin.OutputMode,
+     thread_pool: *ThreadPool,
+     dynamic_linker: ?[]const u8 = null,
++    sysroot: ?[]const u8 = null,
+     /// `null` means to not emit a binary file.
+     emit_bin: ?EmitLoc,
+     /// `null` means to not emit a C header file.
+@@ -868,25 +869,32 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             break :blk false;
+         };
+ 
+-        const DarwinOptions = struct {
+-            syslibroot: ?[]const u8 = null,
+-            system_linker_hack: bool = false,
++        const darwin_can_use_system_linker_and_sdk =
++            // comptime conditions
++            ((build_options.have_llvm and comptime std.Target.current.isDarwin()) and
++            // runtime conditions
++            (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()));
++
++        const darwin_system_linker_hack = blk: {
++            if (darwin_can_use_system_linker_and_sdk) {
++                break :blk std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
++            } else {
++                break :blk false;
++            }
+         };
+ 
+-        const darwin_options: DarwinOptions = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {
+-            const opts: DarwinOptions = if (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()) inner: {
++        const sysroot = blk: {
++            if (options.sysroot) |sysroot| {
++                break :blk sysroot;
++            } else if (darwin_can_use_system_linker_and_sdk) {
+                 // TODO Revisit this targeting versions lower than macOS 11 when LLVM 12 is out.
+                 // See https://github.com/ziglang/zig/issues/6996
+                 const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11;
+-                const syslibroot = if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
+-                const system_linker_hack = std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
+-                break :inner .{
+-                    .syslibroot = syslibroot,
+-                    .system_linker_hack = system_linker_hack,
+-                };
+-            } else .{};
+-            break :outer opts;
+-        } else .{};
++                break :blk if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
++            } else {
++                break :blk null;
++            }
++        };
+ 
+         const lto = blk: {
+             if (options.want_lto) |explicit| {
+@@ -897,7 +905,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+                 break :blk false;
+             } else if (options.c_source_files.len == 0) {
+                 break :blk false;
+-            } else if (darwin_options.system_linker_hack) {
++            } else if (darwin_system_linker_hack) {
+                 break :blk false;
+             } else switch (options.output_mode) {
+                 .Lib, .Obj => break :blk false,
+@@ -1273,13 +1281,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .module = module,
+             .target = options.target,
+             .dynamic_linker = options.dynamic_linker,
++            .sysroot = sysroot,
+             .output_mode = options.output_mode,
+             .link_mode = link_mode,
+             .object_format = ofmt,
+             .optimize_mode = options.optimize_mode,
+             .use_lld = use_lld,
+             .use_llvm = use_llvm,
+-            .system_linker_hack = darwin_options.system_linker_hack,
++            .system_linker_hack = darwin_system_linker_hack,
+             .link_libc = link_libc,
+             .link_libcpp = link_libcpp,
+             .link_libunwind = link_libunwind,
+@@ -1287,7 +1296,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .frameworks = options.frameworks,
+             .framework_dirs = options.framework_dirs,
+             .system_libs = system_libs,
+-            .syslibroot = darwin_options.syslibroot,
+             .lib_dirs = options.lib_dirs,
+             .rpath_list = options.rpath_list,
+             .strip = strip,
+diff --git a/src/link.zig b/src/link.zig
+index fcb263f03..2d2c1ebea 100644
+--- a/src/link.zig
++++ b/src/link.zig
+@@ -37,6 +37,8 @@ pub const Options = struct {
+     /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`.
+     module: ?*Module,
+     dynamic_linker: ?[]const u8,
++    /// The root path for the dynamic linker and system libraries (as well as frameworks on Darwin)
++    sysroot: ?[]const u8,
+     /// Used for calculating how much space to reserve for symbols in case the binary file
+     /// does not already have a symbol table.
+     symbol_count_hint: u64 = 32,
+@@ -103,8 +105,6 @@ pub const Options = struct {
+     llvm_cpu_features: ?[*:0]const u8,
+     /// Extra args passed directly to LLD. Ignored when not linking with LLD.
+     extra_lld_args: []const []const u8,
+-    /// Darwin-only. Set the root path to the system libraries and frameworks.
+-    syslibroot: ?[]const u8,
+ 
+     objects: []const []const u8,
+     framework_dirs: []const []const u8,
+diff --git a/src/link/Elf.zig b/src/link/Elf.zig
+index 5bf20fdd2..981211151 100644
+--- a/src/link/Elf.zig
++++ b/src/link/Elf.zig
+@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.tsan);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+ 
+         try argv.append("-error-limit=0");
+ 
++        if (self.base.options.sysroot) |sysroot| {
++            try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot}));
++        }
++
+         if (self.base.options.lto) {
+             switch (self.base.options.optimize_mode) {
+                 .Debug => {},
+diff --git a/src/link/MachO.zig b/src/link/MachO.zig
+index 24dfa2c32..1e11a3258 100644
+--- a/src/link/MachO.zig
++++ b/src/link/MachO.zig
+@@ -590,7 +590,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.system_linker_hack);
+-        man.hash.addOptionalBytes(self.base.options.syslibroot);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -720,7 +720,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             for (self.base.options.lib_dirs) |path| {
+                 if (fs.path.isAbsolute(path)) {
+                     var candidates = std.ArrayList([]const u8).init(arena);
+-                    if (self.base.options.syslibroot) |syslibroot| {
++                    if (self.base.options.sysroot) |syslibroot| {
+                         const full_path = try fs.path.join(arena, &[_][]const u8{ syslibroot, path });
+                         try candidates.append(full_path);
+                     }
+@@ -813,7 +813,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+                 try argv.append("zig");
+                 try argv.append("ld");
+ 
+-                if (self.base.options.syslibroot) |syslibroot| {
++                if (self.base.options.sysroot) |syslibroot| {
+                     try argv.append("-syslibroot");
+                     try argv.append(syslibroot);
+                 }
+@@ -959,7 +959,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             }
+         }
+ 
+-        if (self.base.options.syslibroot) |dir| {
++        if (self.base.options.sysroot) |dir| {
+             try argv.append("-syslibroot");
+             try argv.append(dir);
+         }
+diff --git a/src/main.zig b/src/main.zig
+index f5bda4379..b136a05bd 100644
+--- a/src/main.zig
++++ b/src/main.zig
+@@ -377,6 +377,7 @@ const usage_build_generic =
+     \\  -T[script], --script [script]  Use a custom linker script
+     \\  --version-script [path]        Provide a version .map file
+     \\  --dynamic-linker [path]        Set the dynamic interpreter path (usually ld.so)
++    \\  --sysroot [path]               Set the system root directory (usually /)
+     \\  --version [ver]                Dynamic library semver
+     \\  -fsoname[=name]                (Linux) Override the default SONAME value
+     \\  -fno-soname                    (Linux) Disable emitting a SONAME
+@@ -602,6 +603,7 @@ fn buildOutputType(
+     var link_eh_frame_hdr = false;
+     var link_emit_relocs = false;
+     var each_lib_rpath: ?bool = null;
++    var sysroot: ?[]const u8 = null;
+     var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC");
+     var machine_code_model: std.builtin.CodeModel = .default;
+     var runtime_args_start: ?usize = null;
+@@ -859,6 +861,10 @@ fn buildOutputType(
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+                         target_dynamic_linker = args[i];
++                    } else if (mem.eql(u8, arg, "--sysroot")) {
++                        if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
++                        i += 1;
++                        sysroot = args[i];
+                     } else if (mem.eql(u8, arg, "--libc")) {
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+@@ -1621,7 +1627,9 @@ fn buildOutputType(
+             want_native_include_dirs = true;
+     }
+ 
+-    if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
++    if (sysroot == null and cross_target.isNativeOs() and
++        (system_libs.items.len != 0 or want_native_include_dirs))
++    {
+         const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
+             fatal("unable to detect native system paths: {s}", .{@errorName(err)});
+         };
+@@ -1898,6 +1906,7 @@ fn buildOutputType(
+         .is_native_os = cross_target.isNativeOs(),
+         .is_native_abi = cross_target.isNativeAbi(),
+         .dynamic_linker = target_info.dynamic_linker.get(),
++        .sysroot = sysroot,
+         .output_mode = output_mode,
+         .root_pkg = root_pkg,
+         .emit_bin = emit_bin_loc,
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
new file mode 100644
index 000000000000..fbb579d44b06
--- /dev/null
+++ b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
@@ -0,0 +1,61 @@
+From e75dfbcb3f1892f67fa9a86157bc503fad300772 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Fri, 25 Jun 2021 14:04:38 +0200
+Subject: [PATCH 3/3] std/build: add --sysroot general option
+
+---
+ lib/std/build.zig                | 5 +++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index e433ec386..9b7ebb1f4 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -57,6 +57,7 @@ pub const Builder = struct {
+     exe_dir: []const u8,
+     h_dir: []const u8,
+     install_path: []const u8,
++    sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
+     libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct {
+             }
+         }
+ 
++        if (builder.sysroot) |sysroot| {
++            try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
++        }
++
+         for (builder.search_prefixes.items) |search_prefix| {
+             try zig_args.append("-L");
+             try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index 2a0ca86d7..d1154add0 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -87,6 +87,12 @@ pub fn main() !void {
+                     warn("Expected argument after {s}\n\n", .{arg});
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
++            } else if (mem.eql(u8, arg, "--sysroot")) {
++                const sysroot = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --sysroot\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.sysroot = sysroot;
+             } else if (mem.eql(u8, arg, "--search-prefix")) {
+                 const search_prefix = nextArg(args, &arg_idx) orelse {
+                     warn("Expected argument after --search-prefix\n\n", .{});
+@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -h, --help                  Print this help and exit
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
++        \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
+         \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..f9a4c61839aa 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make

From f68c56a0d3a5fd1a959ff6075d82c25064381373 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 39 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 45 files changed, 127 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..bfb80f352be7
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,39 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles cross-profiles is totally
+	# unnecessary. It would be nice if there was some way to avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From bce949c81ae4261d06047915b6b7b5a4e731ca9f Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..3d4dc8b75d59
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

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

* Re: New package: rundird-0.1.1, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (39 preceding siblings ...)
  2021-07-27  1:07 ` ifreund
@ 2021-07-27  1:11 ` ifreund
  2021-08-18 22:18 ` [PR REVIEW] New package: rundird-0.2.0, " ericonr
                   ` (28 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-07-27  1:11 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-887133541

Comment:
Thanks for the review @ericonr! I've gone ahead and done this "properly" by defining zig target and cpu variables in the `build-profile`s and `cross-profile`s. I think this is a lot better as it makes it much easier to keep the zig target cpu features in sync with the ones used for C as the definitions are in the same file. In fact, I caught a couple of minor mistakes I had made in the previous approach this way.

This should be ready to merge from my point of view, assuming CI passes.

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

* Re: [PR REVIEW] New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (40 preceding siblings ...)
  2021-07-27  1:11 ` ifreund
@ 2021-08-18 22:18 ` ericonr
  2021-08-18 22:38 ` ifreund
                   ` (27 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-08-18 22:18 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r691642455

Comment:
What do you think about an `environment/build-style/` file that sets `archs` for the supported archs? This way you don't have to detect if these are set before `do_build` in order to trigger `broken` (or maybe it's the best way, since it avoids duplicating the information?).

Overall looks really good, just want to be sure of the best way of signaling when zig is unsupported.

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

* Re: [PR REVIEW] New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (41 preceding siblings ...)
  2021-08-18 22:18 ` [PR REVIEW] New package: rundird-0.2.0, " ericonr
@ 2021-08-18 22:38 ` ifreund
  2021-08-18 22:41 ` [PR PATCH] [Updated] " ifreund
                   ` (26 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-08-18 22:38 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r691650963

Comment:
Hmm, that seems like it might be a good idea in general but I don't think we need that for zig. Zig is theoretically able to target all of xbps's targets and I've included exhaustive support for xbps's targets in this PR. 

However, support for some of the less common architectures is of course not as good and attempting to actually compile code for them may fail due to issues in the compiler and/or std. This of course depends on the exact code being compiled as well though, especially when the issues are due to stdlib deficiencies which are often easy to add temporary downstream workarounds for as the language matures.

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

* Re: [PR PATCH] [Updated] New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (42 preceding siblings ...)
  2021-08-18 22:38 ` ifreund
@ 2021-08-18 22:41 ` ifreund
  2021-08-18 22:41 ` ifreund
                   ` (25 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-08-18 22:41 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.2.0, Add zig-build build style
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From f25b7795e758a62ef17fc663c9273bf8d16662d2 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:13:02 +0000
Subject: [PATCH 1/3] zig: backport 3 upstream commits

These patches are required in order to integrate zig's crosscompilation
features with xbps when using the zig build system.

All 3 of these commits have landed in the 0.8.x branch upstream and will
be included in the upcoming 0.8.1 release.
---
 ...01-zig-build-add-libc-general-option.patch |  65 +++++
 .../0002-stage2-add-sysroot-link-option.patch | 245 ++++++++++++++++++
 ...std-build-add-sysroot-general-option.patch |  61 +++++
 srcpkgs/zig/template                          |   2 +-
 4 files changed, 372 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
 create mode 100644 srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
 create mode 100644 srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch

diff --git a/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
new file mode 100644
index 000000000000..6c6d894c8e41
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-zig-build-add-libc-general-option.patch
@@ -0,0 +1,65 @@
+From 3e4f3a1924150e22e0ca87e906681ebadcf8433e Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Sun, 13 Jun 2021 04:49:54 +0000
+Subject: [PATCH 1/3] zig build: add --libc general option
+
+This new option sets a default libc paths file to be used for all
+LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
+
+This is required to allow users to cross compile projects linking system
+libraries without needing to patch the build.zig.
+---
+ lib/std/build.zig                | 4 ++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 7628a18c5..e433ec386 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -58,6 +58,7 @@ pub const Builder = struct {
+     h_dir: []const u8,
+     install_path: []const u8,
+     search_prefixes: ArrayList([]const u8),
++    libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+     build_root: []const u8,
+     cache_root: []const u8,
+@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
+         if (self.libc_file) |libc_file| {
+             try zig_args.append("--libc");
+             try zig_args.append(builder.pathFromRoot(libc_file));
++        } else if (builder.libc_file) |libc_file| {
++            try zig_args.append("--libc");
++            try zig_args.append(libc_file);
+         }
+ 
+         switch (self.build_mode) {
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index c6185ef09..2a0ca86d7 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -93,6 +93,12 @@ pub fn main() !void {
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
+                 builder.addSearchPrefix(search_prefix);
++            } else if (mem.eql(u8, arg, "--libc")) {
++                const libc_file = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --libc\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.libc_file = libc_file;
+             } else if (mem.eql(u8, arg, "--color")) {
+                 const next_arg = nextArg(args, &arg_idx) orelse {
+                     warn("expected [auto|on|off] after --color", .{});
+@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
++        \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+         \\
+         \\Project-Specific Options:
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
new file mode 100644
index 000000000000..947a4aae1df0
--- /dev/null
+++ b/srcpkgs/zig/patches/0002-stage2-add-sysroot-link-option.patch
@@ -0,0 +1,245 @@
+From 16228e87d6d7d8929305083e8c76168603780f5f Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Mon, 21 Jun 2021 22:45:43 +0200
+Subject: [PATCH 2/3] stage2: add --sysroot link option
+
+This feature is necessary for cross-compiling code that dynamically
+links system libraries, at least with the current feature set of lld.
+---
+ src/Compilation.zig | 42 +++++++++++++++++++++++++-----------------
+ src/link.zig        |  4 ++--
+ src/link/Elf.zig    |  5 +++++
+ src/link/MachO.zig  |  8 ++++----
+ src/main.zig        | 11 ++++++++++-
+ 5 files changed, 46 insertions(+), 24 deletions(-)
+
+diff --git a/src/Compilation.zig b/src/Compilation.zig
+index 977c9f4b8..5f5c1c5dd 100644
+--- a/src/Compilation.zig
++++ b/src/Compilation.zig
+@@ -612,6 +612,7 @@ pub const InitOptions = struct {
+     output_mode: std.builtin.OutputMode,
+     thread_pool: *ThreadPool,
+     dynamic_linker: ?[]const u8 = null,
++    sysroot: ?[]const u8 = null,
+     /// `null` means to not emit a binary file.
+     emit_bin: ?EmitLoc,
+     /// `null` means to not emit a C header file.
+@@ -868,25 +869,32 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             break :blk false;
+         };
+ 
+-        const DarwinOptions = struct {
+-            syslibroot: ?[]const u8 = null,
+-            system_linker_hack: bool = false,
++        const darwin_can_use_system_linker_and_sdk =
++            // comptime conditions
++            ((build_options.have_llvm and comptime std.Target.current.isDarwin()) and
++            // runtime conditions
++            (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()));
++
++        const darwin_system_linker_hack = blk: {
++            if (darwin_can_use_system_linker_and_sdk) {
++                break :blk std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
++            } else {
++                break :blk false;
++            }
+         };
+ 
+-        const darwin_options: DarwinOptions = if (build_options.have_llvm and comptime std.Target.current.isDarwin()) outer: {
+-            const opts: DarwinOptions = if (use_lld and std.builtin.os.tag == .macos and options.target.isDarwin()) inner: {
++        const sysroot = blk: {
++            if (options.sysroot) |sysroot| {
++                break :blk sysroot;
++            } else if (darwin_can_use_system_linker_and_sdk) {
+                 // TODO Revisit this targeting versions lower than macOS 11 when LLVM 12 is out.
+                 // See https://github.com/ziglang/zig/issues/6996
+                 const at_least_big_sur = options.target.os.getVersionRange().semver.min.major >= 11;
+-                const syslibroot = if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
+-                const system_linker_hack = std.os.getenv("ZIG_SYSTEM_LINKER_HACK") != null;
+-                break :inner .{
+-                    .syslibroot = syslibroot,
+-                    .system_linker_hack = system_linker_hack,
+-                };
+-            } else .{};
+-            break :outer opts;
+-        } else .{};
++                break :blk if (at_least_big_sur) try std.zig.system.getSDKPath(arena) else null;
++            } else {
++                break :blk null;
++            }
++        };
+ 
+         const lto = blk: {
+             if (options.want_lto) |explicit| {
+@@ -897,7 +905,7 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+                 break :blk false;
+             } else if (options.c_source_files.len == 0) {
+                 break :blk false;
+-            } else if (darwin_options.system_linker_hack) {
++            } else if (darwin_system_linker_hack) {
+                 break :blk false;
+             } else switch (options.output_mode) {
+                 .Lib, .Obj => break :blk false,
+@@ -1273,13 +1281,14 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .module = module,
+             .target = options.target,
+             .dynamic_linker = options.dynamic_linker,
++            .sysroot = sysroot,
+             .output_mode = options.output_mode,
+             .link_mode = link_mode,
+             .object_format = ofmt,
+             .optimize_mode = options.optimize_mode,
+             .use_lld = use_lld,
+             .use_llvm = use_llvm,
+-            .system_linker_hack = darwin_options.system_linker_hack,
++            .system_linker_hack = darwin_system_linker_hack,
+             .link_libc = link_libc,
+             .link_libcpp = link_libcpp,
+             .link_libunwind = link_libunwind,
+@@ -1287,7 +1296,6 @@ pub fn create(gpa: *Allocator, options: InitOptions) !*Compilation {
+             .frameworks = options.frameworks,
+             .framework_dirs = options.framework_dirs,
+             .system_libs = system_libs,
+-            .syslibroot = darwin_options.syslibroot,
+             .lib_dirs = options.lib_dirs,
+             .rpath_list = options.rpath_list,
+             .strip = strip,
+diff --git a/src/link.zig b/src/link.zig
+index fcb263f03..2d2c1ebea 100644
+--- a/src/link.zig
++++ b/src/link.zig
+@@ -37,6 +37,8 @@ pub const Options = struct {
+     /// Not every Compilation compiles .zig code! For example you could do `zig build-exe foo.o`.
+     module: ?*Module,
+     dynamic_linker: ?[]const u8,
++    /// The root path for the dynamic linker and system libraries (as well as frameworks on Darwin)
++    sysroot: ?[]const u8,
+     /// Used for calculating how much space to reserve for symbols in case the binary file
+     /// does not already have a symbol table.
+     symbol_count_hint: u64 = 32,
+@@ -103,8 +105,6 @@ pub const Options = struct {
+     llvm_cpu_features: ?[*:0]const u8,
+     /// Extra args passed directly to LLD. Ignored when not linking with LLD.
+     extra_lld_args: []const []const u8,
+-    /// Darwin-only. Set the root path to the system libraries and frameworks.
+-    syslibroot: ?[]const u8,
+ 
+     objects: []const []const u8,
+     framework_dirs: []const []const u8,
+diff --git a/src/link/Elf.zig b/src/link/Elf.zig
+index 5bf20fdd2..981211151 100644
+--- a/src/link/Elf.zig
++++ b/src/link/Elf.zig
+@@ -1354,6 +1354,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.tsan);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -1423,6 +1424,10 @@ fn linkWithLLD(self: *Elf, comp: *Compilation) !void {
+ 
+         try argv.append("-error-limit=0");
+ 
++        if (self.base.options.sysroot) |sysroot| {
++            try argv.append(try std.fmt.allocPrint(arena, "--sysroot={s}", .{sysroot}));
++        }
++
+         if (self.base.options.lto) {
+             switch (self.base.options.optimize_mode) {
+                 .Debug => {},
+diff --git a/src/link/MachO.zig b/src/link/MachO.zig
+index 24dfa2c32..1e11a3258 100644
+--- a/src/link/MachO.zig
++++ b/src/link/MachO.zig
+@@ -590,7 +590,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+         man.hash.add(allow_shlib_undefined);
+         man.hash.add(self.base.options.bind_global_refs_locally);
+         man.hash.add(self.base.options.system_linker_hack);
+-        man.hash.addOptionalBytes(self.base.options.syslibroot);
++        man.hash.addOptionalBytes(self.base.options.sysroot);
+ 
+         // We don't actually care whether it's a cache hit or miss; we just need the digest and the lock.
+         _ = try man.hit();
+@@ -720,7 +720,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             for (self.base.options.lib_dirs) |path| {
+                 if (fs.path.isAbsolute(path)) {
+                     var candidates = std.ArrayList([]const u8).init(arena);
+-                    if (self.base.options.syslibroot) |syslibroot| {
++                    if (self.base.options.sysroot) |syslibroot| {
+                         const full_path = try fs.path.join(arena, &[_][]const u8{ syslibroot, path });
+                         try candidates.append(full_path);
+                     }
+@@ -813,7 +813,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+                 try argv.append("zig");
+                 try argv.append("ld");
+ 
+-                if (self.base.options.syslibroot) |syslibroot| {
++                if (self.base.options.sysroot) |syslibroot| {
+                     try argv.append("-syslibroot");
+                     try argv.append(syslibroot);
+                 }
+@@ -959,7 +959,7 @@ fn linkWithLLD(self: *MachO, comp: *Compilation) !void {
+             }
+         }
+ 
+-        if (self.base.options.syslibroot) |dir| {
++        if (self.base.options.sysroot) |dir| {
+             try argv.append("-syslibroot");
+             try argv.append(dir);
+         }
+diff --git a/src/main.zig b/src/main.zig
+index f5bda4379..b136a05bd 100644
+--- a/src/main.zig
++++ b/src/main.zig
+@@ -377,6 +377,7 @@ const usage_build_generic =
+     \\  -T[script], --script [script]  Use a custom linker script
+     \\  --version-script [path]        Provide a version .map file
+     \\  --dynamic-linker [path]        Set the dynamic interpreter path (usually ld.so)
++    \\  --sysroot [path]               Set the system root directory (usually /)
+     \\  --version [ver]                Dynamic library semver
+     \\  -fsoname[=name]                (Linux) Override the default SONAME value
+     \\  -fno-soname                    (Linux) Disable emitting a SONAME
+@@ -602,6 +603,7 @@ fn buildOutputType(
+     var link_eh_frame_hdr = false;
+     var link_emit_relocs = false;
+     var each_lib_rpath: ?bool = null;
++    var sysroot: ?[]const u8 = null;
+     var libc_paths_file: ?[]const u8 = try optionalStringEnvVar(arena, "ZIG_LIBC");
+     var machine_code_model: std.builtin.CodeModel = .default;
+     var runtime_args_start: ?usize = null;
+@@ -859,6 +861,10 @@ fn buildOutputType(
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+                         target_dynamic_linker = args[i];
++                    } else if (mem.eql(u8, arg, "--sysroot")) {
++                        if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
++                        i += 1;
++                        sysroot = args[i];
+                     } else if (mem.eql(u8, arg, "--libc")) {
+                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
+                         i += 1;
+@@ -1621,7 +1627,9 @@ fn buildOutputType(
+             want_native_include_dirs = true;
+     }
+ 
+-    if (cross_target.isNativeOs() and (system_libs.items.len != 0 or want_native_include_dirs)) {
++    if (sysroot == null and cross_target.isNativeOs() and
++        (system_libs.items.len != 0 or want_native_include_dirs))
++    {
+         const paths = std.zig.system.NativePaths.detect(arena, target_info) catch |err| {
+             fatal("unable to detect native system paths: {s}", .{@errorName(err)});
+         };
+@@ -1898,6 +1906,7 @@ fn buildOutputType(
+         .is_native_os = cross_target.isNativeOs(),
+         .is_native_abi = cross_target.isNativeAbi(),
+         .dynamic_linker = target_info.dynamic_linker.get(),
++        .sysroot = sysroot,
+         .output_mode = output_mode,
+         .root_pkg = root_pkg,
+         .emit_bin = emit_bin_loc,
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
new file mode 100644
index 000000000000..fbb579d44b06
--- /dev/null
+++ b/srcpkgs/zig/patches/0003-std-build-add-sysroot-general-option.patch
@@ -0,0 +1,61 @@
+From e75dfbcb3f1892f67fa9a86157bc503fad300772 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Fri, 25 Jun 2021 14:04:38 +0200
+Subject: [PATCH 3/3] std/build: add --sysroot general option
+
+---
+ lib/std/build.zig                | 5 +++++
+ lib/std/special/build_runner.zig | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index e433ec386..9b7ebb1f4 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -57,6 +57,7 @@ pub const Builder = struct {
+     exe_dir: []const u8,
+     h_dir: []const u8,
+     install_path: []const u8,
++    sysroot: ?[]const u8 = null,
+     search_prefixes: ArrayList([]const u8),
+     libc_file: ?[]const u8 = null,
+     installed_files: ArrayList(InstalledFile),
+@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct {
+             }
+         }
+ 
++        if (builder.sysroot) |sysroot| {
++            try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
++        }
++
+         for (builder.search_prefixes.items) |search_prefix| {
+             try zig_args.append("-L");
+             try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
+diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig
+index 2a0ca86d7..d1154add0 100644
+--- a/lib/std/special/build_runner.zig
++++ b/lib/std/special/build_runner.zig
+@@ -87,6 +87,12 @@ pub fn main() !void {
+                     warn("Expected argument after {s}\n\n", .{arg});
+                     return usageAndErr(builder, false, stderr_stream);
+                 };
++            } else if (mem.eql(u8, arg, "--sysroot")) {
++                const sysroot = nextArg(args, &arg_idx) orelse {
++                    warn("Expected argument after --sysroot\n\n", .{});
++                    return usageAndErr(builder, false, stderr_stream);
++                };
++                builder.sysroot = sysroot;
+             } else if (mem.eql(u8, arg, "--search-prefix")) {
+                 const search_prefix = nextArg(args, &arg_idx) orelse {
+                     warn("Expected argument after --search-prefix\n\n", .{});
+@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
+         \\  -h, --help                  Print this help and exit
+         \\  --verbose                   Print commands before executing them
+         \\  -p, --prefix [path]         Override default install prefix
++        \\  --sysroot [path]            Set the system root directory (usually /)
+         \\  --search-prefix [path]      Add a path to look for binaries, libraries, headers
+         \\  --libc [file]               Provide a file which specifies libc paths
+         \\  --color [auto|off|on]       Enable or disable colored error messages
+-- 
+2.32.0
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..f9a4c61839aa 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,7 +1,7 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.0
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make

From b8f2fc18e34e0ec802d970486da0ab068c668b06 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 40 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 45 files changed, 128 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..9a8825ddf9e7
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,40 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From 217d259f407b7b4510a7176b6142cd1fec0b1a2d Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..3d4dc8b75d59
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

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

* Re: New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (43 preceding siblings ...)
  2021-08-18 22:41 ` [PR PATCH] [Updated] " ifreund
@ 2021-08-18 22:41 ` ifreund
  2021-09-07 17:23 ` [PR PATCH] [Updated] " ifreund
                   ` (24 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-08-18 22:41 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-901475932

Comment:
Just rebased onto master and fixed a typo in a comment that I just noticed.

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

* Re: [PR PATCH] [Updated] New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (44 preceding siblings ...)
  2021-08-18 22:41 ` ifreund
@ 2021-09-07 17:23 ` ifreund
  2021-09-07 17:25 ` ifreund
                   ` (23 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-09-07 17:23 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.2.0, Add zig-build build style
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From 045a5ed44e84d5cc85105581c9e4204021a69121 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Tue, 7 Sep 2021 19:16:44 +0200
Subject: [PATCH 1/3] zig: update to 0.8.1.

---
 srcpkgs/zig/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index baefd41af01e..893ba0ec054f 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,6 +1,6 @@
 # Template file for 'zig'
 pkgname=zig
-version=0.8.0
+version=0.8.1
 revision=1
 archs="x86_64* aarch64*"
 build_style=cmake
@@ -11,7 +11,7 @@ maintainer="Isaac Freund <ifreund@ifreund.xyz>"
 license="MIT"
 homepage="https://ziglang.org"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"
-checksum=03a828d00c06b2e3bb8b7ff706997fd76bf32503b08d759756155b6e8c981e77
+checksum=8c428e14a0a89cb7a15a6768424a37442292858cdb695e2eb503fa3c7bf47f1a
 nopie=yes
 nocross=yes
 

From dac77aa5d6e6fe41a387f3490fc44e5aafa39dfe Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 2/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 40 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 45 files changed, 128 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..9a8825ddf9e7
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,40 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From e53d744449dadd6b096e94696c3b5550e6f31663 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..3d4dc8b75d59
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

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

* Re: New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (45 preceding siblings ...)
  2021-09-07 17:23 ` [PR PATCH] [Updated] " ifreund
@ 2021-09-07 17:25 ` ifreund
  2021-09-15 14:50 ` [PR PATCH] [Updated] " ifreund
                   ` (22 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-09-07 17:25 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-914488321

Comment:
Zig 0.8.1 has been released with the the patches I landed to support sysroot-based cross compilation dynamically linking system libraries. Therefore we no longer need to patch zig to enable the zig-build build style and I've rebased this PR onto #32867.

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

* Re: [PR PATCH] [Updated] New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (46 preceding siblings ...)
  2021-09-07 17:25 ` ifreund
@ 2021-09-15 14:50 ` ifreund
  2021-11-03 13:49 ` ifreund
                   ` (21 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-09-15 14:50 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.2.0, Add zig-build build style
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From d67212c38fd858428d18afed8beb16f37b64a90c Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 1/2] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 40 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 45 files changed, 128 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..9a8825ddf9e7
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,40 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From 2bc8f17e1da5fc86c63bd92971ab4c1f8664f212 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 2/2] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..3d4dc8b75d59
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

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

* Re: [PR PATCH] [Updated] New package: rundird-0.2.0, Add zig-build build style
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (47 preceding siblings ...)
  2021-09-15 14:50 ` [PR PATCH] [Updated] " ifreund
@ 2021-11-03 13:49 ` ifreund
  2021-11-03 16:46 ` [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0 ifreund
                   ` (20 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-03 13:49 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

New package: rundird-0.2.0, Add zig-build build style
<!-- Mark items with [x] where applicable -->

#### 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
-->


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

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

From e881f6e912157d7cc51501c4b35d9c1978cf6c4c Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 1/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 Manual.md                              |  4 +++
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 41 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 46 files changed, 133 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/Manual.md b/Manual.md
index 0f268fa79ea0..e318686d3c30 100644
--- a/Manual.md
+++ b/Manual.md
@@ -998,6 +998,10 @@ configure arguments can be specified via `cross_*_configure_args` where `*` is `
 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
 
+- `zig-build` For packages using [Zig](https://ziglang.org)'s build
+system. Additional arguments may be passed to the `zig build` invocation using
+`configure_args`.
+
 For packages that use the Python module build method (`setup.py` or
 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
 
diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..205c4cadf53f
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install \
+		${configure_args}
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From f3560a0c82deebaae5758ab3209829ee544cab95 Mon Sep 17 00:00:00 2001
From: Isaac Freund <ifreund@ifreund.xyz>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 2/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..3d4dc8b75d59
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

From 564425039b25c38c1611255e857dbc631c130e5d Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 3 Nov 2021 14:48:05 +0100
Subject: [PATCH 3/3] New package: river-0.1.0

---
 ...ble-PIE-for-river-riverctl-rivertile.patch | 42 +++++++++++++++++++
 srcpkgs/river/template                        | 19 +++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
 create mode 100644 srcpkgs/river/template

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
new file mode 100644
index 000000000000..ecc68302db09
--- /dev/null
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -0,0 +1,42 @@
+From 759c1c7a915083f3da46960ff82fa2a3566a7065 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <mail@isaacfreund.com>
+Date: Wed, 3 Nov 2021 14:21:35 +0100
+Subject: [PATCH] Enable PIE for river, riverctl, rivertile
+
+There is sadly not yet a standard way to do this exposed by the zig
+build system. See: https://github.com/ziglang/zig/issues/7201
+---
+ build.zig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build.zig b/build.zig
+index d561f49..8ac9a4e 100644
+--- a/build.zig
++++ b/build.zig
+@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const river = b.addExecutable("river", "river/main.zig");
+         river.setTarget(target);
+         river.setBuildMode(mode);
++        river.pie = true;
+         river.addBuildOption(bool, "xwayland", xwayland);
+         river.addBuildOption([:0]const u8, "version", full_version);
+ 
+@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
+         riverctl.setTarget(target);
+         riverctl.setBuildMode(mode);
++        riverctl.pie = true;
+         riverctl.addBuildOption([:0]const u8, "version", full_version);
+ 
+         riverctl.step.dependOn(&scanner.step);
+@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
+         rivertile.setTarget(target);
+         rivertile.setBuildMode(mode);
++        rivertile.pie = true;
+         rivertile.addBuildOption([:0]const u8, "version", full_version);
+ 
+         rivertile.step.dependOn(&scanner.step);
+-- 
+2.33.1
+
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
new file mode 100644
index 000000000000..0708262d2f67
--- /dev/null
+++ b/srcpkgs/river/template
@@ -0,0 +1,19 @@
+# Template file for 'river'
+pkgname=river
+version=0.1.0
+revision=1
+build_style=zig-build
+configure_args="$(vopt_if xwayland -Dxwayland)"
+hostmakedepends="zig pkg-config wayland-devel scdoc git"
+makedepends="wlroots-devel"
+depends="$(vopt_if xwayland xorg-server-xwayland)"
+short_desc="Dynamic tiling Wayland compositor"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/riverwm/river"
+distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
+checksum=4153a5511a1008e87a2251fc4510a43d6f6085f41b040222506355ff6d4bd10f
+
+build_options="xwayland"
+build_options_default="xwayland"
+desc_option_xwayland="Enable Xwayland support"

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

* Re: [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (48 preceding siblings ...)
  2021-11-03 13:49 ` ifreund
@ 2021-11-03 16:46 ` ifreund
  2021-11-08 15:56 ` ifreund
                   ` (19 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-03 16:46 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

Add zig-build build style, river 0.1.0, rundird 0.2.0
<!-- Mark items with [x] where applicable -->

#### 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
-->
Closes  #33060


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

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

From 05b392f4020fb27d9aa4371c41bb83084eb1cff9 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 1/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 Manual.md                              |  4 +++
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 41 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 46 files changed, 133 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/Manual.md b/Manual.md
index 0f268fa79ea0..e318686d3c30 100644
--- a/Manual.md
+++ b/Manual.md
@@ -998,6 +998,10 @@ configure arguments can be specified via `cross_*_configure_args` where `*` is `
 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
 
+- `zig-build` For packages using [Zig](https://ziglang.org)'s build
+system. Additional arguments may be passed to the `zig build` invocation using
+`configure_args`.
+
 For packages that use the Python module build method (`setup.py` or
 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
 
diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..205c4cadf53f
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install \
+		${configure_args}
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From b45327d1a788e90d0170266d93cc190475f76d92 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 2/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5488292ee390
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

From 3b4fc6829660c204aa35ab509974f73a9925dfe5 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 3 Nov 2021 14:48:05 +0100
Subject: [PATCH 3/3] New package: river-0.1.0

---
 ...ble-PIE-for-river-riverctl-rivertile.patch | 42 +++++++++++++++++++
 srcpkgs/river/template                        | 19 +++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
 create mode 100644 srcpkgs/river/template

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
new file mode 100644
index 000000000000..ecc68302db09
--- /dev/null
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -0,0 +1,42 @@
+From 759c1c7a915083f3da46960ff82fa2a3566a7065 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <mail@isaacfreund.com>
+Date: Wed, 3 Nov 2021 14:21:35 +0100
+Subject: [PATCH] Enable PIE for river, riverctl, rivertile
+
+There is sadly not yet a standard way to do this exposed by the zig
+build system. See: https://github.com/ziglang/zig/issues/7201
+---
+ build.zig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build.zig b/build.zig
+index d561f49..8ac9a4e 100644
+--- a/build.zig
++++ b/build.zig
+@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const river = b.addExecutable("river", "river/main.zig");
+         river.setTarget(target);
+         river.setBuildMode(mode);
++        river.pie = true;
+         river.addBuildOption(bool, "xwayland", xwayland);
+         river.addBuildOption([:0]const u8, "version", full_version);
+ 
+@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
+         riverctl.setTarget(target);
+         riverctl.setBuildMode(mode);
++        riverctl.pie = true;
+         riverctl.addBuildOption([:0]const u8, "version", full_version);
+ 
+         riverctl.step.dependOn(&scanner.step);
+@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
+         rivertile.setTarget(target);
+         rivertile.setBuildMode(mode);
++        rivertile.pie = true;
+         rivertile.addBuildOption([:0]const u8, "version", full_version);
+ 
+         rivertile.step.dependOn(&scanner.step);
+-- 
+2.33.1
+
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
new file mode 100644
index 000000000000..0708262d2f67
--- /dev/null
+++ b/srcpkgs/river/template
@@ -0,0 +1,19 @@
+# Template file for 'river'
+pkgname=river
+version=0.1.0
+revision=1
+build_style=zig-build
+configure_args="$(vopt_if xwayland -Dxwayland)"
+hostmakedepends="zig pkg-config wayland-devel scdoc git"
+makedepends="wlroots-devel"
+depends="$(vopt_if xwayland xorg-server-xwayland)"
+short_desc="Dynamic tiling Wayland compositor"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/riverwm/river"
+distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
+checksum=4153a5511a1008e87a2251fc4510a43d6f6085f41b040222506355ff6d4bd10f
+
+build_options="xwayland"
+build_options_default="xwayland"
+desc_option_xwayland="Enable Xwayland support"

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

* Re: [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (49 preceding siblings ...)
  2021-11-03 16:46 ` [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0 ifreund
@ 2021-11-08 15:56 ` ifreund
  2021-11-08 15:58 ` ifreund
                   ` (18 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-08 15:56 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

Add zig-build build style, river 0.1.0, rundird 0.2.0
<!-- Mark items with [x] where applicable -->

#### 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
-->
Closes  #33060


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

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

From c49c75122f1b6805828252b831d7fbd61b76c098 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 1/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.

This commit also backports one bug fix from the zig master branch
which is critical for our use-case of building software for binary
distribution.
---
 Manual.md                                     |  4 ++
 common/build-profiles/README                  |  2 +
 common/build-profiles/aarch64-musl.sh         |  2 +
 common/build-profiles/aarch64.sh              |  2 +
 common/build-profiles/armv6l-musl.sh          |  2 +
 common/build-profiles/armv6l.sh               |  2 +
 common/build-profiles/armv7l-musl.sh          |  2 +
 common/build-profiles/armv7l.sh               |  2 +
 common/build-profiles/i686-musl.sh            |  2 +
 common/build-profiles/i686.sh                 |  2 +
 common/build-profiles/ppc-musl.sh             |  2 +
 common/build-profiles/ppc.sh                  |  2 +
 common/build-profiles/ppc64-musl.sh           |  2 +
 common/build-profiles/ppc64.sh                |  2 +
 common/build-profiles/ppc64le-musl.sh         |  2 +
 common/build-profiles/ppc64le.sh              |  2 +
 common/build-profiles/ppcle-musl.sh           |  2 +
 common/build-profiles/ppcle.sh                |  2 +
 common/build-profiles/x86_64-musl.sh          |  2 +
 common/build-profiles/x86_64.sh               |  2 +
 common/build-style/zig-build.sh               | 41 ++++++++++++++++
 common/cross-profiles/README                  |  2 +
 common/cross-profiles/aarch64-musl.sh         |  2 +
 common/cross-profiles/aarch64.sh              |  2 +
 common/cross-profiles/armv5tel-musl.sh        |  2 +
 common/cross-profiles/armv5tel.sh             |  2 +
 common/cross-profiles/armv6l-musl.sh          |  2 +
 common/cross-profiles/armv6l.sh               |  2 +
 common/cross-profiles/armv7l-musl.sh          |  2 +
 common/cross-profiles/armv7l.sh               |  2 +
 common/cross-profiles/i686-musl.sh            |  2 +
 common/cross-profiles/i686.sh                 |  2 +
 common/cross-profiles/mips-musl.sh            |  2 +
 common/cross-profiles/mipsel-musl.sh          |  2 +
 common/cross-profiles/mipselhf-musl.sh        |  2 +
 common/cross-profiles/mipshf-musl.sh          |  2 +
 common/cross-profiles/ppc-musl.sh             |  2 +
 common/cross-profiles/ppc.sh                  |  2 +
 common/cross-profiles/ppc64-musl.sh           |  2 +
 common/cross-profiles/ppc64.sh                |  2 +
 common/cross-profiles/ppc64le-musl.sh         |  2 +
 common/cross-profiles/ppc64le.sh              |  2 +
 common/cross-profiles/ppcle-musl.sh           |  2 +
 common/cross-profiles/ppcle.sh                |  2 +
 common/cross-profiles/x86_64-musl.sh          |  2 +
 common/cross-profiles/x86_64.sh               |  2 +
 .../0001-std.build-fix-handling-of-Dcpu.patch | 48 +++++++++++++++++++
 47 files changed, 181 insertions(+)
 create mode 100644 common/build-style/zig-build.sh
 create mode 100644 srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch

diff --git a/Manual.md b/Manual.md
index 5996e1502887..b0afd6db1596 100644
--- a/Manual.md
+++ b/Manual.md
@@ -998,6 +998,10 @@ configure arguments can be specified via `cross_*_configure_args` where `*` is `
 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
 
+- `zig-build` For packages using [Zig](https://ziglang.org)'s build
+system. Additional arguments may be passed to the `zig build` invocation using
+`configure_args`.
+
 For packages that use the Python module build method (`setup.py` or
 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
 
diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..205c4cadf53f
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install \
+		${configure_args}
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
new file mode 100644
index 000000000000..4101f24459bb
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
@@ -0,0 +1,48 @@
+From 1e8cdace7ad324a42228aeb5cd6eb8dd15429413 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Tue, 21 Sep 2021 21:06:10 +0200
+Subject: [PATCH] std.build: fix handling of -Dcpu
+
+Currently -Dcpu is completely ignored if -Dtarget isn't passed as well.
+Further, -Dcpu=baseline is ignored even if -Dtarget=native is passed.
+
+This patch fixes these 2 issues, always respecting the -Dcpu option if
+present.
+---
+ lib/std/build.zig | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 9b7ebb1f4..e398529f9 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -685,7 +685,11 @@ pub const Builder = struct {
+         );
+         const mcpu = self.option([]const u8, "cpu", "Target CPU");
+ 
+-        const triple = maybe_triple orelse return args.default_target;
++        if (maybe_triple == null and mcpu == null) {
++            return args.default_target;
++        }
++
++        const triple = maybe_triple orelse "native";
+ 
+         var diags: CrossTarget.ParseOptions.Diagnostics = .{};
+         const selected_target = CrossTarget.parse(.{
+@@ -2451,11 +2455,8 @@ pub const LibExeObjStep = struct {
+ 
+             if (populated_cpu_features.eql(cross.cpu.features)) {
+                 // The CPU name alone is sufficient.
+-                // If it is the baseline CPU, no command line args are required.
+-                if (cross.cpu.model != std.Target.Cpu.baseline(cross.cpu.arch).model) {
+-                    try zig_args.append("-mcpu");
+-                    try zig_args.append(cross.cpu.model.name);
+-                }
++                try zig_args.append("-mcpu");
++                try zig_args.append(cross.cpu.model.name);
+             } else {
+                 var mcpu_buffer = std.ArrayList(u8).init(builder.allocator);
+ 
+-- 
+2.33.1
+

From 8895cceb8d9647bae8c87b33ddba1b9098c55b5f Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 2/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5488292ee390
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

From ab555a47508f6cb7fe30d796ace6373fbe6dfc78 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 3 Nov 2021 14:48:05 +0100
Subject: [PATCH 3/3] New package: river-0.1.0

---
 ...ble-PIE-for-river-riverctl-rivertile.patch | 42 +++++++++++++++++++
 srcpkgs/river/template                        | 19 +++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
 create mode 100644 srcpkgs/river/template

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
new file mode 100644
index 000000000000..ecc68302db09
--- /dev/null
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -0,0 +1,42 @@
+From 759c1c7a915083f3da46960ff82fa2a3566a7065 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <mail@isaacfreund.com>
+Date: Wed, 3 Nov 2021 14:21:35 +0100
+Subject: [PATCH] Enable PIE for river, riverctl, rivertile
+
+There is sadly not yet a standard way to do this exposed by the zig
+build system. See: https://github.com/ziglang/zig/issues/7201
+---
+ build.zig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build.zig b/build.zig
+index d561f49..8ac9a4e 100644
+--- a/build.zig
++++ b/build.zig
+@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const river = b.addExecutable("river", "river/main.zig");
+         river.setTarget(target);
+         river.setBuildMode(mode);
++        river.pie = true;
+         river.addBuildOption(bool, "xwayland", xwayland);
+         river.addBuildOption([:0]const u8, "version", full_version);
+ 
+@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
+         riverctl.setTarget(target);
+         riverctl.setBuildMode(mode);
++        riverctl.pie = true;
+         riverctl.addBuildOption([:0]const u8, "version", full_version);
+ 
+         riverctl.step.dependOn(&scanner.step);
+@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
+         rivertile.setTarget(target);
+         rivertile.setBuildMode(mode);
++        rivertile.pie = true;
+         rivertile.addBuildOption([:0]const u8, "version", full_version);
+ 
+         rivertile.step.dependOn(&scanner.step);
+-- 
+2.33.1
+
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
new file mode 100644
index 000000000000..0708262d2f67
--- /dev/null
+++ b/srcpkgs/river/template
@@ -0,0 +1,19 @@
+# Template file for 'river'
+pkgname=river
+version=0.1.0
+revision=1
+build_style=zig-build
+configure_args="$(vopt_if xwayland -Dxwayland)"
+hostmakedepends="zig pkg-config wayland-devel scdoc git"
+makedepends="wlroots-devel"
+depends="$(vopt_if xwayland xorg-server-xwayland)"
+short_desc="Dynamic tiling Wayland compositor"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/riverwm/river"
+distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
+checksum=4153a5511a1008e87a2251fc4510a43d6f6085f41b040222506355ff6d4bd10f
+
+build_options="xwayland"
+build_options_default="xwayland"
+desc_option_xwayland="Enable Xwayland support"

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

* Re: [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (50 preceding siblings ...)
  2021-11-08 15:56 ` ifreund
@ 2021-11-08 15:58 ` ifreund
  2021-11-10 23:48 ` subsetpark
                   ` (17 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-08 15:58 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

Add zig-build build style, river 0.1.0, rundird 0.2.0
<!-- Mark items with [x] where applicable -->

#### 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
-->
Closes  #33060


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

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

From 62da18fb6e2cf21c7152c7941c09ddcc7c1fe5c6 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 16:20:30 +0000
Subject: [PATCH 1/3] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.

This commit also backports one bug fix from the zig master branch
which is critical for our use-case of building software for binary
distribution.
---
 Manual.md                                     |  4 ++
 common/build-profiles/README                  |  2 +
 common/build-profiles/aarch64-musl.sh         |  2 +
 common/build-profiles/aarch64.sh              |  2 +
 common/build-profiles/armv6l-musl.sh          |  2 +
 common/build-profiles/armv6l.sh               |  2 +
 common/build-profiles/armv7l-musl.sh          |  2 +
 common/build-profiles/armv7l.sh               |  2 +
 common/build-profiles/i686-musl.sh            |  2 +
 common/build-profiles/i686.sh                 |  2 +
 common/build-profiles/ppc-musl.sh             |  2 +
 common/build-profiles/ppc.sh                  |  2 +
 common/build-profiles/ppc64-musl.sh           |  2 +
 common/build-profiles/ppc64.sh                |  2 +
 common/build-profiles/ppc64le-musl.sh         |  2 +
 common/build-profiles/ppc64le.sh              |  2 +
 common/build-profiles/ppcle-musl.sh           |  2 +
 common/build-profiles/ppcle.sh                |  2 +
 common/build-profiles/x86_64-musl.sh          |  2 +
 common/build-profiles/x86_64.sh               |  2 +
 common/build-style/zig-build.sh               | 41 ++++++++++++++++
 common/cross-profiles/README                  |  2 +
 common/cross-profiles/aarch64-musl.sh         |  2 +
 common/cross-profiles/aarch64.sh              |  2 +
 common/cross-profiles/armv5tel-musl.sh        |  2 +
 common/cross-profiles/armv5tel.sh             |  2 +
 common/cross-profiles/armv6l-musl.sh          |  2 +
 common/cross-profiles/armv6l.sh               |  2 +
 common/cross-profiles/armv7l-musl.sh          |  2 +
 common/cross-profiles/armv7l.sh               |  2 +
 common/cross-profiles/i686-musl.sh            |  2 +
 common/cross-profiles/i686.sh                 |  2 +
 common/cross-profiles/mips-musl.sh            |  2 +
 common/cross-profiles/mipsel-musl.sh          |  2 +
 common/cross-profiles/mipselhf-musl.sh        |  2 +
 common/cross-profiles/mipshf-musl.sh          |  2 +
 common/cross-profiles/ppc-musl.sh             |  2 +
 common/cross-profiles/ppc.sh                  |  2 +
 common/cross-profiles/ppc64-musl.sh           |  2 +
 common/cross-profiles/ppc64.sh                |  2 +
 common/cross-profiles/ppc64le-musl.sh         |  2 +
 common/cross-profiles/ppc64le.sh              |  2 +
 common/cross-profiles/ppcle-musl.sh           |  2 +
 common/cross-profiles/ppcle.sh                |  2 +
 common/cross-profiles/x86_64-musl.sh          |  2 +
 common/cross-profiles/x86_64.sh               |  2 +
 .../0001-std.build-fix-handling-of-Dcpu.patch | 48 +++++++++++++++++++
 srcpkgs/zig/template                          |  4 +-
 48 files changed, 183 insertions(+), 2 deletions(-)
 create mode 100644 common/build-style/zig-build.sh
 create mode 100644 srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch

diff --git a/Manual.md b/Manual.md
index 5996e1502887..b0afd6db1596 100644
--- a/Manual.md
+++ b/Manual.md
@@ -998,6 +998,10 @@ configure arguments can be specified via `cross_*_configure_args` where `*` is `
 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
 
+- `zig-build` For packages using [Zig](https://ziglang.org)'s build
+system. Additional arguments may be passed to the `zig build` invocation using
+`configure_args`.
+
 For packages that use the Python module build method (`setup.py` or
 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
 
diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..205c4cadf53f
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install \
+		${configure_args}
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
new file mode 100644
index 000000000000..4101f24459bb
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
@@ -0,0 +1,48 @@
+From 1e8cdace7ad324a42228aeb5cd6eb8dd15429413 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Tue, 21 Sep 2021 21:06:10 +0200
+Subject: [PATCH] std.build: fix handling of -Dcpu
+
+Currently -Dcpu is completely ignored if -Dtarget isn't passed as well.
+Further, -Dcpu=baseline is ignored even if -Dtarget=native is passed.
+
+This patch fixes these 2 issues, always respecting the -Dcpu option if
+present.
+---
+ lib/std/build.zig | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 9b7ebb1f4..e398529f9 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -685,7 +685,11 @@ pub const Builder = struct {
+         );
+         const mcpu = self.option([]const u8, "cpu", "Target CPU");
+ 
+-        const triple = maybe_triple orelse return args.default_target;
++        if (maybe_triple == null and mcpu == null) {
++            return args.default_target;
++        }
++
++        const triple = maybe_triple orelse "native";
+ 
+         var diags: CrossTarget.ParseOptions.Diagnostics = .{};
+         const selected_target = CrossTarget.parse(.{
+@@ -2451,11 +2455,8 @@ pub const LibExeObjStep = struct {
+ 
+             if (populated_cpu_features.eql(cross.cpu.features)) {
+                 // The CPU name alone is sufficient.
+-                // If it is the baseline CPU, no command line args are required.
+-                if (cross.cpu.model != std.Target.Cpu.baseline(cross.cpu.arch).model) {
+-                    try zig_args.append("-mcpu");
+-                    try zig_args.append(cross.cpu.model.name);
+-                }
++                try zig_args.append("-mcpu");
++                try zig_args.append(cross.cpu.model.name);
+             } else {
+                 var mcpu_buffer = std.ArrayList(u8).init(builder.allocator);
+ 
+-- 
+2.33.1
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index 893ba0ec054f..728c5a64e9df 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,13 +1,13 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.1
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
 makedepends="clang llvm12 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
-maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="MIT"
 homepage="https://ziglang.org"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"

From 536e03a31a62bc9fecde8bd71bb1054b8f4dd3c7 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 2/3] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5488292ee390
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

From fbe6360665d2f48b0ae14d56a3e1adaa4d906630 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 3 Nov 2021 14:48:05 +0100
Subject: [PATCH 3/3] New package: river-0.1.0

---
 ...ble-PIE-for-river-riverctl-rivertile.patch | 42 +++++++++++++++++++
 srcpkgs/river/template                        | 19 +++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
 create mode 100644 srcpkgs/river/template

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
new file mode 100644
index 000000000000..ecc68302db09
--- /dev/null
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -0,0 +1,42 @@
+From 759c1c7a915083f3da46960ff82fa2a3566a7065 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <mail@isaacfreund.com>
+Date: Wed, 3 Nov 2021 14:21:35 +0100
+Subject: [PATCH] Enable PIE for river, riverctl, rivertile
+
+There is sadly not yet a standard way to do this exposed by the zig
+build system. See: https://github.com/ziglang/zig/issues/7201
+---
+ build.zig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build.zig b/build.zig
+index d561f49..8ac9a4e 100644
+--- a/build.zig
++++ b/build.zig
+@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const river = b.addExecutable("river", "river/main.zig");
+         river.setTarget(target);
+         river.setBuildMode(mode);
++        river.pie = true;
+         river.addBuildOption(bool, "xwayland", xwayland);
+         river.addBuildOption([:0]const u8, "version", full_version);
+ 
+@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
+         riverctl.setTarget(target);
+         riverctl.setBuildMode(mode);
++        riverctl.pie = true;
+         riverctl.addBuildOption([:0]const u8, "version", full_version);
+ 
+         riverctl.step.dependOn(&scanner.step);
+@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
+         rivertile.setTarget(target);
+         rivertile.setBuildMode(mode);
++        rivertile.pie = true;
+         rivertile.addBuildOption([:0]const u8, "version", full_version);
+ 
+         rivertile.step.dependOn(&scanner.step);
+-- 
+2.33.1
+
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
new file mode 100644
index 000000000000..0708262d2f67
--- /dev/null
+++ b/srcpkgs/river/template
@@ -0,0 +1,19 @@
+# Template file for 'river'
+pkgname=river
+version=0.1.0
+revision=1
+build_style=zig-build
+configure_args="$(vopt_if xwayland -Dxwayland)"
+hostmakedepends="zig pkg-config wayland-devel scdoc git"
+makedepends="wlroots-devel"
+depends="$(vopt_if xwayland xorg-server-xwayland)"
+short_desc="Dynamic tiling Wayland compositor"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/riverwm/river"
+distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
+checksum=4153a5511a1008e87a2251fc4510a43d6f6085f41b040222506355ff6d4bd10f
+
+build_options="xwayland"
+build_options_default="xwayland"
+desc_option_xwayland="Enable Xwayland support"

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

* Re: Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (51 preceding siblings ...)
  2021-11-08 15:58 ` ifreund
@ 2021-11-10 23:48 ` subsetpark
  2021-11-11  0:31 ` [PR REVIEW] " ericonr
                   ` (16 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: subsetpark @ 2021-11-10 23:48 UTC (permalink / raw)
  To: ml

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

New comment by subsetpark on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-965851951

Comment:
@ifreund @ericonr are there still outstanding issues for this PR? I'd love to get River into my xbps managed packages...

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (52 preceding siblings ...)
  2021-11-10 23:48 ` subsetpark
@ 2021-11-11  0:31 ` ericonr
  2021-11-11  0:31 ` ericonr
                   ` (15 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-11  0:31 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r747113303

Comment:
Unless I'm missing something, this wasn't resolved?

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (53 preceding siblings ...)
  2021-11-11  0:31 ` [PR REVIEW] " ericonr
@ 2021-11-11  0:31 ` ericonr
  2021-11-11  0:31 ` ericonr
                   ` (14 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-11  0:31 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r747112124

Comment:
Would it make sense to query gcc_dir from GCC itself? Would it be worth it?

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (54 preceding siblings ...)
  2021-11-11  0:31 ` ericonr
@ 2021-11-11  0:31 ` ericonr
  2021-11-11  0:31 ` ericonr
                   ` (13 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-11  0:31 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r747112622

Comment:
Nit: you can enable sse2 if you want, if it isn't by default.

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (55 preceding siblings ...)
  2021-11-11  0:31 ` ericonr
@ 2021-11-11  0:31 ` ericonr
  2021-11-11 10:19 ` ifreund
                   ` (12 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-11  0:31 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r747113303

Comment:
Unless I'm missing something, this wasn't resolved?

(This being that the zig commit is together with the build style commit)

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (56 preceding siblings ...)
  2021-11-11  0:31 ` ericonr
@ 2021-11-11 10:19 ` ifreund
  2021-11-11 10:22 ` ifreund
                   ` (11 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-11 10:19 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r747375794

Comment:
according to the output of `zig libc`, `gcc_dir` is only needed when targeting haiku:
```
# The directory that contains `crtbeginS.o` and `crtendS.o`
# Only needed when targeting Haiku.
gcc_dir=
```

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (57 preceding siblings ...)
  2021-11-11 10:19 ` ifreund
@ 2021-11-11 10:22 ` ifreund
  2021-11-11 10:24 ` [PR PATCH] [Updated] " ifreund
                   ` (10 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-11 10:22 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r747377444

Comment:
This was resolved for a while but then I backport a new fix that unfortunately didn't make it into 0.8.1 and forgot about this review comment. I'll split up the commits shortly.

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

* Re: [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (58 preceding siblings ...)
  2021-11-11 10:22 ` ifreund
@ 2021-11-11 10:24 ` ifreund
  2021-11-11 11:25 ` ifreund
                   ` (9 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-11 10:24 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

Add zig-build build style, river 0.1.0, rundird 0.2.0
<!-- Mark items with [x] where applicable -->

#### 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
-->
Closes  #33060


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

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

From d7291936d064c5ad8709a0ab81ced81d13c904e4 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 11 Nov 2021 11:23:30 +0100
Subject: [PATCH 1/4] zig: backport an upstream bugfix

This commit backports one bug fix from the zig master branch which is
critical for our use-case of building software for binary distribution.
---
 .../0001-std.build-fix-handling-of-Dcpu.patch | 48 +++++++++++++++++++
 srcpkgs/zig/template                          |  4 +-
 2 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch

diff --git a/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
new file mode 100644
index 000000000000..4101f24459bb
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
@@ -0,0 +1,48 @@
+From 1e8cdace7ad324a42228aeb5cd6eb8dd15429413 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Tue, 21 Sep 2021 21:06:10 +0200
+Subject: [PATCH] std.build: fix handling of -Dcpu
+
+Currently -Dcpu is completely ignored if -Dtarget isn't passed as well.
+Further, -Dcpu=baseline is ignored even if -Dtarget=native is passed.
+
+This patch fixes these 2 issues, always respecting the -Dcpu option if
+present.
+---
+ lib/std/build.zig | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 9b7ebb1f4..e398529f9 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -685,7 +685,11 @@ pub const Builder = struct {
+         );
+         const mcpu = self.option([]const u8, "cpu", "Target CPU");
+ 
+-        const triple = maybe_triple orelse return args.default_target;
++        if (maybe_triple == null and mcpu == null) {
++            return args.default_target;
++        }
++
++        const triple = maybe_triple orelse "native";
+ 
+         var diags: CrossTarget.ParseOptions.Diagnostics = .{};
+         const selected_target = CrossTarget.parse(.{
+@@ -2451,11 +2455,8 @@ pub const LibExeObjStep = struct {
+ 
+             if (populated_cpu_features.eql(cross.cpu.features)) {
+                 // The CPU name alone is sufficient.
+-                // If it is the baseline CPU, no command line args are required.
+-                if (cross.cpu.model != std.Target.Cpu.baseline(cross.cpu.arch).model) {
+-                    try zig_args.append("-mcpu");
+-                    try zig_args.append(cross.cpu.model.name);
+-                }
++                try zig_args.append("-mcpu");
++                try zig_args.append(cross.cpu.model.name);
+             } else {
+                 var mcpu_buffer = std.ArrayList(u8).init(builder.allocator);
+ 
+-- 
+2.33.1
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index 893ba0ec054f..728c5a64e9df 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,13 +1,13 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.1
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
 makedepends="clang llvm12 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
-maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="MIT"
 homepage="https://ziglang.org"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"

From f9a804b484be959f879f99ef53f684dd7e6ef4af Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 11 Nov 2021 11:24:26 +0100
Subject: [PATCH 2/4] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 Manual.md                              |  4 +++
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 41 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 46 files changed, 133 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/Manual.md b/Manual.md
index 5996e1502887..b0afd6db1596 100644
--- a/Manual.md
+++ b/Manual.md
@@ -998,6 +998,10 @@ configure arguments can be specified via `cross_*_configure_args` where `*` is `
 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
 
+- `zig-build` For packages using [Zig](https://ziglang.org)'s build
+system. Additional arguments may be passed to the `zig build` invocation using
+`configure_args`.
+
 For packages that use the Python module build method (`setup.py` or
 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
 
diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ff872ed9d4b2 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i686-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..205c4cadf53f
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install \
+		${configure_args}
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..452db8eaf386 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i686-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From 41aa950ebe4e0ecc4e6de6c837a61a35fa835a1e Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/4] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5488292ee390
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

From 920fa2d86846762b11f684327cd1d6e2bc805722 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 3 Nov 2021 14:48:05 +0100
Subject: [PATCH 4/4] New package: river-0.1.0

---
 ...ble-PIE-for-river-riverctl-rivertile.patch | 42 +++++++++++++++++++
 srcpkgs/river/template                        | 19 +++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
 create mode 100644 srcpkgs/river/template

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
new file mode 100644
index 000000000000..ecc68302db09
--- /dev/null
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -0,0 +1,42 @@
+From 759c1c7a915083f3da46960ff82fa2a3566a7065 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <mail@isaacfreund.com>
+Date: Wed, 3 Nov 2021 14:21:35 +0100
+Subject: [PATCH] Enable PIE for river, riverctl, rivertile
+
+There is sadly not yet a standard way to do this exposed by the zig
+build system. See: https://github.com/ziglang/zig/issues/7201
+---
+ build.zig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build.zig b/build.zig
+index d561f49..8ac9a4e 100644
+--- a/build.zig
++++ b/build.zig
+@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const river = b.addExecutable("river", "river/main.zig");
+         river.setTarget(target);
+         river.setBuildMode(mode);
++        river.pie = true;
+         river.addBuildOption(bool, "xwayland", xwayland);
+         river.addBuildOption([:0]const u8, "version", full_version);
+ 
+@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
+         riverctl.setTarget(target);
+         riverctl.setBuildMode(mode);
++        riverctl.pie = true;
+         riverctl.addBuildOption([:0]const u8, "version", full_version);
+ 
+         riverctl.step.dependOn(&scanner.step);
+@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
+         rivertile.setTarget(target);
+         rivertile.setBuildMode(mode);
++        rivertile.pie = true;
+         rivertile.addBuildOption([:0]const u8, "version", full_version);
+ 
+         rivertile.step.dependOn(&scanner.step);
+-- 
+2.33.1
+
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
new file mode 100644
index 000000000000..0708262d2f67
--- /dev/null
+++ b/srcpkgs/river/template
@@ -0,0 +1,19 @@
+# Template file for 'river'
+pkgname=river
+version=0.1.0
+revision=1
+build_style=zig-build
+configure_args="$(vopt_if xwayland -Dxwayland)"
+hostmakedepends="zig pkg-config wayland-devel scdoc git"
+makedepends="wlroots-devel"
+depends="$(vopt_if xwayland xorg-server-xwayland)"
+short_desc="Dynamic tiling Wayland compositor"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/riverwm/river"
+distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
+checksum=4153a5511a1008e87a2251fc4510a43d6f6085f41b040222506355ff6d4bd10f
+
+build_options="xwayland"
+build_options_default="xwayland"
+desc_option_xwayland="Enable Xwayland support"

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

* Re: [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (59 preceding siblings ...)
  2021-11-11 10:24 ` [PR PATCH] [Updated] " ifreund
@ 2021-11-11 11:25 ` ifreund
  2021-11-11 11:25 ` [PR REVIEW] " ifreund
                   ` (8 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-11 11:25 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

Add zig-build build style, river 0.1.0, rundird 0.2.0
<!-- Mark items with [x] where applicable -->

#### 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
-->
Closes  #33060


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

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

From d7291936d064c5ad8709a0ab81ced81d13c904e4 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 11 Nov 2021 11:23:30 +0100
Subject: [PATCH 1/4] zig: backport an upstream bugfix

This commit backports one bug fix from the zig master branch which is
critical for our use-case of building software for binary distribution.
---
 .../0001-std.build-fix-handling-of-Dcpu.patch | 48 +++++++++++++++++++
 srcpkgs/zig/template                          |  4 +-
 2 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch

diff --git a/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
new file mode 100644
index 000000000000..4101f24459bb
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
@@ -0,0 +1,48 @@
+From 1e8cdace7ad324a42228aeb5cd6eb8dd15429413 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Tue, 21 Sep 2021 21:06:10 +0200
+Subject: [PATCH] std.build: fix handling of -Dcpu
+
+Currently -Dcpu is completely ignored if -Dtarget isn't passed as well.
+Further, -Dcpu=baseline is ignored even if -Dtarget=native is passed.
+
+This patch fixes these 2 issues, always respecting the -Dcpu option if
+present.
+---
+ lib/std/build.zig | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 9b7ebb1f4..e398529f9 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -685,7 +685,11 @@ pub const Builder = struct {
+         );
+         const mcpu = self.option([]const u8, "cpu", "Target CPU");
+ 
+-        const triple = maybe_triple orelse return args.default_target;
++        if (maybe_triple == null and mcpu == null) {
++            return args.default_target;
++        }
++
++        const triple = maybe_triple orelse "native";
+ 
+         var diags: CrossTarget.ParseOptions.Diagnostics = .{};
+         const selected_target = CrossTarget.parse(.{
+@@ -2451,11 +2455,8 @@ pub const LibExeObjStep = struct {
+ 
+             if (populated_cpu_features.eql(cross.cpu.features)) {
+                 // The CPU name alone is sufficient.
+-                // If it is the baseline CPU, no command line args are required.
+-                if (cross.cpu.model != std.Target.Cpu.baseline(cross.cpu.arch).model) {
+-                    try zig_args.append("-mcpu");
+-                    try zig_args.append(cross.cpu.model.name);
+-                }
++                try zig_args.append("-mcpu");
++                try zig_args.append(cross.cpu.model.name);
+             } else {
+                 var mcpu_buffer = std.ArrayList(u8).init(builder.allocator);
+ 
+-- 
+2.33.1
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index 893ba0ec054f..728c5a64e9df 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,13 +1,13 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.1
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
 makedepends="clang llvm12 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
-maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="MIT"
 homepage="https://ziglang.org"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"

From 4f42118e57a7c485737b84ef6900c5e669781bc2 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 11 Nov 2021 11:24:26 +0100
Subject: [PATCH 2/4] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 Manual.md                              |  4 +++
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 41 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 46 files changed, 133 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/Manual.md b/Manual.md
index 5996e1502887..b0afd6db1596 100644
--- a/Manual.md
+++ b/Manual.md
@@ -998,6 +998,10 @@ configure arguments can be specified via `cross_*_configure_args` where `*` is `
 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
 
+- `zig-build` For packages using [Zig](https://ziglang.org)'s build
+system. Additional arguments may be passed to the `zig build` invocation using
+`configure_args`.
+
 For packages that use the Python module build method (`setup.py` or
 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
 
diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ac69fb0c519d 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i386-linux-gnu"
+XBPS_ZIG_CPU="_i686+sse2"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..205c4cadf53f
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install \
+		${configure_args}
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..16f44013ab76 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i386-linux-gnu"
+XBPS_CROSS_ZIG_CPU="_i686+sse2"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From e048546ccaa0249fe12dc594eddd030625774726 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/4] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..5488292ee390
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,17 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+}

From 2602db1d3e18c130411398d5be492b5c5d92eadc Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 3 Nov 2021 14:48:05 +0100
Subject: [PATCH 4/4] New package: river-0.1.0

---
 ...ble-PIE-for-river-riverctl-rivertile.patch | 42 +++++++++++++++++++
 srcpkgs/river/template                        | 19 +++++++++
 2 files changed, 61 insertions(+)
 create mode 100644 srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
 create mode 100644 srcpkgs/river/template

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
new file mode 100644
index 000000000000..ecc68302db09
--- /dev/null
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -0,0 +1,42 @@
+From 759c1c7a915083f3da46960ff82fa2a3566a7065 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <mail@isaacfreund.com>
+Date: Wed, 3 Nov 2021 14:21:35 +0100
+Subject: [PATCH] Enable PIE for river, riverctl, rivertile
+
+There is sadly not yet a standard way to do this exposed by the zig
+build system. See: https://github.com/ziglang/zig/issues/7201
+---
+ build.zig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build.zig b/build.zig
+index d561f49..8ac9a4e 100644
+--- a/build.zig
++++ b/build.zig
+@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const river = b.addExecutable("river", "river/main.zig");
+         river.setTarget(target);
+         river.setBuildMode(mode);
++        river.pie = true;
+         river.addBuildOption(bool, "xwayland", xwayland);
+         river.addBuildOption([:0]const u8, "version", full_version);
+ 
+@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
+         riverctl.setTarget(target);
+         riverctl.setBuildMode(mode);
++        riverctl.pie = true;
+         riverctl.addBuildOption([:0]const u8, "version", full_version);
+ 
+         riverctl.step.dependOn(&scanner.step);
+@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
+         rivertile.setTarget(target);
+         rivertile.setBuildMode(mode);
++        rivertile.pie = true;
+         rivertile.addBuildOption([:0]const u8, "version", full_version);
+ 
+         rivertile.step.dependOn(&scanner.step);
+-- 
+2.33.1
+
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
new file mode 100644
index 000000000000..0708262d2f67
--- /dev/null
+++ b/srcpkgs/river/template
@@ -0,0 +1,19 @@
+# Template file for 'river'
+pkgname=river
+version=0.1.0
+revision=1
+build_style=zig-build
+configure_args="$(vopt_if xwayland -Dxwayland)"
+hostmakedepends="zig pkg-config wayland-devel scdoc git"
+makedepends="wlroots-devel"
+depends="$(vopt_if xwayland xorg-server-xwayland)"
+short_desc="Dynamic tiling Wayland compositor"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/riverwm/river"
+distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
+checksum=4153a5511a1008e87a2251fc4510a43d6f6085f41b040222506355ff6d4bd10f
+
+build_options="xwayland"
+build_options_default="xwayland"
+desc_option_xwayland="Enable Xwayland support"

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (60 preceding siblings ...)
  2021-11-11 11:25 ` ifreund
@ 2021-11-11 11:25 ` ifreund
  2021-11-11 11:26 ` ifreund
                   ` (7 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-11 11:25 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r747418976

Comment:
done!

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

* Re: Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (61 preceding siblings ...)
  2021-11-11 11:25 ` [PR REVIEW] " ifreund
@ 2021-11-11 11:26 ` ifreund
  2021-11-13  3:15 ` [PR REVIEW] " ericonr
                   ` (6 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-11 11:26 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-966225328

Comment:
@ericonr Thanks for the review! I've enabled sse2 on i686 and split the zig package fix into a separate commit, this should now be good to go afaik.

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (62 preceding siblings ...)
  2021-11-11 11:26 ` ifreund
@ 2021-11-13  3:15 ` ericonr
  2021-11-13  3:15 ` ericonr
                   ` (5 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-13  3:15 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r748674028

Comment:
What about a `post_install` installing https://github.com/riverwm/river/blob/master/example/init ?

Makes it way easier to test!

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (63 preceding siblings ...)
  2021-11-13  3:15 ` [PR REVIEW] " ericonr
@ 2021-11-13  3:15 ` ericonr
  2021-11-13  3:49 ` ericonr
                   ` (4 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-13  3:15 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r748674028

Comment:
What about a `post_install` installing https://github.com/riverwm/river/blob/master/example/init ? (we have `vsconf` for such use cases)

Makes it way easier to test!

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

* Re: Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (64 preceding siblings ...)
  2021-11-13  3:15 ` ericonr
@ 2021-11-13  3:49 ` ericonr
  2021-11-13 11:43 ` [PR PATCH] [Updated] " ifreund
                   ` (3 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-13  3:49 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-967774011

Comment:
Ok, tested both packages, seem to be working just fine. All that's missing is installing the example file and possibly a `vdoc README.md` in rundird, what do you think?

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

* Re: [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (65 preceding siblings ...)
  2021-11-13  3:49 ` ericonr
@ 2021-11-13 11:43 ` ifreund
  2021-11-13 11:44 ` [PR REVIEW] " ifreund
                   ` (2 subsequent siblings)
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-13 11:43 UTC (permalink / raw)
  To: ml

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

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

https://github.com/ifreund/void-packages rundird
https://github.com/void-linux/void-packages/pull/29288

Add zig-build build style, river 0.1.0, rundird 0.2.0
<!-- Mark items with [x] where applicable -->

#### 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
-->
Closes  #33060


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

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

From a09eca325e70182cc249b34945dcd9db6d30b743 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 11 Nov 2021 11:23:30 +0100
Subject: [PATCH 1/4] zig: backport an upstream bugfix

This commit backports one bug fix from the zig master branch which is
critical for our use-case of building software for binary distribution.
---
 .../0001-std.build-fix-handling-of-Dcpu.patch | 48 +++++++++++++++++++
 srcpkgs/zig/template                          |  4 +-
 2 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch

diff --git a/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
new file mode 100644
index 000000000000..4101f24459bb
--- /dev/null
+++ b/srcpkgs/zig/patches/0001-std.build-fix-handling-of-Dcpu.patch
@@ -0,0 +1,48 @@
+From 1e8cdace7ad324a42228aeb5cd6eb8dd15429413 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <ifreund@ifreund.xyz>
+Date: Tue, 21 Sep 2021 21:06:10 +0200
+Subject: [PATCH] std.build: fix handling of -Dcpu
+
+Currently -Dcpu is completely ignored if -Dtarget isn't passed as well.
+Further, -Dcpu=baseline is ignored even if -Dtarget=native is passed.
+
+This patch fixes these 2 issues, always respecting the -Dcpu option if
+present.
+---
+ lib/std/build.zig | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/lib/std/build.zig b/lib/std/build.zig
+index 9b7ebb1f4..e398529f9 100644
+--- a/lib/std/build.zig
++++ b/lib/std/build.zig
+@@ -685,7 +685,11 @@ pub const Builder = struct {
+         );
+         const mcpu = self.option([]const u8, "cpu", "Target CPU");
+ 
+-        const triple = maybe_triple orelse return args.default_target;
++        if (maybe_triple == null and mcpu == null) {
++            return args.default_target;
++        }
++
++        const triple = maybe_triple orelse "native";
+ 
+         var diags: CrossTarget.ParseOptions.Diagnostics = .{};
+         const selected_target = CrossTarget.parse(.{
+@@ -2451,11 +2455,8 @@ pub const LibExeObjStep = struct {
+ 
+             if (populated_cpu_features.eql(cross.cpu.features)) {
+                 // The CPU name alone is sufficient.
+-                // If it is the baseline CPU, no command line args are required.
+-                if (cross.cpu.model != std.Target.Cpu.baseline(cross.cpu.arch).model) {
+-                    try zig_args.append("-mcpu");
+-                    try zig_args.append(cross.cpu.model.name);
+-                }
++                try zig_args.append("-mcpu");
++                try zig_args.append(cross.cpu.model.name);
+             } else {
+                 var mcpu_buffer = std.ArrayList(u8).init(builder.allocator);
+ 
+-- 
+2.33.1
+
diff --git a/srcpkgs/zig/template b/srcpkgs/zig/template
index 893ba0ec054f..728c5a64e9df 100644
--- a/srcpkgs/zig/template
+++ b/srcpkgs/zig/template
@@ -1,13 +1,13 @@
 # Template file for 'zig'
 pkgname=zig
 version=0.8.1
-revision=1
+revision=2
 archs="x86_64* aarch64*"
 build_style=cmake
 make_cmd=make
 makedepends="clang llvm12 lld-devel"
 short_desc="Programming language designed for robustness, optimality, and clarity"
-maintainer="Isaac Freund <ifreund@ifreund.xyz>"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
 license="MIT"
 homepage="https://ziglang.org"
 distfiles="https://ziglang.org/download/${version}/zig-${version}.tar.xz"

From fc195ef7fb7214a5bfabcf45526653c2eb28d118 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 11 Nov 2021 11:24:26 +0100
Subject: [PATCH 2/4] build-styles: add zig-build

We call this "zig-build" instead of just "zig" as this build-style
relies on usage of the zig build system. In the future, other build
systems such as meson may support zig code. Furthermore, the zig
build system may be used to build C/C++ code as well, not just zig.
---
 Manual.md                              |  4 +++
 common/build-profiles/README           |  2 ++
 common/build-profiles/aarch64-musl.sh  |  2 ++
 common/build-profiles/aarch64.sh       |  2 ++
 common/build-profiles/armv6l-musl.sh   |  2 ++
 common/build-profiles/armv6l.sh        |  2 ++
 common/build-profiles/armv7l-musl.sh   |  2 ++
 common/build-profiles/armv7l.sh        |  2 ++
 common/build-profiles/i686-musl.sh     |  2 ++
 common/build-profiles/i686.sh          |  2 ++
 common/build-profiles/ppc-musl.sh      |  2 ++
 common/build-profiles/ppc.sh           |  2 ++
 common/build-profiles/ppc64-musl.sh    |  2 ++
 common/build-profiles/ppc64.sh         |  2 ++
 common/build-profiles/ppc64le-musl.sh  |  2 ++
 common/build-profiles/ppc64le.sh       |  2 ++
 common/build-profiles/ppcle-musl.sh    |  2 ++
 common/build-profiles/ppcle.sh         |  2 ++
 common/build-profiles/x86_64-musl.sh   |  2 ++
 common/build-profiles/x86_64.sh        |  2 ++
 common/build-style/zig-build.sh        | 41 ++++++++++++++++++++++++++
 common/cross-profiles/README           |  2 ++
 common/cross-profiles/aarch64-musl.sh  |  2 ++
 common/cross-profiles/aarch64.sh       |  2 ++
 common/cross-profiles/armv5tel-musl.sh |  2 ++
 common/cross-profiles/armv5tel.sh      |  2 ++
 common/cross-profiles/armv6l-musl.sh   |  2 ++
 common/cross-profiles/armv6l.sh        |  2 ++
 common/cross-profiles/armv7l-musl.sh   |  2 ++
 common/cross-profiles/armv7l.sh        |  2 ++
 common/cross-profiles/i686-musl.sh     |  2 ++
 common/cross-profiles/i686.sh          |  2 ++
 common/cross-profiles/mips-musl.sh     |  2 ++
 common/cross-profiles/mipsel-musl.sh   |  2 ++
 common/cross-profiles/mipselhf-musl.sh |  2 ++
 common/cross-profiles/mipshf-musl.sh   |  2 ++
 common/cross-profiles/ppc-musl.sh      |  2 ++
 common/cross-profiles/ppc.sh           |  2 ++
 common/cross-profiles/ppc64-musl.sh    |  2 ++
 common/cross-profiles/ppc64.sh         |  2 ++
 common/cross-profiles/ppc64le-musl.sh  |  2 ++
 common/cross-profiles/ppc64le.sh       |  2 ++
 common/cross-profiles/ppcle-musl.sh    |  2 ++
 common/cross-profiles/ppcle.sh         |  2 ++
 common/cross-profiles/x86_64-musl.sh   |  2 ++
 common/cross-profiles/x86_64.sh        |  2 ++
 46 files changed, 133 insertions(+)
 create mode 100644 common/build-style/zig-build.sh

diff --git a/Manual.md b/Manual.md
index 5996e1502887..b0afd6db1596 100644
--- a/Manual.md
+++ b/Manual.md
@@ -998,6 +998,10 @@ configure arguments can be specified via `cross_*_configure_args` where `*` is `
 additionally passed to both early and final `gcc`. You can also specify custom `CFLAGS`
 and `LDFLAGS` for the libc as `cross_(glibc|musl)_(cflags|ldflags)`.
 
+- `zig-build` For packages using [Zig](https://ziglang.org)'s build
+system. Additional arguments may be passed to the `zig build` invocation using
+`configure_args`.
+
 For packages that use the Python module build method (`setup.py` or
 [PEP 517](https://www.python.org/dev/peps/pep-0517/)), you can choose one of the following:
 
diff --git a/common/build-profiles/README b/common/build-profiles/README
index e4457c16f22c..41b18fc1174e 100644
--- a/common/build-profiles/README
+++ b/common/build-profiles/README
@@ -9,6 +9,8 @@ for a specific architecture:
 	- XBPS_CXXFLAGS		(C++ compiler flags for the host compiler)
 	- XBPS_FFLAGS		(Fortran compiler flags for the host compiler)
 	- XBPS_RUST_TARGET	(the compiler triplet for usage by cargo)
+	- XBPS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_ZIG_CPU		(the cpu/feature set for zig)
 
 These properties are also set in a cross environment, but the compiler
 flags are not added into the global flags. XBPS_RUST_TARGET is also
diff --git a/common/build-profiles/aarch64-musl.sh b/common/build-profiles/aarch64-musl.sh
index 76249d0b75c8..8427d0478a9a 100644
--- a/common/build-profiles/aarch64-musl.sh
+++ b/common/build-profiles/aarch64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/aarch64.sh b/common/build-profiles/aarch64.sh
index ccf7d5af3d54..59855dfc0c82 100644
--- a/common/build-profiles/aarch64.sh
+++ b/common/build-profiles/aarch64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="aarch64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/armv6l-musl.sh b/common/build-profiles/armv6l-musl.sh
index 172e56e81a82..b46941a39976 100644
--- a/common/build-profiles/armv6l-musl.sh
+++ b/common/build-profiles/armv6l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-linux-musleabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv6l.sh b/common/build-profiles/armv6l.sh
index d84b6bdb2cc2..3b182234cb6d 100644
--- a/common/build-profiles/armv6l.sh
+++ b/common/build-profiles/armv6l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv6l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_ZIG_CPU="generic+v6"
diff --git a/common/build-profiles/armv7l-musl.sh b/common/build-profiles/armv7l-musl.sh
index f81ad699e07a..dbf3eb0d5b92 100644
--- a/common/build-profiles/armv7l-musl.sh
+++ b/common/build-profiles/armv7l-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_CXXFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-linux-musleabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/armv7l.sh b/common/build-profiles/armv7l.sh
index a100e410f9a9..141639b132b0 100644
--- a/common/build-profiles/armv7l.sh
+++ b/common/build-profiles/armv7l.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="armv7l-unknown-linux-gnueabihf"
 XBPS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/build-profiles/i686-musl.sh b/common/build-profiles/i686-musl.sh
index e76ab89d6ae3..a607ef619e79 100644
--- a/common/build-profiles/i686-musl.sh
+++ b/common/build-profiles/i686-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-linux-musl"
 XBPS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_ZIG_TARGET="i686-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/i686.sh b/common/build-profiles/i686.sh
index 036a91b2b92b..ac69fb0c519d 100644
--- a/common/build-profiles/i686.sh
+++ b/common/build-profiles/i686.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="i686-pc-linux-gnu"
 XBPS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_ZIG_TARGET="i386-linux-gnu"
+XBPS_ZIG_CPU="_i686+sse2"
diff --git a/common/build-profiles/ppc-musl.sh b/common/build-profiles/ppc-musl.sh
index 17296432e97b..60b2e700270a 100644
--- a/common/build-profiles/ppc-musl.sh
+++ b/common/build-profiles/ppc-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-musl"
 XBPS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc.sh b/common/build-profiles/ppc.sh
index f7ec35b69a64..b7a113139792 100644
--- a/common/build-profiles/ppc.sh
+++ b/common/build-profiles/ppc.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc-linux-gnu"
 XBPS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64-musl.sh b/common/build-profiles/ppc64-musl.sh
index 53c5ea6fb3f8..4ec7430b39a9 100644
--- a/common/build-profiles/ppc64-musl.sh
+++ b/common/build-profiles/ppc64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64.sh b/common/build-profiles/ppc64.sh
index aa9af966ea78..1d0c04ae3747 100644
--- a/common/build-profiles/ppc64.sh
+++ b/common/build-profiles/ppc64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_ZIG_CPU="970"
diff --git a/common/build-profiles/ppc64le-musl.sh b/common/build-profiles/ppc64le-musl.sh
index cb9423f99748..8d2db1b2b518 100644
--- a/common/build-profiles/ppc64le-musl.sh
+++ b/common/build-profiles/ppc64le-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-musl"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppc64le.sh b/common/build-profiles/ppc64le.sh
index c91ea054789e..8f0e735f873e 100644
--- a/common/build-profiles/ppc64le.sh
+++ b/common/build-profiles/ppc64le.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpc64le-unknown-linux-gnu"
 XBPS_RUST_TARGET="$XBPS_TRIPLET"
+XBPS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/ppcle-musl.sh b/common/build-profiles/ppcle-musl.sh
index 7585c4f6919d..c8d7e28e4834 100644
--- a/common/build-profiles/ppcle-musl.sh
+++ b/common/build-profiles/ppcle-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-musl"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/ppcle.sh b/common/build-profiles/ppcle.sh
index 0cdc6cc853c9..7eccadf4ed26 100644
--- a/common/build-profiles/ppcle.sh
+++ b/common/build-profiles/ppcle.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="powerpcle-linux-gnu"
 XBPS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_ZIG_CPU="pwr8"
diff --git a/common/build-profiles/x86_64-musl.sh b/common/build-profiles/x86_64-musl.sh
index b0bbb30bd160..538baea0b613 100644
--- a/common/build-profiles/x86_64-musl.sh
+++ b/common/build-profiles/x86_64-musl.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-musl"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-profiles/x86_64.sh b/common/build-profiles/x86_64.sh
index a53f4aafdacd..388b5561a6d2 100644
--- a/common/build-profiles/x86_64.sh
+++ b/common/build-profiles/x86_64.sh
@@ -3,3 +3,5 @@ XBPS_TARGET_CXXFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TARGET_FFLAGS="$XBPS_TARGET_CFLAGS"
 XBPS_TRIPLET="x86_64-unknown-linux-gnu"
 XBPS_RUST_TARGET="${XBPS_TRIPLET}"
+XBPS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/build-style/zig-build.sh b/common/build-style/zig-build.sh
new file mode 100644
index 000000000000..205c4cadf53f
--- /dev/null
+++ b/common/build-style/zig-build.sh
@@ -0,0 +1,41 @@
+do_build() {
+	local zig_target zig_cpu
+
+	# TODO: This duplication between build-profiles and cross-profiles
+	# is totally unnecessary. It would be nice if there was some way to
+	# avoid it.
+	if [ "$CROSS_BUILD" ]; then
+		zig_target="${XBPS_CROSS_ZIG_TARGET}"
+		zig_cpu="${XBPS_CROSS_ZIG_CPU}"
+	else
+		zig_target="${XBPS_ZIG_TARGET}"
+		zig_cpu="${XBPS_ZIG_CPU}"
+	fi
+
+	# Inform zig of the required libc include paths.
+	cat > xbps_zig_libc.txt <<-EOF
+		include_dir=${XBPS_CROSS_BASE}/usr/include
+		sys_include_dir=${XBPS_CROSS_BASE}/usr/include
+		crt_dir=${XBPS_CROSS_BASE}/usr/lib
+		msvc_lib_dir=
+		kernel32_lib_dir=
+		gcc_dir=
+	EOF
+
+	# The Zig build system only has a single install step, there is no
+	# way to build artifacts for a given prefix and then install those artifacts
+	# to that prefix at some later time. Therefore, we build and install to the zig-out
+	# directory and later copy the artifacts to the destdir in do_install().
+	# We use zig-out to avoid path conflicts as it is the default install
+	# prefix used by the zig build system.
+	DESTDIR="zig-out" zig build \
+		--sysroot "${XBPS_CROSS_BASE}" \
+		--libc xbps_zig_libc.txt \
+		-Dtarget="${zig_target}" -Dcpu="${zig_cpu}" \
+		-Drelease-safe --prefix /usr install \
+		${configure_args}
+}
+
+do_install() {
+	cp -r zig-out/* "${DESTDIR}"
+}
diff --git a/common/cross-profiles/README b/common/cross-profiles/README
index 2a2a1d4b423a..f2300b5d5a94 100644
--- a/common/cross-profiles/README
+++ b/common/cross-profiles/README
@@ -13,5 +13,7 @@ A cross profile file must provide the following variables:
 	- XBPS_CROSS_LDFLAGS	(Linker flags for the cross compiler)
 	- XBPS_CROSS_RUST_TARGET (the rust triplet for the rust cross compiler)
 	- XBPS_CROSS_RUSTFLAGS (rust compiler flags for the cross compiler)
+	- XBPS_CROSS_ZIG_TARGET	(the arch-os-abi target triplet for zig)
+	- XBPS_CROSS_ZIG_CPU	(the cpu/feature set for zig)
 
 A source package matching `cross-${XBPS_CROSS_TRIPLET}' must also exist.
diff --git a/common/cross-profiles/aarch64-musl.sh b/common/cross-profiles/aarch64-musl.sh
index 56ce2d32964a..892abba9ef3c 100644
--- a/common/cross-profiles/aarch64-musl.sh
+++ b/common/cross-profiles/aarch64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/aarch64.sh b/common/cross-profiles/aarch64.sh
index 068870a31588..7a99e6fc72c6 100644
--- a/common/cross-profiles/aarch64.sh
+++ b/common/cross-profiles/aarch64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="aarch64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="aarch64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/armv5tel-musl.sh b/common/cross-profiles/armv5tel-musl.sh
index 3894f0c87313..0eb813a54d64 100644
--- a/common/cross-profiles/armv5tel-musl.sh
+++ b/common/cross-profiles/armv5tel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv5tel.sh b/common/cross-profiles/armv5tel.sh
index d56c50a80063..f5828360f112 100644
--- a/common/cross-profiles/armv5tel.sh
+++ b/common/cross-profiles/armv5tel.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabi"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabi"
+XBPS_CROSS_ZIG_CPU="generic+v5te+soft_float"
diff --git a/common/cross-profiles/armv6l-musl.sh b/common/cross-profiles/armv6l-musl.sh
index 58b67f85a97e..5f32f9ba0aec 100644
--- a/common/cross-profiles/armv6l-musl.sh
+++ b/common/cross-profiles/armv6l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv6l.sh b/common/cross-profiles/armv6l.sh
index b146eb87219b..7040996ea1c1 100644
--- a/common/cross-profiles/armv6l.sh
+++ b/common/cross-profiles/armv6l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="arm-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v6"
diff --git a/common/cross-profiles/armv7l-musl.sh b/common/cross-profiles/armv7l-musl.sh
index 93e3cc5b3d72..9a38832e0d7d 100644
--- a/common/cross-profiles/armv7l-musl.sh
+++ b/common/cross-profiles/armv7l-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-musleabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-musleabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/armv7l.sh b/common/cross-profiles/armv7l.sh
index 674165e238a1..b8c9c41d35a5 100644
--- a/common/cross-profiles/armv7l.sh
+++ b/common/cross-profiles/armv7l.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="armv7-unknown-linux-gnueabihf"
+XBPS_CROSS_ZIG_TARGET="arm-linux-gnueabihf"
+XBPS_CROSS_ZIG_CPU="generic+v7a+vfp3"
diff --git a/common/cross-profiles/i686-musl.sh b/common/cross-profiles/i686-musl.sh
index fcb3d8ec4b49..c1cdf60f5ebb 100644
--- a/common/cross-profiles/i686-musl.sh
+++ b/common/cross-profiles/i686-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="i686-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/i686.sh b/common/cross-profiles/i686.sh
index 07ee8883707a..16f44013ab76 100644
--- a/common/cross-profiles/i686.sh
+++ b/common/cross-profiles/i686.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="i686-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="i386-linux-gnu"
+XBPS_CROSS_ZIG_CPU="_i686+sse2"
diff --git a/common/cross-profiles/mips-musl.sh b/common/cross-profiles/mips-musl.sh
index f1d9fe2fd1a3..7c44de7577e2 100644
--- a/common/cross-profiles/mips-musl.sh
+++ b/common/cross-profiles/mips-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipsel-musl.sh b/common/cross-profiles/mipsel-musl.sh
index 0d1117deb06c..fa4390c98dcd 100644
--- a/common/cross-profiles/mipsel-musl.sh
+++ b/common/cross-profiles/mipsel-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic+soft_float"
diff --git a/common/cross-profiles/mipselhf-musl.sh b/common/cross-profiles/mipselhf-musl.sh
index 8587a88e6ca5..49f4558ca2fa 100644
--- a/common/cross-profiles/mipselhf-musl.sh
+++ b/common/cross-profiles/mipselhf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mipsel-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mipsel-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/mipshf-musl.sh b/common/cross-profiles/mipshf-musl.sh
index 2914eaf19f85..513391b6284e 100644
--- a/common/cross-profiles/mipshf-musl.sh
+++ b/common/cross-profiles/mipshf-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="mips-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="mips-linux-musl"
+XBPS_CROSS_ZIG_CPU="generic"
diff --git a/common/cross-profiles/ppc-musl.sh b/common/cross-profiles/ppc-musl.sh
index 631b1fb427e9..327ae2341b99 100644
--- a/common/cross-profiles/ppc-musl.sh
+++ b/common/cross-profiles/ppc-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-musl"
+XBPS_ZIG_TARGET="powerpc-linux-musl"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc.sh b/common/cross-profiles/ppc.sh
index 4647c62de2dd..787f6bb2943b 100644
--- a/common/cross-profiles/ppc.sh
+++ b/common/cross-profiles/ppc.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc-unknown-linux-gnu"
+XBPS_ZIG_TARGET="powerpc-linux-gnu"
+XBPS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64-musl.sh b/common/cross-profiles/ppc64-musl.sh
index 2cc74b352a13..c4b0f35e094b 100644
--- a/common/cross-profiles/ppc64-musl.sh
+++ b/common/cross-profiles/ppc64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-musl"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64.sh b/common/cross-profiles/ppc64.sh
index 4fedf210000d..7ed5bc0d5f1f 100644
--- a/common/cross-profiles/ppc64.sh
+++ b/common/cross-profiles/ppc64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="970"
diff --git a/common/cross-profiles/ppc64le-musl.sh b/common/cross-profiles/ppc64le-musl.sh
index b08f78c91f33..df18c300ddb0 100644
--- a/common/cross-profiles/ppc64le-musl.sh
+++ b/common/cross-profiles/ppc64le-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppc64le.sh b/common/cross-profiles/ppc64le.sh
index 88e8649a7658..3fe7b2da47b6 100644
--- a/common/cross-profiles/ppc64le.sh
+++ b/common/cross-profiles/ppc64le.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpc64le-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpc64le-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/ppcle-musl.sh b/common/cross-profiles/ppcle-musl.sh
index 2ba308f224d5..48e27c04b90f 100644
--- a/common/cross-profiles/ppcle-musl.sh
+++ b/common/cross-profiles/ppcle-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-musl"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/ppcle.sh b/common/cross-profiles/ppcle.sh
index 3e5230b194ef..a59158233660 100644
--- a/common/cross-profiles/ppcle.sh
+++ b/common/cross-profiles/ppcle.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="powerpcle-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="powerpcle-linux-gnu"
+XBPS_CROSS_ZIG_CPU="pwr8"
diff --git a/common/cross-profiles/x86_64-musl.sh b/common/cross-profiles/x86_64-musl.sh
index a1c27c6f7933..38642a07f8a9 100644
--- a/common/cross-profiles/x86_64-musl.sh
+++ b/common/cross-profiles/x86_64-musl.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-musl"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-musl"
+XBPS_CROSS_ZIG_CPU="baseline"
diff --git a/common/cross-profiles/x86_64.sh b/common/cross-profiles/x86_64.sh
index 360dd2068fc2..bd966d0e01df 100644
--- a/common/cross-profiles/x86_64.sh
+++ b/common/cross-profiles/x86_64.sh
@@ -8,3 +8,5 @@ XBPS_CROSS_CXXFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_FFLAGS="$XBPS_CROSS_CFLAGS"
 XBPS_CROSS_RUSTFLAGS="--sysroot=${XBPS_CROSS_BASE}/usr"
 XBPS_CROSS_RUST_TARGET="x86_64-unknown-linux-gnu"
+XBPS_CROSS_ZIG_TARGET="x86_64-linux-gnu"
+XBPS_CROSS_ZIG_CPU="baseline"

From f3c37d7fc783e8c864528bd018a13212703012fa Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Thu, 17 Jun 2021 01:40:15 +0000
Subject: [PATCH 3/4] New package: rundird-0.2.0

---
 srcpkgs/rundird/files/rundird/run |  2 ++
 srcpkgs/rundird/template          | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 srcpkgs/rundird/files/rundird/run
 create mode 100644 srcpkgs/rundird/template

diff --git a/srcpkgs/rundird/files/rundird/run b/srcpkgs/rundird/files/rundird/run
new file mode 100644
index 000000000000..e4aae8c83b4b
--- /dev/null
+++ b/srcpkgs/rundird/files/rundird/run
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec rundird
diff --git a/srcpkgs/rundird/template b/srcpkgs/rundird/template
new file mode 100644
index 000000000000..8fa83b5e0dcc
--- /dev/null
+++ b/srcpkgs/rundird/template
@@ -0,0 +1,18 @@
+# Template file for 'rundird'
+pkgname=rundird
+version=0.2.0
+revision=1
+build_style=zig-build
+hostmakedepends="zig"
+makedepends="pam-devel"
+short_desc="Simple daemon + PAM module providing an XDG_RUNTIME_DIR"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/ifreund/rundird"
+distfiles="${homepage}/archive/v${version}.tar.gz"
+checksum=1dea207f39388e8c2c275b8a9aada0166d1f587a806f2e5e4486d98259e23e4c
+
+post_install() {
+	vsv rundird
+	vdoc README.md
+}

From 0cf7e95dc6359ee7a756514dd8f155860cbb5fb9 Mon Sep 17 00:00:00 2001
From: Isaac Freund <mail@isaacfreund.com>
Date: Wed, 3 Nov 2021 14:48:05 +0100
Subject: [PATCH 4/4] New package: river-0.1.0

---
 ...ble-PIE-for-river-riverctl-rivertile.patch | 42 +++++++++++++++++++
 srcpkgs/river/template                        | 23 ++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
 create mode 100644 srcpkgs/river/template

diff --git a/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
new file mode 100644
index 000000000000..ecc68302db09
--- /dev/null
+++ b/srcpkgs/river/patches/0001-Enable-PIE-for-river-riverctl-rivertile.patch
@@ -0,0 +1,42 @@
+From 759c1c7a915083f3da46960ff82fa2a3566a7065 Mon Sep 17 00:00:00 2001
+From: Isaac Freund <mail@isaacfreund.com>
+Date: Wed, 3 Nov 2021 14:21:35 +0100
+Subject: [PATCH] Enable PIE for river, riverctl, rivertile
+
+There is sadly not yet a standard way to do this exposed by the zig
+build system. See: https://github.com/ziglang/zig/issues/7201
+---
+ build.zig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/build.zig b/build.zig
+index d561f49..8ac9a4e 100644
+--- a/build.zig
++++ b/build.zig
+@@ -85,6 +85,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const river = b.addExecutable("river", "river/main.zig");
+         river.setTarget(target);
+         river.setBuildMode(mode);
++        river.pie = true;
+         river.addBuildOption(bool, "xwayland", xwayland);
+         river.addBuildOption([:0]const u8, "version", full_version);
+ 
+@@ -97,6 +98,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const riverctl = b.addExecutable("riverctl", "riverctl/main.zig");
+         riverctl.setTarget(target);
+         riverctl.setBuildMode(mode);
++        riverctl.pie = true;
+         riverctl.addBuildOption([:0]const u8, "version", full_version);
+ 
+         riverctl.step.dependOn(&scanner.step);
+@@ -114,6 +116,7 @@ pub fn build(b: *zbs.Builder) !void {
+         const rivertile = b.addExecutable("rivertile", "rivertile/main.zig");
+         rivertile.setTarget(target);
+         rivertile.setBuildMode(mode);
++        rivertile.pie = true;
+         rivertile.addBuildOption([:0]const u8, "version", full_version);
+ 
+         rivertile.step.dependOn(&scanner.step);
+-- 
+2.33.1
+
diff --git a/srcpkgs/river/template b/srcpkgs/river/template
new file mode 100644
index 000000000000..d30060422419
--- /dev/null
+++ b/srcpkgs/river/template
@@ -0,0 +1,23 @@
+# Template file for 'river'
+pkgname=river
+version=0.1.0
+revision=1
+build_style=zig-build
+configure_args="$(vopt_if xwayland -Dxwayland)"
+hostmakedepends="zig pkg-config wayland-devel scdoc git"
+makedepends="wlroots-devel"
+depends="$(vopt_if xwayland xorg-server-xwayland)"
+short_desc="Dynamic tiling Wayland compositor"
+maintainer="Isaac Freund <mail@isaacfreund.com>"
+license="GPL-3.0-or-later"
+homepage="https://github.com/riverwm/river"
+distfiles="${homepage}/releases/download/v${version}/river-${version}.tar.gz"
+checksum=4153a5511a1008e87a2251fc4510a43d6f6085f41b040222506355ff6d4bd10f
+
+build_options="xwayland"
+build_options_default="xwayland"
+desc_option_xwayland="Enable Xwayland support"
+
+post_install() {
+	vsconf example/init
+}

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

* Re: [PR REVIEW] Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (66 preceding siblings ...)
  2021-11-13 11:43 ` [PR PATCH] [Updated] " ifreund
@ 2021-11-13 11:44 ` ifreund
  2021-11-13 11:47 ` ifreund
  2021-11-13 14:46 ` [PR PATCH] [Merged]: " ericonr
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-13 11:44 UTC (permalink / raw)
  To: ml

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

New review comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#discussion_r748715095

Comment:
Yeah that's definitely a good call, done.

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

* Re: Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (67 preceding siblings ...)
  2021-11-13 11:44 ` [PR REVIEW] " ifreund
@ 2021-11-13 11:47 ` ifreund
  2021-11-13 14:46 ` [PR PATCH] [Merged]: " ericonr
  69 siblings, 0 replies; 71+ messages in thread
From: ifreund @ 2021-11-13 11:47 UTC (permalink / raw)
  To: ml

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

New comment by ifreund on void-packages repository

https://github.com/void-linux/void-packages/pull/29288#issuecomment-968055738

Comment:
> Ok, tested both packages, seem to be working just fine. All that's missing is installing the example file and possibly a `vdoc README.md` in rundird, what do you think?

Excellent! Good call on including the example river init and rundird README.md, especially for rundird as I forgot that I never wrote a man page for that. Not that there's much that would go in a man page, the only important bit of end-user documentation is the PAM configuration.

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

* Re: [PR PATCH] [Merged]: Add zig-build build style, river 0.1.0, rundird 0.2.0
  2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
                   ` (68 preceding siblings ...)
  2021-11-13 11:47 ` ifreund
@ 2021-11-13 14:46 ` ericonr
  69 siblings, 0 replies; 71+ messages in thread
From: ericonr @ 2021-11-13 14:46 UTC (permalink / raw)
  To: ml

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

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

Add zig-build build style, river 0.1.0, rundird 0.2.0
https://github.com/void-linux/void-packages/pull/29288

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

#### 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
-->
Closes  #33060


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

end of thread, other threads:[~2021-11-13 14:46 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-07 10:59 [PR PATCH] New package: rundird-0.1.0 ifreund
2021-03-07 11:01 ` [PR PATCH] [Updated] " ifreund
2021-03-08  6:34 ` ericonr
2021-03-11  9:15 ` travankor
2021-03-11  9:16 ` travankor
2021-03-11 13:10 ` ericonr
2021-03-11 13:39 ` travankor
2021-03-11 13:45 ` travankor
2021-03-11 13:45 ` travankor
2021-05-24 19:07 ` [PR PATCH] [Updated] " ifreund
2021-06-07 20:39 ` ifreund
2021-06-10  2:19 ` ifreund
2021-06-10  3:10 ` ifreund
2021-06-10  4:26 ` ifreund
2021-06-10  4:31 ` ifreund
2021-06-17  1:40 ` ifreund
2021-06-17  1:49 ` ifreund
2021-06-17  3:07 ` [PR REVIEW] " ericonr
2021-06-17  3:07 ` ericonr
2021-06-17  3:07 ` ericonr
2021-06-17  3:07 ` ericonr
2021-06-17  3:07 ` ericonr
2021-06-17  3:07 ` ericonr
2021-06-17 17:41 ` [PR PATCH] [Updated] " ifreund
2021-06-17 17:43 ` [PR REVIEW] " ifreund
2021-06-17 17:43 ` ifreund
2021-06-17 19:23 ` ericonr
2021-06-17 20:16 ` [PR PATCH] [Updated] " ifreund
2021-06-17 20:22 ` ifreund
2021-06-18  0:21 ` ifreund
2021-06-21 21:08 ` ifreund
2021-06-21 21:09 ` ifreund
2021-06-21 21:10 ` [PR PATCH] [Updated] " ifreund
2021-06-21 21:12 ` ifreund
2021-06-26 11:06 ` ifreund
2021-07-25 20:55 ` [PR REVIEW] New package: rundird-0.1.1, Add zig-build build style ericonr
2021-07-25 20:55 ` ericonr
2021-07-25 20:59 ` ericonr
2021-07-25 22:30 ` [PR REVIEW] " ifreund
2021-07-27  1:02 ` [PR PATCH] [Updated] " ifreund
2021-07-27  1:07 ` ifreund
2021-07-27  1:11 ` ifreund
2021-08-18 22:18 ` [PR REVIEW] New package: rundird-0.2.0, " ericonr
2021-08-18 22:38 ` ifreund
2021-08-18 22:41 ` [PR PATCH] [Updated] " ifreund
2021-08-18 22:41 ` ifreund
2021-09-07 17:23 ` [PR PATCH] [Updated] " ifreund
2021-09-07 17:25 ` ifreund
2021-09-15 14:50 ` [PR PATCH] [Updated] " ifreund
2021-11-03 13:49 ` ifreund
2021-11-03 16:46 ` [PR PATCH] [Updated] Add zig-build build style, river 0.1.0, rundird 0.2.0 ifreund
2021-11-08 15:56 ` ifreund
2021-11-08 15:58 ` ifreund
2021-11-10 23:48 ` subsetpark
2021-11-11  0:31 ` [PR REVIEW] " ericonr
2021-11-11  0:31 ` ericonr
2021-11-11  0:31 ` ericonr
2021-11-11  0:31 ` ericonr
2021-11-11 10:19 ` ifreund
2021-11-11 10:22 ` ifreund
2021-11-11 10:24 ` [PR PATCH] [Updated] " ifreund
2021-11-11 11:25 ` ifreund
2021-11-11 11:25 ` [PR REVIEW] " ifreund
2021-11-11 11:26 ` ifreund
2021-11-13  3:15 ` [PR REVIEW] " ericonr
2021-11-13  3:15 ` ericonr
2021-11-13  3:49 ` ericonr
2021-11-13 11:43 ` [PR PATCH] [Updated] " ifreund
2021-11-13 11:44 ` [PR REVIEW] " ifreund
2021-11-13 11:47 ` ifreund
2021-11-13 14:46 ` [PR PATCH] [Merged]: " ericonr

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).