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 787FA158041 for ; Tue, 20 Feb 2024 04:33:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7832B2BC03F; Tue, 20 Feb 2024 04:32:43 +0000 (UTC) Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) (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 035BB2BC03A for ; Tue, 20 Feb 2024 04:32:43 +0000 (UTC) Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-21433afcc53so1980304fac.3 for ; Mon, 19 Feb 2024 20:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708403561; x=1709008361; 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=oWzqHVW0WhyTGQHomZEHDHlp/TL3KLD1lIQRNtoZ/8M=; b=P5+MZfmsU3mLt+TOGx8bpm+G1F+EeZ6rmMXJopVbvnkNCoDsMWfBuPFJ6NOal+6Hn0 PGfYe/7eoHU7EU5PfOODy/Vosfi92sbvDBgnwnYE+v4N4bjUKdLNZbjR3E86HUCS+9nX OLwP5KwNdLtXi+EXUDBXPaXuN6KrouU9iuc/tUeFAQfxxw++QBaITPSN3wlgKtuUz4Kw zE0d+uhr0DfJXhgS9O853WJ//t3uZAbWk8BZy9V/4OoOd0oRrjlTzI20V6gJrzR9kSg2 ns158xPX/JGyxnwukZWqkSQNOb9Wbrd9t5m2RRKHqXdbIqo7yT5NcrzUkZlq3QDcBjnP YklQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708403561; x=1709008361; 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=oWzqHVW0WhyTGQHomZEHDHlp/TL3KLD1lIQRNtoZ/8M=; b=KCyBJB3LyNuxowJvudPUA8+iYEJdSk45zYkxvD1zGiZ9c0l41GU9SSN+0h2ZooIN36 FnFBQI5RgGoGO5meUoWuK2y6T2n+r4RBLD2GzDhaMVzYnBqy/iTRuZ7TWJCLyytrHSCf KhnXTKiRBJLzkKb5nMSlz53+TzLOhcwRX99HZ4XEu+wQtPXbvUZxJC/yAVJo+oLNyxe3 w6cTbJ/rpPVywDlZWOty+Oo+HIvq+nxqMSISWsC9TG92RoMZefDqPPtEMVUdXLrJbqt3 ihtigiUhhOO/FkHq2JOngya2TwlIDNCOZrefG8kwDufySOAoLjXvN3m2uEZR7TKUPnBs LcSg== X-Gm-Message-State: AOJu0YwZaxvs/DKsJVZ2R0zVq/hUD/zLgel+oqvgJHF72JWdgP0aLQV9 lcGw4Qt8cwXlV3/XaKqRcVa9kEmyEmcTxKTIN/Fd067FIo7eciuVGL79THGT X-Google-Smtp-Source: AGHT+IGtNcoWPOyokKf1428bR0DWc3JLwlPIkoNBVFqDVUsMRoUDsxs1SojDiKX2ttlE4cFFQq+5oA== X-Received: by 2002:a05:6871:2b22:b0:21e:e583:25dc with SMTP id dr34-20020a0568712b2200b0021ee58325dcmr3891524oac.3.1708403561513; Mon, 19 Feb 2024 20:32:41 -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 fu6-20020a0568705d8600b0021ed50d4741sm854858oab.7.2024.02.19.20.32.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 20:32:40 -0800 (PST) From: Eli Schwartz To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: fix src_configure to handle flag-o-matic correctly Date: Mon, 19 Feb 2024 23:26:49 -0500 Message-ID: <20240220043235.3889132-4-eschwartz93@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240220043235.3889132-1-eschwartz93@gmail.com> References: <20240220043235.3889132-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: d45ddb73-9b6c-4f7f-b914-7d9283b12762 X-Archives-Hash: a2453abda9f0584cc57f2a932f97b51e Use of python_configure_all is a bit broken, because distutils-r1 is a bit broken. It has the intriguing value-claim that *FLAGS shall be modified with local -x as part of run-phase, which means that all modifications are reset as soon as any given phase exits. Including sub-phases. If you make changes in python_configure or python_configure_all, as you are expected to do instead of defining src_configure and then running the eclass phases manually, your changes inherently get erased before you actually *get* to running builds (i.e. reading the variables). For an example of how this works, consider dev-python/scipy. It builds with filter-lto, for the standard reasons. However, filter-lto gets run inside python_configure_all, so it gets erased and ignored. Note: it "worked" anyways prior to reworking meson.eclass to pass -Db_lto based on `is-flagq flto`. This is because filter-lto removed it from LDFLAGS, and since distutils-r1 doesn't localize that variable, the changes stuck around. As a result: - the previous fix to scipy caused scipy to be compiled with LTO, but not linked with LTO - meson.eclass changes caused scipy to be built with -Db_lto=true, which affects both compiling and linking It's absolutely unsafe to have flag-o-matic be ignored like this, and it is fascinating to end up with LTO restored into compile flags while still being filtered from LDFLAGS... simply as a side effect of distutils-r1 not modifying the latter. - this patch causes scipy to be built with -Db_lto=false Consequences of the change make no difference to standard dev-python/ packages, but affect packages that use both distutils-r1 and other packaging infrastructure: - global variables for tools are exported. This is supposed to be a safe, albeit unnecessary for better-than-setuptools build systems, option. - the "debug" option applies the DEBUG preprocessor macro to more than just python code. This was already the case for python projects that built non-CPython API C/C++ code and then linked them with thin python wrappers, so projects with python bindings shouldn't be any different. Also, it is a "debug" use flag so it's pretty silly if it only toggles debug on python bindings but not the rest of the package, so just... deal with it I guess? - any project that uses cython, now ignores the Modern C Porting flag "incompatible-pointer-types". This is terrible, because code which should trigger that error is terrible. But it's also terrible for python projects with mixed Cython and handwritten C, to squelch that error just because one file happens to use Cython. Yet, we do it because we don't have a way to make extremely specific files built with different CFLAGS compared to the rest of the project. There's no actual reason to treat handwritten C python modules different from non-distutils phases. Signed-off-by: Eli Schwartz --- eclass/distutils-r1.eclass | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 35825d4c3aa6..873421bbcee8 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -1813,16 +1813,15 @@ distutils-r1_run_phase() { fi # Set up build environment, bug #513664. - local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX} tc-export AR CC CPP CXX if [[ ${DISTUTILS_EXT} ]]; then if [[ ${BDEPEND} == *dev-python/cython* ]] ; then # Workaround for https://github.com/cython/cython/issues/2747 (bug #918983) - local -x CFLAGS="${CFLAGS} $(test-flags-CC -Wno-error=incompatible-pointer-types)" + append-cflags $(test-flags-CC -Wno-error=incompatible-pointer-types) fi - local -x CPPFLAGS="${CPPFLAGS} $(usex debug '-UNDEBUG' '-DNDEBUG')" + append-cppflags $(usex debug '-UNDEBUG' '-DNDEBUG') # always generate .c files from .pyx files to ensure we get latest # bug fixes from Cython (this works only when setup.py is using # cythonize() but it's better than nothing) -- 2.43.0