dev-python/pillow: Fix cross-compiling of 5.4.1

Normally you shouldn't add -I/usr/include or -L/usr/lib, even if it is
prepended with the SYSROOT, but Pillow's stupid build system checks
for headers with Python rather than the toolchain. Luckily only
minimal patching is needed.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.10
This commit is contained in:
James Le Cuirot
2019-01-08 23:00:42 +00:00
parent c3b72e5c11
commit 05ca39b5dc
3 changed files with 53 additions and 2 deletions

View File

@@ -0,0 +1,28 @@
diff -Naur a/setup.py b/setup.py
--- a/setup.py 2019-01-06 12:12:16.000000000 +0000
+++ b/setup.py 2019-01-08 23:04:45.574698210 +0000
@@ -197,12 +197,13 @@
def _pkg_config(name):
try:
+ command = os.environ.get('PKG_CONFIG', 'pkg-config')
command_libs = [
- 'pkg-config',
+ command,
'--libs-only-L', name,
]
command_cflags = [
- 'pkg-config',
+ command,
'--cflags-only-I', name,
]
if not DEBUG:
@@ -298,7 +299,7 @@
_add_directory(include_dirs, "src/libImaging")
pkg_config = None
- if _cmd_exists('pkg-config'):
+ if _cmd_exists(os.environ.get('PKG_CONFIG', 'pkg-config')):
pkg_config = _pkg_config
#

View File

@@ -0,0 +1,12 @@
diff -Naur a/setup.py b/setup.py
--- a/setup.py 2019-01-08 23:06:33.082873069 +0000
+++ b/setup.py 2019-01-08 23:06:47.707165225 +0000
@@ -356,7 +356,7 @@
for d in os.environ[k].split(os.path.pathsep):
_add_directory(library_dirs, d)
- prefix = sysconfig.get_config_var("prefix")
+ prefix = None
if prefix:
_add_directory(library_dirs, os.path.join(prefix, "lib"))
_add_directory(include_dirs, os.path.join(prefix, "include"))

View File

@@ -6,7 +6,7 @@ EAPI=7
PYTHON_COMPAT=( python2_7 python3_{4,5,6,7} pypy )
PYTHON_REQ_USE='tk?,threads(+)'
inherit distutils-r1 virtualx
inherit distutils-r1 toolchain-funcs virtualx
MY_PN=Pillow
MY_P=${MY_PN}-${PV}
@@ -47,7 +47,7 @@ DEPEND="${RDEPEND}
S="${WORKDIR}/${MY_P}"
PATCHES=(
"${FILESDIR}/${PN}-5.2.0-fix-lib-paths.patch"
"${FILESDIR}"/${PN}-5.4.1-{pkg-config,toolchain-paths}.patch
)
python_configure_all() {
@@ -66,6 +66,17 @@ python_configure_all() {
$(use_enable webp webpmux)
$(use_enable zlib)
)
# setup.py sucks at adding the right toolchain paths but it does
# accept additional ones from INCLUDE and LIB so set these. You
# wouldn't normally need these at all as the toolchain should look
# here anyway but this setup.py does stupid things.
export \
INCLUDE=${ESYSROOT}/usr/include \
LIB=${ESYSROOT}/usr/$(get_libdir)
# We have patched in this env var.
tc-export PKG_CONFIG
}
python_compile_all() {