summaryrefslogtreecommitdiff
path: root/app-arch/7-zip/7-zip-21.04_beta-r1.ebuild
blob: 6c7a6c30ff0b83b2fd32d0a385ba2ac9cae712bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 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="LGPL-2.1+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+asm"

BDEPEND="
	|| ( virtual/7z app-arch/libarchive app-arch/unar )
	asm? (
		amd64? ( dev-lang/uasm )
		arm64? ( dev-lang/uasm )
		x86? ( dev-lang/uasm )
	)
"

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 || die
	local myemakeargs=(
		CC="$(tc-getCC) ${CFLAGS} ${LDFLAGS}"
		CXX="$(tc-getCXX) ${CXXFLAGS} ${LDFLAGS}"
		CFLAGS_WARN_WALL="-Wall -Wextra"
	)
	if use asm; then
		myemakeargs+=(USE_ASM=1 MY_ASM=uasm)
		if use amd64; then
			myemakeargs+=(IS_X64=1)
		elif use arm64; then
			myemakeargs+=(IS_ARM64=1)
		elif use x86; then
			myemakeargs+=(IS_X86=1)
		fi
	fi
	mkdir -p b/g || die
	emake -f ../../cmpl_gcc.mak "${myemakeargs[@]}"
}

src_install() {
	dobin CPP/7zip/Bundles/Alone2/b/g/7zz
	dosym 7zz /usr/bin/7z
	dodoc DOC/*
}