diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-05-07 12:18:12 -0700 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-05-07 12:20:16 -0700 |
commit | e1ccf12c15f2c02281757bbd61c4053f0b74577d (patch) | |
tree | fd2dd1a2e31d17f1287775228a30edc57dbf586f /meta-filesystems/recipes-filesystems | |
parent | da8a50684ad87a7937bf9242c0bc831ad5b2f544 (diff) | |
download | meta-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>
Diffstat (limited to 'meta-filesystems/recipes-filesystems')
-rw-r--r-- | meta-filesystems/recipes-filesystems/zfs/zfs/0001-Define-strndupa-if-it-does-not-exist.patch | 36 | ||||
-rw-r--r-- | meta-filesystems/recipes-filesystems/zfs/zfs_2.1.4.bb | 4 |
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 @@ +From 54883e714b7fd1e7f4ce47eb1fc09adff35d561e Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sat, 7 May 2022 12:15:22 -0700 +Subject: [PATCH] Define strndupa if it does not exist + +musl e.g. does not supply strndupa, unlike glibc + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + etc/systemd/system-generators/zfs-mount-generator.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/etc/systemd/system-generators/zfs-mount-generator.c b/etc/systemd/system-generators/zfs-mount-generator.c +index b806339..592d2f9 100644 +--- a/etc/systemd/system-generators/zfs-mount-generator.c ++++ b/etc/systemd/system-generators/zfs-mount-generator.c +@@ -47,6 +47,15 @@ + #define STRCMP ((int(*)(const void *, const void *))&strcmp) + #define PID_T_CMP ((int(*)(const void *, const void *))&pid_t_cmp) + ++#ifndef strndupa ++#define strndupa(s, n) \ ++ (__extension__ ({const char *__in = (s); \ ++ size_t __len = strnlen (__in, (n)) + 1; \ ++ char *__out = (char *) alloca (__len); \ ++ __out[__len-1] = '\0'; \ ++ (char *) memcpy (__out, __in, __len-1);})) ++#endif ++ + static int + pid_t_cmp(const pid_t *lhs, const pid_t *rhs) + { +-- +2.36.0 + 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" LIC_FILES_CHKSUM = "file://LICENSE;md5=7087caaf1dc8a2856585619f4a787faa" HOMEPAGE ="https://github.com/openzfs/zfs" -SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz" +SRC_URI = "https://github.com/openzfs/zfs/releases/download/${BPN}-${PV}/${BPN}-${PV}.tar.gz \ + file://0001-Define-strndupa-if-it-does-not-exist.patch \ +" SRC_URI[sha256sum] = "3b52c0d493f806f638dca87dde809f53861cd318c1ebb0e60daeaa061cf1acf6" # Using both 'module' and 'autotools' classes seems a bit odd, they both |