Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/file/, sys-apps/file/files/
Date: Sun, 28 Jun 2020 02:10:42
Message-Id: 1593310093.3d32972fa6671b911726d7a2abd4128afd35a36b.gyakovlev@gentoo
1 commit: 3d32972fa6671b911726d7a2abd4128afd35a36b
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jun 28 02:07:30 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sun Jun 28 02:08:13 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3d32972f
7
8 sys-apps/file: revbump 5.39, add include termios.h patch
9
10 Closes: https://bugs.gentoo.org/728416
11 Package-Manager: Portage-2.3.103, Repoman-2.3.23
12 Acked-by: Lars Wendler <polynomial-c <AT> gentoo.org>
13 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
14
15 sys-apps/file/file-5.39-r2.ebuild | 141 +++++++++++++++++++++
16 .../file/files/file-5.39-add-missing-termios.patch | 27 ++++
17 2 files changed, 168 insertions(+)
18
19 diff --git a/sys-apps/file/file-5.39-r2.ebuild b/sys-apps/file/file-5.39-r2.ebuild
20 new file mode 100644
21 index 00000000000..204826c0d4d
22 --- /dev/null
23 +++ b/sys-apps/file/file-5.39-r2.ebuild
24 @@ -0,0 +1,141 @@
25 +# Copyright 1999-2020 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=7
29 +
30 +PYTHON_COMPAT=( python3_{6..9} )
31 +DISTUTILS_OPTIONAL=1
32 +
33 +inherit autotools distutils-r1 libtool toolchain-funcs multilib-minimal
34 +
35 +if [[ ${PV} == "9999" ]] ; then
36 + EGIT_REPO_URI="https://github.com/glensc/file.git"
37 + inherit git-r3
38 +else
39 + SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
40 + 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"
41 +fi
42 +
43 +DESCRIPTION="identify a file's format by scanning binary data for patterns"
44 +HOMEPAGE="https://www.darwinsys.com/file/"
45 +
46 +LICENSE="BSD-2"
47 +SLOT="0"
48 +IUSE="bzip2 lzma python seccomp static-libs zlib"
49 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
50 +
51 +DEPEND="
52 + bzip2? ( app-arch/bzip2[${MULTILIB_USEDEP}] )
53 + lzma? ( app-arch/xz-utils[${MULTILIB_USEDEP}] )
54 + python? (
55 + ${PYTHON_DEPS}
56 + dev-python/setuptools[${PYTHON_USEDEP}]
57 + )
58 + zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
59 +RDEPEND="${DEPEND}
60 + python? ( !dev-python/python-magic )
61 + seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
62 +
63 +PATCHES=(
64 + "${FILESDIR}/${PN}-5.39-portage_sandbox.patch" #713710 #728978
65 + "${FILESDIR}/${P}-add-missing-termios.patch" #728416
66 +)
67 +
68 +src_prepare() {
69 + default
70 + eautoreconf
71 + elibtoolize
72 +
73 + # don't let python README kill main README #60043
74 + mv python/README.md python/README.python.md || die
75 + sed 's@××××××.md@README.python.md@' -i python/setup.py || die #662090
76 +}
77 +
78 +multilib_src_configure() {
79 + local myeconfargs=(
80 + --enable-fsect-man5
81 + $(use_enable bzip2 bzlib)
82 + $(use_enable lzma xzlib)
83 + $(use_enable seccomp libseccomp)
84 + $(use_enable static-libs static)
85 + $(use_enable zlib)
86 + )
87 + econf "${myeconfargs[@]}"
88 +}
89 +
90 +build_src_configure() {
91 + local myeconfargs=(
92 + --disable-shared
93 + --disable-libseccomp
94 + --disable-bzlib
95 + --disable-xzlib
96 + --disable-zlib
97 + )
98 + tc-env_build econf "${myeconfargs[@]}"
99 +}
100 +
101 +need_build_file() {
102 + # when cross-compiling, we need to build up our own file
103 + # because people often don't keep matching host/target
104 + # file versions #362941
105 + tc-is-cross-compiler && ! has_version -b "~${CATEGORY}/${P}"
106 +}
107 +
108 +src_configure() {
109 + local ECONF_SOURCE=${S}
110 +
111 + if need_build_file; then
112 + mkdir -p "${WORKDIR}"/build || die
113 + cd "${WORKDIR}"/build || die
114 + build_src_configure
115 + fi
116 +
117 + multilib-minimal_src_configure
118 +}
119 +
120 +multilib_src_compile() {
121 + if multilib_is_native_abi ; then
122 + emake
123 + else
124 + cd src || die
125 + emake magic.h #586444
126 + emake libmagic.la
127 + fi
128 +}
129 +
130 +src_compile() {
131 + if need_build_file; then
132 + emake -C "${WORKDIR}"/build/src magic.h #586444
133 + emake -C "${WORKDIR}"/build/src file
134 + local -x PATH="${WORKDIR}/build/src:${PATH}"
135 + fi
136 + multilib-minimal_src_compile
137 +
138 + if use python ; then
139 + cd python || die
140 + distutils-r1_src_compile
141 + fi
142 +}
143 +
144 +multilib_src_install() {
145 + if multilib_is_native_abi ; then
146 + default
147 + else
148 + emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
149 + fi
150 +}
151 +
152 +multilib_src_install_all() {
153 + dodoc ChangeLog MAINT README
154 +
155 + # Required for `file -C`
156 + dodir /usr/share/misc/magic
157 + insinto /usr/share/misc/magic
158 + doins -r magic/Magdir/*
159 +
160 + if use python ; then
161 + cd python || die
162 + distutils-r1_src_install
163 + fi
164 + find "${ED}" -type f -name "*.la" -delete || die
165 +}
166
167 diff --git a/sys-apps/file/files/file-5.39-add-missing-termios.patch b/sys-apps/file/files/file-5.39-add-missing-termios.patch
168 new file mode 100644
169 index 00000000000..e6cba0d4c28
170 --- /dev/null
171 +++ b/sys-apps/file/files/file-5.39-add-missing-termios.patch
172 @@ -0,0 +1,27 @@
173 +From 769e9868c17a471323b81b12cab851c9fd22baf4 Mon Sep 17 00:00:00 2001
174 +From: Georgy Yakovlev <gyakovlev@g.o>
175 +Date: Mon, 15 Jun 2020 14:18:45 -0700
176 +Subject: [PATCH] add missing termios.h include
177 +
178 +on ppc, TCGETS relies on struct termios being complete, on other
179 +architectures it does not.
180 +so termios.h should be included before ioctl.h
181 +---
182 + src/seccomp.c | 1 +
183 + 1 file changed, 1 insertion(+)
184 +
185 +diff --git a/src/seccomp.c b/src/seccomp.c
186 +index e667adf..296f5b3 100644
187 +--- a/src/seccomp.c
188 ++++ b/src/seccomp.c
189 +@@ -33,6 +33,7 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
190 + #if HAVE_LIBSECCOMP
191 + #include <seccomp.h> /* libseccomp */
192 + #include <sys/prctl.h> /* prctl */
193 ++#include <termios.h>
194 + #include <sys/ioctl.h>
195 + #include <sys/socket.h>
196 + #include <fcntl.h>
197 +--
198 +2.27.0
199 +