1################################################################################ 2# 3# cmake 4# 5################################################################################ 6 7CMAKE_VERSION_MAJOR = 3.22 8CMAKE_VERSION = $(CMAKE_VERSION_MAJOR).3 9CMAKE_SITE = https://cmake.org/files/v$(CMAKE_VERSION_MAJOR) 10CMAKE_LICENSE = BSD-3-Clause 11CMAKE_LICENSE_FILES = Copyright.txt 12CMAKE_CPE_ID_VENDOR = cmake_project 13# Tool download MITM attack warning if using npm package to install cmake 14CMAKE_IGNORE_CVES = CVE-2016-10642 15 16# CMake is a particular package: 17# * CMake can be built using the generic infrastructure or the cmake one. 18# Since Buildroot has no requirement regarding the host system cmake 19# program presence, it uses the generic infrastructure to build the 20# host-cmake package, then the (target-)cmake package can be built 21# using the cmake infrastructure; 22# * CMake bundles its dependencies within its sources. This is the 23# reason why the host-cmake package has no dependencies:, whereas 24# the (target-)cmake package has a lot of dependencies, using only 25# the system-wide libraries instead of rebuilding and statically 26# linking with the ones bundled into the CMake sources. 27 28CMAKE_DEPENDENCIES = zlib jsoncpp libcurl libarchive expat bzip2 xz libuv rhash 29 30CMAKE_CONF_OPTS = \ 31 -DKWSYS_LFS_WORKS=TRUE \ 32 -DKWSYS_CHAR_IS_SIGNED=TRUE \ 33 -DCMAKE_USE_SYSTEM_LIBRARIES=1 \ 34 -DCTEST_USE_XMLRPC=OFF \ 35 -DBUILD_CursesDialog=OFF 36 37# Get rid of -I* options from $(HOST_CPPFLAGS) to prevent that a 38# header available in $(HOST_DIR)/include is used instead of a 39# CMake internal header, e.g. lzma* headers of the xz package 40HOST_CMAKE_CFLAGS = $(shell echo $(HOST_CFLAGS) | sed -r "s%$(HOST_CPPFLAGS)%%") 41HOST_CMAKE_CXXFLAGS = $(shell echo $(HOST_CXXFLAGS) | sed -r "s%$(HOST_CPPFLAGS)%%") 42 43# We may be a ccache dependency, so we can't use ccache 44HOST_CMAKE_CONFIGURE_OPTS = \ 45 $(HOST_CONFIGURE_OPTS) \ 46 CC="$(HOSTCC_NOCCACHE)" \ 47 GCC="$(HOSTCC_NOCCACHE)" \ 48 CXX="$(HOSTCXX_NOCCACHE)" 49 50define HOST_CMAKE_CONFIGURE_CMDS 51 (cd $(@D); \ 52 $(HOST_CMAKE_CONFIGURE_OPTS) \ 53 CFLAGS="$(HOST_CMAKE_CFLAGS)" \ 54 ./bootstrap --prefix=$(HOST_DIR) \ 55 --parallel=$(PARALLEL_JOBS) -- \ 56 -DCMAKE_C_FLAGS="$(HOST_CMAKE_CFLAGS)" \ 57 -DCMAKE_CXX_FLAGS="$(HOST_CMAKE_CXXFLAGS)" \ 58 -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \ 59 -DCMAKE_USE_OPENSSL:BOOL=OFF \ 60 -DBUILD_CursesDialog=OFF \ 61 ) 62endef 63 64define HOST_CMAKE_BUILD_CMDS 65 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) 66endef 67 68define HOST_CMAKE_INSTALL_CMDS 69 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install/fast 70endef 71 72define CMAKE_REMOVE_EXTRA_DATA 73 rm $(TARGET_DIR)/usr/bin/{cmake,cpack} 74 rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{completions,editors} 75 rm -fr $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/{Help,include} 76endef 77 78define CMAKE_INSTALL_CTEST_CFG_FILE 79 $(INSTALL) -m 0644 -D $(@D)/Modules/CMake.cmake \ 80 $(TARGET_DIR)/usr/share/cmake-$(CMAKE_VERSION_MAJOR)/Modules/CMake.cmake.ctest 81endef 82 83CMAKE_POST_INSTALL_TARGET_HOOKS += CMAKE_REMOVE_EXTRA_DATA 84CMAKE_POST_INSTALL_TARGET_HOOKS += CMAKE_INSTALL_CTEST_CFG_FILE 85 86define CMAKE_INSTALL_TARGET_CMDS 87 (cd $(@D); \ 88 $(HOST_MAKE_ENV) DESTDIR=$(TARGET_DIR) \ 89 cmake -P cmake_install.cmake \ 90 ) 91endef 92 93$(eval $(cmake-package)) 94$(eval $(host-generic-package)) 95