From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4325A158041 for ; Tue, 20 Feb 2024 06:35:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0ECC72BC0A1; Tue, 20 Feb 2024 06:35:12 +0000 (UTC) Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) (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) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 615482BC09E for ; Tue, 20 Feb 2024 06:35:11 +0000 (UTC) Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3c02adddb8eso4485853b6e.0 for ; Mon, 19 Feb 2024 22:35:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708410910; x=1709015710; darn=lists.gentoo.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xqHInWZhiCvKcOiSfCvM7fWXCr1PvJSk17oClSpcvPg=; b=VWSITZA4jrhrizEbQd32EwHMY1YwwzTPtS5vEmnKLXZxvcl+DXsFtZ+2LlSWxLfRAo lIb2vc9fVDXwnzMM3++gII6yZ32tiQoLslfMecUp0kjZLpVj3zkQqZE3bzaXdAlCZd+1 eHMzz/Jyd8WaGzA1cqvpI7f7WPWwgZ7y3BGJ7XLa85/GwjIi3/A4LSSyRFg0SxmU+ixp wP51nAx8cqwyCUBgwjYbmNYkiMhKKvBStzZAtb+VZAy8nQA6bsv9uYpk6Un2hsWNF8gV 8Va9+D1lLuU/ch9rWp22twxa1zUeug//Qq6g7v/9cU7KcYgjnNvNgEu9GhRCYrIIIqUs AYMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708410910; x=1709015710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xqHInWZhiCvKcOiSfCvM7fWXCr1PvJSk17oClSpcvPg=; b=De8f5hLbGRN8tWdoE4vvbZ1nW9R2e2FvMrFgA/HZgdJFLZB4MBVX45+0YjOZAJXKJi KpCwoNkHar4zx8EvKIrc86TVxeNgzICDyMldV3QYCzYStO7zgPdkGktlrijz/JF/byCS M37qHPvVNUuxcAOfDB3SXs32ZkCrP+0Qgygsu/PJUI2ZoIovp6a6fgvPpVNbtSetA/ZE 1MRplzQc+UVQDX60qt1+4rsfXIUqKm2bkkiDbor5q67egA9Z5pcXfIx5p7PtQ5tSY/7j 996fxdtKisv0n0Rxj21jT4fDAjw4MIZ3rayocm917m9L4CUZ4WR1HxZMtf/NUzTD8BML joKw== X-Gm-Message-State: AOJu0YznjqPldcvYvk5x0c54BwCgLw2L9ehRGLZ4jSAlCwUsSexE7mn4 gYIuDDGy3GsZAgeXSWxWqWa2trducJtgYcSmdMXr4hypxSQ4xSvFvR+PUgVk X-Google-Smtp-Source: AGHT+IHkARtUEigI9B8JkIpQ/p5iOHezTOv4n9HOJ+T6r3GDsxXFsTwJ+jX2oIf94ysFnQiBY4/ueQ== X-Received: by 2002:a05:6808:f8d:b0:3bf:d1ea:23bc with SMTP id o13-20020a0568080f8d00b003bfd1ea23bcmr3761413oiw.49.1708410909902; Mon, 19 Feb 2024 22:35:09 -0800 (PST) Received: from acleverhostname.attlocal.net (108-200-163-197.lightspeed.bcvloh.sbcglobal.net. [108.200.163.197]) by smtp.gmail.com with ESMTPSA id a14-20020a05680802ce00b003c15d61ec3fsm461475oid.37.2024.02.19.22.35.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 22:35:08 -0800 (PST) From: Eli Schwartz To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH v2 3/5] meson.eclass: refactor src_configure into a setter function Date: Tue, 20 Feb 2024 01:14:43 -0500 Message-ID: <20240220063504.3959739-4-eschwartz93@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220063504.3959739-1-eschwartz93@gmail.com> References: <1b9b73ea-9895-4680-aab7-117e47c9cc36@gmail.com> <20240220063504.3959739-1-eschwartz93@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 226e9822-2536-4534-a68a-85fc6db9fd30 X-Archives-Hash: c5ac01a6fffac2d3fa88763946ceaf1e This is necessary in order to get at the implementation of `meson setup` from other eclasses, which do not simply call meson_src_configure. The intended use case is distutils-r1, where a python build backend wraps meson and needs its arguments while calling meson on its own. This allows distutils-r1 to invoke `setup_meson_src_configure` followed by gpep517, and get access to: - the preparation which needs to be done, including setting up the environment - the array of setup arguments Signed-off-by: Eli Schwartz --- v2: new patch eclass/meson.eclass | 49 +++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/eclass/meson.eclass b/eclass/meson.eclass index e1963e552710..620381ed7079 100644 --- a/eclass/meson.eclass +++ b/eclass/meson.eclass @@ -277,15 +277,12 @@ meson_feature() { usex "$1" "-D${2-$1}=enabled" "-D${2-$1}=disabled" } -# @FUNCTION: meson_src_configure -# @USAGE: [extra meson arguments] +# @FUNCTION: setup_meson_src_configure # @DESCRIPTION: -# This is the meson_src_configure function. -meson_src_configure() { - debug-print-function ${FUNCNAME} "$@" - - [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}" - +# Calculate the command line which meson should use, and other relevant +# variables. Invoke via "${mesonargs[@]}" in the calling environment. +# This function is called from meson_src_configure. +setup_meson_src_configure() { local ltoflags=() if tc-is-lto; then # We want to connect -flto in *FLAGS to the dedicated meson option, @@ -344,8 +341,7 @@ meson_src_configure() { : "${BUILD_PKG_CONFIG_PATH:=${PKG_CONFIG_PATH}}" fi - local mesonargs=( - meson setup + mesonargs=( --libdir "$(get_libdir)" --localstatedir "${EPREFIX}/var/lib" --prefix "${EPREFIX}/usr" @@ -390,12 +386,6 @@ meson_src_configure() { # Arguments from user "${MYMESONARGS[@]}" - - # Source directory - "${EMESON_SOURCE:-${S}}" - - # Build directory - "${BUILD_DIR}" ) # Used by symbolextractor.py @@ -407,13 +397,32 @@ meson_src_configure() { python_export_utf8_locale # https://bugs.gentoo.org/721786 - local -x BOOST_INCLUDEDIR="${BOOST_INCLUDEDIR-${EPREFIX}/usr/include}" - local -x BOOST_LIBRARYDIR="${BOOST_LIBRARYDIR-${EPREFIX}/usr/$(get_libdir)}" + export BOOST_INCLUDEDIR="${BOOST_INCLUDEDIR-${EPREFIX}/usr/include}" + export BOOST_LIBRARYDIR="${BOOST_LIBRARYDIR-${EPREFIX}/usr/$(get_libdir)}" +} + +# @FUNCTION: meson_src_configure +# @USAGE: [extra meson arguments] +# @DESCRIPTION: +# This is the meson_src_configure function. +meson_src_configure() { + debug-print-function ${FUNCNAME} "$@" + + [[ -n "${NINJA_DEPEND}" ]] || ewarn "Unknown value '${NINJA}' for \${NINJA}" ( + setup_meson_src_configure "$@" + mesonargs+=( + # Source directory + "${EMESON_SOURCE:-${S}}" + + # Build directory + "${BUILD_DIR}" + ) + export -n {C,CPP,CXX,F,OBJC,OBJCXX,LD}FLAGS PKG_CONFIG_{LIBDIR,PATH} - echo "${mesonargs[@]}" >&2 - "${mesonargs[@]}" + echo meson setup "${mesonargs[@]}" >&2 + meson setup "${mesonargs[@]}" ) || die } -- 2.43.0