Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146677714
D44509.id136303.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D44509.id136303.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 in the configure step. 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 do not run cmake for configure step, 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/deskutils/mindforger/Makefile b/deskutils/mindforger/Makefile
--- a/deskutils/mindforger/Makefile
+++ b/deskutils/mindforger/Makefile
@@ -26,7 +26,8 @@
OPTIONS_DEFAULT= CMARK
CMARK_DESC= CommonMark support (Markdown -> HTML rendering)
-CMARK_BUILD_DEPENDS= cmake:devel/cmake-core
+CMARK_USES= cmake:noconf
+CMAKE_OFF= CMARK_SHARED CMARK_TESTS
CMARK_QMAKE_OFF= CONFIG+="mfnomd2html"
.include <bsd.port.options.mk>
@@ -39,9 +40,9 @@
.endif
pre-build-CMARK-on:
- @cd ${WRKSRC_cm} && cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
- -DCMARK_TESTS:BOOL=OFF -DCMARK_SHARED:BOOL=OFF \
- -B build && cmake --build build
+ @cd ${WRKSRC_cm} && ${SETENVI} ${WRK_ENV} ${CONFIGURE_ENV} \
+ ${CMAKE_BIN} ${CMAKE_ARGS} -B build && \
+ ${CMAKE_BIN} --build build
post-patch:
@${REINPLACE_CMD} -e '/_WIN32/s,_APPLE,_${OPSYS},' \
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>
diff --git a/x11/waybar/Makefile b/x11/waybar/Makefile
--- a/x11/waybar/Makefile
+++ b/x11/waybar/Makefile
@@ -26,7 +26,7 @@
FLAVORS= default nopulse
CONFLICTS_INSTALL= ${PORTNAME}*
-USES= compiler:c++20-lang gnome meson pkgconfig
+USES= cmake:noconf compiler:c++20-lang gnome meson pkgconfig
USE_GITHUB= yes
USE_GNOME= gtkmm30
GH_ACCOUNT= Alexays
@@ -165,9 +165,9 @@
# XXX https://github.com/HowardHinnant/date/issues/799
.if ${CXX} == c++ && exists(/usr/include/c++/v1/__chrono/concepts.h)
-BUILD_DEPENDS+= ${CMAKE_BIN}:devel/cmake-core
-CONFIGURE_ENV+= CC="${CC}" CXX="${CXX}" CPP="${CPP}"
-CMAKE_BIN= ${LOCALBASE}/bin/cmake
+CMAKE_ARGS= -B ${WRKDIR}/libcxx_build -S ${WRKSRC_libcxx}/libcxx
+CMAKE_OFF= LIBCXX_INCLUDE_BENCHMARKS
+CMAKE_INSTALL_PREFIX= ${WRKDIR}/libcxx_prefix
# XXX Move into separate port and standardize via USES
GH_TUPLE+= llvm:llvm-project:llvmorg-16.0.1:libcxx
@@ -177,10 +177,7 @@
pre-configure: bundled-libcxx
bundled-libcxx:
- @${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} \
- -DLIBCXX_INCLUDE_BENCHMARKS:BOOL=OFF \
- -DCMAKE_INSTALL_PREFIX:PATH=${WRKDIR}/libcxx_prefix \
- -B ${WRKDIR}/libcxx_build -S ${WRKSRC_libcxx}/libcxx
+ @${SETENVI} ${WRK_ENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS}
@${DO_MAKE_BUILD:NDESTDIR*} install -C ${WRKDIR}/libcxx_build
.endif # exists(/usr/include/c++/v1/__chrono/concepts.h)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 5, 3:48 PM (21 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29290594
Default Alt Text
D44509.id136303.diff (7 KB)
Attached To
Mode
D44509: cmake.mk: add indirect argument for ports
Attached
Detach File
Event Timeline
Log In to Comment