From patchwork Wed May 13 18:39:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asaf Kahlon X-Patchwork-Id: 1289606 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=mpUwrilC; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49Mk4P252zz9sSr for ; Thu, 14 May 2020 04:40:04 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 416A022643; Wed, 13 May 2020 18:40:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WC77VaFhHQTj; Wed, 13 May 2020 18:39:56 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 2E069221D9; Wed, 13 May 2020 18:39:56 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id E14461BF41C for ; Wed, 13 May 2020 18:39:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id DB3A287516 for ; Wed, 13 May 2020 18:39:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XY1kKJv_WAMR for ; Wed, 13 May 2020 18:39:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 6A5E38750B for ; Wed, 13 May 2020 18:39:53 +0000 (UTC) Received: by mail-wm1-f54.google.com with SMTP id k12so27624364wmj.3 for ; Wed, 13 May 2020 11:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=o2Cw7e42HVnUo6S/iqeqoWHz1y+yasgKfLdMUIxmYqY=; b=mpUwrilCOYNqYbpBGmlJY/YyhYzgHVqx/gS59dub58562qcG31rA+tzkXeQRvynWUg uCrjyYJ7xyUufm5xFdVE6KRKqFC+B3iRxI0uNzOwluzZJ5rp3oh2jut2PHSph0wZdDaK aKnL2WfK8gWgQVadivPlz2PX2sKGSemRDaNqbPIkX2HhHYNSsKta94Zc0ukWDTwtafVd eD5zeP4Uj/yQWXBkM3/oFq+EbK0FeLk0ZWG1pln0Mwk/xtT41pC64paOHb61xhm6SyOo VHFHXpdan3dhVuq1iQrJ5mKZzi3Fj66Cvzk/iwM23Alnjflhi9mhGtDAs/cTLdUvSuOO Vabg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=o2Cw7e42HVnUo6S/iqeqoWHz1y+yasgKfLdMUIxmYqY=; b=JMERZ7iawlN4czwUbM4OaRCoJ1Dz7yElOzpUs0L/RS64ltGQQcs/d8Rqe42KQYC6jP r6EpOoylMu+5DQ4Htdn+cDcUkcjhRNT0L734uQRz7DhMqHwFooMLgWIeBxv+6zbdXTEU K46WKIp3Mb7oJFkj6EmmpHjkzbKWE4C1OpWWjbXCC9hxJN9vkU+IYa3LHMQ2dRRnhf+6 t8MA+xWw6KjfkSA2SNJr3Ly1CtY3JjuN8lKV532GnOQIzmQ32t6TRfiW58hyPgvvz4OW rHTA4eNcND1+87MtfjG3IlTT813czly0tPHH1pwxEA8/j96n9GIZ2wgLW9uvIdZk2085 D3rQ== X-Gm-Message-State: AGi0PubtHdpLKMw6kXXLx+ueOHpWcmlFP2kCTi/t9Agy1qBCE0gtGA94 TFspNSj41WQhfJMOmMqxG76r6hJM X-Google-Smtp-Source: APiQypJPeSinWJz6fYxB6OSbOVlAzdeezzvZaiD+iIK/7aiiVv/dDFAuExFqkpVjiSxuib3i01EFUA== X-Received: by 2002:a05:600c:2055:: with SMTP id p21mr21689329wmg.127.1589395191545; Wed, 13 May 2020 11:39:51 -0700 (PDT) Received: from localhost.localdomain (bzq-84-108-4-25.cablep.bezeqint.net. [84.108.4.25]) by smtp.gmail.com with ESMTPSA id o203sm20960323wme.12.2020.05.13.11.39.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 11:39:50 -0700 (PDT) From: Asaf Kahlon To: buildroot@buildroot.org Date: Wed, 13 May 2020 21:39:03 +0300 Message-Id: <20200513183903.8656-1-asafka7@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] package/python-pybind11: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki , Eyal Royee , Adam Duskett , Asaf Kahlon Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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. The package is installed both as 'cmake-package' (for staging) and as 'python-package' (for the host). The reason for that is the fact that pybind11 can be used in two different ways: * When compiling C++ extentions from setup.py. On this case one should be able to import the pythonic pybind11 module before the compilation itself, hence the use of host-python-package. * When a C++ project builds Python wrappings. On this case one should be able to find the pybind11 headers from the staging dir. In addition, one shuold be able to locate pybind11 with CMake's 'find_package' command, hence the use of cmake-package. Because the package installs only headers, it's not installed for the target, but only for host and staging dirs. Moreover, there's a cross-compilation issue when building pybind11, and recently a PR has been sent to them in order to fix that. The patch is added in this commit. Signed-off-by: Asaf Kahlon --- package/Config.in | 1 + ...ovided-PythonLibs-on-newer-CMake-ver.patch | 31 +++++++++++++++++++ package/python-pybind11/Config.in | 23 ++++++++++++++ package/python-pybind11/python-pybind11.hash | 3 ++ package/python-pybind11/python-pybind11.mk | 19 ++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 package/python-pybind11/0001-Use-the-CMake-provided-PythonLibs-on-newer-CMake-ver.patch create mode 100644 package/python-pybind11/Config.in create mode 100644 package/python-pybind11/python-pybind11.hash create mode 100644 package/python-pybind11/python-pybind11.mk diff --git a/package/Config.in b/package/Config.in index c12676d859..6b64546186 100644 --- a/package/Config.in +++ b/package/Config.in @@ -1070,6 +1070,7 @@ 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-pybind11/Config.in" source "package/python-pycairo/Config.in" source "package/python-pycares/Config.in" source "package/python-pycli/Config.in" diff --git a/package/python-pybind11/0001-Use-the-CMake-provided-PythonLibs-on-newer-CMake-ver.patch b/package/python-pybind11/0001-Use-the-CMake-provided-PythonLibs-on-newer-CMake-ver.patch new file mode 100644 index 0000000000..3db5b4b259 --- /dev/null +++ b/package/python-pybind11/0001-Use-the-CMake-provided-PythonLibs-on-newer-CMake-ver.patch @@ -0,0 +1,31 @@ +From dc0d4e3d7b6ed7ea356bd8bfc2ce09bf27db2537 Mon Sep 17 00:00:00 2001 +From: Cody Piersall +Date: Thu, 30 Apr 2020 13:08:53 -0500 +Subject: [PATCH 1/1] Use the CMake-provided PythonLibs on newer CMake + versions. + +--- + tools/pybind11Tools.cmake | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/tools/pybind11Tools.cmake b/tools/pybind11Tools.cmake +index 8d85dd4..70eb089 100644 +--- a/tools/pybind11Tools.cmake ++++ b/tools/pybind11Tools.cmake +@@ -13,7 +13,12 @@ if(NOT PYBIND11_PYTHON_VERSION) + endif() + + set(Python_ADDITIONAL_VERSIONS 3.9 3.8 3.7 3.6 3.5 3.4) +-find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED) ++# this minimum was determined by testing, and could potentially be made lower ++if(CMAKE_VERSION VERSION_LESS 3.10.2) ++ find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED) ++else() ++ find_package(PythonLibs ${PYBIND11_PYTHON_VERSION} REQUIRED) ++endif() + + include(CheckCXXCompilerFlag) + include(CMakeParseArguments) +-- +2.26.2 + diff --git a/package/python-pybind11/Config.in b/package/python-pybind11/Config.in new file mode 100644 index 0000000000..e79c0075a6 --- /dev/null +++ b/package/python-pybind11/Config.in @@ -0,0 +1,23 @@ +config BR2_PACKAGE_PYTHON_PYBIND11 + bool "python-pybind11" + depends on BR2_INSTALL_LIBSTDCPP + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 # C++11 + depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # exception_ptr + 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. Its goals and syntax are + similar to the excellent Boost.Python library by David + Abrahams: + To minimize boilerplate code in traditional extension modules + by inferring type information using compile-time + introspection. + + https://github.com/pybind/pybind11 + +comment "python-pybind11 needs a toolchain w/ C++, gcc >= 4.8" + depends on !BR2_INSTALL_LIBSTDCPP + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 + +comment "python-pybind11 needs exception_ptr" + depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735 diff --git a/package/python-pybind11/python-pybind11.hash b/package/python-pybind11/python-pybind11.hash new file mode 100644 index 0000000000..75101ac847 --- /dev/null +++ b/package/python-pybind11/python-pybind11.hash @@ -0,0 +1,3 @@ +# Locally computed sha256 +sha256 97504db65640570f32d3fdf701c25a340c8643037c3b69aec469c10c93dc8504 pybind11-2.5.0.tar.gz +sha256 9a37ea54aa3cf12c7f3292799f20822ffd4b9b7142b36a7a9997b28c39264dc9 LICENSE diff --git a/package/python-pybind11/python-pybind11.mk b/package/python-pybind11/python-pybind11.mk new file mode 100644 index 0000000000..f77c6c664e --- /dev/null +++ b/package/python-pybind11/python-pybind11.mk @@ -0,0 +1,19 @@ +################################################################################ +# +# python-pybind11 +# +################################################################################ + +PYTHON_PYBIND11_VERSION = 2.5.0 +PYTHON_PYBIND11_SOURCE = pybind11-$(PYTHON_PYBIND11_VERSION).tar.gz +PYTHON_PYBIND11_SITE = $(call github,pybind,pybind11,v$(PYTHON_PYBIND11_VERSION)) +PYTHON_PYBIND11_LICENSE = BSD-3-Clause +PYTHON_PYBIND11_LICENSE_FILES = LICENSE +PYTHON_PYBIND11_DEPENDENCIES = $(if $(BR2_PACKAGE_PYTHON3),python3,python) +PYTHON_PYBIND11_INSTALL_STAGING = YES +PYTHON_PYBIND11_INSTALL_TARGET = NO +PYTHON_PYBIND11_CONF_OPTS = -DPYBIND11_TEST=OFF +HOST_PYTHON_PYBIND11_SETUP_TYPE = setuptools + +$(eval $(cmake-package)) +$(eval $(host-python-package))