summaryrefslogtreecommitdiff
blob: 4ea2095e7171b6961a21e6474a7a88db24949d75 (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit toolchain-funcs

DESCRIPTION="A file archiver with a high compression ratio"
HOMEPAGE="https://7-zip.org"
SRC_URI="mirror://sourceforge/project/sevenzip/7-Zip/${PV}/7z$(ver_rs 1 '')-src.tar.xz"
RESTRICT="mirror"
S="${WORKDIR}"

LICENSE="LGPL-2.1 BSD rar? ( unRAR )"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+asm rar static"

RDEPEND="!app-arch/p7zip"
DEPEND="${RDEPEND}"
BDEPEND="
	asm? ( dev-lang/jwasm )
"

DOCS=(
	DOC/7zC.txt
	DOC/7zFormat.txt
	DOC/lzma.txt
	DOC/Methods.txt
	DOC/readme.txt
	DOC/src-history.txt
)

PATCHES=(
	"${FILESDIR}/7-zip-flags.patch"
)

src_prepare() {
	# Fix line endings so 7-zip-flags.patch
	sed -i \
		-e 's/\r$//' \
		CPP/7zip/7zip_gcc.mak C/7zip_gcc_c.mak \
		|| die 'sed failed'
	default
}

src_compile() {
	local myemakeargs=(
		CFLAGS_BASE2="${CFLAGS}"
		CXXFLAGS_BASE2="${CXXFLAGS}"
		CFLAGS_WARN_WALL='-Wall -Wextra'
		IS_X64=1
		USE_ASM=$(usex asm 1 '')
		USE_JWASM=$(usex asm 1 '')
		COMPL_STATIC=$(usex static 1 '')
		O="${S}"
		DISABLE_RAR=$(usex rar '' 1)
	)
	tc-env_build emake \
		-C CPP/7zip/Bundles/Alone2 \
		-f makefile.gcc \
		"${myemakeargs[@]}"
}

src_install() {
	dobin 7zz$(usex static 's' '')
	dosym 7zz /usr/bin/7z
	einstalldocs
}