From 1d5c04ba656ea196f81fe20bc6fc95b123af7dd7 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Sat, 14 Aug 2021 14:57:14 -0400 Subject: app-arch/7-zip: respect LDFLAGS, nostrip, other cleanups --- app-arch/7-zip/7-zip-21.03_beta-r1.ebuild | 49 ++++++++++++++++++++++++++++ app-arch/7-zip/7-zip-21.03_beta.ebuild | 53 ------------------------------- app-arch/7-zip/files/7-zip-flags.patch | 49 ++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 53 deletions(-) create mode 100644 app-arch/7-zip/7-zip-21.03_beta-r1.ebuild delete mode 100644 app-arch/7-zip/7-zip-21.03_beta.ebuild create mode 100644 app-arch/7-zip/files/7-zip-flags.patch diff --git a/app-arch/7-zip/7-zip-21.03_beta-r1.ebuild b/app-arch/7-zip/7-zip-21.03_beta-r1.ebuild new file mode 100644 index 0000000..0d94eca --- /dev/null +++ b/app-arch/7-zip/7-zip-21.03_beta-r1.ebuild @@ -0,0 +1,49 @@ +# Copyright 2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic + +MY_PV=${PV%%_*} +MY_PV=${MY_PV//./} + +DESCRIPTION="File archiver with a high compression ratio" +HOMEPAGE="https://7-zip.org/" +SRC_URI="https://7-zip.org/a/7z${MY_PV}-src.7z" + +LICENSE="" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +DEPEND="" +RDEPEND="${DEPEND}" +BDEPEND="|| ( virtual/7z app-arch/libarchive app-arch/unar )" + +S=${WORKDIR}/7z${MY_PV}-src + +PATCHES=( ${FILESDIR}/7-zip-flags.patch ) + +src_unpack() { + if command -v 7z >/dev/null 2>&1; then + 7z x ${DISTDIR}/7z${MY_PV}-src.7z -o$S || die + elif command -v bsdtar >/dev/null 2>&1; then + mkdir $S || die + bsdtar -C $S -xf ${DISTDIR}/7z${MY_PV}-src.7z || die + elif command -v unar >/dev/null 2>&1; then + unar -d $S ${DISTDIR}/7z${MY_PV}-src.7z || die + else + die "no 7z unpacker found" + fi +} + +src_compile() { + cd CPP/7zip/Bundles/Alone2 + make -f ../../cmpl_gcc.mak +} + +src_install() { + dobin CPP/7zip/Bundles/Alone2/b/g/7zz + dosym 7zz /usr/bin/7z + dodoc DOC/* +} diff --git a/app-arch/7-zip/7-zip-21.03_beta.ebuild b/app-arch/7-zip/7-zip-21.03_beta.ebuild deleted file mode 100644 index 15ce7ee..0000000 --- a/app-arch/7-zip/7-zip-21.03_beta.ebuild +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit flag-o-matic - -MY_PV=${PV%%_*} -MY_PV=${MY_PV//./} - -DESCRIPTION="File archiver with a high compression ratio" -HOMEPAGE="https://7-zip.org/" -SRC_URI="https://7-zip.org/a/7z${MY_PV}-src.7z" - -LICENSE="" -SLOT="0" -KEYWORDS="~amd64 ~x86" - -DEPEND="" -RDEPEND="${DEPEND}" -BDEPEND="|| ( virtual/7z app-arch/libarchive app-arch/unar )" - -S=${WORKDIR}/7z${MY_PV}-src - -src_unpack() { - if command -v 7z >/dev/null 2>&1; then - 7z x ${DISTDIR}/7z${MY_PV}-src.7z -o$S || die - elif command -v bsdtar >/dev/null 2>&1; then - mkdir $S || die - bsdtar -C $S -xf ${DISTDIR}/7z${MY_PV}-src.7z || die - elif command -v unar >/dev/null 2>&1; then - unar -d $S ${DISTDIR}/7z${MY_PV}-src.7z || die - else - die "no 7z unpacker found" - fi -} - -src_prepare() { - default - sed -i -e 's/-Werror//g' -e "s/-O2/$CFLAGS/" CPP/7zip/7zip_gcc.mak || die -} - -src_compile() { - cd CPP/7zip/Bundles/Alone2 - append-ldflags -Wl,-z,noexecstack - make -f ../../cmpl_gcc.mak -} - -src_install() { - dobin CPP/7zip/Bundles/Alone2/b/g/7zz - dosym 7zz /usr/bin/7z - dodoc DOC/* -} diff --git a/app-arch/7-zip/files/7-zip-flags.patch b/app-arch/7-zip/files/7-zip-flags.patch new file mode 100644 index 0000000..372819d --- /dev/null +++ b/app-arch/7-zip/files/7-zip-flags.patch @@ -0,0 +1,49 @@ +diff -ru a/CPP/7zip/7zip_gcc.mak b/CPP/7zip/7zip_gcc.mak +--- a/CPP/7zip/7zip_gcc.mak 2021-07-16 08:23:49.524088300 -0400 ++++ b/CPP/7zip/7zip_gcc.mak 2021-08-14 14:43:34.618587556 -0400 +@@ -13,13 +13,13 @@ + + + ifneq ($(CC), xlc) +-CFLAGS_WARN_WALL = -Wall -Werror -Wextra ++CFLAGS_WARN_WALL = -Wall -Wextra -Wno-misleading-indentation + 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) \ + -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ + -fPIC + +@@ -62,17 +62,17 @@ + + ifdef IS_MINGW + SHARED_EXT=.dll +-LDFLAGS = -shared -DEF $(DEF_FILE) $(LDFLAGS_STATIC) ++MY_LDFLAGS = -shared -DEF $(DEF_FILE) $(LDFLAGS_STATIC) + else + SHARED_EXT=.so +-LDFLAGS = -shared -fPIC $(LDFLAGS_STATIC) ++MY_LDFLAGS = -shared -fPIC $(LDFLAGS_STATIC) + CC_SHARED=-fPIC + endif + + + else + +-LDFLAGS = $(LDFLAGS_STATIC) ++MY_LDFLAGS = $(LDFLAGS_STATIC) + # -s is not required for clang, do we need it for GGC ??? + # -s + +@@ -156,7 +156,7 @@ + $(MY_MKDIR) $(O) + + $(PROGPATH): $(OBJS) +- $(CXX) -o $(PROGPATH) -s $(MY_ARCH_2) $(LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) ++ $(CXX) -o $(PROGPATH) $(MY_ARCH_2) $(LDFLAGS) $(MY_LDFLAGS) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) + + # -s strips debug sections from executable in GCC + -- cgit v1.2.3-70-g09d2