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