Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v8 2/5] package/python-numpy: fixup npymath.ini for numpy extensions
Date: Tue,  7 Apr 2020 16:45:12 +0530	[thread overview]
Message-ID: <20200407111515.21131-3-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20200407111515.21131-1-jagan@amarulasolutions.com>

From: Esben Haabendal <esben@geanix.com>

Inorder to build the numpy distutils extension packages like
python-scipy, python-numba, it require an explicit pkg-config
path fixup for npymath.ini.

This pkg-config path fixup would update the prefix path of
npymath.ini with actual target staging area where numpy core
was built, so-that numpy distutils extension packages would
explicitly link this config path for their package environment.

Without this extension packages cannot find -lnpymath since
it uses host libraries (like libnpymath.a).

So, attach the post install staging hook with pkg-config
path fixup for npymath.ini.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v8:
- none
Changes for v7:
- rephrase commit and comments of fixup npymath.ini

 package/python-numpy/python-numpy.mk | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/package/python-numpy/python-numpy.mk b/package/python-numpy/python-numpy.mk
index 3f0df7a640..4d2e852b43 100644
--- a/package/python-numpy/python-numpy.mk
+++ b/package/python-numpy/python-numpy.mk
@@ -32,6 +32,21 @@ define PYTHON_NUMPY_CONFIGURE_CMDS
 	echo "include_dirs = $(STAGING_DIR)/usr/include" >> $(@D)/site.cfg
 endef
 
+# Fixup the npymath.ini prefix path with actual target staging area where
+# numpy core was built. Without this, target builds using numpy distutils
+# extensions like python-scipy, python-numba cannot find -lnpymath since
+# it uses host libraries (like libnpymath.a).
+# So, the numpy distutils extension packages would explicitly link this
+# config path for their package environment.
+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

  parent reply	other threads:[~2020-04-07 11:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07 11:15 [Buildroot] [PATCH v8 0/5] package/python-scipy: new package Jagan Teki
2020-04-07 11:15 ` [Buildroot] [PATCH v8 1/5] package/python-numpy: Bump to version 1.18.2 Jagan Teki
2020-05-01 12:37   ` Thomas Petazzoni
2020-04-07 11:15 ` Jagan Teki [this message]
2022-01-07 22:10   ` [Buildroot] [PATCH v8 2/5] package/python-numpy: fixup npymath.ini for numpy extensions Arnout Vandecappelle
2020-04-07 11:15 ` [Buildroot] [PATCH v8 3/5] package/python-pybind11: new host package Jagan Teki
2020-04-07 11:15 ` [Buildroot] [PATCH v8 4/5] support/testing: add python-pybind11 test Jagan Teki
2022-01-07 21:38   ` Arnout Vandecappelle
2020-04-07 11:15 ` [Buildroot] [PATCH v8 5/5] package/python-scipy: new package Jagan Teki
2022-01-07 23:12   ` Arnout Vandecappelle
2020-04-07 11:49 ` [Buildroot] [PATCH v8 0/5] " Thomas Petazzoni
2020-04-07 13:43   ` Jagan Teki
2020-04-07 15:01     ` Yann E. MORIN
2020-04-07 16:18       ` Jagan Teki
2020-07-03  8:09         ` Jagan Teki

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=20200407111515.21131-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