summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* gcc-config: Don't call portageq if the variable is already setv2.11Ulrich Müller2023-05-141-4/+5
| | | | | | | | Bug: https://bugs.gentoo.org/906329 Acked-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org> Closes: https://github.com/gentoo/gcc-config/pull/3 Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: Add missing terminating quote for 'backing up' path messageSam James2023-04-301-1/+1
| | | | | | | | Cosmetic. Before: * Backing up '//usr/lib/gcc/hppa2.0-unknown-linux-gnu/12/libgcc_s.so.4' to '/lib After: * Backing up '//usr/lib/gcc/hppa2.0-unknown-linux-gnu/12/libgcc_s.so.4' to '/lib' Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: Use relative paths for liblto and cc symlink targetsv2.10Krzesimir Nowak2023-01-051-2/+3
| | | | | | | | | | That way, for ROOT different than / (like /build/amd64-usr) these symlinks won't dangle after chrooting into ROOT. Bug: https://bugs.gentoo.org/880977 Signed-off-by: Krzesimir Nowak <knowak@microsoft.com> Closes: https://github.com/gentoo/gcc-config/pull/2 Signed-off-by: Sam James <sam@gentoo.org>
* Read LIBDIR with portageq from EROOT instead of hardcoding the / valuev2.9James Le Cuirot2022-12-281-1/+4
| | | | | | | | We fall back to the hardcoded / value if that fails. Signed-off-by: James Le Cuirot <chewi@gentoo.org> Closes: https://github.com/gentoo/gcc-config/pull/1 Signed-off-by: Sam James <sam@gentoo.org>
* Read CHOST with portageq from EROOT and not /James Le Cuirot2022-12-281-0/+1
| | | | | | | Failing that, the fallback method still reads from EROOT as before. Signed-off-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
* Allow EPREFIX to be overridden for manipulating prefixed ROOTJames Le Cuirot2022-12-281-3/+4
| | | | | | | | This use case was totally broken. We need to hardcode BROOT instead, as we don't want to source /lib/gentoo/functions.sh from ROOT. Signed-off-by: James Le Cuirot <chewi@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
* Revert "gcc-config: set CCACHE_COMPILERCHECK to major GCC version"v2.8Sam James2022-10-101-8/+0
| | | | | | | | | | | | | | | | | This isn't going to work where the compiler used is Clang but GCC is installed -- we'll end up always using a cache key of the major GCC version, even for say, different Clang versions. Fortunately, using %compiler% -dumpversion instead of %compiler% -v locally will handle it fine as a workaround (to be set in ccache.conf) because since b7a62d5e3f5e6e05c929f225ead22a2981c9f64 in gentoo.git, GCC installs with just the major version in its paths, and -dumpversion reports said major version, not the whole version (can use gcc -dumpfullversion if needed). This reverts commit 3e49f724d090d65b739be1a67f6c40574337a2f7. Bug: https://bugs.gentoo.org/872971 Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: update /etc/clang/gentoo-gcc-install.cfg if existsSam James2022-10-091-0/+15
| | | | | | | | | | | | | * Set '--gcc-install-dir' for Clang to direct it to the currently active GCC installation. * Only write to /etc/clang/gentoo-gcc-install.cfg if it already exists to allow us to back out the change gracefully (by stopping installation in sys-devel/clang-common) as there's some concerns wrt sysroot compatibility. Bug: https://github.com/llvm/llvm-project/issues/57570 Bug: https://bugs.gentoo.org/868639 Signed-off-by: Sam James <sam@gentoo.org>
* Makefile: drop excessive EPREFIXingv2.7Sam James2022-10-081-1/+0
| | | | | Bug: https://bugs.gentoo.org/875377 Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: set CCACHE_COMPILERCHECK to major GCC versionSam James2022-09-291-0/+8
| | | | | | | | | | | | This avoids invalidating caches on every GCC snapshot bump for the same major version (e.g. 12.2.1_p*), but also for 12.1 -> 12.2. It should be fine to mix objects between such versions. If needed, we can swap this to just stripping .1_p* but that's a bit more awkward. Bug: https://bugs.gentoo.org/872971 Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: improve languageSam James2022-09-291-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: create ${CTARGET}-cc symlinkv2.6Sam James2022-09-231-1/+8
| | | | | | | | | | | | We need this because configure scripts may look for ${CTARGET}-cc first, and while this wasn't a problem in the past, LLVM installs fallback symlinks in /usr/lib/llvm/${SLOT}/bin for the benefit of llvm-only profiles, and configure has started finding these rather than falling back to say, ${CTARGET}-gcc like it has been all this time. Bug: https://bugs.gentoo.org/870577 Bug: https://bugs.gentoo.org/872416 Signed-off-by: Sam James <sam@gentoo.org>
* tests: use sys-apps/gentoo-functions if availableSam James2022-09-231-9/+16
| | | | | | Gives us nicer looking output. Signed-off-by: Sam James <sam@gentoo.org>
* */*: use portable Bash shebangSam James2022-09-232-3/+3
| | | | | | Useful for Prefix in particular. Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: add comment explaining SELinux-related writable checkv2.5Sam James2021-11-131-0/+5
| | | | | Bug: https://bugs.gentoo.org/823203 Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: Check writability in env.d instead of EROOTJason Zaman2021-11-131-1/+1
| | | | | | | | | | | | | | | | | SELinux blocks access to / so gcc-config fails even tho the required dirs are writable. Adding SELinux rules to allow writing to / is pretty undesirable. The best is to check for writability in the actual dirs that gcc-config needs to write. It should be sufficient to check only one dir instead of every dir, since the check for only EROOT has been sufficient in the past. avc: denied { write } for pid=17173 comm="gcc-config" name="/" dev="zfs" ino=34 scontext=staff_u:sysadm_r:gcc_config_t:s0-s0:c0.c1023 tcontext=system_u:object_r:root_t:s0 tclass=dir Bug: https://github.com/perfinion/hardened-refpolicy/pull/20 Bug: https://bugs.gentoo.org/823203 Signed-off-by: Jason Zaman <perfinion@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
* gcc-config: add support for special 'latest' version for profile switchv2.4Sergei Trofimovich2021-02-261-0/+10
| | | | | | | | To ease switching to latest version add special 'latest' verison. Works for both "latest" and "<CTARGET>-latest" forms. Bug: https://bugs.gentoo.org/765664 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: provide 'gcc-config --get-current-profile [CTARGET]' exampleSergei Trofimovich2021-02-261-1/+2
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: clarify comment around profile version selectionSergei Trofimovich2021-02-261-2/+2
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: clarify comment around index number choiceSergei Trofimovich2021-02-261-1/+1
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: add examples of profile formatsSergei Trofimovich2021-02-261-2/+3
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: Do not call 'python' directly.v2.3.3Arfrever Frehtes Taifersar Arahesis2021-01-231-6/+5
| | | | | | | | 'python' is not available with dev-lang/python-exec[-native-symlinks]. Bug: https://bugs.gentoo.org/766597 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: maintain ABI ordering for LDPATHv2.3.2Sergei Trofimovich2020-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Before the change we ordered paths in reverse order for both gcc versions and ABI lists: $ cat /etc/ld.so.conf.d/05gcc-x86_64-pc-linux-gnu.conf /usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0/32 /usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0 /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/32 /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0 After the change we preserved ABI ordering and use reverse gcc version ordering: $ cat /etc/ld.so.conf.d/05gcc-x86_64-pc-linux-gnu.conf /usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0 /usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0/32 /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0 /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/32 In theory both should work. I practice some systems (like riscv today) do not distinct between some ABIs. Let's list valid ABI first to keep such systems running. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: make USE_CC_WRAPPERS=yes to install cc/f77 linksManoj Gupta2020-06-242-2/+10
| | | | | | | | Add USE_CC_WRAPPERS option to control installation of cc/f77 symlinks. This will let packages other than GCC to install 'cc'. Signed-off-by: Manoj Gupta <manojgupta@google.com> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* README: add 'Releasing' sectionv2.3.1Sergei Trofimovich2020-06-211-0/+6
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* README: document c89/c99 wrapper presenceSergei Trofimovich2020-06-211-0/+3
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* tests: fix 'insanity' testsSergei Trofimovich2020-06-201-4/+1
| | | | | | | | commit 8a4854aec042f ("gcc-config: make USE_NATIVE_LINKS=no to clean stale symlinks") dropped warnings around 'insanity' checks. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: install /usr/bin/c{89,99}, take over from toolchain.eclassSergei Trofimovich2020-06-209-4/+91
| | | | | | Reported-by: Kent Fredric Bug: https://bugs.gentoo.org/728722 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: finish comment linesSergei Trofimovich2020-05-231-2/+2
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: make USE_NATIVE_LINKS=no to clean /lib/cppv2.3Sergei Trofimovich2020-05-221-1/+5
| | | | | Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: make USE_NATIVE_LINKS=no to clean stale symlinksSergei Trofimovich2020-05-221-7/+6
| | | | | | | | Before the change symlinks like /usr/bin/cc were untouched. After the change they are explicitly removed. Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: clarify comments on how aliases are expandedSergei Trofimovich2020-05-221-2/+5
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: add facts around tool namesSergei Trofimovich2020-05-221-0/+23
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: link /lib/cpp to qualified 'cpp'Sergei Trofimovich2020-05-221-1/+1
| | | | | | | | | | Change link /lib/cpp from /usr/bin/cpp to /usr/bin/${CTARGET}-cpp. When USE_NATIVE_LINKS=no starts skipping unqualified links we might want to delete /lib/cpp, or keep it. Depends on how many tools depend on it's presence. Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: add build-time and runtime switches to disable native symlinksSergei Trofimovich2020-05-222-2/+14
| | | | | | | | | | | We have two knobs here: 1. Build-time knob USE_NATIVE_LINKS to set a default, defaults to 'yes' (existing behaviour) 2. Run-time --enable-native-links / --disable-native-links knobs. These are not persistent across gcc-config runs and are meant for manual testing. Undocumented for now. Reported-by: Kent Fredric Bug: https://bugs.gentoo.org/724454 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: add a TODO to use 'sort -V'Sergei Trofimovich2020-04-101-1/+2
| | | | | | Was suggested by Jason A. Donenfeld and jthill. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* tests: add a test for bug #706318v2.2.1Sergei Trofimovich2020-01-269-0/+15
| | | | | Bug: https://bugs.gentoo.org/706318 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: distinguish errors between bad profile and bad compilerSergei Trofimovich2020-01-261-5/+8
| | | | | | | The distinction is useful when making tests: compiler is often missing when config is present. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: fix numbered access to toolchainsSergei Trofimovich2020-01-261-1/+1
| | | | | | | | | | | | | In commit bc80e12ab1 ("gcc-config: add basic version sorting support") i've missed the case of accessing toolchain by number: $ gcc-config -L 1 The change adds version sorting to numbered access as well. Reported-by: lekto@o2.pl Bug: https://bugs.gentoo.org/706318 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: add basic version sorting supportv2.2Sergei Trofimovich2020-01-124-3/+42
| | | | | | | | | | | | | | | | Before the change gcc version orderig was relying on bash sorting in flob matches, like: cat /etc/env.d/gcc/${CHOST}-* | fgrep LDPATH | tail -n 1 This stopped working with gcc-10, which lexicographically goes before gcc-9. The workaround for now is to normalizeversions to fixed-width and order them lexicographically: gcc-0009 gcc-0010 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: consolidate profiles sourcing logic in a single functionv2.1Sergei Trofimovich2019-09-081-18/+11
| | | | | Bug: https://bugs.gentoo.org/174422 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: Ignore PATH set in profile files.Arfrever Frehtes Taifersar Arahesis2019-09-081-0/+18
| | | | | | | | | | | Profile files created by toolchain.eclass before gentoo commit 534e0f7d5e8a02264b7b7fc97c3ef11441e35c5c contain assignment of PATH variable (e.g. PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/9.2.0"). Sourcing them without restoring previous PATH value breaks gcc-config. Fixes: 231bc60d6fa6b8eb309ac2ca308f7c60213f81a3 Bug: https://bugs.gentoo.org/174422 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Revert "gcc-config: store gcc backup into /lib/gcc-backup, not /lib"Sergei Trofimovich2019-09-074-80/+4
| | | | | | | | | | | | | This reverts commit 44570a44be60a8fc33bd05089047c1f2980b3047. Unfortunately ld.so does has static set of fallback paths when it fails to lookup shared library from ld.so.cache: those are /lib64 and /usr/lib64 on amd64. Let's revert the change and jkeep relying on /lib64 for now. Bug: https://bugs.gentoo.org/667020 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: add einfo logging around library backupSergei Trofimovich2019-09-071-0/+3
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: store gcc backup into /lib/gcc-backup, not /libSergei Trofimovich2019-09-074-4/+79
| | | | | | | | | | | | | | | Writing (and removing) libraries to /lib outside package manager was a surprise to users in bug #667020# where libunwind.so was clobbered by gcc-config runs. This change isolates all logic that handles file copies outside package manager into /lib/gcc-backup directory. To make new library still resolveable we install env.d entry with contents of LDPATH="/lib/gcc-backup" Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Makefile: drop C*FLAGS from Makefile as gcc-wrapper is no moreSergei Trofimovich2019-09-071-4/+0
| | | | | | gcc-config doec not contain C code nowadays. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* Makefile: install READMESergei Trofimovich2019-09-071-1/+4
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* README: add examples of querying facts about toolchainsSergei Trofimovich2019-09-071-3/+12
| | | | Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: drop empty /etc/env.d/05gcc-${CTARGET} filesSergei Trofimovich2019-09-072-12/+10
| | | | | | | Thesse files are generated for cross-gcc only. Were empty since Aug 2018. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* gcc-config: don't recreate unused '.NATIVE' symlink.Sergei Trofimovich2019-09-072-9/+4
| | | | | | As gcc-wrapper is gone nothing should use it anymore. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>