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 supports indirect 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:indirect 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,8 +2,11 @@ # # Feature: cmake # Usage: USES=cmake or USES=cmake:ARGS -# Valid ARGS: insource, run, noninja, testing +# Valid ARGS: indirect, insource, noninja, run, testing # ARGS description: +# indirect 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. # insource do not perform an out-of-source build # noninja don't use ninja instead of make # Setting this should be an exception, and hints to an issue @@ -31,6 +34,7 @@ # CMAKE_OFF Appends -D: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:bool=ON to the CMAKE_TESTING_ARGS. +# Default: BUILD_TESTING +# CMAKE_TESTING_OFF Appends -D: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= indirect insource 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:Mindirect) +. 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:Mindirect) +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:indirect +CMAKE_OFF= CMARK_SHARED CMARK_TESTS CMARK_QMAKE_OFF= CONFIG+="mfnomd2html" .include @@ -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 - -.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 +.include diff --git a/devel/py-Levenshtein/Makefile b/devel/py-Levenshtein/Makefile --- a/devel/py-Levenshtein/Makefile +++ b/devel/py-Levenshtein/Makefile @@ -12,12 +12,10 @@ LICENSE_FILE= ${WRKSRC}/COPYING BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}scikit-build>=0.13:devel/py-scikit-build@${PY_FLAVOR} \ - ${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \ - cmake-core>0:devel/cmake-core - + ${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}rapidfuzz>0:devel/py-rapidfuzz@${PY_FLAVOR} -USES= python +USES= cmake:indirect python USE_PYTHON= autoplist pep517 post-install: diff --git a/devel/py-rapidfuzz/Makefile b/devel/py-rapidfuzz/Makefile --- a/devel/py-rapidfuzz/Makefile +++ b/devel/py-rapidfuzz/Makefile @@ -11,8 +11,7 @@ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE -BUILD_DEPENDS= cmake:devel/cmake-core \ - ninja:devel/ninja \ +BUILD_DEPENDS= ninja:devel/ninja \ jarowinkler-cpp>0:textproc/jarowinkler-cpp \ rapidfuzz-cpp>0:devel/rapidfuzz-cpp \ taskflow>0:devel/taskflow \ @@ -23,7 +22,7 @@ RUN_DEPENDS= ${PYNUMPY} TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}hypothesis>0:devel/py-hypothesis@${PY_FLAVOR} -USES= compiler:c++14-lang python +USES= cmake:indirect compiler:c++14-lang python USE_PYTHON= distutils autoplist pytest TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} diff --git a/graphics/py-pivy/Makefile b/graphics/py-pivy/Makefile --- a/graphics/py-pivy/Makefile +++ b/graphics/py-pivy/Makefile @@ -10,12 +10,11 @@ LICENSE= MIT -BUILD_DEPENDS= cmake:devel/cmake-core \ - swig:devel/swig +BUILD_DEPENDS= swig:devel/swig LIB_DEPENDS= libCoin.so:graphics/Coin \ libSoQt.so:x11-toolkits/soqt -USES= compiler:c11 python qt:5 +USES= cmake:indirect compiler:c11 python qt:5 USE_GITHUB= yes GH_ACCOUNT= coin3d USE_PYTHON= distutils diff --git a/x11/waybar/Makefile b/x11/waybar/Makefile --- a/x11/waybar/Makefile +++ b/x11/waybar/Makefile @@ -165,9 +165,10 @@ # 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 +USES+= cmake:indirect +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 +178,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)