diff options
3 files changed, 29 insertions, 100 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb/0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb/0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch deleted file mode 100644 index 474f0f1584..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb/0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch +++ /dev/null | |||
| @@ -1,67 +0,0 @@ | |||
| 1 | From 30c79d1b49839a15c05a0d0ca7e54787cd7988c6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 3 | Date: Thu, 4 May 2023 07:17:57 +0000 | ||
| 4 | Subject: [PATCH] CMakeLists.txt: allow to set PYTHON_INSTDIR from outside | ||
| 5 | |||
| 6 | CMakeLists.txt used: | ||
| 7 | |||
| 8 | find_package(Python REQUIRED COMPONENTS Interpreter) | ||
| 9 | execute_process( | ||
| 10 | COMMAND ${Python_EXECUTABLE} -c | ||
| 11 | "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 12 | OUTPUT_VARIABLE PYTHON_INSTDIR | ||
| 13 | OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| 14 | ) | ||
| 15 | |||
| 16 | but with python3native this returns: | ||
| 17 | |||
| 18 | nanopb/0.4.7-r0/git $ ../recipe-sysroot-native/usr/bin/python3-native/python3 -c "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 19 | lib/python3.11/site-packages | ||
| 20 | |||
| 21 | which doesn't respect target libdir which might be lib64 with multilib and with python3targetconfig | ||
| 22 | it also doesn't work right because of the long relative path: | ||
| 23 | |||
| 24 | nanopb/0.4.7-r0/build $ ../recipe-sysroot-native/usr/bin/python3-native/python3 -c "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 25 | ../../../../../../../../../../../../usr/lib64/python3.11/site-packages | ||
| 26 | |||
| 27 | CMake Error at cmake_install.cmake:46 (file): | ||
| 28 | file cannot create directory: | ||
| 29 | /OE/lge/build/starfish/nanbield/BUILD/work/o22-starfish-linux/nanopb/0.4.7-r0/image/usr/../../../../../../../../../../../../usr/lib64/python3.11/site-packages/proto. | ||
| 30 | Maybe need administrative privileges. | ||
| 31 | |||
| 32 | Let CMake variable to be passed from the recipe to avoid this as we're already using | ||
| 33 | ${D}${PYTHON_SITEPACKAGES_DIR} in do_install:append anyway. | ||
| 34 | |||
| 35 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 36 | Upstream-Status: Pending | ||
| 37 | --- | ||
| 38 | CMakeLists.txt | 16 +++++++++------- | ||
| 39 | 1 file changed, 9 insertions(+), 7 deletions(-) | ||
| 40 | |||
| 41 | diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
| 42 | index 8d241c5..7d3f993 100644 | ||
| 43 | --- a/CMakeLists.txt | ||
| 44 | +++ b/CMakeLists.txt | ||
| 45 | @@ -39,13 +39,15 @@ if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR) | ||
| 46 | set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/nanopb") | ||
| 47 | endif() | ||
| 48 | |||
| 49 | -find_package(Python REQUIRED COMPONENTS Interpreter) | ||
| 50 | -execute_process( | ||
| 51 | - COMMAND ${Python_EXECUTABLE} -c | ||
| 52 | - "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 53 | - OUTPUT_VARIABLE PYTHON_INSTDIR | ||
| 54 | - OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| 55 | -) | ||
| 56 | +if(NOT DEFINED PYTHON_INSTDIR) | ||
| 57 | + find_package(Python REQUIRED COMPONENTS Interpreter) | ||
| 58 | + execute_process( | ||
| 59 | + COMMAND ${Python_EXECUTABLE} -c | ||
| 60 | + "import os.path, sys, sysconfig; print(os.path.relpath(sysconfig.get_path('purelib'), start=sys.prefix))" | ||
| 61 | + OUTPUT_VARIABLE PYTHON_INSTDIR | ||
| 62 | + OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| 63 | + ) | ||
| 64 | +endif() | ||
| 65 | |||
| 66 | if(nanopb_BUILD_GENERATOR) | ||
| 67 | set(generator_protos nanopb) | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb deleted file mode 100644 index 9ad558146c..0000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.7.bb +++ /dev/null | |||
| @@ -1,33 +0,0 @@ | |||
| 1 | DESCRIPTION="Protocol Buffers with small code size" | ||
| 2 | LICENSE="Zlib" | ||
| 3 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f" | ||
| 4 | |||
| 5 | DEPENDS = "protobuf-native" | ||
| 6 | |||
| 7 | SRC_URI = "git://github.com/nanopb/nanopb.git;branch=master;protocol=https \ | ||
| 8 | file://0001-CMakeLists.txt-allow-to-set-PYTHON_INSTDIR-from-outs.patch \ | ||
| 9 | " | ||
| 10 | SRCREV = "b97aa657a706d3ba4a9a6ccca7043c9d6fe41cba" | ||
| 11 | |||
| 12 | S = "${WORKDIR}/git" | ||
| 13 | |||
| 14 | inherit cmake python3native | ||
| 15 | |||
| 16 | EXTRA_OECMAKE += "-DPYTHON_INSTDIR=${PYTHON_SITEPACKAGES_DIR}" | ||
| 17 | |||
| 18 | do_install:append() { | ||
| 19 | install -Dm 0755 ${S}/generator/nanopb_generator.py ${D}${bindir}/nanopb_generator.py | ||
| 20 | install -Dm 0755 ${S}/generator/protoc-gen-nanopb ${D}${bindir}/protoc-gen-nanopb | ||
| 21 | install -Dm 0755 ${S}/generator/proto/__init__.py ${D}${PYTHON_SITEPACKAGES_DIR}/proto/__init__.py | ||
| 22 | } | ||
| 23 | |||
| 24 | FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" | ||
| 25 | FILES:${PN}-dev += "${libdir}/cmake/${BPN}" | ||
| 26 | |||
| 27 | RDEPENDS:${PN} += "\ | ||
| 28 | ${PYTHON_PN}-protobuf \ | ||
| 29 | protobuf-compiler \ | ||
| 30 | " | ||
| 31 | |||
| 32 | BBCLASSEXTEND = "native nativesdk" | ||
| 33 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.8.bb b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.8.bb new file mode 100644 index 0000000000..d282bf1b2c --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-devtools/nanopb/nanopb_0.4.8.bb | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | DESCRIPTION="Protocol Buffers with small code size" | ||
| 2 | LICENSE="Zlib" | ||
| 3 | LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=9db4b73a55a3994384112efcdb37c01f" | ||
| 4 | |||
| 5 | DEPENDS = "protobuf-native" | ||
| 6 | |||
| 7 | SRC_URI = "git://github.com/nanopb/nanopb.git;branch=master;protocol=https" | ||
| 8 | SRCREV = "6cfe48d6f1593f8fa5c0f90437f5e6522587745e" | ||
| 9 | |||
| 10 | S = "${WORKDIR}/git" | ||
| 11 | |||
| 12 | inherit cmake python3-dir | ||
| 13 | |||
| 14 | EXTRA_OECMAKE += "-Dnanopb_PYTHON_INSTDIR_OVERRIDE=${PYTHON_SITEPACKAGES_DIR}" | ||
| 15 | |||
| 16 | RDEPENDS:${PN} += "${PYTHON_PN}-protobuf" | ||
| 17 | |||
| 18 | # Maintain compatability with old header locations for packages | ||
| 19 | # which haven't yet migrated to `nanopb/pb*.h` | ||
| 20 | do_install:append() { | ||
| 21 | for hdr in ${D}${includedir}/nanopb/*; do | ||
| 22 | ln -sv nanopb/$(basename "$hdr") ${D}${includedir}/ | ||
| 23 | done | ||
| 24 | } | ||
| 25 | |||
| 26 | FILES:${PN} += "${PYTHON_SITEPACKAGES_DIR}" | ||
| 27 | |||
| 28 | BBCLASSEXTEND = "native nativesdk" | ||
| 29 | |||
