From a50867096860f6fb01469cb8556f0533dda39235 Mon Sep 17 00:00:00 2001 From: Shuhei Takahashi Date: Wed, 5 Jul 2023 11:28:22 +0900 Subject: [PATCH] sys-apps/proot: Fix build on LLVM toolchains proot's makefile doesn't support overriding ld/pkg-config command invocations, so patch it. An upstream patch has been sent: https://github.com/proot-me/proot/issues/359 proot doesn't link with LLVM ld, so force to use GNU ld. https://github.com/proot-me/proot/issues/360 --- .../proot/files/proot-5.1.0-makefile.patch | 16 ++++++++-- .../proot/files/proot-5.3.0-makefile.patch | 30 ++++++++++++++++--- ...-5.1.0-r2.ebuild => proot-5.1.0-r3.ebuild} | 2 ++ ...oot-5.3.0.ebuild => proot-5.3.0-r1.ebuild} | 3 ++ 4 files changed, 45 insertions(+), 6 deletions(-) rename sys-apps/proot/{proot-5.1.0-r2.ebuild => proot-5.1.0-r3.ebuild} (96%) rename sys-apps/proot/{proot-5.3.0.ebuild => proot-5.3.0-r1.ebuild} (94%) diff --git a/sys-apps/proot/files/proot-5.1.0-makefile.patch b/sys-apps/proot/files/proot-5.1.0-makefile.patch index 414cb29010cb7b..e17315c63eb69c 100644 --- a/sys-apps/proot/files/proot-5.1.0-makefile.patch +++ b/sys-apps/proot/files/proot-5.1.0-makefile.patch @@ -1,7 +1,10 @@ --- a/src/GNUmakefile 2018-08-01 16:30:00.957743804 +0300 +++ b/src/GNUmakefile 2018-08-01 16:30:34.876741798 +0300 -@@ -15,8 +15,8 @@ +@@ -13,10 +13,11 @@ + STRIP = $(CROSS_COMPILE)strip + OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump ++LD_CMD = $(CROSS_COMPILE)ld CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I. -I$(VPATH) -CFLAGS += -Wall -Wextra -O2 @@ -11,7 +14,16 @@ CARE_LDFLAGS = -larchive -@@ -182,7 +182,7 @@ +@@ -130,7 +131,7 @@ + $(Q)cat $^ >> $@ + $(Q)echo "#endif /* BUILD_H */" >> $@ + +-BUILD_ID_NONE := $(shell if ld --build-id=none --version >/dev/null 2>&1; then echo ',--build-id=none'; fi) ++BUILD_ID_NONE := $(shell if ${LD_CMD} --build-id=none --version >/dev/null 2>&1; then echo ',--build-id=none'; fi) + + ###################################################################### + # Build rules +@@ -182,7 +183,7 @@ $(eval $(call define_from_arch.h,$1,LOADER_ADDRESS)) LOADER_CFLAGS$1 += -fPIC -ffreestanding $(LOADER_ARCH_CFLAGS$1) diff --git a/sys-apps/proot/files/proot-5.3.0-makefile.patch b/sys-apps/proot/files/proot-5.3.0-makefile.patch index 15d7fc916b0ecb..77fcc008afae1d 100644 --- a/sys-apps/proot/files/proot-5.3.0-makefile.patch +++ b/sys-apps/proot/files/proot-5.3.0-makefile.patch @@ -1,11 +1,33 @@ --- a/src/GNUmakefile 2022-01-21 11:40:00.957743804 +0300 +++ b/src/GNUmakefile 2022-01-21 11:40:34.876741798 +0300 -@@ -21,8 +21,8 @@ - HAS_PYTHON_CONFIG := $(shell ${PYTHON}-config --ldflags ${PYTHON_EMBED} 2>/dev/null) +@@ -14,6 +14,8 @@ + OBJCOPY = $(CROSS_COMPILE)objcopy + OBJDUMP = $(CROSS_COMPILE)objdump + PYTHON = python3 ++LD_CMD = $(CROSS_COMPILE)ld ++PKG_CONFIG = $(CROSS_COMPILE)pkg-config + + HAS_SWIG := $(shell swig -version 2>/dev/null) + PYTHON_MAJOR_VERSION = $(shell ${PYTHON} -c "import sys; print(sys.version_info.major)" 2>/dev/null) +@@ -22,9 +24,9 @@ CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I. -I$(VPATH) -CFLAGS += -g -Wall -Wextra -O2 +-CFLAGS += $(shell pkg-config --cflags talloc libarchive) +CFLAGS += -Wall -Wextra - CFLAGS += $(shell pkg-config --cflags talloc libarchive) ++CFLAGS += $(shell ${PKG_CONFIG} --cflags talloc libarchive) LDFLAGS += -Wl,-z,noexecstack - LDFLAGS += $(shell pkg-config --libs talloc libarchive) +-LDFLAGS += $(shell pkg-config --libs talloc libarchive) ++LDFLAGS += $(shell ${PKG_CONFIG} --libs talloc libarchive) + + CARE_LDFLAGS = -larchive + +@@ -159,7 +161,7 @@ + $(Q)cat $^ >> $@ + $(Q)echo "#endif /* BUILD_H */" >> $@ + +-BUILD_ID_NONE := $(shell if ld --build-id=none --version >/dev/null 2>&1; then echo ',--build-id=none'; fi) ++BUILD_ID_NONE := $(shell if ${LD_CMD} --build-id=none --version >/dev/null 2>&1; then echo ',--build-id=none'; fi) + + ###################################################################### + # Build rules diff --git a/sys-apps/proot/proot-5.1.0-r2.ebuild b/sys-apps/proot/proot-5.1.0-r3.ebuild similarity index 96% rename from sys-apps/proot/proot-5.1.0-r2.ebuild rename to sys-apps/proot/proot-5.1.0-r3.ebuild index cca458ee3e8678..6c6f6d54a2a343 100644 --- a/sys-apps/proot/proot-5.1.0-r2.ebuild +++ b/sys-apps/proot/proot-5.1.0-r3.ebuild @@ -37,6 +37,8 @@ src_compile() { # build the proot and care targets emake -C src V=1 \ CC="$(tc-getCC)" \ + LD="$(tc-getCC) -fuse-ld=bfd" \ + LD_CMD="$(tc-getLD)" \ OBJCOPY="$(tc-getOBJCOPY)" \ OBJDUMP="$(tc-getOBJDUMP)" \ STRIP="$(tc-getSTRIP)" \ diff --git a/sys-apps/proot/proot-5.3.0.ebuild b/sys-apps/proot/proot-5.3.0-r1.ebuild similarity index 94% rename from sys-apps/proot/proot-5.3.0.ebuild rename to sys-apps/proot/proot-5.3.0-r1.ebuild index eb4b5e4b443cf6..50773e9263b1a3 100644 --- a/sys-apps/proot/proot-5.3.0.ebuild +++ b/sys-apps/proot/proot-5.3.0-r1.ebuild @@ -36,6 +36,9 @@ src_compile() { # build the proot and care targets emake -C src V=1 \ CC="$(tc-getCC)" \ + LD="$(tc-getCC) -fuse-ld=bfd" \ + LD_CMD="$(tc-getLD)" \ + PKG_CONFIG="$(tc-getPKG_CONFIG)" \ OBJCOPY="$(tc-getOBJCOPY)" \ OBJDUMP="$(tc-getOBJDUMP)" \ STRIP="$(tc-getSTRIP)" \