Thu Jan 12 19:32:37 2023 UTC ()
cmake: copy mk/configure/cmake.mk to configure-settings.mk

for use with cmake/build.mk

Don't bother with CMAKE_DEPENDENCIES_REWRITE - only ever used by
kdelibs4 and kdepimlibs4

Don't bother with CMAKE_MODULE_PATH_OVERRIDE - doesn't appear to make
any functional difference these days.


(markd)
diff -r1.5 -r1.6 pkgsrc/devel/cmake/build.mk
diff -r0 -r1.1 pkgsrc/devel/cmake/configure-settings.mk

cvs diff -r1.5 -r1.6 pkgsrc/devel/cmake/build.mk (expand / switch to unified diff)

--- pkgsrc/devel/cmake/build.mk 2022/09/28 10:05:35 1.5
+++ pkgsrc/devel/cmake/build.mk 2023/01/12 19:32:37 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: build.mk,v 1.5 2022/09/28 10:05:35 markd Exp $ 1# $NetBSD: build.mk,v 1.6 2023/01/12 19:32:37 markd Exp $
2# 2#
3# This Makefile fragment supports building using the CMake build tool. 3# This Makefile fragment supports building using the CMake build tool.
4# 4#
5# User-settable variables: 5# User-settable variables:
6# 6#
7# CMAKE_GENERATOR 7# CMAKE_GENERATOR
8# Which build tool to use. 8# Which build tool to use.
9# 9#
10# Possible: make ninja 10# Possible: make ninja
11# Default: make 11# Default: make
12# 12#
13# Package-settable variables: 13# Package-settable variables:
14# 14#
@@ -55,26 +55,28 @@ CMAKE_INSTALL_ARGS?= # empty @@ -55,26 +55,28 @@ CMAKE_INSTALL_ARGS?= # empty
55TOOL_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build 55TOOL_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
56_CMAKE_BUILD_SYSTEM?= Ninja 56_CMAKE_BUILD_SYSTEM?= Ninja
57_CMAKE_BUILD_TOOL?= ninja 57_CMAKE_BUILD_TOOL?= ninja
58.else 58.else
59_CMAKE_BUILD_SYSTEM?= Unix Makefiles 59_CMAKE_BUILD_SYSTEM?= Unix Makefiles
60_CMAKE_BUILD_TOOL?= ${MAKE_PROGRAM} 60_CMAKE_BUILD_TOOL?= ${MAKE_PROGRAM}
61.endif 61.endif
62 62
63CONFIGURE_DIRS?= . 63CONFIGURE_DIRS?= .
64BUILD_DIRS?= ${CONFIGURE_DIRS} 64BUILD_DIRS?= ${CONFIGURE_DIRS}
65TEST_DIRS?= ${CONFIGURE_DIRS} 65TEST_DIRS?= ${CONFIGURE_DIRS}
66INSTALL_DIRS?= ${CONFIGURE_DIRS} 66INSTALL_DIRS?= ${CONFIGURE_DIRS}
67 67
 68_CMAKE_CONFIGURE_SETTINGS= yes
 69
68.PHONY: cmake-configure cmake-build cmake-test cmake-install 70.PHONY: cmake-configure cmake-build cmake-test cmake-install
69 71
70do-configure: cmake-configure 72do-configure: cmake-configure
71cmake-configure: 73cmake-configure:
72.for d in ${CONFIGURE_DIRS} 74.for d in ${CONFIGURE_DIRS}
73 ${RUN} cd ${WRKSRC}/${d} && ${SETENV} ${CONFIGURE_ENV} cmake \ 75 ${RUN} cd ${WRKSRC}/${d} && ${SETENV} ${CONFIGURE_ENV} cmake \
74 --install-prefix ${PREFIX} \ 76 --install-prefix ${PREFIX} \
75 -B ${CMAKE_BUILD_DIR} \ 77 -B ${CMAKE_BUILD_DIR} \
76 -G ${_CMAKE_BUILD_SYSTEM:Q} \ 78 -G ${_CMAKE_BUILD_SYSTEM:Q} \
77 ${CMAKE_CONFIGURE_ARGS} 79 ${CMAKE_CONFIGURE_ARGS}
78.endfor 80.endfor
79 81
80do-build: cmake-build 82do-build: cmake-build

File Added: pkgsrc/devel/cmake/configure-settings.mk
# $NetBSD: configure-settings.mk,v 1.1 2023/01/12 19:32:37 markd Exp $
#
# This file handles packages that use CMake as their primary build
# system. For more information about CMake, see http://www.cmake.org/.
#
# Package-settable variables:
#
# CMAKE_MODULE_PATH_OVERRIDE
#	Deprecated
#	A list of files relative to WRKSRC in which the CMAKE_MODULE_PATH
#	variable is adjusted to include the path from the pkgsrc wrappers.
#	The file ${WRKSRC}/CMakeLists.txt is always appended to this list.
#
# CMAKE_PKGSRC_BUILD_FLAGS
#	If set to yes, disable compiler optimization flags associated
#	with the CMAKE_BUILD_TYPE setting (for pkgsrc these come in from
#	the user via variables like CFLAGS).  The default is yes, but you can
#	set it to no for pkgsrc packages that do not use a compiler to avoid
#	cmake "Manually-specified variables were not used by the project"
#	warnings associated with this variable.
#
# CMAKE_PREFIX_PATH
#	A list of directories to add the CMAKE_PREFIX_PATH cmake variable.
#	If a package installs its contents in ${PREFIX}/package instead of
#	${PREFIX} and it installs cmake modules there 
#	"CMAKE_PREFIX_PATH += ${PREFIX}/package" should be in its 
#	buildlink3.mk so that packages that depend on it can find its 
#	cmake modules if they use cmake to build.
#
# CMAKE_USE_GNU_INSTALL_DIRS
#	If set to yes, set GNU standard installation directories with pkgsrc
#	configured settings.  The default is yes.
#
# CMAKE_INSTALL_PREFIX
#	Destination directory to install software. The default is ${PREFIX}.
#
# CMAKE_INSTALL_NAME_DIR
#       Destination directory to install shlibs, used by
#       install_name_tool(1) on macOS. The default is ${PREFIX}/lib.
#

_CMAKE_MOD_DIR=	${BUILDLINK_DIR}/cmake-Modules

.if !empty(USE_LANGUAGES) && ${INSTALL_UNSTRIPPED:Uno:tl} != yes
INSTALL_TARGET?=	install/strip
.endif

CMAKE_USE_GNU_INSTALL_DIRS?=	yes

CMAKE_INSTALL_PREFIX?=	${PREFIX}
CMAKE_INSTALL_NAME_DIR?=${PREFIX}/lib

CMAKE_CONFIGURE_ARGS+=	-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
.if empty(CMAKE_PKGSRC_BUILD_FLAGS:M[nN][oO])
CMAKE_CONFIGURE_ARGS+=    -DCMAKE_PKGSRC_BUILD_FLAGS:BOOL=TRUE
.endif

.if ${OPSYS} != "Darwin"
# Arguably, we should pass CMAKE_BUILD_RPATH and CMAKE_INSTALL_RPATH
# both equal to ${PREFIX}/lib, and omit -Wl,-R from LDFLAGS, to align
# with how cmake thinks RPATH should be handled, but that is a
# somewhat risky change.
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_SKIP_RPATH:BOOL=TRUE
.else
# TODO: Explain this better.
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_SKIP_RPATH:BOOL=FALSE
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_INSTALL_NAME_DIR:PATH=${CMAKE_INSTALL_NAME_DIR}
.endif

.if defined(CMAKE_USE_GNU_INSTALL_DIRS) && empty(CMAKE_USE_GNU_INSTALL_DIRS:M[nN][oO])
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_INSTALL_LIBDIR:PATH=lib
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_INSTALL_MANDIR:PATH=${PKGMANDIR}
.  if defined(INFO_FILES)
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_INSTALL_INFODIR:PATH=${PKGINFODIR}
.  endif
.  if defined(USE_PKGLOCALEDIR) && empty(USE_PKGLOCALEDIR:M[nN][oO])
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_INSTALL_LOCALEDIR:PATH=${PKGLOCALEDIR}/locale
.  endif
.endif
.if !empty(MACHINE_PLATFORM:MDarwin-*-aarch64)
CMAKE_CONFIGURE_ARGS+=	-DCMAKE_APPLE_SILICON_PROCESSOR=arm64
.endif

.if defined(CMAKE_PREFIX_PATH)
CMAKE_CONFIGURE_ARGS+=-DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH:ts;:Q}
.endif