1 |
|
# Copyright 1999-2020 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python2_7 python3_{6,7,8} )
|
|
6 |
DISTUTILS_USE_PEP517=setuptools
|
7 |
7 |
DISTUTILS_OPTIONAL=1
|
|
8 |
PYTHON_COMPAT=( python3_{10..11} )
|
8 |
9 |
|
9 |
10 |
inherit distutils-r1 libtool toolchain-funcs multilib-minimal
|
10 |
11 |
|
11 |
|
if [[ ${PV} == "9999" ]] ; then
|
|
12 |
if [[ ${PV} == 9999 ]] ; then
|
12 |
13 |
EGIT_REPO_URI="https://github.com/glensc/file.git"
|
13 |
14 |
inherit autotools git-r3
|
14 |
15 |
else
|
|
16 |
VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/file.asc
|
|
17 |
inherit verify-sig
|
15 |
18 |
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"
|
|
19 |
SRC_URI+=" verify-sig? ( ftp://ftp.astron.com/pub/file/${P}.tar.gz.asc )"
|
|
20 |
|
|
21 |
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
|
|
22 |
|
|
23 |
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-file )"
|
17 |
24 |
fi
|
18 |
25 |
|
19 |
|
DESCRIPTION="identify a file's format by scanning binary data for patterns"
|
|
26 |
DESCRIPTION="Identify a file's format by scanning binary data for patterns"
|
20 |
27 |
HOMEPAGE="https://www.darwinsys.com/file/"
|
21 |
28 |
|
22 |
29 |
LICENSE="BSD-2"
|
23 |
30 |
SLOT="0"
|
24 |
|
IUSE="python static-libs zlib"
|
|
31 |
IUSE="bzip2 lzip lzma python seccomp static-libs zlib zstd"
|
25 |
32 |
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
|
26 |
33 |
|
27 |
34 |
DEPEND="
|
|
35 |
bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
|
|
36 |
lzip? ( app-arch/lzlib )
|
|
37 |
lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
|
28 |
38 |
python? (
|
29 |
39 |
${PYTHON_DEPS}
|
30 |
40 |
dev-python/setuptools[${PYTHON_USEDEP}]
|
31 |
41 |
)
|
32 |
|
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
|
33 |
|
RDEPEND="${DEPEND}
|
34 |
|
python? ( !dev-python/python-magic )"
|
|
42 |
seccomp? ( >=sys-libs/libseccomp-2.5.4[${MULTILIB_USEDEP}] )
|
|
43 |
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
|
|
44 |
zstd? ( app-arch/zstd:=[${MULTILIB_USEDEP}] )
|
|
45 |
"
|
|
46 |
RDEPEND="
|
|
47 |
${DEPEND}
|
|
48 |
python? ( !dev-python/python-magic )
|
|
49 |
seccomp? ( >=sys-libs/libseccomp-2.5.4[${MULTILIB_USEDEP}] )
|
|
50 |
"
|
|
51 |
BDEPEND+="
|
|
52 |
python? (
|
|
53 |
${PYTHON_DEPS}
|
|
54 |
${DISTUTILS_DEPS}
|
|
55 |
)
|
|
56 |
"
|
|
57 |
|
|
58 |
# https://bugs.gentoo.org/898676
|
|
59 |
QA_CONFIG_IMPL_DECL_SKIP=( makedev )
|
35 |
60 |
|
36 |
|
PATCHES=( "${FILESDIR}"/${P}-CVE-2019-18218.patch )
|
|
61 |
PATCHES=(
|
|
62 |
"${FILESDIR}/file-5.43-seccomp-fstatat64-musl.patch" #789336, not upstream yet
|
|
63 |
"${FILESDIR}/file-5.43-portage-sandbox.patch" #889046
|
|
64 |
"${FILESDIR}/file-5.44-limits-solaris.patch" # applied upstream
|
|
65 |
"${FILESDIR}/file-5.44-seccomp-utimes.patch" # upstream
|
|
66 |
"${FILESDIR}/file-5.44-decompress-empty.patch" # upstream
|
|
67 |
)
|
37 |
68 |
|
38 |
69 |
src_prepare() {
|
39 |
70 |
default
|
40 |
71 |
|
41 |
|
[[ ${PV} == "9999" ]] && eautoreconf
|
42 |
|
elibtoolize
|
|
72 |
if [[ ${PV} == 9999 ]] ; then
|
|
73 |
eautoreconf
|
|
74 |
else
|
|
75 |
elibtoolize
|
|
76 |
fi
|
43 |
77 |
|
44 |
|
# don't let python README kill main README #60043
|
|
78 |
# Don't let python README kill main README, bug ##60043
|
45 |
79 |
mv python/README.md python/README.python.md || die
|
46 |
|
sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
|
|
80 |
|
|
81 |
# bug #662090
|
|
82 |
sed -i 's@README.md@README.python.md@' python/setup.py || die
|
47 |
83 |
}
|
48 |
84 |
|
49 |
85 |
multilib_src_configure() {
|
50 |
86 |
local myeconfargs=(
|
51 |
|
--disable-libseccomp
|
52 |
87 |
--enable-fsect-man5
|
|
88 |
$(use_enable bzip2 bzlib)
|
|
89 |
$(multilib_native_use_enable lzip lzlib)
|
|
90 |
$(use_enable lzma xzlib)
|
|
91 |
$(use_enable seccomp libseccomp)
|
53 |
92 |
$(use_enable static-libs static)
|
54 |
93 |
$(use_enable zlib)
|
|
94 |
$(use_enable zstd zstdlib)
|
55 |
95 |
)
|
56 |
|
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
|
|
96 |
|
|
97 |
econf "${myeconfargs[@]}"
|
57 |
98 |
}
|
58 |
99 |
|
59 |
|
src_configure() {
|
60 |
|
# when cross-compiling, we need to build up our own file
|
|
100 |
build_src_configure() {
|
|
101 |
local myeconfargs=(
|
|
102 |
--disable-shared
|
|
103 |
--disable-libseccomp
|
|
104 |
--disable-bzlib
|
|
105 |
--disable-xzlib
|
|
106 |
--disable-zlib
|
|
107 |
)
|
|
108 |
|
|
109 |
econf_build "${myeconfargs[@]}"
|
|
110 |
}
|
|
111 |
|
|
112 |
need_build_file() {
|
|
113 |
# When cross-compiling, we need to build up our own file
|
61 |
114 |
# because people often don't keep matching host/target
|
62 |
|
# file versions #362941
|
63 |
|
if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
|
|
115 |
# file versions, bug #362941
|
|
116 |
tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
|
|
117 |
}
|
|
118 |
|
|
119 |
src_configure() {
|
|
120 |
local ECONF_SOURCE="${S}"
|
|
121 |
|
|
122 |
if need_build_file ; then
|
64 |
123 |
mkdir -p "${WORKDIR}"/build || die
|
65 |
124 |
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
|
|
125 |
build_src_configure
|
78 |
126 |
fi
|
79 |
127 |
|
80 |
128 |
multilib-minimal_src_configure
|
... | ... | |
84 |
132 |
if multilib_is_native_abi ; then
|
85 |
133 |
emake
|
86 |
134 |
else
|
87 |
|
cd src || die
|
88 |
|
emake magic.h #586444
|
89 |
|
emake libmagic.la
|
|
135 |
# bug #586444
|
|
136 |
emake -C src magic.h
|
|
137 |
emake -C src libmagic.la
|
90 |
138 |
fi
|
91 |
139 |
}
|
92 |
140 |
|
93 |
141 |
src_compile() {
|
94 |
|
if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
|
95 |
|
emake -C "${WORKDIR}"/build/src magic.h #586444
|
|
142 |
if need_build_file ; then
|
|
143 |
# bug #586444
|
|
144 |
emake -C "${WORKDIR}"/build/src magic.h
|
96 |
145 |
emake -C "${WORKDIR}"/build/src file
|
97 |
|
PATH="${WORKDIR}/build/src:${PATH}"
|
|
146 |
local -x PATH="${WORKDIR}/build/src:${PATH}"
|
98 |
147 |
fi
|
|
148 |
|
99 |
149 |
multilib-minimal_src_compile
|
100 |
150 |
|
101 |
151 |
if use python ; then
|
... | ... | |
113 |
163 |
}
|
114 |
164 |
|
115 |
165 |
multilib_src_install_all() {
|
116 |
|
dodoc ChangeLog MAINT README
|
|
166 |
dodoc ChangeLog MAINT # README
|
117 |
167 |
|
118 |
168 |
# Required for `file -C`
|
119 |
|
dodir /usr/share/misc/magic
|
120 |
169 |
insinto /usr/share/misc/magic
|
121 |
170 |
doins -r magic/Magdir/*
|
122 |
171 |
|
... | ... | |
124 |
173 |
cd python || die
|
125 |
174 |
distutils-r1_src_install
|
126 |
175 |
fi
|
|
176 |
|
127 |
177 |
find "${ED}" -type f -name "*.la" -delete || die
|
128 |
178 |
}
|