commit:     4d2e32a01b4ae0007af77d3114864276f25ae424
Author:     NRK <nrk <AT> disroot <DOT> org>
AuthorDate: Sat Feb 24 13:32:34 2024 +0000
Commit:     Haelwenn Monnier <contact <AT> hacktivis <DOT> me>
CommitDate: Mon Feb 26 17:45:01 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=4d2e32a0

app-arch/7zip: add rar support

Closes: https://bugs.gentoo.org/918634
Signed-off-by: NRK <nrk <AT> disroot.org>

 app-arch/7zip/7zip-23.01.ebuild | 26 ++++++++++++++++++++++----
 app-arch/7zip/metadata.xml      |  7 ++++---
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/app-arch/7zip/7zip-23.01.ebuild b/app-arch/7zip/7zip-23.01.ebuild
index 38a77c1c4c..45f60812c2 100644
--- a/app-arch/7zip/7zip-23.01.ebuild
+++ b/app-arch/7zip/7zip-23.01.ebuild
@@ -1,4 +1,4 @@
-# Copyright 2023 Gentoo Authors
+# Copyright 2023-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -9,9 +9,9 @@ NO_DOT_PV=$(ver_rs 1- '')
 DESCRIPTION="A free file archiver for extremely high compression"
 HOMEPAGE="https://www.7-zip.org/ https://sourceforge.net/projects/sevenzip/";
 
SRC_URI="https://sourceforge.net/projects/sevenzip/files/7-Zip/${PV}/7z${NO_DOT_PV}-src.tar.xz/download
 -> ${PN}-${PV}.tar.xz"
-LICENSE="LGPL-2 BSD"
+LICENSE="LGPL-2 BSD rar? ( unRAR )"
 
-IUSE="asm"
+IUSE="asm rar"
 SLOT="0"
 KEYWORDS="~amd64"
 
@@ -20,6 +20,12 @@ RESTRICT="mirror"
 
 RDEPEND=""
 DEPEND="${RDEPEND}"
+# TODO(NRK): package asmc? since 7zip docs recommends using it over jwasm since
+# jwasm doesn't support AES instructions.
+#
+# alternatively look into packaging uasm 
(https://www.terraspace.co.uk/uasm.html)
+# instead which is jwasm based but also supports AES. the 7zip AUR package uses
+# uasm for reference.
 BDEPEND="asm? ( dev-lang/jwasm )"
 
 pkg_setup() {
@@ -62,7 +68,19 @@ src_compile() {
        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}"
+       local args=(
+               -f "../../${mfile}"
+               USE_JWASM=1
+       )
+       # NOTE: makefile doesn't check the value of DISABLE_RAR_COMPRESS, only
+       # whether it's defined or not. so in case user has `rar` enabled
+       # DISABLE_RAR_COMPRESS (and DISABLE_RAR) needs to stay undefined.
+       if ! use rar; then
+               # disables non-free rar code but allows listing and extracting
+               # non-compressed rar archives
+               args+=(DISABLE_RAR_COMPRESS=1)
+       fi
+       emake ${args[@]}
        popd > /dev/null || die "Unable to switch directory"
 }
 

diff --git a/app-arch/7zip/metadata.xml b/app-arch/7zip/metadata.xml
index 099821269c..43ad17ef87 100644
--- a/app-arch/7zip/metadata.xml
+++ b/app-arch/7zip/metadata.xml
@@ -1,13 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
-       <use>
-               <flag name="asm">Use <pkg>dev-lang/jwasm</pkg> to include 
optimized code</flag>
-       </use>
        <maintainer type="person">
                <email>[email protected]</email>
                <name>Martin Matouš</name>
        </maintainer>
+       <use>
+               <flag name="asm">Use <pkg>dev-lang/jwasm</pkg> to include 
optimized code</flag>
+               <flag name="rar">Enable support for non-free rar decoder</flag>
+       </use>
        <upstream>
                <maintainer>
                        <name>Igor Pavlov</name>

Reply via email to