Diff file-5.37-r1 with a file-9999

/usr/portage/sys-apps/file/file-9999.ebuild 2020-06-24 12:39:00.000000000 +0300
3 3

  
4 4
EAPI=7
5 5

  
6
PYTHON_COMPAT=( python3_{6,7,8} )
6
PYTHON_COMPAT=( python3_{6..9} )
7 7
DISTUTILS_OPTIONAL=1
8 8

  
9
inherit distutils-r1 libtool toolchain-funcs multilib-minimal
9
inherit autotools distutils-r1 libtool toolchain-funcs multilib-minimal
10 10

  
11 11
if [[ ${PV} == "9999" ]] ; then
12 12
	EGIT_REPO_URI="https://github.com/glensc/file.git"
13
	inherit autotools git-r3
13
	inherit git-r3
14 14
else
15 15
	SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
16
	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
16
	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
17 17
fi
18 18

  
19 19
DESCRIPTION="identify a file's format by scanning binary data for patterns"
......
21 21

  
22 22
LICENSE="BSD-2"
23 23
SLOT="0"
24
IUSE="python static-libs zlib"
24
IUSE="bzip2 lzma python seccomp static-libs zlib"
25 25
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
26 26

  
27 27
DEPEND="
28
	bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
29
	lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
28 30
	python? (
29 31
		${PYTHON_DEPS}
30 32
		dev-python/setuptools[${PYTHON_USEDEP}]
31 33
	)
32 34
	zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
33 35
RDEPEND="${DEPEND}
34
	python? ( !dev-python/python-magic )"
36
	python? ( !dev-python/python-magic )
37
	seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
35 38

  
36
PATCHES=( "${FILESDIR}"/${P}-CVE-2019-18218.patch )
39
PATCHES=(
40
	"${FILESDIR}/${PN}-5.39-portage_sandbox.patch" #713710 #728978
41
)
37 42

  
38 43
src_prepare() {
39 44
	default
40

  
41
	[[ ${PV} == "9999" ]] && eautoreconf
45
	eautoreconf
42 46
	elibtoolize
43 47

  
44 48
	# don't let python README kill main README #60043
......
48 52

  
49 53
multilib_src_configure() {
50 54
	local myeconfargs=(
51
		--disable-libseccomp
52 55
		--enable-fsect-man5
56
		$(use_enable bzip2 bzlib)
57
		$(use_enable lzma xzlib)
58
		$(use_enable seccomp libseccomp)
53 59
		$(use_enable static-libs static)
54 60
		$(use_enable zlib)
55 61
	)
56
	ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
62
	econf "${myeconfargs[@]}"
57 63
}
58 64

  
59
src_configure() {
65
build_src_configure() {
66
	local myeconfargs=(
67
		--disable-shared
68
		--disable-libseccomp
69
		--disable-bzlib
70
		--disable-xzlib
71
		--disable-zlib
72
	)
73
	tc-env_build econf "${myeconfargs[@]}"
74
}
75

  
76
need_build_file() {
60 77
	# when cross-compiling, we need to build up our own file
61 78
	# because people often don't keep matching host/target
62 79
	# file versions #362941
63
	if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
80
	tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
81
}
82

  
83
src_configure() {
84
	local ECONF_SOURCE=${S}
85

  
86
	if need_build_file; then
64 87
		mkdir -p "${WORKDIR}"/build || die
65 88
		cd "${WORKDIR}"/build || die
66
		tc-export_build_env BUILD_C{C,XX}
67
		ECONF_SOURCE="${S}" \
68
		ac_cv_header_zlib_h=no \
69
		ac_cv_lib_z_gzopen=no \
70
		CHOST=${CBUILD} \
71
		CFLAGS=${BUILD_CFLAGS} \
72
		CXXFLAGS=${BUILD_CXXFLAGS} \
73
		CPPFLAGS=${BUILD_CPPFLAGS} \
74
		LDFLAGS="${BUILD_LDFLAGS} -static" \
75
		CC=${BUILD_CC} \
76
		CXX=${BUILD_CXX} \
77
		econf --disable-shared --disable-libseccomp
89
		build_src_configure
78 90
	fi
79 91

  
80 92
	multilib-minimal_src_configure
......
91 103
}
92 104

  
93 105
src_compile() {
94
	if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
106
	if need_build_file; then
95 107
		emake -C "${WORKDIR}"/build/src magic.h #586444
96 108
		emake -C "${WORKDIR}"/build/src file
97
		PATH="${WORKDIR}/build/src:${PATH}"
109
		local -x PATH="${WORKDIR}/build/src:${PATH}"
98 110
	fi
99 111
	multilib-minimal_src_compile
100 112

  
Thank you!