diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake-native_3.20.1.bb b/meta-balena-dunfell/recipes-devtools/cmake/cmake-native_3.20.1.bb new file mode 100644 index 0000000000..d91e42ef9a --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake-native_3.20.1.bb @@ -0,0 +1,53 @@ +require cmake.inc +inherit native + +DEPENDS += "bzip2-replacement-native xz-native zlib-native curl-native ncurses-native" + +SRC_URI += "file://OEToolchainConfig.cmake \ + file://environment.d-cmake.sh \ + file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \ + file://0005-Disable-use-of-ext2fs-ext2_fs.h-by-cmake-s-internal-.patch \ + " + + +B = "${WORKDIR}/build" +do_configure[cleandirs] = "${B}" + +CMAKE_EXTRACONF = "\ + -DCMAKE_LIBRARY_PATH=${STAGING_LIBDIR_NATIVE} \ + -DBUILD_CursesDialog=1 \ + -DCMAKE_USE_SYSTEM_LIBRARIES=1 \ + -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBARCHIVE=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_EXPAT=0 \ + -DENABLE_ACL=0 -DHAVE_ACL_LIBACL_H=0 \ + -DHAVE_SYS_ACL_H=0 \ +" + +do_configure () { + ${S}/configure --verbose --prefix=${prefix} \ + ${@oe.utils.parallel_make_argument(d, '--parallel=%d')} \ + ${@bb.utils.contains('CCACHE', 'ccache ', '--enable-ccache', '', d)} \ + -- ${CMAKE_EXTRACONF} +} + +do_compile() { + oe_runmake +} + +do_install() { + oe_runmake 'DESTDIR=${D}' install + + # The following codes are here because eSDK needs to provide compatibilty + # for SDK. That is, eSDK could also be used like traditional SDK. + mkdir -p ${D}${datadir}/cmake + install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/ + mkdir -p ${D}${base_prefix}/environment-setup.d + install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${base_prefix}/environment-setup.d/cmake.sh +} + +do_compile[progress] = "percent" + +SYSROOT_DIRS_NATIVE += "${datadir}/cmake ${base_prefix}/environment-setup.d" diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake.inc b/meta-balena-dunfell/recipes-devtools/cmake/cmake.inc new file mode 100644 index 0000000000..2e6059f980 --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake.inc @@ -0,0 +1,30 @@ +# Copyright (C) 2005, Koninklijke Philips Electronics NV. All Rights Reserved +# Released under the MIT license (see packages/COPYING) + +SUMMARY = "Cross-platform, open-source make system" +DESCRIPTION = "CMake is used to control the software compilation process \ +using simple platform and compiler independent configuration files. CMake \ +generates native makefiles and workspaces that can be used in the compiler \ +environment of your choice." +HOMEPAGE = "http://www.cmake.org/" +BUGTRACKER = "http://public.kitware.com/Bug/my_view_page.php" +SECTION = "console/utils" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://Copyright.txt;md5=31023e1d3f51ca90a58f55bcee8e2339 \ + file://Source/cmake.h;beginline=1;endline=2;md5=a5f70e1fef8614734eae0d62b4f5891b \ + " + +CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}" + +SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz \ + file://0003-cmake-support-OpenEmbedded-Qt4-tool-binary-names.patch \ + file://0004-Fail-silently-if-system-Qt-installation-is-broken.patch \ +" + +SRC_URI[sha256sum] = "3f1808b9b00281df06c91dd7a021d7f52f724101000da7985a401678dfe035b0" + +UPSTREAM_CHECK_REGEX = "cmake-(?P\d+(\.\d+)+)\.tar" + +# This is specific to the npm package that installs cmake, so isn't +# relevant to OpenEmbedded +CVE_CHECK_WHITELIST += "CVE-2016-10642" diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake/0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch new file mode 100644 index 0000000000..06e10bf861 --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch @@ -0,0 +1,44 @@ +From ac9b8d316ff3e013bc9d3c063db99aa1f064ce6a Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Thu, 27 Apr 2017 11:35:05 -0400 +Subject: [PATCH] CMakeDetermineSystem: use oe environment vars to load default + toolchain file in sdk + +Passing the toolchain by: + + - shell aliases does not work if cmake is called by a script + - unconditionally by a wrapper script causes cmake to believe it is + configuring things when it is not (for example, `cmake --build` breaks). + +The OE_CMAKE_TOOLCHAIN_FILE variable is only used as a default if no +toolchain is explicitly specified. + +Setting the CMAKE_TOOLCHAIN_FILE cmake variable is marked as cached +because '-D' options are cache entries themselves. + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Cody P Schafer +Signed-off-by: Otavio Salvador + +--- + Modules/CMakeDetermineSystem.cmake | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake +index bae270d..5bb6bc0 100644 +--- a/Modules/CMakeDetermineSystem.cmake ++++ b/Modules/CMakeDetermineSystem.cmake +@@ -111,6 +111,13 @@ else() + endif() + endif() + ++if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) ++ if(DEFINED ENV{OE_CMAKE_TOOLCHAIN_FILE}) ++ set(CMAKE_TOOLCHAIN_FILE "$ENV{OE_CMAKE_TOOLCHAIN_FILE}" CACHE FILEPATH "toolchain file") ++ message(STATUS "Toolchain file defaulted to '${CMAKE_TOOLCHAIN_FILE}'") ++ endif() ++endif() ++ + # if a toolchain file is used, the user wants to cross compile. + # in this case read the toolchain file and keep the CMAKE_HOST_SYSTEM_* + # variables around so they can be used in CMakeLists.txt. diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake/0003-cmake-support-OpenEmbedded-Qt4-tool-binary-names.patch b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0003-cmake-support-OpenEmbedded-Qt4-tool-binary-names.patch new file mode 100644 index 0000000000..575a5cb7fb --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0003-cmake-support-OpenEmbedded-Qt4-tool-binary-names.patch @@ -0,0 +1,56 @@ +From 2d02ac91d5a5d72eaddba4894eaa6db3ed8fee62 Mon Sep 17 00:00:00 2001 +From: Otavio Salvador +Date: Thu, 12 May 2011 15:36:03 +0000 +Subject: [PATCH] cmake: support OpenEmbedded Qt4 tool binary names + +The FindQt4 module looks for Qt4 binaries to be able to gather the +paths used for compilation and also to be using during other processes +(translation update, translation binary generating and like) however +OpenEmbedded has renamed those to allow old QMake to be used in +parallel with the current one. This patch adds support for the +OpenEmbedded specific binary names. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Otavio Salvador + +The patch was slightly adapted in order to match cmake 3.2.2: +Instead of find_program, _find_qt4_program is now used. + +Signed-off-by: Moritz Blume +Signed-off-by: Otavio Salvador + +--- + Modules/FindQt4.cmake | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake +index 3993968..b2a8585 100644 +--- a/Modules/FindQt4.cmake ++++ b/Modules/FindQt4.cmake +@@ -518,7 +518,7 @@ endfunction() + + set(QT4_INSTALLED_VERSION_TOO_OLD FALSE) + +-set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac) ++set(_QT4_QMAKE_NAMES qmake qmake2 qmake4 qmake-qt4 qmake-mac) + _qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION) + + if (QT_QMAKE_EXECUTABLE AND +@@ -1136,12 +1136,12 @@ if (QT_QMAKE_EXECUTABLE AND + _find_qt4_program(QT_MOC_EXECUTABLE Qt4::moc moc-qt4 moc4 moc) + _find_qt4_program(QT_UIC_EXECUTABLE Qt4::uic uic-qt4 uic4 uic) + _find_qt4_program(QT_UIC3_EXECUTABLE Qt4::uic3 uic3) +- _find_qt4_program(QT_RCC_EXECUTABLE Qt4::rcc rcc) +- _find_qt4_program(QT_DBUSCPP2XML_EXECUTABLE Qt4::qdbuscpp2xml qdbuscpp2xml) +- _find_qt4_program(QT_DBUSXML2CPP_EXECUTABLE Qt4::qdbusxml2cpp qdbusxml2cpp) ++ _find_qt4_program(QT_RCC_EXECUTABLE Qt4::rcc rcc4 rcc) ++ _find_qt4_program(QT_DBUSCPP2XML_EXECUTABLE Qt4::qdbuscpp2xml qdbuscpp2xml4 qdbuscpp2xml) ++ _find_qt4_program(QT_DBUSXML2CPP_EXECUTABLE Qt4::qdbusxml2cpp qdbusxml2cpp4 qdbusxml2cpp) + _find_qt4_program(QT_LUPDATE_EXECUTABLE Qt4::lupdate lupdate-qt4 lupdate4 lupdate) + _find_qt4_program(QT_LRELEASE_EXECUTABLE Qt4::lrelease lrelease-qt4 lrelease4 lrelease) +- _find_qt4_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE Qt4::qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator) ++ _find_qt4_program(QT_QCOLLECTIONGENERATOR_EXECUTABLE Qt4::qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator qcollectiongenerator4) + _find_qt4_program(QT_DESIGNER_EXECUTABLE Qt4::designer designer-qt4 designer4 designer) + _find_qt4_program(QT_LINGUIST_EXECUTABLE Qt4::linguist linguist-qt4 linguist4 linguist) + diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake/0004-Fail-silently-if-system-Qt-installation-is-broken.patch b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0004-Fail-silently-if-system-Qt-installation-is-broken.patch new file mode 100644 index 0000000000..1b196db81a --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0004-Fail-silently-if-system-Qt-installation-is-broken.patch @@ -0,0 +1,79 @@ +From 60864efbe52cc12018efaafbc4e4c3c8b4af2b65 Mon Sep 17 00:00:00 2001 +From: Otavio Salvador +Date: Thu, 5 Jul 2018 10:26:48 -0300 +Subject: [PATCH] Fail silently if system Qt installation is broken + +Fixes a regression in behaviour from 2.8.10 to 2.8.11 resulting in the +following error if the system Qt installation is broken: + +CMake Error at Modules/FindQt4.cmake:1028 (set_property): + set_property could not find TARGET Qt4::QtCore. Perhaps it has not yet + been created. +Call Stack (most recent call first): + Tests/RunCMake/CMakeLists.txt:79 (find_package) + +Upstream-Status: Pending + +Signed-off-by: Paul Eggleton + +The patch was slightly adapted in order to match cmake 3.2.2: +Another set_property was introduced which had to be included +within the if(QT_QTCORE_FOUND) statement. + +Signed-off-by: Moritz Blume +Signed-off-by: Otavio Salvador + +--- + Modules/FindQt4.cmake | 39 ++++++++++++++++++++------------------- + 1 file changed, 20 insertions(+), 19 deletions(-) + +diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake +index b2a8585..77c89aa 100644 +--- a/Modules/FindQt4.cmake ++++ b/Modules/FindQt4.cmake +@@ -988,25 +988,26 @@ if (QT_QMAKE_EXECUTABLE AND + endif() + endmacro() + +- +- # Set QT_xyz_LIBRARY variable and add +- # library include path to QT_INCLUDES +- _QT4_ADJUST_LIB_VARS(QtCore) +- set_property(TARGET Qt4::QtCore APPEND PROPERTY +- INTERFACE_INCLUDE_DIRECTORIES +- "${QT_MKSPECS_DIR}/default" +- ${QT_INCLUDE_DIR} +- ) +- set_property(TARGET Qt4::QtCore APPEND PROPERTY +- INTERFACE_COMPILE_DEFINITIONS +- $<$>:QT_NO_DEBUG> +- ) +- set_property(TARGET Qt4::QtCore PROPERTY +- INTERFACE_QT_MAJOR_VERSION 4 +- ) +- set_property(TARGET Qt4::QtCore APPEND PROPERTY +- COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION +- ) ++ if(QT_QTCORE_FOUND) ++ # Set QT_xyz_LIBRARY variable and add ++ # library include path to QT_INCLUDES ++ _QT4_ADJUST_LIB_VARS(QtCore) ++ set_property(TARGET Qt4::QtCore APPEND PROPERTY ++ INTERFACE_INCLUDE_DIRECTORIES ++ "${QT_MKSPECS_DIR}/default" ++ ${QT_INCLUDE_DIR} ++ ) ++ set_property(TARGET Qt4::QtCore APPEND PROPERTY ++ INTERFACE_COMPILE_DEFINITIONS ++ $<$>:QT_NO_DEBUG> ++ ) ++ set_property(TARGET Qt4::QtCore PROPERTY ++ INTERFACE_QT_MAJOR_VERSION 4 ++ ) ++ set_property(TARGET Qt4::QtCore APPEND PROPERTY ++ COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION ++ ) ++ endif() + + foreach(QT_MODULE ${QT_MODULES}) + _QT4_ADJUST_LIB_VARS(${QT_MODULE}) diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake/0005-Disable-use-of-ext2fs-ext2_fs.h-by-cmake-s-internal-.patch b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0005-Disable-use-of-ext2fs-ext2_fs.h-by-cmake-s-internal-.patch new file mode 100644 index 0000000000..d6f7308fe0 --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake/0005-Disable-use-of-ext2fs-ext2_fs.h-by-cmake-s-internal-.patch @@ -0,0 +1,39 @@ +From fd9a04c1434e12f21c043385e306e0b52d38d749 Mon Sep 17 00:00:00 2001 +From: Otavio Salvador +Date: Thu, 5 Jul 2018 10:28:04 -0300 +Subject: [PATCH] Disable use of ext2fs/ext2_fs.h by cmake's internal + + libarchive copy +Organization: O.S. Systems Software LTDA. + +We don't want to add a dependency on e2fsprogs-native for cmake-native, +and we don't use CPack so just disable this functionality. + +Upstream-Status: Inappropriate [config] + +Signed-off-by: Paul Eggleton +Signed-off-by: Otavio Salvador + +--- + Utilities/cmlibarchive/CMakeLists.txt | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt +index bfcaf30..2960683 100644 +--- a/Utilities/cmlibarchive/CMakeLists.txt ++++ b/Utilities/cmlibarchive/CMakeLists.txt +@@ -682,12 +682,8 @@ LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H) + LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H) + LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) + LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) +-LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H) +- +-CHECK_C_SOURCE_COMPILES("#include +-#include +-int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS) +- ++SET(HAVE_EXT2FS_EXT2_FS_H 0) ++SET(HAVE_WORKING_EXT2_IOC_GETFLAGS 0) + LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H) + LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H) + LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake b/meta-balena-dunfell/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake new file mode 100644 index 0000000000..8f6f3a272d --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake/OEToolchainConfig.cmake @@ -0,0 +1,25 @@ +set( CMAKE_SYSTEM_NAME Linux ) +set( CMAKE_C_FLAGS $ENV{CFLAGS} CACHE STRING "" FORCE ) +set( CMAKE_CXX_FLAGS $ENV{CXXFLAGS} CACHE STRING "" FORCE ) +set( CMAKE_ASM_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE ) +set( CMAKE_LDFLAGS_FLAGS ${CMAKE_CXX_FLAGS} CACHE STRING "" FORCE ) +set( CMAKE_SYSROOT $ENV{OECORE_TARGET_SYSROOT} ) + +set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_TARGET_SYSROOT} ) +set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) +set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY ) + +set(CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX "$ENV{OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX}") + +# Set CMAKE_SYSTEM_PROCESSOR from the sysroot name (assuming processor-distro-os). +if ($ENV{SDKTARGETSYSROOT} MATCHES "/sysroots/([a-zA-Z0-9_-]+)-.+-.+") + set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_MATCH_1}) +endif() + +# Include the toolchain configuration subscripts +file( GLOB toolchain_config_files "${CMAKE_CURRENT_LIST_FILE}.d/*.cmake" ) +foreach(config ${toolchain_config_files}) + include(${config}) +endforeach() diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake/environment.d-cmake.sh b/meta-balena-dunfell/recipes-devtools/cmake/cmake/environment.d-cmake.sh new file mode 100644 index 0000000000..7bdb19fb6c --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake/environment.d-cmake.sh @@ -0,0 +1,2 @@ +export OE_CMAKE_TOOLCHAIN_FILE="$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake" +export OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX="`echo $OECORE_BASELIB | sed -e s/lib//`" diff --git a/meta-balena-dunfell/recipes-devtools/cmake/cmake_3.20.1.bb b/meta-balena-dunfell/recipes-devtools/cmake/cmake_3.20.1.bb new file mode 100644 index 0000000000..64c92b89f2 --- /dev/null +++ b/meta-balena-dunfell/recipes-devtools/cmake/cmake_3.20.1.bb @@ -0,0 +1,53 @@ +require cmake.inc + +inherit cmake bash-completion + +DEPENDS += "curl expat zlib libarchive xz ncurses bzip2" + +SRC_URI_append_class-nativesdk = " \ + file://OEToolchainConfig.cmake \ + file://environment.d-cmake.sh \ + file://0001-CMakeDetermineSystem-use-oe-environment-vars-to-load.patch \ +" + +# Strip ${prefix} from ${docdir}, set result into docdir_stripped +python () { + prefix=d.getVar("prefix") + docdir=d.getVar("docdir") + + if not docdir.startswith(prefix): + bb.fatal('docdir must contain prefix as its prefix') + + docdir_stripped = docdir[len(prefix):] + if len(docdir_stripped) > 0 and docdir_stripped[0] == '/': + docdir_stripped = docdir_stripped[1:] + + d.setVar("docdir_stripped", docdir_stripped) +} + +EXTRA_OECMAKE=" \ + -DCMAKE_DOC_DIR=${docdir_stripped}/cmake-${CMAKE_MAJOR_VERSION} \ + -DCMAKE_USE_SYSTEM_LIBRARIES=1 \ + -DCMAKE_USE_SYSTEM_LIBRARY_JSONCPP=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=0 \ + -DCMAKE_USE_SYSTEM_LIBRARY_LIBRHASH=0 \ + -DKWSYS_CHAR_IS_SIGNED=1 \ + -DBUILD_CursesDialog=0 \ + -DKWSYS_LFS_WORKS=1 \ +" + +do_install_append_class-nativesdk() { + mkdir -p ${D}${datadir}/cmake + install -m 644 ${WORKDIR}/OEToolchainConfig.cmake ${D}${datadir}/cmake/ + + mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d + install -m 644 ${WORKDIR}/environment.d-cmake.sh ${D}${SDKPATHNATIVE}/environment-setup.d/cmake.sh +} + +FILES_${PN}_append_class-nativesdk = " ${SDKPATHNATIVE}" + +FILES_${PN} += "${datadir}/cmake-${CMAKE_MAJOR_VERSION} ${datadir}/cmake ${datadir}/aclocal ${datadir}/emacs ${datadir}/vim" +FILES_${PN}-doc += "${docdir}/cmake-${CMAKE_MAJOR_VERSION}" +FILES_${PN}-dev = "" + +BBCLASSEXTEND = "nativesdk"