diff mbox series

[meta-networking,2/2] tgt: Fix build with musl

Message ID 20240109041324.4110649-2-raj.khem@gmail.com
State New
Headers show
Series [meta-oe,1/2] libconfig-general-perl: Enable on musl targets | expand

Commit Message

Khem Raj Jan. 9, 2024, 4:13 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../tgt/files/musl-__wordsize.patch           | 41 +++++++++++++++++++
 .../recipes-extended/tgt/tgt_1.0.90.bb        |  6 +--
 2 files changed, 44 insertions(+), 3 deletions(-)
 create mode 100644 meta-networking/recipes-extended/tgt/files/musl-__wordsize.patch
diff mbox series

Patch

diff --git a/meta-networking/recipes-extended/tgt/files/musl-__wordsize.patch b/meta-networking/recipes-extended/tgt/files/musl-__wordsize.patch
new file mode 100644
index 0000000000..ac758cc39d
--- /dev/null
+++ b/meta-networking/recipes-extended/tgt/files/musl-__wordsize.patch
@@ -0,0 +1,41 @@ 
+The definition of __WORDSIZE is found in <sys/reg.h>
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- a/usr/iscsi/iscsid.h
++++ b/usr/iscsi/iscsid.h
+@@ -22,6 +22,9 @@
+ #include <stdint.h>
+ #include <inttypes.h>
+ #include <netdb.h>
++#if !defined(__GLIBC__)
++#include <sys/reg.h>
++#endif
+ 
+ #include "transport.h"
+ #include "list.h"
+--- a/usr/tgtd.h
++++ b/usr/tgtd.h
+@@ -1,6 +1,9 @@
+ #ifndef __TARGET_DAEMON_H
+ #define __TARGET_DAEMON_H
+ 
++#if !defined(__GLIBC__)
++#include <sys/reg.h>
++#endif
+ #include "log.h"
+ #include "scsi_cmnd.h"
+ #include "tgtadm_error.h"
+--- a/usr/util.h
++++ b/usr/util.h
+@@ -19,6 +19,9 @@
+ #include <linux/fs.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
++#if !defined(__GLIBC__)
++#include <sys/reg.h>
++#endif
+ 
+ #include "be_byteshift.h"
+ 
diff --git a/meta-networking/recipes-extended/tgt/tgt_1.0.90.bb b/meta-networking/recipes-extended/tgt/tgt_1.0.90.bb
index f68ae99db5..35995f7876 100644
--- a/meta-networking/recipes-extended/tgt/tgt_1.0.90.bb
+++ b/meta-networking/recipes-extended/tgt/tgt_1.0.90.bb
@@ -7,9 +7,10 @@  DEPENDS = "sg3-utils libaio"
 SRCREV = "df991fa788e22cd8b8e3013cfae306988c19c3d0"
 
 SRC_URI = "git://github.com/fujita/tgt.git;branch=master;protocol=https \
-	file://0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch \
+	      file://0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch \
         file://0001-usr-Makefile-WARNING-fix.patch \
         file://usr-Makefile-apply-LDFLAGS-to-all-executables.patch \
+        file://musl-__wordsize.patch \
 "
 SRC_URI += "file://tgtd.init \
             file://tgtd.service \
@@ -18,8 +19,6 @@  SRC_URI += "file://tgtd.init \
 
 S = "${WORKDIR}/git"
 
-COMPATIBLE_HOST:libc-musl = "null"
-
 CONFFILES:${PN} += "${sysconfdir}/tgt/targets.conf"
 
 inherit update-rc.d systemd
@@ -29,6 +28,7 @@  SYSTEMD_AUTO_ENABLE:${PN} = "disable"
 
 CFLAGS += ' -I. -DUSE_SIGNALFD -DUSE_TIMERFD -D_GNU_SOURCE -DTGT_VERSION=\\"1.0.63\\" -DBSDIR=\\"${libdir}/backing-store\\"'
 
+CFLAGS:append:libc-musl = " -D_LARGEFILE64_SOURCE"
 #do_compile() {
 #    oe_runmake SYSROOT="${STAGING_DIR_TARGET}" -e programs conf scripts
 #}