From cc9204734c45b32de7dfec4ab38493cbd367818a Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Sun, 14 Jan 2024 22:11:29 +0800 Subject: [PATCH] efivar: fix compilation with musl 1.2.4 --- lang/php8/Makefile | 3 ++ lang/python/python3-libselinux/Makefile | 6 ++- .../003-Use-off_t-instead-of-off64_t.patch | 40 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 libs/efivar/patches/003-Use-off_t-instead-of-off64_t.patch diff --git a/lang/php8/Makefile b/lang/php8/Makefile index b2c138f1..7ef300cc 100644 --- a/lang/php8/Makefile +++ b/lang/php8/Makefile @@ -194,6 +194,9 @@ CONFIGURE_ARGS+= \ ifeq ($(CONFIG_LIBC_USE_GLIBC),y) TARGET_LDFLAGS += -ldl endif +ifeq ($(CONFIG_USE_MUSL),y) +TARGET_CFLAGS += -D_LARGEFILE64_SOURCE +endif ifneq ($(SDK)$(CONFIG_PACKAGE_php8-mod-bcmath),) CONFIGURE_ARGS+= --enable-bcmath=shared diff --git a/lang/python/python3-libselinux/Makefile b/lang/python/python3-libselinux/Makefile index 95cb2a81..f56483b4 100644 --- a/lang/python/python3-libselinux/Makefile +++ b/lang/python/python3-libselinux/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk SRC_NAME:=libselinux PKG_NAME:=python3-$(SRC_NAME) PKG_VERSION:=3.3 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_BUILD_DIR:=$(BUILD_DIR)/python-libselinux/$(SRC_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(SRC_NAME)-$(PKG_VERSION).tar.gz @@ -48,6 +48,10 @@ define Package/python3-libselinux/description This package provides the Python bindings for libselinux. endef +ifneq ($(CONFIG_USE_MUSL),) + TARGET_CFLAGS += -D_LARGEFILE64_SOURCE +endif + MAKE_FLAGS += \ FTS_LDLIBS=-lfts \ SHLIBDIR=/usr/lib \ diff --git a/libs/efivar/patches/003-Use-off_t-instead-of-off64_t.patch b/libs/efivar/patches/003-Use-off_t-instead-of-off64_t.patch new file mode 100644 index 00000000..969f65c0 --- /dev/null +++ b/libs/efivar/patches/003-Use-off_t-instead-of-off64_t.patch @@ -0,0 +1,40 @@ +From 914c686cc54b2405dab08bff77cd60827aab54b1 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 14 Dec 2022 16:55:51 -0800 +Subject: [PATCH] Use off_t instead of off64_t + +Pass _FILE_OFFSET_BITS=64 to ensure 64bit off_t + +This helps building efivar for 32bit arches on systems using musl C +library. It works with glibc since _GNU_SOURCE defines +_LARGEFILE64_SOURCE as well, this feature test macro enables the 64bit +interfaces which were done as intermediate steps when transition to +66-bit off_t was done as part olf LFS64 support. + +Signed-off-by: Khem Raj +--- + src/error.c | 2 +- + src/include/defaults.mk | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- a/src/error.c ++++ b/src/error.c +@@ -191,7 +191,7 @@ dbglog_write(void *cookie, const char *b + } + + static int +-dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence) ++dbglog_seek(void *cookie UNUSED, off_t *offset, int whence) + { + FILE *log = efi_errlog ? efi_errlog : stderr; + int rc; +--- a/src/include/defaults.mk ++++ b/src/include/defaults.mk +@@ -34,6 +34,7 @@ CPPFLAGS ?= + override _CPPFLAGS := $(CPPFLAGS) + override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \ + -D_GNU_SOURCE \ ++ -D_FILE_OFFSET_BITS=64 \ + -I$(TOPDIR)/src/include/ + CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS) + CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \