summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2022-05-07 12:18:12 -0700
committerKhem Raj <raj.khem@gmail.com>2022-05-07 12:20:16 -0700
commite1ccf12c15f2c02281757bbd61c4053f0b74577d (patch)
treefd2dd1a2e31d17f1287775228a30edc57dbf586f
parentda8a50684ad87a7937bf9242c0bc831ad5b2f544 (diff)
downloadmeta-openembedded-e1ccf12c15f2c02281757bbd61c4053f0b74577d.tar.gz
zfs: Fix build on musl systems
musl does not provide strndupa Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Windel Bouwman <windel@windel.nl>
-rw-r--r--meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch36
-rw-r--r--meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb4
2 files changed, 39 insertions, 1 deletions
diff --git a/meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch b/meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch
new file mode 100644
index 0000000000..8bb8b9479a
--- /dev/null
+++ b/meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch
@@ -0,0 +1,36 @@
1From 54883e714b7fd1e7f4ce47eb1fc09adff35d561e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 7 May 2022 12:15:22 -0700
4Subject: [PATCH] Define strndupa if it does not exist
5
6musl e.g. does not supply strndupa, unlike glibc
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 etc/systemd/system-generators/zfs-mount-generator.c | 9 +++++++++
12 1 file changed, 9 insertions(+)
13
14diff --git a/etc/systemd/system-generators/zfs-mount-generator.c b/etc/systemd/system-generators/zfs-mount-generator.c
15index b806339..592d2f9 100644
16--- a/etc/systemd/system-generators/zfs-mount-generator.c
17+++ b/etc/systemd/system-generators/zfs-mount-generator.c
18@@ -47,6 +47,15 @@
19 #define STRCMP ((int(*)(const void *, const void *))&strcmp)
20 #define PID_T_CMP ((int(*)(const void *, const void *))&pid_t_cmp)
21
22+#ifndef strndupa
23+#define strndupa(s, n) \
24+ (__extension__ ({const char *__in = (s); \
25+ size_t __len = strnlen (__in, (n)) + 1; \
26+ char *__out = (char *) alloca (__len); \
27+ __out[__len-1] = '\0'; \
28+ (char *) memcpy (__out, __in, __len-1);}))
29+#endif
30+
31 static int
32 pid_t_cmp(const pid_t *lhs, const pid_t *rhs)
33 {
34--
352.36.0
36
diff --git a/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb b/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb
index 072af79019..1752e03750 100644
--- a/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb
+++ b/meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb
@@ -5,7 +5,9 @@ LICENSE = "CDDL-1.0"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=7087caaf1dc8a2856585619f4a787faa" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=7087caaf1dc8a2856585619f4a787faa"
6HOMEPAGE ="https://github.com/openzfs/zfs" 6HOMEPAGE ="https://github.com/openzfs/zfs"
7 7
8SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz" 8SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \
9 file://0001-Define-strndupa-if-it-does-not-exist.patch \
10"
9SRC_URI[sha256sum] = "3b52c0d493f806f638dca87dde809f53861cd318c1ebb0e60daeaa061cf1acf6" 11SRC_URI[sha256sum] = "3b52c0d493f806f638dca87dde809f53861cd318c1ebb0e60daeaa061cf1acf6"
10 12
11# Using both 'module' and 'autotools' classes seems a bit odd, they both 13# Using both 'module' and 'autotools' classes seems a bit odd, they both