Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F105945297
D44509.id136224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D44509.id136224.diff
View Options
diff --git a/CHANGES b/CHANGES
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,14 @@
All ports committers are allowed to commit to this file.
+20240326:
+AUTHOR: makc@FreeBSD.org
+
+ USES=cmake now support noconf argument. This argument adds cmake binary to
+ the BUILD_DEPENDS and and exposes CMAKE_ARGS and some other helpers, but
+ does not run cmake on configure stage. cmake:noconf is intended primarily
+ for ports, which use meson or pep517 for build.
+
20240229:
AUTHOR: tijl@FreeBSD.org
diff --git a/Mk/Uses/cmake.mk b/Mk/Uses/cmake.mk
--- a/Mk/Uses/cmake.mk
+++ b/Mk/Uses/cmake.mk
@@ -2,9 +2,12 @@
#
# Feature: cmake
# Usage: USES=cmake or USES=cmake:ARGS
-# Valid ARGS: insource, run, noninja, testing
+# Valid ARGS: insource, noconf, noninja, run, testing
# ARGS description:
# insource do not perform an out-of-source build
+# noconf don't run cmake for configure stage, only add build dependency.
+# This should be set only for ports, which use other build systems,
+# e.g. pep517 or meson, but rely internally on cmake.
# noninja don't use ninja instead of make
# Setting this should be an exception, and hints to an issue
# inside the ports build system.
@@ -31,6 +34,7 @@
# CMAKE_OFF Appends -D<var>:bool=OFF to the CMAKE_ARGS.
# CMAKE_ARGS - Arguments passed to cmake
# Default: see below
+# Variables for ports, which use cmake for configure
# CMAKE_BUILD_TYPE - Type of build (cmake predefined build types).
# Projects may have their own build profiles.
# CMake supports the following types: Debug,
@@ -38,19 +42,28 @@
# Debug and Release profiles respect system
# CFLAGS, RelWithDebInfo and MinSizeRel will set
# CFLAGS to "-O2 -g" and "-Os -DNDEBUG".
-# Default: Release, if WITH_DEBUG is not set,
-# Debug otherwise
+# Default: Release, if neither WITH_DEBUG nor WITH_DEBUGINFO is set,
+# RelWithDebInfo, if WITH_DEBUGINFO is set,
+# Debug, if WITH_DEBUG is set.
# CMAKE_SOURCE_PATH - Path to the source directory
# Default: ${WRKSRC}
+# Variables for ports, which use cmake for testing
+# CMAKE_TESTING_ARGS - Additional arguments passed to cmake on test target.
+# CMAKE_TESTING_ON Appends -D<var>:bool=ON to the CMAKE_TESTING_ARGS.
+# Default: BUILD_TESTING
+# CMAKE_TESTING_OFF Appends -D<var>:bool=OFF to the CMAKE_TESTING_ARGS.
+# Default: empty
+# CMAKE_TESTING_TARGET - Name of the test target. Default: test
#
# MAINTAINER: kde@FreeBSD.org
.if !defined(_INCLUDE_USES_CMAKE_MK)
_INCLUDE_USES_CMAKE_MK= yes
-_valid_ARGS= insource run noninja testing _internal
+_valid_ARGS= insource noconf noninja run testing _internal
_CMAKE_VERSION= 3.28.3
+CMAKE_BIN= ${LOCALBASE}/bin/cmake
# Sanity check
. for arg in ${cmake_ARGS}
@@ -59,12 +72,14 @@
. endif
. endfor
-# Check whehter other flags than only '_internal' are passed (this should be equivalent to PORT = devel/cmake-core
-. if ${cmake_ARGS} != _internal
-CMAKE_BIN= ${LOCALBASE}/bin/cmake
+. if !empty(cmake_ARGS:M_internal)
+# _internal is intended only for devel/cmake-core
+MASTER_SITES?= https://github.com/Kitware/CMake/releases/download/v${DISTVERSION}/ \
+ https://www.cmake.org/files/v${DISTVERSION}/
+. else
BUILD_DEPENDS+= ${CMAKE_BIN}:devel/cmake-core
-. if ${cmake_ARGS:Mrun}
+. if !empty(cmake_ARGS:Mrun)
RUN_DEPENDS+= ${CMAKE_BIN}:devel/cmake-core
. endif
@@ -76,12 +91,6 @@
CMAKE_BUILD_TYPE?= Release
. endif #defined(WITH_DEBUG)
-PLIST_SUB+= CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:tl}"
-
-. if defined(STRIP) && ${STRIP} != "" && !defined(WITH_DEBUG) && !defined(WITH_DEBUGINFO)
-INSTALL_TARGET?= install/strip
-. endif
-
CMAKE_ARGS+= -DCMAKE_C_COMPILER:STRING="${CC}" \
-DCMAKE_CXX_COMPILER:STRING="${CXX}" \
-DCMAKE_C_FLAGS:STRING="${CFLAGS}" \
@@ -116,6 +125,17 @@
. if defined(CMAKE_NOCOLOR)
CMAKE_ARGS+= -DCMAKE_COLOR_MAKEFILE:BOOL=OFF
. endif
+. endif
+
+. if empty(cmake_ARGS:Mnoconf)
+. if defined(STRIP) && ${STRIP} != "" && !defined(WITH_DEBUG) && !defined(WITH_DEBUGINFO)
+INSTALL_TARGET?= install/strip
+. endif
+. endif
+
+# Use cmake for configure stage and for testing
+. if empty(cmake_ARGS:M_internal) && empty(cmake_ARGS:Mnoconf)
+PLIST_SUB+= CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE:tl}"
_CMAKE_MSG= "===> Performing in-source build"
CMAKE_SOURCE_PATH?= ${WRKSRC}
@@ -176,10 +196,4 @@
. endif
. endif
-. if !empty(cmake_ARGS:M_internal)
-MASTER_SITES?= https://github.com/Kitware/CMake/releases/download/v${DISTVERSION}/ \
- https://www.cmake.org/files/v${DISTVERSION}/
-
-. endif
-
.endif #!defined(_INCLUDE_USES_CMAKE_MK)
diff --git a/devel/cmake-core/Makefile b/devel/cmake-core/Makefile
--- a/devel/cmake-core/Makefile
+++ b/devel/cmake-core/Makefile
@@ -55,12 +55,6 @@
CPACK_DESC= Enable FreeBSD generator in CPack
CPACK_LIB_DEPENDS= libpkg.so:${PKG_ORIGIN}
-.include <bsd.port.pre.mk>
-
-.if defined(STRIP) && ${STRIP} != "" && !defined(WITH_DEBUG)
-INSTALL_TARGET= install/strip
-.endif
-
# Before running configure, substitute in the values of options
# for the build. CMake's configure doesn't accept --with-foo
# or similar options: it expects them to be set in CMake-style
@@ -109,4 +103,4 @@
# source directories, but gets accidentally installed.
@${FIND} ${STAGEDIR}${PREFIX} -name ".NoDartCoverage" -delete
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 10:48 PM (19 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15580594
Default Alt Text
D44509.id136224.diff (5 KB)
Attached To
Mode
D44509: cmake.mk: add indirect argument for ports
Attached
Detach File
Event Timeline
Log In to Comment