public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andrew Ammerlaan" <andrewammerlaan@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:master commit in: app-arch/7zip/files/, app-arch/7zip/
Date: Mon,  4 Sep 2023 11:04:29 +0000 (UTC)	[thread overview]
Message-ID: <1693752856.2d22b3eb5edb6b4fea5e44f940201587af1f5a06.andrewammerlaan@gentoo> (raw)

commit:     2d22b3eb5edb6b4fea5e44f940201587af1f5a06
Author:     Martin Matouš <m <AT> matous <DOT> dev>
AuthorDate: Sun Sep  3 14:52:21 2023 +0000
Commit:     Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Sun Sep  3 14:54:16 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=2d22b3eb

app-arch/7zip: respect build environment

Closes: https://bugs.gentoo.org/913186
Closes: https://bugs.gentoo.org/913188
Closes: https://bugs.gentoo.org/913189
Signed-off-by: Martin Matouš <m <AT> matous.dev>

 app-arch/7zip/7zip-23.01.ebuild                    | 16 +++-
 .../7zip/files/7zip-23.01-respect-build-env.patch  | 98 ++++++++++++++++++++++
 2 files changed, 110 insertions(+), 4 deletions(-)

diff --git a/app-arch/7zip/7zip-23.01.ebuild b/app-arch/7zip/7zip-23.01.ebuild
index 191ccaaeee..38a77c1c4c 100644
--- a/app-arch/7zip/7zip-23.01.ebuild
+++ b/app-arch/7zip/7zip-23.01.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit toolchain-funcs
+inherit edos2unix toolchain-funcs
 
 NO_DOT_PV=$(ver_rs 1- '')
 DESCRIPTION="A free file archiver for extremely high compression"
@@ -45,14 +45,22 @@ pkg_setup() {
 }
 
 src_prepare() {
-	default
+	# patch doesn't deal with CRLF even if file+patch match
+	# not even with --ignore-whitespace, --binary or --force
+	edos2unix ./7zip_gcc.mak ./var_gcc{,_x64}.mak ./var_clang{,_x64}.mak
+	PATCHES+=( "${FILESDIR}/${P}-respect-build-env.patch" )
+
 	sed -i -e 's/-Werror //g' ./7zip_gcc.mak || die "Error removing -Werror"
-	sed -i -e 's/$(LFLAGS_STRIP)//g' ./7zip_gcc.mak \
-		|| die "Error removing hardcoded strip"
+	default
 }
 
 src_compile() {
 	pushd "./Bundles/Alone2" || die "Unable to switch directory"
+	export G_CC=$(tc-getCC)
+	export G_CXX=$(tc-getCXX)
+	export G_CFLAGS=${CFLAGS}
+	export G_CXXFLAGS=${CXXFLAGS}
+	export G_LDFLAGS=${LDFLAGS}
 	# USE_JWASM=1 - if asm: use JWasm assembler instead of Asmc (not a gentoo package)
 	emake DISABLE_RAR=1 USE_JWASM=1 --file "../../${mfile}"
 	popd > /dev/null || die "Unable to switch directory"

diff --git a/app-arch/7zip/files/7zip-23.01-respect-build-env.patch b/app-arch/7zip/files/7zip-23.01-respect-build-env.patch
new file mode 100644
index 0000000000..2615a9e34a
--- /dev/null
+++ b/app-arch/7zip/files/7zip-23.01-respect-build-env.patch
@@ -0,0 +1,98 @@
+Respect build environment settings
+
+Bug: https://bugs.gentoo.org/913186
+Bug: https://bugs.gentoo.org/913188
+Bug: https://bugs.gentoo.org/913189
+
+
+--- a/7zip_gcc.mak
++++ b/7zip_gcc.mak
+@@ -87,14 +87,14 @@ SHARED_EXT=.dll
+ LDFLAGS = -shared -DEF $(DEF_FILE) $(LDFLAGS_STATIC)
+ else
+ SHARED_EXT=.so
+-LDFLAGS = -shared -fPIC $(LDFLAGS_STATIC)
++LDFLAGS = -shared -fPIC $(G_LDFLAGS) $(LDFLAGS_STATIC)
+ CC_SHARED=-fPIC
+ endif
+
+
+ else
+
+-LDFLAGS = $(LDFLAGS_STATIC)
++LDFLAGS = $(LDFLAGS_STATIC) $(G_LDFLAGS)
+ # -s is not required for clang, do we need it for GCC ???
+
+ #-static -static-libgcc -static-libstdc++
+@@ -149,7 +149,7 @@ endif
+
+
+
+-CFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CC_SHARED) -o $@
++CFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CC_SHARED) $(G_CFLAGS) -o $@
+
+
+ ifdef IS_MINGW
+@@ -190,7 +190,7 @@ CXX_WARN_FLAGS =
+ #-Wno-invalid-offsetof
+ #-Wno-reorder
+
+-CXXFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CXXFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CXXFLAGS_EXTRA) $(CC_SHARED) $(CXX_WARN_FLAGS) $(CXX_STD_FLAGS) -o $@
++CXXFLAGS = $(MY_ARCH_2) $(LOCAL_FLAGS) $(CXXFLAGS_BASE2) $(CFLAGS_BASE) $(FLAGS_FLTO) $(CXXFLAGS_EXTRA) $(CC_SHARED) $(CXX_WARN_FLAGS) $(CXX_STD_FLAGS) $(G_CXXFLAGS) -o $@
+
+ STATIC_TARGET=
+ ifdef COMPL_STATIC
+@@ -208,7 +208,7 @@ $(O):
+ # -Wl,--print-gc-sections
+
+ ifneq ($(CC), $(CROSS_COMPILE)clang)
+-LFLAGS_STRIP = -s
++
+ endif
+
+ LFLAGS_ALL = $(LFLAGS_STRIP) $(MY_ARCH_2) $(LDFLAGS) $(FLAGS_FLTO) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2)
+--- a/var_clang.mak
++++ b/var_clang.mak
+@@ -6,6 +6,6 @@ IS_ARM64=
+ CROSS_COMPILE=
+ MY_ARCH=
+ USE_ASM=
+-CC=$(CROSS_COMPILE)clang
+-CXX=$(CROSS_COMPILE)clang++
++CC=$(G_CC)
++CXX=$(G_CXX)
+ USE_CLANG=1
+--- a/var_clang_x64.mak
++++ b/var_clang_x64.mak
+@@ -6,7 +6,7 @@ IS_ARM64=
+ CROSS_COMPILE=
+ MY_ARCH=
+ USE_ASM=1
+-CC=$(CROSS_COMPILE)clang
+-CXX=$(CROSS_COMPILE)clang++
++CC=$(G_CC)
++CXX=$(G_CXX)
+ USE_CLANG=1
+
+--- a/var_gcc.mak
++++ b/var_gcc.mak
+@@ -6,7 +6,7 @@ IS_ARM64=
+ CROSS_COMPILE=
+ MY_ARCH=
+ USE_ASM=
+-CC=$(CROSS_COMPILE)gcc
+-CXX=$(CROSS_COMPILE)g++
++CC=$(G_CC)
++CXX=$(G_CXX)
+
+ # -march=armv8-a+crc+crypto
+--- a/var_gcc_x64.mak
++++ b/var_gcc_x64.mak
+@@ -6,5 +6,5 @@ IS_ARM64=
+ CROSS_COMPILE=
+ MY_ARCH=
+ USE_ASM=1
+-CC=$(CROSS_COMPILE)gcc
+-CXX=$(CROSS_COMPILE)g++
++CC=$(G_CC)
++CXX=$(G_CXX)


             reply	other threads:[~2023-09-04 11:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 11:04 Andrew Ammerlaan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-27  6:31 [gentoo-commits] repo/proj/guru:master commit in: app-arch/7zip/files/, app-arch/7zip/ Haelwenn Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1693752856.2d22b3eb5edb6b4fea5e44f940201587af1f5a06.andrewammerlaan@gentoo \
    --to=andrewammerlaan@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox