mirror of
https://github.com/openwrt/openwrt.git
synced 2026-11-27 16:50:30 +04:00
Instead of carrying 110-liblzma.patch and 140-zlib.patch, which make
FindLibLZMA and FindZLIB search with pkg-config, pass the staging
include and library paths to CMake's bootstrap script. This avoids
refreshing the patches on every CMake update.
LIBLZMA_INCLUDE_DIR, LIBLZMA_LIBRARY, ZLIB_INCLUDE_DIR and ZLIB_LIBRARY
are cache variables, so setting them skips the search, and CMake links
the static libraries from staging instead of the host ones.
This replaces the patches introduced in 3848cf458e ("tools/cmake:
Build without some included libs").
Tested on Linux with the host zlib and liblzma development packages
installed: cmake, ctest and cpack link the staging libraries.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26619
Signed-off-by: Robert Marko <robimarko@gmail.com>
72 lines
1.9 KiB
Makefile
72 lines
1.9 KiB
Makefile
#
|
|
# Copyright (C) 2006-2016 OpenWrt.org
|
|
#
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
# See /LICENSE for more information.
|
|
#
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
PKG_NAME:=cmake
|
|
PKG_VERSION:=4.4.3
|
|
PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION)))
|
|
PKG_RELEASE:=3
|
|
PKG_CPE_ID:=cpe:/a:kitware:cmake
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \
|
|
https://cmake.org/files/v$(PKG_VERSION_MAJOR)/
|
|
PKG_HASH:=c46400618b4f1f2b43507f24fb22f3ae830c3416cf23b776e16e1d413aa892f0
|
|
|
|
HOST_BUILD_PARALLEL:=1
|
|
HOST_CONFIGURE_PARALLEL:=1
|
|
|
|
include $(INCLUDE_DIR)/host-build.mk
|
|
|
|
HOST_CONFIGURE_VARS += \
|
|
CC="$(HOSTCC_NOCACHE)" \
|
|
CXX="$(HOSTCXX_NOCACHE)" \
|
|
MAKEFLAGS="$(HOST_JOBS)" \
|
|
CXXFLAGS="$(HOST_CFLAGS)" \
|
|
MAKE="$(STAGING_DIR_HOST)/bin/ninja"
|
|
|
|
HOST_CONFIGURE_ARGS := \
|
|
--no-debugger \
|
|
$(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") \
|
|
--prefix="$(STAGING_DIR_HOST)" \
|
|
--system-expat \
|
|
--system-liblzma \
|
|
--system-zlib \
|
|
--system-zstd \
|
|
--generator=Ninja
|
|
|
|
CMAKE_HOST_OPTIONS = \
|
|
-DLIBLZMA_INCLUDE_DIR="$(STAGING_DIR_HOST)/include" \
|
|
-DLIBLZMA_LIBRARY="$(STAGING_DIR_HOST)/lib/liblzma.a" \
|
|
-DZLIB_INCLUDE_DIR="$(STAGING_DIR_HOST)/include" \
|
|
-DZLIB_LIBRARY="$(STAGING_DIR_HOST)/lib/libz.a" \
|
|
-DZSTD_INCLUDE_DIR="$(STAGING_DIR_HOST)/include" \
|
|
-DZSTD_LIBRARY="$(STAGING_DIR_HOST)/lib/libzstd.a" \
|
|
-DBUILD_TESTING=OFF
|
|
|
|
define Host/Configure
|
|
$(call Host/Configure/Default,-- $(CMAKE_HOST_OPTIONS))
|
|
endef
|
|
|
|
define Host/Compile/Default
|
|
+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
|
|
endef
|
|
|
|
define Host/Install/Default
|
|
+$(NINJA) -C $(HOST_BUILD_DIR) install
|
|
endef
|
|
|
|
define Host/Uninstall/Default
|
|
+$(NINJA) -C $(HOST_BUILD_DIR) uninstall
|
|
endef
|
|
|
|
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
|
|
HOST_MAKE_FLAGS += VERBOSE=1
|
|
endif
|
|
|
|
$(eval $(call HostBuild))
|