From: Jagan Teki <jagan@amarulasolutions.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v6 2/4] package/python-numpy: fixup numpy distutils for cross compilation
Date: Wed, 18 Mar 2020 14:37:38 +0530 [thread overview]
Message-ID: <20200318090740.4973-3-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20200318090740.4973-1-jagan@amarulasolutions.com>
From: Esben Haabendal <esben@geanix.com>
Fix problems using the numpy distutils extension for cross compilation,
so that linking with npymath library will use target library when building
target packages.
Signed-off-by: Esben Haabendal <esben@geanix.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v6:
- drop python2 staging directory
package/python-numpy/python-numpy.mk | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/package/python-numpy/python-numpy.mk b/package/python-numpy/python-numpy.mk
index 6d4cd22e62..18d9f40887 100644
--- a/package/python-numpy/python-numpy.mk
+++ b/package/python-numpy/python-numpy.mk
@@ -32,6 +32,23 @@ define PYTHON_NUMPY_CONFIGURE_CMDS
echo "include_dirs = $(STAGING_DIR)/usr/include" >> $(@D)/site.cfg
endef
+# The numpy distutils extensions are not very cross friendly. It comes with
+# it's own pkg-config look-alike, which we are patching to allow overriding
+# where it locates the configuration files. This allows us to use fixed up
+# target configuration files, which we make sure includes full path to the
+# target staging area, so that when building for target, we actually use the
+# target libraries. Without this, target builds using numpy distutils
+# extensions (such as fx. python-scipy) will use the host libraries, which
+# obviously will not work.
+PYTHON_NUMPY_STAGING_DIR = $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/numpy
+PYTHON_NUMPY_NPY_PKG_CONFIG_PATH=$(PYTHON_NUMPY_STAGING_DIR)/core/lib/npy-pkg-config
+define PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
+ sed -e '/^pkgdir=/d' \
+ -e '/^prefix=/i pkgdir=$(PYTHON_NUMPY_STAGING_DIR)/core' \
+ -i $(PYTHON_NUMPY_NPY_PKG_CONFIG_PATH)/npymath.ini
+endef
+PYTHON_NUMPY_POST_INSTALL_STAGING_HOOKS += PYTHON_NUMPY_FIXUP_NPY_PKG_CONFIG_FILES
+
# Some package may include few headers from NumPy, so let's install it
# in the staging area.
PYTHON_NUMPY_INSTALL_STAGING = YES
--
2.17.1
next prev parent reply other threads:[~2020-03-18 9:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-18 9:07 [Buildroot] [PATCH v6 0/4] package/python-scipy: new package Jagan Teki
2020-03-18 9:07 ` [Buildroot] [PATCH v6 1/4] package/python-numpy: Bump to version 1.18.1 Jagan Teki
2020-03-18 9:28 ` Esben Haabendal
2020-03-20 14:08 ` Gwenhael Goavec-Merou
2020-03-18 9:07 ` Jagan Teki [this message]
2020-03-18 9:31 ` [Buildroot] [PATCH v6 2/4] package/python-numpy: fixup numpy distutils for cross compilation Esben Haabendal
2020-03-18 9:07 ` [Buildroot] [PATCH v6 3/4] package/python-pybind11: Add new host package Jagan Teki
2020-03-18 9:07 ` [Buildroot] [PATCH v6 4/4] package/python-scipy: Add new package Jagan Teki
2020-03-18 10:37 ` Yegor Yefremov
2020-03-18 13:36 ` Jagan Teki
2020-03-18 13:39 ` Yegor Yefremov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200318090740.4973-3-jagan@amarulasolutions.com \
--to=jagan@amarulasolutions.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox