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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2FD831382C5 for ; Fri, 26 Mar 2021 19:05:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7E0AAE0829; Fri, 26 Mar 2021 19:05:47 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 55A10E0829 for ; Fri, 26 Mar 2021 19:05:47 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EDD00335C30 for ; Fri, 26 Mar 2021 19:05:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2EE884EE for ; Fri, 26 Mar 2021 19:05:44 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1616785536.d9793d70892f5107f4a140e14dfec15997ef65cc.ulm@gentoo> Subject: [gentoo-commits] proj/devmanual:master commit in: ebuild-writing/variables/ X-VCS-Repository: proj/devmanual X-VCS-Files: ebuild-writing/variables/text.xml X-VCS-Directories: ebuild-writing/variables/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: d9793d70892f5107f4a140e14dfec15997ef65cc X-VCS-Branch: master Date: Fri, 26 Mar 2021 19:05:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7726ce75-8302-4bb7-b70e-5a99a86c54d0 X-Archives-Hash: dfb7560b89319b76de4d10c818bac3e4 commit: d9793d70892f5107f4a140e14dfec15997ef65cc Author: Michael Orlitzky gentoo org> AuthorDate: Thu Jul 2 19:48:52 2020 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Fri Mar 26 19:05:36 2021 +0000 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=d9793d70 ebuild-writing/variables: add a "User environment" section. Gentoo has always tried to respect a user's CFLAGS environment variable, ensuring that it is passed to the underlying build system. Likewise, CC and LDFLAGS are well-respected these days. Recently, we have added some other variables to this list, like NM, RANLIB, LD, and AS. The meanings of most of these are enshrined in toolchain-funcs.eclass, but in order to properly support them, we must document their intended use so that user's can set them to the correct value and developers can inject them into the right spot in the upstream build system. One motivating example package is PARI, whose build system interprets the LD environment variable in a different way than GNU librool interprets it. If a user sets LD to something appropriate for libtool, the PARI build will fail, and conversely; that is, without help from the ebuild. This commit adds a new section to the ebuild-writing/variables page documenting the origin and intended use of these variables within Gentoo. This should ensure that users and Gentoo developers agree on their meanings, and will guide ebuild development when a problematic upstream build system is encountered. Closes: https://bugs.gentoo.org/730610 Signed-off-by: Michael Orlitzky gentoo.org> [Remove URI for "as". Whitespace fixes.] Signed-off-by: Ulrich Müller gentoo.org> ebuild-writing/variables/text.xml | 163 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) diff --git a/ebuild-writing/variables/text.xml b/ebuild-writing/variables/text.xml index 2ba4c4b..e947b88 100644 --- a/ebuild-writing/variables/text.xml +++ b/ebuild-writing/variables/text.xml @@ -806,5 +806,168 @@ REQUIRED_USE="foo? ( !bar !baz ) bar? ( !foo !baz ) baz? ( !foo !bar )" +
+User environment + + +

+The following variables may be set in the user's environment and should be +respected by all ebuilds. The purpose of each variable within Gentoo is listed +alongside an example of a valid value. Upstream usage may diverge, but ebuilds +should ensure that these variables are interpreted consistently within Gentoo. +The chosen meanings are inspired by a few real and de-facto standards: +

+ +
    +
  • + + The POSIX (2018) make specification +
  • +
  • + + The GNU make (v4.3) implementation +
  • +
  • + + The GNU libtool (v2.4.6) package +
  • +
+ +

+Many of these variables only have an effect if they are invoked directly. +For example, your compiler driver is usually responsible for assembling object +files rather than a direct call to ${AS}. In that case, setting +ASFLAGS will have no effect on the build process; instead, you would set +something like CFLAGS="-Wa,-alh,-L" to tell the C compiler to pass those +flags to the assembler. The LDFLAGS variable is the exception to this +rule, as it is intended to be passed to the compiler driver rather than +${LD}. +

+ + + + + + + + + + AR + + + ar-compatible library archiver + + POSIX make + x86_64-pc-linux-gnu-ar + + + ARFLAGS + flags for ${AR} + POSIX make + -v + + + AS + as-compatible assembler + GNU make + x86_64-pc-linux-gnu-as + + + ASFLAGS + flags for ${AS} + GNU make + --reduce-memory-overheads + + + CC + C compiler driver (also usually used for linking) + POSIX make + clang-9 + + + CFLAGS + flags for ${CC} + POSIX make + -march=native + + + CPPFLAGS + flags for the C preprocessor + GNU make + -D_GNU_SOURCE + + + CXX + C++ compiler driver (also usually used for linking) + GNU make + clang++ + + + CXXFLAGS + flags for ${CXX} + GNU make + -fvisibility=hidden + + + LD + dynamic linker + GNU libtool + x86_64-pc-linux-gnu-ld + + + LDFLAGS + flags for the compiler driver to pass to its linker + POSIX make + -Wl,-O1 -Wl,--as-needed + + + LEX + + + lex-compatible lexer + + POSIX make + /usr/bin/flex + + + LFLAGS + flags for ${LEX} + POSIX make + --8bit --posix-compat + + + NM + + + nm-compatible symbol extractor + + GNU libtool + x86_64-pc-linux-gnu-nm + + + RANLIB + archive index generator + GNU libtool + x86_64-pc-linux-gnu-ranlib + + + YACC + + + yacc-compatible compiler-compiler + + POSIX make + /usr/bin/bison + + + YFLAGS + flags for ${YACC} + POSIX make + -d + +
VariablePurposeOriginExample
+ + +