From 3c3614cec4f4355a7c2f7fa5bc61f8bb07e55025 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Thu, 16 Feb 2023 15:25:12 +0100 Subject: tools/7z: Allow building on alpine When using alpine as host, things start to fail. Lets pull in the upstream alpine patches to make things work. This should not affect other hosts. Note, that Alpine has the '_GNU_SOURCE' define in the APKBUILD file, but here we add this flag to the needed fix flags patch, which does similar things too. Signed-off-by: Olliver Schinagl --- tools/7z/patches/7-zip-flags.patch | 27 +++++++++++++++++ tools/7z/patches/7-zip-musl.patch | 59 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 tools/7z/patches/7-zip-flags.patch create mode 100644 tools/7z/patches/7-zip-musl.patch (limited to 'tools') diff --git a/tools/7z/patches/7-zip-flags.patch b/tools/7z/patches/7-zip-flags.patch new file mode 100644 index 0000000000..ed5b508401 --- /dev/null +++ b/tools/7z/patches/7-zip-flags.patch @@ -0,0 +1,27 @@ +--- a/CPP/7zip/7zip_gcc.mak ++++ b/CPP/7zip/7zip_gcc.mak +@@ -18,13 +18,13 @@ PROGPATH_STATIC = $(O)/$(PROG)s + + + ifneq ($(CC), xlc) +-CFLAGS_WARN_WALL = -Wall -Werror -Wextra ++CFLAGS_WARN_WALL = -Wall -Wextra + endif + + # for object file + CFLAGS_BASE_LIST = -c + # CFLAGS_BASE_LIST = -S +-CFLAGS_BASE = -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \ ++CFLAGS_BASE = $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) -D_GNU_SOURCE \ + -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ + -fPIC + +@@ -192,7 +192,7 @@ all: $(O) $(PROGPATH) $(STATIC_TARGET) + $(O): + $(MY_MKDIR) $(O) + +-LFLAGS_ALL = -s $(MY_ARCH_2) $(LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) ++LFLAGS_ALL = $(MY_ARCH_2) $(LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) + $(PROGPATH): $(OBJS) + $(CXX) -o $(PROGPATH) $(LFLAGS_ALL) + diff --git a/tools/7z/patches/7-zip-musl.patch b/tools/7z/patches/7-zip-musl.patch new file mode 100644 index 0000000000..cf3386e4de --- /dev/null +++ b/tools/7z/patches/7-zip-musl.patch @@ -0,0 +1,59 @@ +--- a/C/CpuArch.c ++++ b/C/CpuArch.c +@@ -421,8 +421,6 @@ BoolInt CPU_IsSupported_AES (void) { ret + + #ifdef USE_HWCAP + +-#include +- + #define MY_HWCAP_CHECK_FUNC_2(name1, name2) \ + BoolInt CPU_IsSupported_ ## name1() { return (getauxval(AT_HWCAP) & (HWCAP_ ## name2)) ? 1 : 0; } + +--- a/C/Threads.c ++++ b/C/Threads.c +@@ -257,7 +257,7 @@ WRes Thread_Create_With_CpuSet(CThread * + */ + + // ret2 = +- pthread_attr_setaffinity_np(&attr, sizeof(*cpuSet), cpuSet); ++ //pthread_attr_setaffinity_np(&attr, sizeof(*cpuSet), cpuSet); + // if (ret2) ret = ret2; + #endif + } +@@ -267,14 +267,12 @@ WRes Thread_Create_With_CpuSet(CThread * + if (!ret) + { + p->_created = 1; +- /* + if (cpuSet) + { + // ret2 = + pthread_setaffinity_np(p->_tid, sizeof(*cpuSet), cpuSet); + // if (ret2) ret = ret2; + } +- */ + } + } + // ret2 = +--- a/C/Threads.h ++++ b/C/Threads.h +@@ -19,6 +19,7 @@ + #endif + + #include ++#include + + #endif + +--- a/CPP/Windows/SystemInfo.cpp ++++ b/CPP/Windows/SystemInfo.cpp +@@ -36,9 +36,6 @@ + #endif + */ + +-#ifdef MY_CPU_ARM_OR_ARM64 +-#include +-#endif + #endif + + #ifdef __linux__ -- cgit v1.2.3