From nobody Mon Apr 8 09:27:14 2024 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VCkJL5hJTz5GdS4; Mon, 8 Apr 2024 09:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VCkJL570Vz4R9h; Mon, 8 Apr 2024 09:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712568434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M/bcSuneRP65j+Fn58D4N6HQmMYr8UJqn5tNaDvwl9g=; b=PDbYkGUjUfGcoI9AE5U+U2gkQBXMeMmm44gtY3VA9Y4eM3FnV+xKlCwR1UK9M6wexLVoTi FP0uKUuxDJxG6uYoP6/Tqw7KyajB4i4LB6G9Gl3CANodCNMQ+hkcPTPXpDedIjGfv8z1w+ iSc73MQG/RZNFtK9/eck+yUcBr7tI2MUiSHZ950AG20c6092usujeqtyhEBc90bC93StyX gcNs1+rLgvzVQ9pbFzPT9AzVn/qW8DJhcf+DX7XBbyqS0dpjRTFTWF7Yaoj7i0WOOsa4a4 HkAznzrw1I0T1JhLRUXWPfIZJRbGI+IO4PlXJ0SVCdDd325nxDZm0xf6fLBfZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712568434; a=rsa-sha256; cv=none; b=oiBQjdC2RUlOD4N8UxprMuWH0UZYcP7g6NRP0MQaor3VAvk71ZVeqGO4F+A1RFCIPFIOyw 5+UuPjd6oiJsox1q/PajgO38opQMQQ00oFtdpMnT4L0b3uRGo3iC+tuC+K9oJDdA2nv8Z4 dFMHjs/3/nV65L6zUlhPADJvkOG0zhmavtKQg4GYubN2A0BnFVyO6WcbpepsHC/zFN+6ue 6w6HWfaPJYM/xM1nQ9AxMryIj7PxmBliXbBKW98ymKwvanfQ+jyATobv0gyCY5kFl5nD/y vuwBnomMlAmm+2/j5O7IlYXX0t15uNCFyhvlXD0NpKk+kRZGKeX5uyb/ykgH5g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712568434; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=M/bcSuneRP65j+Fn58D4N6HQmMYr8UJqn5tNaDvwl9g=; b=GnYKp9YE5AIYOMEhA0B00tictREYZOm6Oa8vqdarMZV7wGni1FYQ3qIZdMhe3LWwZRLJmd mTHb53VHNQHbaLMzvJQY4oY18dL65lYvmIV8kIzD+tRyUMlgJuS+yI4avkLaPMMKzxUaYS E4uAtH987i2Erq5Hk2fS+MM4HlMuogOlqZIR83L0ZJMdOWKNMWyPy7DvozoInasAGqlkxS XgipQGg3oOrLWBjMx2QjBwxfI1b9emqhecFdIV8a8wfRBbDCh4WbMaCOQJiTwpk6KHtoPJ q/Sz587FdzdGmd8PUCLN0E/DpNpZD5KirAz/7aRkc3XdwIQALRKVOt8MxpDr9w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VCkJL4jmGz154h; Mon, 8 Apr 2024 09:27:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 4389REZY012648; Mon, 8 Apr 2024 09:27:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 4389REPp012645; Mon, 8 Apr 2024 09:27:14 GMT (envelope-from git) Date: Mon, 8 Apr 2024 09:27:14 GMT Message-Id: <202404080927.4389REPp012645@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Max Brazhnikov Subject: git: 4963e985a45d - main - Mk/cmake.mk: add support for indirect argument List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: makc X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4963e985a45dca57a9dba4d3c39d8862ac9cc185 Auto-Submitted: auto-generated The branch main has been updated by makc: URL: https://cgit.FreeBSD.org/ports/commit/?id=4963e985a45dca57a9dba4d3c39d8862ac9cc185 commit 4963e985a45dca57a9dba4d3c39d8862ac9cc185 Author: Max Brazhnikov AuthorDate: 2024-04-08 09:15:42 +0000 Commit: Max Brazhnikov CommitDate: 2024-04-08 09:15:42 +0000 Mk/cmake.mk: add support for indirect argument Add indirect to list of arguments for USES=cmake. cmake:indirect is intended primarily for ports, which use meson or pep517 for build, but rely on cmake underneath. Update documentation while here. Differential Revision: https://reviews.freebsd.org/D44509 --- CHANGES | 8 ++++++++ Mk/Uses/cmake.mk | 54 ++++++++++++++++++++++++++++++++++-------------------- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/CHANGES b/CHANGES index b840bc11fdeb..ebfabbffd719 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,14 @@ in the release notes and/or placed into UPDATING. All ports committers are allowed to commit to this file. +20240408: +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 index 8229fa9cbb55..e9a9dc64df58 100644 --- 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, indirect, noninja, run, testing # ARGS description: # insource do not perform an out-of-source build +# 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. # 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: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= insource indirect 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 @@ IGNORE= Incorrect 'USES+= cmake:${cmake_ARGS}' usage: argument [${arg}] is not r . 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?= RelWithDebInfo 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 @@ CMAKE_NOCOLOR= yes . 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 @@ do-test: . 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)