Skip to content

Commit

Permalink
depends: allow building packages with CMake
Browse files Browse the repository at this point in the history
Allows upgrading libzip. Adding CMake as a dependency is inevitable as
both upstream and Qt6 uses CMake as their build system.
  • Loading branch information
div72 committed Sep 23, 2024
1 parent afd6c73 commit 6efc63b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
27 changes: 27 additions & 0 deletions depends/funcs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,33 @@ endif
ifneq ($($(1)_ldflags),)
$(1)_autoconf += LDFLAGS="$$($(1)_ldflags)"
endif

# We hardcode the library install path to "lib" to match the PKG_CONFIG_PATH
# setting in depends/toolchain.cmake.in, which also hardcodes "lib".
# Without this setting, CMake by default would use the OS library
# directory, which might be "lib64" or something else, not "lib", on multiarch systems.
$(1)_cmake=env CC="$$($(1)_cc)" \
CFLAGS="$$($(1)_cppflags) $$($(1)_cflags)" \
CXX="$$($(1)_cxx)" \
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
LDFLAGS="$$($(1)_ldflags)" \
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" \
-DCMAKE_AR=`which $$($(1)_ar)` \
-DCMAKE_NM=`which $$($(1)_nm)` \
-DCMAKE_RANLIB=`which $$($(1)_ranlib)` \
-DCMAKE_INSTALL_LIBDIR=lib/ \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=$(V) \
$$($(1)_config_opts)
ifeq ($($(1)_type),build)
$(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib"
else
ifneq ($(host),$(build))
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system_name)
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host)
$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host)
endif
endif
endef

define int_add_cmds
Expand Down
1 change: 1 addition & 0 deletions depends/hosts/darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ darwin_debug_CFLAGS=-O1
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)

darwin_cmake_system=Darwin
darwin_cmake_system_name=Darwin
4 changes: 4 additions & 0 deletions depends/hosts/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ i686_linux_CXX=$(default_host_CXX) -m32
x86_64_linux_CC=$(default_host_CC) -m64
x86_64_linux_CXX=$(default_host_CXX) -m64
endif


linux_cmake_system_name=Linux
linux_cmake_system_version=3.17.0
4 changes: 4 additions & 0 deletions depends/hosts/mingw32.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ mingw32_debug_CFLAGS=-O1
mingw32_debug_CXXFLAGS=$(mingw32_debug_CFLAGS)

mingw32_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

mingw32_cmake_system_name=Windows
# Windows 7 (NT 6.1).
mingw32_cmake_system_version=6.1

0 comments on commit 6efc63b

Please sign in to comment.