[Buildroot] [PATCH/next] pybind11: new package
guillaume.bressaix at gmail.com
guillaume.bressaix at gmail.com
Sat Nov 13 20:51:58 UTC 2021
From: "Guillaume W. Bres" <guillaume.bressaix at gmail.com>
fixes http://autobuild.buildroot.net/results/d2f0a0ad8f6c7178517df109e7d885dac9134c3a
fixes http://autobuild.buildroot.net/results/b57e9a3279260dae4a590f9421238fcabb2f7cab
fixes http://autobuild.buildroot.net/results/515e6f2fc6b5780260d98d6bb52b541ce4bf1afe
fixes http://autobuild.buildroot.net/results/d89c4ecc81222d4f80c951da2232d2e393fa1c69
list goes on..
---
python-pybind was not the right approach and is in failure since
it's been upgraded to V2.6.1.
Building with setup.py now requires a cmake build first.
With this new approach we can build the package with cmake
for python bindings in C++ AND we also have the
C++ bindings in python as an option (depending & requiring the first one).
I make this a host-only package, in the sense that other packages will
require it at build time, and I don't forsee any reasons to have
such a package as a target package.
Signed-off-by: Guillaume W. Bres <guillaume.bressaix at gmail.com>
---
DEVELOPERS | 2 +-
package/Config.in | 2 +-
package/pybind11/Config.in | 25 ++++++++++++++
package/pybind11/pybind11.hash | 3 ++
package/pybind11/pybind11.mk | 42 ++++++++++++++++++++++++
package/python-pybind/Config.in | 8 -----
package/python-pybind/python-pybind.hash | 4 ---
package/python-pybind/python-pybind.mk | 13 --------
8 files changed, 72 insertions(+), 27 deletions(-)
create mode 100644 package/pybind11/Config.in
create mode 100644 package/pybind11/pybind11.hash
create mode 100644 package/pybind11/pybind11.mk
delete mode 100644 package/python-pybind/Config.in
delete mode 100644 package/python-pybind/python-pybind.hash
delete mode 100644 package/python-pybind/python-pybind.mk
diff --git a/DEVELOPERS b/DEVELOPERS
index 6f812eb564..e5e6d0f538 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1104,7 +1104,7 @@ F: package/libnids/
F: package/libxcrypt/
F: package/liquid-dsp/
F: package/pixiewps/
-F: package/python-pybind/
+F: package/pybind11/
F: package/reaver/
N: Guo Ren <ren_guo at c-sky.com>
diff --git a/package/Config.in b/package/Config.in
index e355ab1987..7d36c22d0e 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1132,7 +1132,6 @@ menu "External python modules"
source "package/python-pyalsa/Config.in"
source "package/python-pyasn1/Config.in"
source "package/python-pyasn1-modules/Config.in"
- source "package/python-pybind/Config.in"
source "package/python-pycairo/Config.in"
source "package/python-pycares/Config.in"
source "package/python-pycli/Config.in"
@@ -2005,6 +2004,7 @@ endif
source "package/protobuf/Config.in"
source "package/protobuf-c/Config.in"
source "package/protozero/Config.in"
+ source "package/pybind11/Config.in"
source "package/qhull/Config.in"
source "package/qlibc/Config.in"
source "package/riemann-c-client/Config.in"
diff --git a/package/pybind11/Config.in b/package/pybind11/Config.in
new file mode 100644
index 0000000000..cc3d481ccc
--- /dev/null
+++ b/package/pybind11/Config.in
@@ -0,0 +1,25 @@
+comment "pybind11 needs a toolchain w/ C++, wchar"
+ depends on !BR2_INSTALL_LIBSTDCPP || !BR2_USE_WCHAR
+
+config BR2_PACKAGE_PYBIND11
+ bool "pybind11"
+ depends on BR2_USE_WCHAR # boost
+ depends on BR2_INSTALL_LIBSTDCPP # boost
+ depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # boost-thread
+ select BR2_PACKAGE_BOOST
+ help
+ Pybind11 is a lightweight header-only library that exposes C++
+ types in Python and vice versa, mainly to create Python
+ bindings of existing C++ code.
+
+ http://pybind11.readthedocs.org/en/master
+
+if BR2_PACKAGE_PYBIND11
+
+config BR2_PACKAGE_PYBIND11_WITH_PYTHON
+ bool "pybind11-python"
+ depends on BR2_PACKAGE_PYTHON3
+ help
+ Activate support for python-pybind
+
+endif
diff --git a/package/pybind11/pybind11.hash b/package/pybind11/pybind11.hash
new file mode 100644
index 0000000000..ab8825bf04
--- /dev/null
+++ b/package/pybind11/pybind11.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 f1bcc07caa568eb312411dde5308b1e250bd0e1bc020fae855bf9f43209940cc pybind11-2.8.1.tar.gz
+sha256 83965b843b98f670d3a85bd041ed4b372c8ec50d7b4a5995a83ac697ba675dcb LICENSE
diff --git a/package/pybind11/pybind11.mk b/package/pybind11/pybind11.mk
new file mode 100644
index 0000000000..3c7856b82d
--- /dev/null
+++ b/package/pybind11/pybind11.mk
@@ -0,0 +1,42 @@
+################################################################################
+#
+# pybind11
+#
+################################################################################
+
+PYBIND11_VERSION = 2.8.1
+PYBIND11_SITE = $(call github,pybind,pybind11,v$(PYBIND11_VERSION))
+PYBIND11_LICENSE = BSD-3-Clause
+PYBIND11_LICENSE_FILES = LICENSE
+PYBIND11_INSTALL_STAGING = YES
+PYBIND11_SUPPORTS_IN_SOURCE_BUILD = YES
+
+HOST_PYBIND11_CONF_OPTS = \
+ -DBUILD_DOCS=OFF \
+ -DDOWNLOAD_EIGEN=OFF \
+ -DPYTHON=$(TARGET_DIR)/usr/bin/python \
+ -DPYTHON_PREFIX=$(STAGING_DIR)/usr
+
+# pybind11-python support activation
+# this requires the cmake build installed within $(@D)
+ifeq ($(BR2_PACKAGE_PYBIND11_WITH_PYTHON),y)
+
+HOST_PYBIND11_DEPENDENCIES += host-python3
+
+HOST_PYBIND11_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=$(@D)/pybind11
+
+define PYBIND11_PYTHON_BUILD
+ cd $(@D) && $(HOST_DIR)/bin/python setup.py install
+endef
+
+HOST_PYBIND11_POST_INSTALL_HOOKS += PYBIND11_PYTHON_BUILD
+
+else
+
+HOST_PYBIND11_CONF_OPTS += \
+ -DPYBIND_FINDPYTHON=OFF \
+ -DPYBIND11_NOPYTHON=ON
+
+endif
+
+$(eval $(host-cmake-package))
diff --git a/package/python-pybind/Config.in b/package/python-pybind/Config.in
deleted file mode 100644
index 604cb9ee67..0000000000
--- a/package/python-pybind/Config.in
+++ /dev/null
@@ -1,8 +0,0 @@
-config BR2_PACKAGE_PYTHON_PYBIND
- bool "python-pybind"
- help
- PyBind is a lightweight header-only library that exposes C++
- types in Python and vice versa, mainly to create Python
- bindings of existing C++ code.
-
- http://pybind11.readthedocs.org/en/master
diff --git a/package/python-pybind/python-pybind.hash b/package/python-pybind/python-pybind.hash
deleted file mode 100644
index a68ac846e2..0000000000
--- a/package/python-pybind/python-pybind.hash
+++ /dev/null
@@ -1,4 +0,0 @@
-# Locally calculated
-sha256 cdbe326d357f18b83d10322ba202d69f11b2f49e2d87ade0dc2be0c5c34f8e2a python-pybind-2.6.1.tar.gz
-# License files, locally calculated
-sha256 83965b843b98f670d3a85bd041ed4b372c8ec50d7b4a5995a83ac697ba675dcb LICENSE
diff --git a/package/python-pybind/python-pybind.mk b/package/python-pybind/python-pybind.mk
deleted file mode 100644
index a6a1bdb976..0000000000
--- a/package/python-pybind/python-pybind.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-################################################################################
-#
-# python-pybind
-#
-################################################################################
-
-PYTHON_PYBIND_VERSION = 2.6.1
-PYTHON_PYBIND_SITE = $(call github,pybind,pybind11,v$(PYTHON_PYBIND_VERSION))
-PYTHON_PYBIND_LICENSE = BSD-3-Clause
-PYTHON_PYBIND_LICENSE_FILES = LICENSE
-PYTHON_PYBIND_SETUP_TYPE = setuptools
-
-$(eval $(python-package))
--
2.20.1
More information about the buildroot
mailing list