mirror of
				https://github.com/optim-enterprises-bv/openwrt-ipq.git
				synced 2025-11-03 19:58:34 +00:00 
			
		
		
		
	tools/cmake: Build without some included libs
Saves a little bit of time when compiling cmake. Added patches to fix searching liblzma and zlib. The issue is that because pkgconfig is not used, the system libraries get used. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
		
				
					committed by
					
						
						Christian Marangi
					
				
			
			
				
	
			
			
			
						parent
						
							89df3589e6
						
					
				
				
					commit
					3848cf458e
				
			@@ -45,7 +45,7 @@ $(curdir)/b43-tools/compile := $(curdir)/bison/compile
 | 
				
			|||||||
$(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile
 | 
					$(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile
 | 
				
			||||||
$(curdir)/bison/compile := $(curdir)/flex/compile
 | 
					$(curdir)/bison/compile := $(curdir)/flex/compile
 | 
				
			||||||
$(curdir)/cbootimage/compile += $(curdir)/automake/compile
 | 
					$(curdir)/cbootimage/compile += $(curdir)/automake/compile
 | 
				
			||||||
$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile
 | 
					$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(curdir)/expat/compile $(curdir)/xz/compile $(curdir)/zlib/compile $(curdir)/zstd/compile
 | 
				
			||||||
$(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
 | 
					$(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
 | 
				
			||||||
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile
 | 
					$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile
 | 
				
			||||||
$(curdir)/fakeroot/compile := $(curdir)/libtool/compile
 | 
					$(curdir)/fakeroot/compile := $(curdir)/libtool/compile
 | 
				
			||||||
@@ -90,9 +90,9 @@ else
 | 
				
			|||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
 | 
					ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
 | 
				
			||||||
$(foreach tool, $(filter-out zstd zlib xz pkgconf patch ninja meson libressl cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
 | 
					$(foreach tool, $(filter-out zstd zlib xz pkgconf patch ninja meson libressl expat cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
 | 
				
			||||||
tools-y += ccache
 | 
					tools-y += ccache
 | 
				
			||||||
$(curdir)/ccache/compile := $(curdir)/cmake/compile $(curdir)/zstd/compile
 | 
					$(curdir)/ccache/compile := $(curdir)/cmake/compile
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# in case there is no patch tool on the host we need to make patch tool a
 | 
					# in case there is no patch tool on the host we need to make patch tool a
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,8 +32,14 @@ HOST_CONFIGURE_VARS += \
 | 
				
			|||||||
HOST_CONFIGURE_ARGS := \
 | 
					HOST_CONFIGURE_ARGS := \
 | 
				
			||||||
	$(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") \
 | 
						$(if $(MAKE_JOBSERVER),--parallel="$(MAKE_JOBSERVER)") \
 | 
				
			||||||
	--prefix="$(STAGING_DIR_HOST)" \
 | 
						--prefix="$(STAGING_DIR_HOST)" \
 | 
				
			||||||
 | 
						--system-expat \
 | 
				
			||||||
 | 
						--system-liblzma \
 | 
				
			||||||
 | 
						--system-zlib \
 | 
				
			||||||
 | 
						--system-zstd \
 | 
				
			||||||
	--generator=Ninja
 | 
						--generator=Ninja
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HOST_LDFLAGS += -Wl,-rpath,$(STAGING_DIR_HOST)/lib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
define Host/Compile/Default
 | 
					define Host/Compile/Default
 | 
				
			||||||
	+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
 | 
						+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
 | 
				
			||||||
endef
 | 
					endef
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								tools/cmake/patches/110-liblzma.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								tools/cmake/patches/110-liblzma.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					--- a/Modules/FindLibLZMA.cmake
 | 
				
			||||||
 | 
					+++ b/Modules/FindLibLZMA.cmake
 | 
				
			||||||
 | 
					@@ -43,7 +43,13 @@ This module will set the following varia
 | 
				
			||||||
 | 
					   version number as a string (ex: "5.0.3")
 | 
				
			||||||
 | 
					 #]=======================================================================]
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					-find_path(LIBLZMA_INCLUDE_DIR lzma.h )
 | 
				
			||||||
 | 
					+if(UNIX)
 | 
				
			||||||
 | 
					+  find_package(PkgConfig QUIET)
 | 
				
			||||||
 | 
					+  pkg_search_module(PC_liblzma liblzma)
 | 
				
			||||||
 | 
					+endif()
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+find_path(LIBLZMA_INCLUDE_DIR lzma.h HINTS ${PC_liblzma_INCLUDEDIR} ${PC_liblzma_INCLUDE_DIRS})
 | 
				
			||||||
 | 
					+find_library(LIBLZMA_LIBRARY NAMES lzma HINTS ${PC_liblzma_LIBDIR} ${PC_liblzma_LIBRARY_DIRS})
 | 
				
			||||||
 | 
					 if(NOT LIBLZMA_LIBRARY)
 | 
				
			||||||
 | 
					   find_library(LIBLZMA_LIBRARY_RELEASE NAMES lzma liblzma NAMES_PER_DIR PATH_SUFFIXES lib)
 | 
				
			||||||
 | 
					   find_library(LIBLZMA_LIBRARY_DEBUG NAMES lzmad liblzmad NAMES_PER_DIR PATH_SUFFIXES lib)
 | 
				
			||||||
							
								
								
									
										20
									
								
								tools/cmake/patches/140-zlib.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								tools/cmake/patches/140-zlib.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					--- a/Modules/FindZLIB.cmake
 | 
				
			||||||
 | 
					+++ b/Modules/FindZLIB.cmake
 | 
				
			||||||
 | 
					@@ -85,10 +85,13 @@ else()
 | 
				
			||||||
 | 
					   set(ZLIB_NAMES_DEBUG zd zlibd zdlld zlibd1 zlib1d zlibstaticd zlibwapid zlibvcd zlibstatd)
 | 
				
			||||||
 | 
					 endif()
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					-# Try each search configuration.
 | 
				
			||||||
 | 
					-foreach(search ${_ZLIB_SEARCHES})
 | 
				
			||||||
 | 
					-  find_path(ZLIB_INCLUDE_DIR NAMES zlib.h ${${search}} PATH_SUFFIXES include)
 | 
				
			||||||
 | 
					-endforeach()
 | 
				
			||||||
 | 
					+if(UNIX)
 | 
				
			||||||
 | 
					+  find_package(PkgConfig QUIET)
 | 
				
			||||||
 | 
					+  pkg_search_module(PC_zlib zlib)
 | 
				
			||||||
 | 
					+endif()
 | 
				
			||||||
 | 
					+
 | 
				
			||||||
 | 
					+find_path(ZLIB_INCLUDE_DIR zlib.h HINTS ${PC_zlib_INCLUDEDIR} ${PC_zlib_INCLUDE_DIRS})
 | 
				
			||||||
 | 
					+find_library(ZLIB_LIBRARY NAMES z HINTS ${PC_zlib_LIBDIR} ${PC_zlib_LIBRARY_DIRS})
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 # Allow ZLIB_LIBRARY to be set manually, as the location of the zlib library
 | 
				
			||||||
 | 
					 if(NOT ZLIB_LIBRARY)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user