diff mbox series

[meta-oe,14/63] libio-pty-perl: Fix build on musl

Message ID 20220904073417.3251865-14-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,01/63] libutempter: Upgrade to 1.2.2-alt1 | expand

Commit Message

Khem Raj Sept. 4, 2022, 7:33 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...Tty.xs-Do-not-mark-strlcpy-as-static.patch | 45 +++++++++++++++++++
 .../perl/libio-pty-perl_1.16.bb               |  4 +-
 2 files changed, 48 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-devtools/perl/libio-pty-perl/0001-Tty.xs-Do-not-mark-strlcpy-as-static.patch
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/perl/libio-pty-perl/0001-Tty.xs-Do-not-mark-strlcpy-as-static.patch b/meta-oe/recipes-devtools/perl/libio-pty-perl/0001-Tty.xs-Do-not-mark-strlcpy-as-static.patch
new file mode 100644
index 0000000000..07c7690fb8
--- /dev/null
+++ b/meta-oe/recipes-devtools/perl/libio-pty-perl/0001-Tty.xs-Do-not-mark-strlcpy-as-static.patch
@@ -0,0 +1,45 @@ 
+From fae771aefc593a0ef798bc0c1e21b0524eb85e2d Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 31 Aug 2022 20:32:35 -0700
+Subject: [PATCH] Tty.xs: Do not mark strlcpy as static
+
+Some libcs e.g. musl do not provide implementation of strlcpy but they
+do provide the signature in string.h, if we mark it static here then it
+conflicts with the libc define and compiler may warn/error
+
+Fixes
+Tty.xs:190:1: error: static declaration of 'strlcpy' follows non-static declaration
+strlcpy(                                                                                                                 ^
+/mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/libio-pty-perl/1.16-r0/recipe-sysroot/usr/include/string.h:86:8: note: previous declaration is here
+size_t strlcpy (char *, const char *, size_t);                                                                                  ^
+
+Upstream-Status: Submitted [https://github.com/toddr/IO-Tty/pull/33]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Tty.xs | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Tty.xs b/Tty.xs
+index aa638f4..4bab39d 100644
+--- a/Tty.xs
++++ b/Tty.xs
+@@ -186,11 +186,11 @@ mysignal(int sig, mysig_t act)
+  * will be copied.  Always NUL terminates (unless siz == 0).
+  * Returns strlen(src); if retval >= siz, truncation occurred.
+  */
+-static size_t
+-strlcpy(dst, src, siz)
+-        char *dst;
+-        const char *src;
+-        size_t siz;
++size_t
++strlcpy(
++        char *dst,
++        const char *src,
++        size_t siz)
+ {
+         register char *d = dst;
+         register const char *s = src;
+-- 
+2.37.3
+
diff --git a/meta-oe/recipes-devtools/perl/libio-pty-perl_1.16.bb b/meta-oe/recipes-devtools/perl/libio-pty-perl_1.16.bb
index e714851854..0f1c71b70c 100644
--- a/meta-oe/recipes-devtools/perl/libio-pty-perl_1.16.bb
+++ b/meta-oe/recipes-devtools/perl/libio-pty-perl_1.16.bb
@@ -3,7 +3,9 @@  SECTION = "libs"
 LICENSE = "Artistic-1.0 | GPL-1.0-or-later"
 LIC_FILES_CHKSUM = "file://META.yml;beginline=11;endline=12;md5=b2562f94907eeb42e8ce9d45f628e587"
 
-SRC_URI = "http://www.cpan.org/modules/by-module/IO/IO-Tty-${PV}.tar.gz"
+SRC_URI = "http://www.cpan.org/modules/by-module/IO/IO-Tty-${PV}.tar.gz \
+           file://0001-Tty.xs-Do-not-mark-strlcpy-as-static.patch \
+           "
 
 SRC_URI[md5sum] = "5ee30bf7c76f00cc69f92388ad776e2a"
 SRC_URI[sha256sum] = "8f1a09c070738adc695df903f2e7f74308dd8d991b914c0bc390a0e6021294dd"