blob: 863cdc56fe572921d9c21657ffdc27d623cb0cbc (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit edos2unix flag-o-matic toolchain-funcs
NO_DOT_PV=$(ver_rs 1- '')
DESCRIPTION="Free file archiver for extremely high compression"
HOMEPAGE="https://www.7-zip.org/ https://sourceforge.net/projects/sevenzip/"
# linux-x64 tarball is only used for docs
SRC_URI="
https://downloads.sourceforge.net/sevenzip/7-Zip/${PV}/7z${NO_DOT_PV}-src.tar.xz
https://downloads.sourceforge.net/sevenzip/7-Zip/${PV}/7z${NO_DOT_PV}-linux-x64.tar.xz
"
S="${WORKDIR}"
LICENSE="LGPL-2 BSD rar? ( unRAR )"
SLOT="0"
KEYWORDS="amd64 arm64"
IUSE="uasm jwasm rar"
REQUIRED_USE="?? ( uasm jwasm )"
DOCS=( readme.txt History.txt License.txt )
HTML_DOCS=( MANUAL )
DEPEND="${RDEPEND}"
BDEPEND="
app-arch/xz-utils[extra-filters(+)]
uasm? ( dev-lang/uasm )
jwasm? ( dev-lang/jwasm )
"
PATCHES=(
"${FILESDIR}/${PN}-24.05-respect-build-env.patch"
)
# TODO(NRK): also build and install the library
# TODO(NRK): make it so this package can be used as a drop-in replacement
# for app-arch/p7zip ??
pkg_setup() {
# instructions in DOC/readme.txt, Compiling 7-Zip for Unix/Linux
# TLDR; every combination of options (clang|gcc)+(asm/noasm)
# has a dedicated makefile & builddir
mfile="cmpl"
if tc-is-clang; then
mfile="${mfile}_clang"
bdir=c
elif tc-is-gcc; then
mfile="${mfile}_gcc"
bdir=g
else
die "Unsupported compiler: $(tc-getCC)"
fi
if use jwasm || use uasm ; then
mfile="${mfile}_x64"
bdir="${bdir}_x64"
fi
export mfile="${mfile}.mak"
export bdir
}
src_prepare() {
# patch doesn't deal with CRLF even if file+patch match
# not even with --ignore-whitespace, --binary or --force
pushd "./CPP/7zip" || die "Unable to switch directory"
edos2unix ./7zip_gcc.mak ./var_gcc{,_x64}.mak ./var_clang{,_x64}.mak
sed -i -e 's/-Werror //g' ./7zip_gcc.mak || die "Error removing -Werror"
popd >/dev/null || die "Unable to switch directory"
default
}
src_compile() {
pushd "./CPP/7zip/Bundles/Alone2" || die "Unable to switch directory"
# avoid executable stack when using uasm/jwasm, harmless otherwise
append-ldflags -Wl,-z,noexecstack
export G_CFLAGS=${CFLAGS}
export G_CXXFLAGS=${CXXFLAGS}
export G_LDFLAGS=${LDFLAGS}
local args=(
-f "../../${mfile}"
CC=$(tc-getCC)
CXX=$(tc-getCXX)
)
# 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
if use jwasm; then
args+=( USE_JWASM=1 )
elif use uasm; then
args+=( MY_ASM=uasm )
fi
mkdir -p "${bdir}" || die # Bug: https://bugs.gentoo.org/933619
emake ${args[@]}
popd > /dev/null || die "Unable to switch directory"
}
src_install() {
dobin "./CPP/7zip/Bundles/Alone2/b/${bdir}/7zz"
einstalldocs
}
|