kumquat-buildroot/package/zxing-cpp/zxing-cpp.mk
Fabrice Fontaine 38f39a6031 package/zxing-cpp: fix python build
Fix the following build failures raised since bump to version 1.4.0 in
commit 456a739831:

-- Found PythonInterp: /usr/bin/python3.6 (found suitable version "3.6.9", minimum required is "3.6")
CMake Error at /home/buildroot/autobuild/run/instance-3/output-1/host/sparc64-buildroot-linux-gnu/sysroot/usr/share/cmake/pybind11/FindPythonLibsNew.cmake:147 (message):
  Python config failure:

  Traceback (most recent call last):

    File "<string>", line 6, in <module>

  ImportError: cannot import name 'sysconfig'

and

In file included from /home/buildroot/autobuild/instance-1/output-1/host/include/python3.11/Python.h:38,
                 from /home/buildroot/autobuild/instance-1/output-1/host/sh4-buildroot-linux-gnu/sysroot/usr/include/pybind11/detail/common.h:266,
                 from /home/buildroot/autobuild/instance-1/output-1/host/sh4-buildroot-linux-gnu/sysroot/usr/include/pybind11/attr.h:13,
                 from /home/buildroot/autobuild/instance-1/output-1/host/sh4-buildroot-linux-gnu/sysroot/usr/include/pybind11/detail/class.h:12,
                 from /home/buildroot/autobuild/instance-1/output-1/host/sh4-buildroot-linux-gnu/sysroot/usr/include/pybind11/pybind11.h:13,
                 from /home/buildroot/autobuild/instance-1/output-1/host/sh4-buildroot-linux-gnu/sysroot/usr/include/pybind11/numpy.h:12,
                 from /home/buildroot/autobuild/instance-1/output-1/build/zxing-cpp-2.1.0/wrappers/python/zxing.cpp:18:
/home/buildroot/autobuild/instance-1/output-1/host/include/python3.11/pyport.h:601:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  601 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
      |  ^~~~~

Fixes:
 - http://autobuild.buildroot.org/results/665b246a4bb14480152ee59050672a7469148a5b
 - http://autobuild.buildroot.org/results/0502b05020de57e4910125c699c4264047187c51
 - http://autobuild.buildroot.org/results/c5e7fe83d46c704e05800e3ae62bf476458c7b71

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-09-21 12:29:14 +02:00

58 lines
1.8 KiB
Makefile

################################################################################
#
# zxing-cpp
#
################################################################################
ZXING_CPP_VERSION = 2.1.0
ZXING_CPP_SITE = $(call github,zxing-cpp,zxing-cpp,v$(ZXING_CPP_VERSION))
ZXING_CPP_LICENSE = Apache-2.0
ZXING_CPP_LICENSE_FILES = LICENSE
ZXING_CPP_INSTALL_STAGING = YES
ZXING_CPP_SUPPORTS_IN_SOURCE_BUILD = NO
ZXING_CPP_DEPENDENCIES = host-pkgconf stb
ZXING_CPP_CONF_OPTS = \
-DBUILD_READERS=ON \
-DBUILD_WRITERS=ON \
-DBUILD_EXAMPLES=OFF \
-DBUILD_BLACKBOX_TESTS=OFF \
-DBUILD_UNIT_TESTS=OFF \
-DBUILD_DEPENDENCIES=LOCAL
ifeq ($(BR2_PACKAGE_OPENCV3_LIB_HIGHGUI)$(BR2_PACKAGE_OPENCV4_LIB_HIGHGUI),y)
ifeq ($(BR2_PACKAGE_OPENCV3),y)
ZXING_CPP_DEPENDENCIES += opencv3
endif
ifeq ($(BR2_PACKAGE_OPENCV4),y)
ZXING_CPP_DEPENDENCIES += opencv4
endif
ZXING_CPP_CONF_OPTS += -DCMAKE_REQUIRE_FIND_PACKAGE_OpenCV=TRUE
else
ZXING_CPP_CONF_OPTS += -DCMAKE_DISABLE_FIND_PACKAGE_OpenCV=TRUE
endif
ifeq ($(BR2_PACKAGE_PYTHON3)$(BR2_PACKAGE_PYTHON_PYBIND),yy)
ZXING_CPP_DEPENDENCIES += python3 python-pybind
ZXING_CPP_CONF_OPTS += \
-DBUILD_PYTHON_MODULE=ON \
-DPYTHON_EXECUTABLE=$(HOST_DIR)/bin/python3 \
-DPYTHON_INCLUDE_DIRS=$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)
else
ZXING_CPP_CONF_OPTS += -DBUILD_PYTHON_MODULE=OFF
endif
ifeq ($(BR2_PACKAGE_QT5BASE),y)
ZXING_CPP_DEPENDENCIES += qt5base
ifeq ($(BR2_PACKAGE_QT5DECLARATIVE_QUICK)$(BR2_PACKAGE_QT5MULTIMEDIA),yy)
ZXING_CPP_DEPENDENCIES += qt5declarative qt5multimedia
endif
# Only set qt5 as required when all optional qt5 dependencies are present
ifeq ($(BR2_PACKAGE_QT5BASE_GUI)$(BR2_PACKAGE_QT5DECLARATIVE_QUICK)$(BR2_PACKAGE_QT5MULTIMEDIA),yyy)
ZXING_CPP_CONF_OPTS += -DCMAKE_REQUIRE_FIND_PACKAGE_Qt5=TRUE
endif
else
ZXING_CPP_CONF_OPTS += -DCMAKE_DISABLE_FIND_PACKAGE_Qt5=TRUE
endif
$(eval $(cmake-package))