public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-04-14  1:22 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-04-14  1:22 UTC (permalink / raw
  To: gentoo-commits

commit:     f54e246c839f152fa6df5a8e58d7f072d5524c6e
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  5 21:58:39 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Apr  5 21:58:39 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=f54e246c

gcc-config: fix typo in ldpath setup in non-ld.so.conf.d case

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc-config b/gcc-config
index 9798118..6f86179 100755
--- a/gcc-config
+++ b/gcc-config
@@ -375,7 +375,7 @@ switch_profile() {
 		if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
 			echo "${MY_LDPATH}" > "${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
 		else
-			echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}tmp"
+			echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
 		fi
 
 		# Punt old files; maybe globs too much, but oh well



^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-04-14  1:22 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-04-14  1:22 UTC (permalink / raw
  To: gentoo-commits

commit:     0e573d1ab64ae999ef5ef5eaefbec537643705d8
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  5 22:02:29 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Apr  5 22:02:29 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=0e573d1a

gcc-config: slightly optimize env setup when switching profiles

Since this code already sources the entire env.d file, there's no point
in manually loading a single variable out of it.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc-config b/gcc-config
index 6f86179..dabae91 100755
--- a/gcc-config
+++ b/gcc-config
@@ -329,11 +329,11 @@ switch_profile() {
 	if egrep -q '^(PATH|ROOTPATH)=' "${GCC_ENV_D}/${CC_COMP}" ; then
 		convert_profile_paths "${GCC_ENV_D}/${CC_COMP}" || return 1
 	fi
-	source_var GCC_PATH "${GCC_ENV_D}/${CC_COMP}"
 
 	# Setup things properly again for this profile
 	unset GCC_SPECS LDPATH
 	source "${GCC_ENV_D}/${CC_COMP}"
+
 	# Ignore active profile errors here since we're switching away
 	OLD_CC_COMP=$(get_current_profile 2>/dev/null)
 



^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-04-14  1:22 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-04-14  1:22 UTC (permalink / raw
  To: gentoo-commits

commit:     968585e75310f95dd50a861eace5086996876f4b
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Thu Apr  5 23:00:27 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Apr  5 23:10:35 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=968585e7

gcc-config: make wrapping of programs dynamic

Rather than hand maintain a list of which programs to wrap, automatically
wrap everything found in the gcc path.  Similarly, use the old profile to
automatically delete all the old progs that we wrapped.

There is the possibility that if the old gcc profile is removed before we
switch to the new one, the exact list of programs that we wrapped will be
lost, but that shouldn't generally happen.  If it does, we'll try and fix
the case which caused it to happen instead.

URL: http://bugs.gentoo.org/238984
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |   81 ++++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 65 insertions(+), 16 deletions(-)

diff --git a/gcc-config b/gcc-config
index dabae91..6cfea7c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -20,6 +20,7 @@ source /etc/init.d/functions.sh || {
 	exit 1
 }
 esyslog() { :; }
+has() { [[ " ${*:2} " == *" $1 "* ]]; }
 die() { eerror "${argv0}: $*"; exit 1; }
 umask 022
 
@@ -175,8 +176,22 @@ atomic_cp() {
 	mv "${tmp}" "${dst}/${dstfile}"
 }
 
+uniq_wrapper_list() {
+	local ver=$1; shift
+	# We want to normalize away existing target prefix.
+	set -- "${@#${CTARGET}-*}"
+	# And we want to filter out any version suffixed progs.
+	set -- "${@//*-${ver}}"
+	# Finally, filter out dupes.
+	printf '%s\n' "$@" | sort -u
+}
+
 update_wrappers() {
-	local CTARGET=$1
+	# Update the wrappers for this profile.  We need to clean out
+	# the old wrappers if the functionality no longer exists (like
+	# re-emerging gcc with diff USE flags) and install new wrappers
+	# for new functionality (like a version bump).
+	local x CTARGET=$1
 
 	# Find the bin wrapper
 	local wrapper
@@ -185,19 +200,39 @@ update_wrappers() {
 		[[ -e ${wrapper} ]] && break
 	done
 
-	# Update the wrappers for this profile.  We maintain this list
-	# by hand as the tools that are available can come & go if the
-	# user re-emerges gcc with dif USE flags.  We need to clean out
-	# the old wrappers if the functionality no longer exists.
-	# XXX: Future work: save the list of wrappers we generated in
-	# the generated env.d file so we can scrub things better.
-	# After that, we can use a dynamic list based on what tools are
-	# actually available in ${GCC_PATH}/.
-	local ref
-	for x in {,${CTARGET}-}{cpp,cc,gcc,c++,g++,f77,g77,gcj,gcjh,gcov,gdc,gdmd,gfortran,gccgo} ; do
-		# Obviously don't want to touch native stuff for cross-compilers
-		[[ ${x} != ${CTARGET}-* ]] && is_cross_compiler && continue
+	# Use the old dir to see what we wrapped up previously.
+	local old_wrappers=( $(
+		[[ -n ${OLD_GCC_PATH} ]] || exit 1
+		uniq_wrapper_list "${OLD_CC_COMP_VERSION}" $(
+			cd "${ROOT}${OLD_GCC_PATH}" 2>/dev/null || exit 1
+			echo *
+		)
+	) )
+
+	# See what new stuff we need to wrap up.
+	local new_wrappers=( $(
+		uniq_wrapper_list "${CC_COMP_VERSION}" $(
+			cd "${ROOT}${GCC_PATH}" || exit 1
+			echo *
+		)
+	) )
+	[[ -z ${new_wrappers} ]] && return 1
+
+	# First delete the wrappers that the old one provided but the
+	# new one does not.
+	for x in "${old_wrappers[@]}" ; do
+		has "${x}" "${new_wrappers[@]}" && continue
+		rm -f "${ROOT}usr/bin/${x}" "${ROOT}usr/bin/${CTARGET}-${x}"
+	done
 
+	# For all toolchains, we want to create the fully qualified
+	# `tuple-foo`.  Only native ones do we want the simple `foo`.
+	local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
+	is_cross_compiler || all_wrappers+=( "${new_wrappers[@]}" )
+
+	# Then install wrappers for anything new to this profile.
+	local ref
+	for x in "${all_wrappers[@]}" ; do
 		# Only install a wrapper if the binary exists ...
 		# We want to figure out the 'reference file' for each
 		# wrapper (the binary we're 'wrapping') so that we can
@@ -209,9 +244,19 @@ update_wrappers() {
 			*)   ref=${x};;
 		esac
 		ref="${ROOT}${GCC_PATH}/${ref}"
+		if [[ ! -x ${ref} ]] ; then
+			if is_cross_compiler ; then
+				ewarn "insanity with ${x} and ${ref}"
+			else
+				# For native targets, the ref might not be
+				# fully qualified, so use the short name.
+				ref="${ROOT}${GCC_PATH}/${x#${CTARGET}-}"
+			fi
+		fi
 		if [[ -x ${ref} ]] ; then
 			atomic_cp "${wrapper}" "${ROOT}usr/bin" "${x}" "${ref}"
 		else
+			ewarn "double insanity with ${x} and ${ref}"
 			# Make sure we have no stale wrappers
 			rm -f "${bin}"
 		fi
@@ -312,9 +357,8 @@ handle_split_usr() {
 }
 
 switch_profile() {
-	local GCC_PROFILES=
-	local OLD_CC_COMP=
-	local GCC_PATH=
+	local OLD_CC_COMP OLD_CC_COMP_VERSION OLD_GCC_PATH OLD_GCC_VER
+	local GCC_PATH
 
 	# Make sure we have write access to the dirs.  Do not require `root`
 	# so that we work with prefix/cross/etc... setups that run as user.
@@ -336,6 +380,11 @@ switch_profile() {
 
 	# Ignore active profile errors here since we're switching away
 	OLD_CC_COMP=$(get_current_profile 2>/dev/null)
+	if [[ -f ${GCC_ENV_D}/${OLD_CC_COMP} ]] ; then
+		OLD_GCC_PATH=$(show_var GCC_PATH "${GCC_ENV_D}/${OLD_CC_COMP}")
+		OLD_GCC_VER=$(show_var GCC_VER "${GCC_ENV_D}/${OLD_CC_COMP}")
+	fi
+	OLD_CC_COMP_VERSION=${OLD_GCC_VER:-$(chop_gcc_ver_spec ${OLD_CC_COMP})}
 
 	# GCC_SPECS have long been stable, and people messing with
 	# them know better than to install bad paths, so don't bother



^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-06-10  4:00 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-06-10  4:00 UTC (permalink / raw
  To: gentoo-commits

commit:     1c8ed2a8669f4375f965c78ed37588b87cf534b1
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 03:47:32 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 03:47:32 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=1c8ed2a8

wrapper: remove ROOT from env when looking up bin path

When falling back to running gcc-config to find out the path to the
real binary, make sure to clear out $ROOT.  Otherwise gcc-config will
try to look in $ROOT for its config files when really we're trying to
execute programs in /.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 wrapper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/wrapper.c b/wrapper.c
index a2e7a92..65e5317 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -213,7 +213,7 @@ static void find_wrapper_target(struct wrapper_data *data)
 	/* Only our wrapper is in PATH, so get the CC path using
 	 * gcc-config and execute the real binary in there ...
 	 */
-	FILE *inpipe = popen(GCC_CONFIG " --get-bin-path", "r");
+	FILE *inpipe = popen("ROOT= " GCC_CONFIG " --get-bin-path", "r");
 	if (inpipe == NULL)
 		wrapper_errp("could not open pipe");
 



^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-06-10  4:00 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-06-10  4:00 UTC (permalink / raw
  To: gentoo-commits

commit:     7ba7c0b5b29c9dec3d1e0f37c78235eecad3ca25
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 10 03:54:06 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sun Jun 10 03:54:06 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=7ba7c0b5

gcc-config: do not export GCC_SPECS for cross-compilers

Don't want the cross-compiler settings getting used by the native compiler.

URL: https://bugs.gentoo.org/420097
Reported-by: Amadeusz Sławiński <amade <AT> asmblr.net>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gcc-config b/gcc-config
index 554ff2b..c545974 100755
--- a/gcc-config
+++ b/gcc-config
@@ -406,9 +406,15 @@ switch_profile() {
 	cat <<-EOF > "${envd}.tmp"
 		PATH="${GCC_PATH}"
 		ROOTPATH="${GCC_PATH}"
-		GCC_SPECS="${GCC_SPECS}"
 	EOF
 	if ! is_cross_compiler ; then
+		# Only write GCC_SPECS for the native compiler. #420097
+		# Otherwise, the env.d of cross-compilers come after the
+		# native one and overrides the native setting.  Further,
+		# we don't support GCC_SPECS with cross-compilers, so
+		# writing out that settings doesn't make much sense.
+		printf 'GCC_SPECS="%s"\n' "${GCC_SPECS}" >> "${envd}.tmp"
+
 		# Regardless of the profile selected, keep the runtime lookup
 		# paths stable.  Otherwise, all the apps that were built with
 		# a new compiler will start trying to use older versions of



^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-11-19  1:11 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-11-19  1:11 UTC (permalink / raw
  To: gentoo-commits

commit:     12a60e3fea8fe751f26d3153fbd940fad085038f
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 19 01:03:14 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 19 01:03:14 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=12a60e3f

gcc-config: clean up libgcj pc files better

We need to clean up libgcj when switching to versions that do not have
gcj support enabled.  We should also clean up all broken symlinks that
might be orphaned due to the unmerging of older versions.

URL: http://bugs.gentoo.org/430932
Reported-by: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail.com>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/gcc-config b/gcc-config
index 0445335..0406f95 100755
--- a/gcc-config
+++ b/gcc-config
@@ -422,14 +422,19 @@ switch_profile() {
 		ln -sf ${CC_COMP} "${GCC_ENV_D}/.NATIVE"
 
 		# Relocate random crap
-		if [[ -e ${ROOT}/usr/${GENTOO_LIBDIR}/pkgconfig/libgcj-${CC_COMP_VERSION}.pc ]] ; then
-			local mver=${CC_COMP_VERSION:0:3}
-			for x in "" "-${mver}" ; do
-				x="${ROOT}/usr/lib/pkgconfig/libgcj${x}.pc"
+		local pkgconfdir="${ROOT}/usr/${GENTOO_LIBDIR}/pkgconfig"
+		local mver=${CC_COMP_VERSION:0:3}
+		for x in "" "-${mver}" ; do
+			x="${pkgconfdir}/libgcj${x}.pc"
+			if [[ -e ${pkgconfdir}/libgcj-${CC_COMP_VERSION}.pc ]] ; then
+				ln -sf libgcj-${CC_COMP_VERSION}.pc "${x}"
+			else
+				# Maybe we selected a version that lacks gcj support.
 				rm -f "${x}"
-				ln -s libgcj-${CC_COMP_VERSION}.pc "${x}"
-			done
-		fi
+			fi
+		done
+		# Clean out anything left over from older versions. #430932
+		find "${pkgconfdir}"/libgcj*.pc -xtype l -delete 2>/dev/null
 
 		handle_split_usr
 		: $(( envd_changed += $? ))


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-11-19  1:11 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-11-19  1:11 UTC (permalink / raw
  To: gentoo-commits

commit:     9021391c1b8aca00b3b09b03766bd0d09f7ed339
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 29 06:32:45 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 19 00:27:06 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=9021391c

gcc-config: only handle default ABI libgcc_s with split /usr

Since a split /usr system should only be running the default ABI before
mounting /usr, there's no need to walk and setup all the other ABIs.
This might break very weird systems, but they shouldn't be doing that
in the first place.  And this makes the code much simpler.

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |   70 ++++++++++++++++++-----------------------------------------
 1 files changed, 22 insertions(+), 48 deletions(-)

diff --git a/gcc-config b/gcc-config
index 9cf69fb..0445335 100755
--- a/gcc-config
+++ b/gcc-config
@@ -294,32 +294,15 @@ handle_split_usr() {
 	#
 	# The funky move magic is required for proper updating of in-use files.
 	#
-	# XXX: This fails when configuring the native target in a cross-compiled
-	#      ROOT.  Only way around that is to store the multilib configuration
-	#      in the gcc profile when we compiled it and then read that instead
-	#      of executing the gcc.  Some day.
-	#
 	# We use the same ordering logic as mentioned in the MY_LDPATH setup.
 	# We get the libs from the latest version available.
-	local LATEST_GCC_PATH gcc LATEST_GCC_LDPATH
-
-	eval $(gawk -F= '
-		{
-			if ($1 == "GCC_PATH") {
-				p = gensub("\"","","g",$2)
-			} else if ($1 == "LDPATH") {
-				l = gensub("\"","","g",$2)
-			}
-		}
-		END {
-			print "LATEST_GCC_PATH=\"" p "\""
-			print "LATEST_GCC_LDPATH=\"" l "\""
-		}
-		' "${GCC_ENV_D}"/${CHOST}-*
-	)
+	local LDPATH
+
+	eval $(grep -h '^LDPATH=' "${GCC_ENV_D}"/${CHOST}-* | tail -1)
+	LDPATH=${LDPATH%%:*}
 
 	# If /usr isn't a sep mount, then don't bother with linking stuff.
-	if ln "${ROOT}/${LATEST_GCC_LDPATH%%:*}/libgcc.a" "${ROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
+	if ln "${ROOT}/${LDPATH}/libgcc.a" "${ROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
 		rm -f "${ROOT}"/lib/.gcc.config.$$
 		if [[ -n $(find "${ROOT}"/lib*/lib{gcc_s,unwind}.so* 2>/dev/null) ]] ; then
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
@@ -329,34 +312,25 @@ handle_split_usr() {
 		return 0
 	fi
 
-	gcc="${ROOT}${LATEST_GCC_PATH}/gcc"
-
-	local multilib
-	for multilib in $("${gcc}" -print-multi-lib); do
-		local multiarg=${multilib#*;}
-		multiarg=${multiarg/@/-}
-		local multilibdir=${multilib%;*}
-		local libdir="${ROOT}lib/"$("${gcc}" ${multiarg} -print-multi-os-directory)
-
-		mkdir -p "${libdir}"/.gcc.config.new || continue # !?!?!
-
-		local gcclib
-		for gcclib in gcc_s unwind ; do
-			# This assumes that we always have the .so symlink,
-			# but for now, that should be safe ...
-			gcclib=$("${gcc}" -print-file-name="lib${gcclib}.so")
-			if [[ ${gcclib} == */* ]] ; then
-				cp -pP "${ROOT}${gcclib}".* "${libdir}"/.gcc.config.new/
-				# no need to sanity remove this as the `mv` should take
-				# care of it.  we also need this step to be completly atomic
-				# for systems that have even `mv` linked against libgcc_s.so.
-				# http://bugs.gentoo.org/150257
-				#rm -f "${libdir}"/lib${gcclib}.so*
-				mv -f "${libdir}"/.gcc.config.new/* "${libdir}"/
-			fi
+	# Only bother with this stuff for the native ABI.  We assume the user
+	# doesn't have critical binaries for non-native ABIs which is fair.
+	local gcclib
+	local libdir="${ROOT}${GENTOO_LIBDIR}"
+	mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
+	for gcclib in gcc_s unwind ; do
+		# This assumes that we always have the .so symlink,
+		# but for now, that should be safe ...
+		for gcclib in "${ROOT}${LDPATH}"/lib${gcclib}.so.* ; do
+			[[ -e ${gcclib} ]] || continue
+			cp -pP "${gcclib}" "${libdir}"/.gcc.config.new/
+			# no need to sanity `rm` this as the `mv` should take care
+			# of it.  we also need this step to be completely atomic
+			# for systems that have even `mv` linked against libgcc_s.so.
+			# http://bugs.gentoo.org/150257
+			mv -f "${libdir}"/.gcc.config.new/* "${libdir}"/
 		done
-		rmdir "${libdir}"/.gcc.config.new
 	done
+	rmdir "${libdir}"/.gcc.config.new
 
 	return 0
 }


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-11-19  6:52 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-11-19  6:52 UTC (permalink / raw
  To: gentoo-commits

commit:     7ee46ae0f636f56054df4035f50de79af03e3657
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 19 01:44:11 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 19 03:11:11 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=7ee46ae0

gcc-config: handle multilib libgcj pc files

Scan all of the multilib dirs that gcc supports and handle libgcj pc
files for each one.

URL: http://bugs.gentoo.org/435728
Reported-by: Michał Górny <mgorny <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/gcc-config b/gcc-config
index 0406f95..18d0b48 100755
--- a/gcc-config
+++ b/gcc-config
@@ -354,8 +354,10 @@ switch_profile() {
 	fi
 
 	# Setup things properly again for this profile
-	unset GCC_SPECS LDPATH
+	unset GCC_SPECS LDPATH MULTIOSDIRS
 	source "${GCC_ENV_D}/${CC_COMP}"
+	# Support older configs that did not setup MULTIOSDIRS for us.
+	: ${MULTIOSDIRS:=../${GENTOO_LIBDIR}}
 
 	# Ignore active profile errors here since we're switching away
 	OLD_CC_COMP=$(get_current_profile 2>/dev/null)
@@ -404,7 +406,7 @@ switch_profile() {
 		)
 
 		# Pass all by default
-		awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH)=/ {print $0}' \
+		awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH|MULTIOSDIRS)=/ {print $0}' \
 			"${GCC_ENV_D}/${CC_COMP}" >> "${envd}.tmp"
 		if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
 			echo "${MY_LDPATH}" > "${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
@@ -422,19 +424,22 @@ switch_profile() {
 		ln -sf ${CC_COMP} "${GCC_ENV_D}/.NATIVE"
 
 		# Relocate random crap
-		local pkgconfdir="${ROOT}/usr/${GENTOO_LIBDIR}/pkgconfig"
+		local x libdir pkgconfdir
 		local mver=${CC_COMP_VERSION:0:3}
-		for x in "" "-${mver}" ; do
-			x="${pkgconfdir}/libgcj${x}.pc"
-			if [[ -e ${pkgconfdir}/libgcj-${CC_COMP_VERSION}.pc ]] ; then
-				ln -sf libgcj-${CC_COMP_VERSION}.pc "${x}"
-			else
-				# Maybe we selected a version that lacks gcj support.
-				rm -f "${x}"
-			fi
+		for libdir in ${MULTIOSDIRS//:/ } ; do
+			pkgconfdir="${ROOT}/usr/lib/${libdir}/pkgconfig"
+			for x in "" "-${mver}" ; do
+				x="${pkgconfdir}/libgcj${x}.pc"
+				if [[ -e ${pkgconfdir}/libgcj-${CC_COMP_VERSION}.pc ]] ; then
+					ln -sf libgcj-${CC_COMP_VERSION}.pc "${x}"
+				else
+					# Maybe we selected a version that lacks gcj support.
+					rm -f "${x}"
+				fi
+			done
+			# Clean out anything left over from older versions. #430932
+			find "${pkgconfdir}"/libgcj*.pc -xtype l -delete 2>/dev/null
 		done
-		# Clean out anything left over from older versions. #430932
-		find "${pkgconfdir}"/libgcj*.pc -xtype l -delete 2>/dev/null
 
 		handle_split_usr
 		: $(( envd_changed += $? ))


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2012-12-29 21:08 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2012-12-29 21:08 UTC (permalink / raw
  To: gentoo-commits

commit:     205d3103e5cf075f908da72644cb4cbcfb49dbaf
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 29 15:41:26 2012 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Dec 29 21:09:05 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=205d3103

try_real_hard_to_find_CHOST: use probed GNU sed

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gcc-config b/gcc-config
index 18d0b48..61e3d1c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -93,7 +93,7 @@ try_real_hard_to_find_CHOST() {
 		# newer portage supports spaces between the var and =
 		# CHOST     =  "this-is-retarded"
 		ret=$(eval $(
-			sed -n \
+			${SED} -n \
 				-e 's:[[:space:]]::g' \
 				-e "/^${varname}=/p" \
 				"${conf}"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2013-01-02  3:52 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2013-01-02  3:52 UTC (permalink / raw
  To: gentoo-commits

commit:     b4640899a944245441860c09849c147c65518e1c
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  2 03:51:57 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Jan  2 03:51:57 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=b4640899

gcc-config: drop Solaris special casing with /lib/cpp

When we added this logic, Gentoo/prefix wasn't a standard setup.  Now that
we do have Gentoo/prefix, there's no reason to special case Solaris as this
path won't be an issue (as prefix systems don't write to /lib/).

If someone really cares about using portage in a non-prefix setup, we can
talk about how best to support things then.  But this issue isn't Solaris
specific, so we shouldn't have that tuple hardcoded.

URL: http://bugs.gentoo.org/79964
Reported-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/gcc-config b/gcc-config
index a9128d5..b11a98f 100755
--- a/gcc-config
+++ b/gcc-config
@@ -270,7 +270,6 @@ update_wrappers() {
 	rm -f "${ROOT}usr/bin/${CTARGET}-cc" "${ROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
 
 	# install the canonical cpp wrapper
-	[[ ${CTARGET} == *-solaris* ]] && return 0
 	if ! is_cross_compiler ; then
 		atomic_cp "${wrapper}" "${ROOT}lib" "cpp" "${ROOT}usr/bin/cpp"
 	fi


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2013-01-02 18:30 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2013-01-02 18:30 UTC (permalink / raw
  To: gentoo-commits

commit:     03c49f853b4850a043f91816097250a1b3ddcf22
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  2 08:55:17 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Jan  2 18:32:08 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=03c49f85

gcc-config: for Prefix split-/usr is never an issue

Don't consider linking, even if /usr would be split, on Prefix.  Do
cleanup from older gcc-config though.  This leaves a gap where we don't
cleanup if the Prefix install uses a different filesystem for its /usr,
but that should be pretty rare, non-standard and utterly weird, so we
don't care.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/gcc-config b/gcc-config
index b11a98f..6fb9904 100755
--- a/gcc-config
+++ b/gcc-config
@@ -311,6 +311,9 @@ handle_split_usr() {
 		return 0
 	fi
 
+	# Gentoo Prefix systems don't "boot", so no need to handle split-/usr
+	[[ -n ${EPREFIX} ]] && return 0
+
 	# Only bother with this stuff for the native ABI.  We assume the user
 	# doesn't have critical binaries for non-native ABIs which is fair.
 	local gcclib


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2013-01-12 17:05 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2013-01-12 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     deaecbb404c8a60f9aec3bc85a4fc1621a561687
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  5 16:12:34 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Jan 12 17:07:36 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=deaecbb4

make aware of EPREFIX offset prefix

- changed Makefile to expand @GENTOO_EPREFIX@ for gcc-config
- defined EPREFIX and EROOT in gcc-config, and used them
- made wrapper look in the offset for files

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 Makefile   |    7 ++++++-
 gcc-config |   59 +++++++++++++++++++++++++++++++++--------------------------
 wrapper.c  |   14 +++++++++-----
 3 files changed, 48 insertions(+), 32 deletions(-)

diff --git a/Makefile b/Makefile
index 409d7b0..db14af9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,14 @@
+EPREFIX ?=
+
 CFLAGS ?= -O2 -g
 CFLAGS += -Wall -Wextra
+CPPFLAGS += '-DEPREFIX="$(EPREFIX)"'
 
 PN = gcc-config
 PV = git
 P = $(PN)-$(PV)
 
-PREFIX = /usr
+PREFIX = $(EPREFIX)/usr
 BINDIR = $(PREFIX)/bin
 SUBLIBDIR = lib
 LIBDIR = $(PREFIX)/$(SUBLIBDIR)
@@ -21,6 +24,8 @@ clean:
 
 .gcc-config: gcc-config
 	sed \
+		-e '1s:/:$(EPREFIX)/:' \
+		-e 's:@GENTOO_EPREFIX@:$(EPREFIX):g' \
 		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
 		-e 's:@PV@:$(PV):g' \
 		$< > $@

diff --git a/gcc-config b/gcc-config
index 6fb9904..b4ed712 100755
--- a/gcc-config
+++ b/gcc-config
@@ -9,14 +9,17 @@
 : ${ROOT:=/}
 [[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
 [[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
+EPREFIX="@GENTOO_EPREFIX@"
+[[ ${EPREFIX} == @*@ ]] && EPREFIX=""
+EROOT="${ROOT%/}${EPREFIX}/"
 
 cd /
 
 trap ":" INT QUIT TSTP
 
 argv0=${0##*/}
-source /etc/init.d/functions.sh || {
-	echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+source "${EPREFIX}"/etc/init.d/functions.sh || {
+	echo "${argv0}: Could not source ${EPREFIX}/etc/init.d/functions.sh!" 1>&2
 	exit 1
 }
 esyslog() { :; }
@@ -84,9 +87,9 @@ try_real_hard_to_find_CHOST() {
 	#
 
 	local varname=${1:-CHOST}
-	local conf=${ROOT}/etc/portage/make.conf
-	if [[ ! -e ${conf} && -e ${ROOT}/etc/make.conf ]] ; then
-		conf=${ROOT}/etc/make.conf
+	local conf=${EROOT}/etc/portage/make.conf
+	if [[ ! -e ${conf} && -e ${EROOT}/etc/make.conf ]] ; then
+		conf=${EROOT}/etc/make.conf
 	fi
 	local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
 	if [[ -z ${ret} ]] ; then
@@ -109,8 +112,8 @@ try_real_hard_to_find_CHOST() {
 	#
 	# Then we try /etc/env.d/gcc/config-${CTARGET}
 	#
-	if [[ -s ${ROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
-		ret=$(split_gcc_ver $(show_var CURRENT "${ROOT}"/etc/env.d/gcc/config-${CTARGET}))
+	if [[ -s ${EROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
+		ret=$(split_gcc_ver $(show_var CURRENT "${EROOT}"/etc/env.d/gcc/config-${CTARGET}))
 		echo ${ret% *}
 	fi
 }
@@ -133,7 +136,7 @@ get_chost() {
 	if [[ -z ${CHOST} ]] ; then
 		eerror "${argv0}: Could not get portage CHOST!"
 		eerror "${argv0}: You should verify that CHOST is set in one of these places:"
-		eerror "${argv0}:  - ${ROOT}/etc/portage/make.conf"
+		eerror "${argv0}:  - ${EROOT}/etc/portage/make.conf"
 		eerror "${argv0}:  - active environment"
 		exit 1
 	fi
@@ -196,7 +199,7 @@ update_wrappers() {
 	# Find the bin wrapper
 	local wrapper
 	for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
-		wrapper="${ROOT}usr/${wrapper}/misc/gcc-config"
+		wrapper="${EROOT}usr/${wrapper}/misc/gcc-config"
 		[[ -e ${wrapper} ]] && break
 	done
 
@@ -222,7 +225,7 @@ update_wrappers() {
 	# new one does not.
 	for x in "${old_wrappers[@]}" ; do
 		has "${x}" "${new_wrappers[@]}" && continue
-		rm -f "${ROOT}usr/bin/${x}" "${ROOT}usr/bin/${CTARGET}-${x}"
+		rm -f "${EROOT}usr/bin/${x}" "${EROOT}usr/bin/${CTARGET}-${x}"
 	done
 
 	# For all toolchains, we want to create the fully qualified
@@ -259,19 +262,19 @@ update_wrappers() {
 
 		# Now do the actual wrapper copy with paths to the reference binary
 		if [[ -x ${ref} ]] ; then
-			atomic_cp "${wrapper}" "${ROOT}usr/bin" "${x}" "${ref}"
+			atomic_cp "${wrapper}" "${EROOT}usr/bin" "${x}" "${ref}"
 		else
 			ewarn "double insanity with ${x} and ${ref}"
 			# Make sure we have no stale wrappers
-			rm -f "${ROOT}usr/bin/${x}"
+			rm -f "${EROOT}usr/bin/${x}"
 		fi
 	done
 	# legacy cruft, make sure we dont leave it laying around #143205
-	rm -f "${ROOT}usr/bin/${CTARGET}-cc" "${ROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
+	rm -f "${EROOT}usr/bin/${CTARGET}-cc" "${EROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
 
 	# install the canonical cpp wrapper
 	if ! is_cross_compiler ; then
-		atomic_cp "${wrapper}" "${ROOT}lib" "cpp" "${ROOT}usr/bin/cpp"
+		atomic_cp "${wrapper}" "${EROOT}lib" "cpp" "${EROOT}usr/bin/cpp"
 	fi
 }
 
@@ -301,11 +304,11 @@ handle_split_usr() {
 	LDPATH=${LDPATH%%:*}
 
 	# If /usr isn't a sep mount, then don't bother with linking stuff.
-	if ln "${ROOT}/${LDPATH}/libgcc.a" "${ROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
-		rm -f "${ROOT}"/lib/.gcc.config.$$
-		if [[ -n $(find "${ROOT}"/lib*/lib{gcc_s,unwind}.so* 2>/dev/null) ]] ; then
+	if ln "${ROOT}/${LDPATH}/libgcc.a" "${EROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
+		rm -f "${EROOT}"/lib/.gcc.config.$$
+		if [[ -n $(find "${EROOT}"/lib*/lib{gcc_s,unwind}.so* 2>/dev/null) ]] ; then
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
-			rm -f "${ROOT}"/lib*/lib{gcc_s,unwind}.so*
+			rm -f "${EROOT}"/lib*/lib{gcc_s,unwind}.so*
 			return 1
 		fi
 		return 0
@@ -317,7 +320,7 @@ handle_split_usr() {
 	# Only bother with this stuff for the native ABI.  We assume the user
 	# doesn't have critical binaries for non-native ABIs which is fair.
 	local gcclib
-	local libdir="${ROOT}${GENTOO_LIBDIR}"
+	local libdir="${EROOT}${GENTOO_LIBDIR}"
 	mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
 	for gcclib in gcc_s unwind ; do
 		# This assumes that we always have the .so symlink,
@@ -343,7 +346,7 @@ switch_profile() {
 
 	# Make sure we have write access to the dirs.  Do not require `root`
 	# so that we work with prefix/cross/etc... setups that run as user.
-	[[ ! -w ${ROOT} ]] && die "need write access to ${ROOT}"
+	[[ ! -w ${EROOT} ]] && die "need write access to ${EROOT}"
 
 	if is_cross_compiler ; then
 		ebegin "Switching cross-compiler to ${CC_COMP}"
@@ -429,7 +432,7 @@ switch_profile() {
 		local x libdir pkgconfdir
 		local mver=${CC_COMP_VERSION:0:3}
 		for libdir in ${MULTIOSDIRS//:/ } ; do
-			pkgconfdir="${ROOT}/usr/lib/${libdir}/pkgconfig"
+			pkgconfdir="${EROOT}/usr/lib/${libdir}/pkgconfig"
 			for x in "" "-${mver}" ; do
 				x="${pkgconfdir}/libgcj${x}.pc"
 				if [[ -e ${pkgconfdir}/libgcj-${CC_COMP_VERSION}.pc ]] ; then
@@ -477,7 +480,7 @@ switch_profile() {
 		ewarn "If you intend to use the gcc from the new profile in an already"
 		ewarn "running shell, please remember to do:"
 		echo
-		ewarn "  . /etc/profile"
+		ewarn "  . ${EPREFIX}/etc/profile"
 		echo
 	fi
 
@@ -655,7 +658,7 @@ DOIT=""
 FORCE="no"
 
 CC_COMP=
-ENV_D="${ROOT}etc/env.d"
+ENV_D="${EROOT}etc/env.d"
 GCC_ENV_D="${ENV_D}/gcc"
 
 for x in "$@" ; do
@@ -786,7 +789,11 @@ if [[ -z ${CC_COMP} ]] ; then
 fi
 
 if [[ ${DOIT} != "get_current_profile" ]] ; then
-	GCC_LIB=$(get_lib_path | awk -F/ '{ print  "/"$2"/"$3"/"$4"/" }')
+	GCC_LIB=$(
+		get_lib_path | \
+			${SED} -e "s|${EPREFIX:-/}/*|/|g" | \
+			awk -F/ '{ print "/"$2"/"$3"/"$4"/" }'
+	)
 
 	# For people who insist on using funky version strings ("4.6.x"
 	# rather than "4.6.2"), allow them to manually specify it.
@@ -799,11 +806,11 @@ if [[ ${DOIT} != "get_current_profile" ]] ; then
 		CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
 	fi
 
-	if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
+	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
 		CC_COMP_VERSION=${CC_COMP_VERSION%-*}
 	fi
 
-	if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
+	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
 	   [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
 	then
 		eerror "${argv0}: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2

diff --git a/wrapper.c b/wrapper.c
index 65e5317..50c35a4 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -21,8 +21,12 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
-#define GCC_CONFIG "/usr/bin/gcc-config"
-#define ENVD_BASE  "/etc/env.d/05gcc"
+#ifndef EPREFIX
+# define EPREFIX ""
+#endif
+
+#define GCC_CONFIG EPREFIX "/usr/bin/gcc-config"
+#define ENVD_BASE  EPREFIX "/etc/env.d/05gcc"
 
 #define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
 
@@ -146,7 +150,7 @@ static int find_target_in_envd(struct wrapper_data *data, int cross_compile)
 		/* for the sake of speed, we'll keep a symlink around for
 		 * the native compiler.  #190260
 		 */
-		snprintf(envd_file, sizeof(envd_file)-1, "/etc/env.d/gcc/.NATIVE");
+		snprintf(envd_file, sizeof(envd_file)-1, EPREFIX "/etc/env.d/gcc/.NATIVE");
 	} else {
 		char *ctarget, *end = strrchr(data->name, '-');
 		if (end == NULL)
@@ -289,8 +293,8 @@ int main(int argc, char *argv[])
 			data.name = wrapper_aliases[i].target;
 
 	/* What is the full name of our wrapper? */
-	data.fullname = xmalloc(strlen(data.name) + sizeof("/usr/bin/") + 1);
-	sprintf(data.fullname, "/usr/bin/%s", data.name);
+	data.fullname = xmalloc(strlen(data.name) + sizeof(EPREFIX "/usr/bin/") + 1);
+	sprintf(data.fullname, EPREFIX "/usr/bin/%s", data.name);
 
 	find_wrapper_target(&data);
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2013-01-12 17:14 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2013-01-12 17:14 UTC (permalink / raw
  To: gentoo-commits

commit:     1487cdb45f497c371ceac411091fb0adb01e6ca2
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  5 16:12:36 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Jan 12 17:16:26 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=1487cdb4

gcc-config: cleanup old Darwin stuff from /lib too

Cleanup lib/libgcc_s{.1,_ppc,...}.dylib for Darwin hosts.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc-config b/gcc-config
index b4ed712..3b3941a 100755
--- a/gcc-config
+++ b/gcc-config
@@ -306,9 +306,9 @@ handle_split_usr() {
 	# If /usr isn't a sep mount, then don't bother with linking stuff.
 	if ln "${ROOT}/${LDPATH}/libgcc.a" "${EROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
 		rm -f "${EROOT}"/lib/.gcc.config.$$
-		if [[ -n $(find "${EROOT}"/lib*/lib{gcc_s,unwind}.so* 2>/dev/null) ]] ; then
+		if [[ -n $(find "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib} 2>/dev/null) ]] ; then
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
-			rm -f "${EROOT}"/lib*/lib{gcc_s,unwind}.so*
+			rm -f "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib}
 			return 1
 		fi
 		return 0


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2013-01-12 17:17 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2013-01-12 17:17 UTC (permalink / raw
  To: gentoo-commits

commit:     93a98ac9befc5f4450436d106c8cc9190c12b4d1
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 11 09:31:45 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Jan 12 17:20:24 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=93a98ac9

gcc-config: prefix: copy GCC's libs to emulate ld.so.conf magic

Because Prefix doesn't have ld.so.conf magic in place (either because it
doesn't exist, or because we don't have the privileges to touch it), we
need to ensure that GCC's libs can be found at runtime.  To do so, we
use a special dir in which we stack all GCC's libs per version.  This
dir is in RPATH (or equivalent), such that applications and libraries
can find their libgcc_s.so.1 (needed on Solaris) or libstdc++.so.6, or
libgomp.so, ... etc.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |  234 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 234 insertions(+), 0 deletions(-)

diff --git a/gcc-config b/gcc-config
index 3b3941a..89fc32c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -340,6 +340,239 @@ handle_split_usr() {
 	return 0
 }
 
+prefix_copy_gcc_libs() {
+	# no business here if not Prefix
+	[[ -z ${EPREFIX} ]] && return 0
+
+	# To emulate properly what ld.so.conf magic does for non-prefix,
+	# we have to copy the libs of all installed (native) GCC's and
+	# make sure we do the current one as last, such that the
+	# pointers for the unversioned libs point to the currently
+	# selected version.  This is only necessary for platforms that use
+	# shared libs, and only record the object name (not the full path).
+	case ${CHOST} in
+		*-mint*)
+			# static only, nothing to do here
+			return 0
+			;;
+		*-darwin*)
+			# Mach-O records all references with full path, hence each
+			# object has links to the GCC-specific version of the lib.
+			return 0
+			;;
+	esac
+
+	# dstlibgcc location is added to RPATH by the binutils wrapper
+	local dstlibgcc=${EROOT}/usr/${CHOST}/lib/gcc
+
+	# Prepare empty directories first
+	local temporary=.gcc.config.new
+	rm -rf   "${dstlibgcc}"/${temporary} || return 1
+	mkdir -p "${dstlibgcc}"/${temporary} || return 1
+
+	local LIBSUFFIX
+	case ${CHOST} in
+		*-aix*)
+			LIBSUFFIX="a"
+			AIXLIBS=
+
+			do_single_runtime() {
+				local sourcedir=$1; shift
+				local libname=$1; shift
+				local targetdir=$1; shift
+				local finaldir=$1; shift
+
+				aixdll \
+					--merge-runtime \
+					--finish=false \
+					--target="${targetdir}"/lib${libname}.${LIBSUFFIX} \
+					"${sourcedir}"/lib${libname}.${LIBSUFFIX} \
+					|| return 1
+				[[ ${AIXLIBS} == *":${targetdir}/lib${libname}.${LIBSUFFIX}:"* ]] \
+					|| AIXLIBS="${AIXLIBS}:${targetdir}/lib${libname}.${LIBSUFFIX}:"
+			}
+
+			finish_runtime_dir() {
+				local sourcedir=$1; shift
+				local targetdir=$1; shift
+				local cleanup=$1; shift
+
+				local f save_IFS
+				save_IFS=$IFS; IFS=:
+				for f in ${AIXLIBS}; do
+					IFS=$save_IFS
+					[[ -n ${f} ]] || continue
+					aixdll \
+						--finish-merge \
+						--keepdir=false \
+						"${f}" \
+						|| return 1
+				done
+				IFS=$save_IFS
+				unset AIXLIBS
+
+				finish_runtime_dir_elf \
+					"${sourcedir}" \
+					"${targetdir}" \
+					${cleanup} \
+					|| return 1
+			}
+			;;
+		hppa64*-hpux*)
+			LIBSUFFIX="sl"
+			do_single_runtime() {
+				do_single_runtime_elf "$@"
+			}
+			finish_runtime_dir() {
+				finish_runtime_dir_elf "$@"
+			}
+			;;
+		hppa*-hpux*)
+			LIBSUFFIX="sl"
+			do_single_runtime() {
+				local sourcedir=$1; shift
+				local libname=$1; shift
+				local targetdir=$1; shift
+				local finaldir=$1; shift
+
+				# when using some simple shell script wrappers (again :)),
+				# there may be no libs around!
+				if [[ -n $(ls "${sourcedir}"/lib${libname}.*${LIBSUFFIX}* 2>/dev/null) ]]; then
+					cp -fpP "${sourcedir}"/lib${libname}.*${LIBSUFFIX}* "${targetdir}" || return 1
+					# gcc creates "libgcc_s.4" with symlink "libgcc_s.sl -> libgcc_s.4", and
+					# we patch it to also set the 'internal name' (=soname) (gcc-PR40913).
+					if [[ ${libname} == 'gcc_s' ]]; then
+						if [[ -n $(ls "${sourcedir}"/lib${libname}.[0-9] 2>/dev/null) ]]; then
+							cp -fpP "${sourcedir}"/lib${libname}.[0-9] "${targetdir}" || return 1
+						fi
+					fi
+					# we do not need the unversioned lib, as linking
+					# is done against the used gcc's private copy.
+					rm -f "${targetdir}"/lib${libname}.${LIBSUFFIX} || return 1
+				fi
+			}
+			finish_runtime_dir() {
+				finish_runtime_dir_elf "$@"
+			}
+			;;
+		*)
+			LIBSUFFIX="so"
+			do_single_runtime() {
+				do_single_runtime_elf "$@"
+			}
+			finish_runtime_dir() {
+				finish_runtime_dir_elf "$@"
+			}
+			;;
+	esac
+
+	do_single_runtime_elf() {
+		local sourcedir=$1; shift
+		local libname=$1; shift
+		local targetdir=$1; shift
+		local finaldir=$1; shift
+
+		# when using some simple shell script wrappers (again :)),
+		# there may be no libs around!
+		if [[ -n $(ls "${sourcedir}"/lib${libname}.*${LIBSUFFIX}* 2>/dev/null) ]]; then
+			cp -fpP "${sourcedir}"/lib${libname}.*${LIBSUFFIX}* "${targetdir}" || return 1
+			# we do not need the unversioned lib, as linking
+			# is done against the used gcc's private copy.
+			rm -f "${targetdir}"/lib${libname}.${LIBSUFFIX} || return 1
+		fi
+	}
+
+	finish_runtime_dir_elf() {
+		local sourcedir=$1; shift
+		local targetdir=$1; shift
+		local cleanup=$1; shift
+
+		if [[ ${cleanup} == clean ]]; then
+			for f in "${targetdir}"/*; do
+				[[ ${f} == ${sourcedir} ]] && continue
+				[[ -e "${sourcedir}/${f##*/}" ]] && continue
+				rm -f "${f}"
+			done
+		fi
+
+		# move symlinks first:
+		# because of file ordering, the real files may be
+		# moved before the symlinks, causing the symlinks
+		# going broken.
+		for f in "${sourcedir}"/*; do
+			[[ -e ${f} && -L ${f} ]] || continue
+			# use backups: hpux cannot overwrite sharedlibs in use: "Text file busy"
+			rm -f "${targetdir}"/${f##*/}*'~' >/dev/null 2>&1
+			mv -f --backup=numbered --suffix='~' "${f}" "${targetdir}"/${f##*/} || return 1
+			rm -f "${targetdir}"/${f##*/}*'~' >/dev/null 2>&1
+		done
+
+		for f in "${sourcedir}"/*; do
+			[[ -f "${f}" ]] || continue
+			# use backups: hpux cannot overwrite sharedlibs in use: "Text file busy"
+			rm -f "${targetdir}"/${f##*/}*'~' >/dev/null 2>&1
+			mv -f --backup=numbered --suffix='~' "${f}" "${targetdir}"/${f##*/} || return 1
+			rm -f "${targetdir}"/${f##*/}*'~' >/dev/null 2>&1
+		done
+		rmdir "${sourcedir}"
+	}
+
+	local GCC_PROFILES=$(LC_ALL="C" ls ${GCC_ENV_D}/${CHOST}-*)
+
+	local targetdirs= GCC_PATH= LDPATH=
+	for x in ${GCC_PROFILES} ; do
+		unset GCC_PATH LDPATH
+		eval $(
+			source "${x}"
+			echo "GCC_PATH='${GCC_PATH}'"
+			echo "LDPATH='${LDPATH%%:*}'"
+		)
+
+		pushd "${ROOT%/}${LDPATH}" > /dev/null || return 1
+
+		local donelibs= lib= gcclib=
+		for lib in lib*.${LIBSUFFIX}; do
+			gcclib=${lib#lib}
+			gcclib=${gcclib%.${LIBSUFFIX}}
+			gcclib=${gcclib%%.[0-9]*} # we need the unversioned libname.
+			[[ ${donelibs} != *" ${gcclib} "* ]] || continue
+			donelibs="${donelibs} ${gcclib} "
+
+			[[ ${targetdirs} == *":${dstlibgcc},clean:"* ]] ||
+				targetdirs="${targetdirs}:${dstlibgcc},clean:"
+
+			do_single_runtime \
+				"${ROOT%/}${LDPATH}" \
+				${gcclib} \
+				"${dstlibgcc}"/${temporary} \
+				"${dstlibgcc}" \
+				|| return 1
+		done
+
+		popd > /dev/null
+	done
+
+	local clean= targetdir=
+	local save_IFS=$IFS
+	IFS=:
+	for targetdir in ${targetdirs}; do
+		IFS=${save_IFS}
+		[[ -n ${targetdir} ]] || continue
+
+		# eventually cleanup old files
+		clean=${targetdir##*,}
+
+		targetdir=${targetdir%,*}
+
+		finish_runtime_dir \
+			"${targetdir}"/${temporary} \
+			"${targetdir}" \
+			${clean} \
+			|| return 1
+	done
+	IFS=${save_IFS}
+}
+
 switch_profile() {
 	local OLD_CC_COMP OLD_CC_COMP_VERSION OLD_GCC_PATH OLD_GCC_VER
 	local GCC_PATH
@@ -446,6 +679,7 @@ switch_profile() {
 			find "${pkgconfdir}"/libgcj*.pc -xtype l -delete 2>/dev/null
 		done
 
+		prefix_copy_gcc_libs
 		handle_split_usr
 		: $(( envd_changed += $? ))
 	fi


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2013-01-12 17:20 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2013-01-12 17:20 UTC (permalink / raw
  To: gentoo-commits

commit:     cfbb9e94ca23c360d5801946e39da29c7d422dfc
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Jan  5 16:42:24 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Jan 12 17:23:25 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=cfbb9e94

gcc-config: prefix: don't bother running ldconfig

In Prefix we're unprivileged (most likely) so don't bother trying to
update ld.so.conf or anything like that.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 gcc-config |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc-config b/gcc-config
index 89fc32c..8d2347f 100755
--- a/gcc-config
+++ b/gcc-config
@@ -646,8 +646,8 @@ switch_profile() {
 		# Pass all by default
 		awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH|MULTIOSDIRS)=/ {print $0}' \
 			"${GCC_ENV_D}/${CC_COMP}" >> "${envd}.tmp"
-		if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
-			echo "${MY_LDPATH}" > "${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
+		if [[ -d ${EROOT}/etc/ld.so.conf.d ]] ; then
+			echo "${MY_LDPATH}" > "${EROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
 		else
 			echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
 		fi
@@ -692,7 +692,7 @@ switch_profile() {
 	   [[ ${FORCE} == "yes" || ${envd_changed} -gt 0 ]]
 	then
 		# in case python is broken ...
-		if ! env-update ; then
+		if [[ -z ${EPREFIX} ]] && ! env-update ; then
 			echo ""
 			ewarn "env-update failed to work properly; making sure ld.so.conf paths"
 			ewarn "are setup properly.  Please rerun gcc-config with the -f option."


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2013-05-22 23:54 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2013-05-22 23:54 UTC (permalink / raw
  To: gentoo-commits

commit:     2b41e23eaf727bdba8574f805d80916beff8621e
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed May 22 23:48:24 2013 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed May 22 23:53:49 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gcc-config.git;a=commit;h=2b41e23e

build with 64bit interfaces

We use stat(), so make sure we use the 64bit versions, else trying
to stat() a file with 64bit inodes will randomly fail on us.

URL: http://bugs.gentoo.org/471024
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

---
 wrapper.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/wrapper.c b/wrapper.c
index 50c35a4..b00e818 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -11,6 +11,10 @@
 # define USE_DEBUG 0
 #endif
 
+#ifndef _FILE_OFFSET_BITS
+# define _FILE_OFFSET_BITS 64	/* #471024 */
+#endif
+
 #include <errno.h>
 #include <libgen.h>
 #include <limits.h>


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2015-05-13  4:26 Ryan Hill
  0 siblings, 0 replies; 83+ messages in thread
From: Ryan Hill @ 2015-05-13  4:26 UTC (permalink / raw
  To: gentoo-commits

commit:     fbf72a0a0c3c5708e68fa493b2014605b828f2e6
Author:     Ryan Hill <rhill <AT> gentoo <DOT> org>
AuthorDate: Wed May 13 04:23:53 2015 +0000
Commit:     Ryan Hill <rhill <AT> gentoo <DOT> org>
CommitDate: Wed May 13 04:23:53 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=fbf72a0a

Use /lib/gentoo/functions.sh instead of /etc/init.d/functions.sh.

URL: https://bugs.gentoo.org/504118
Signed-off-by: Ryan Hill <rhill <AT> gentoo.org>
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>

 gcc-config | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc-config b/gcc-config
index 8d2347f..4fccc8c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -18,8 +18,9 @@ cd /
 trap ":" INT QUIT TSTP
 
 argv0=${0##*/}
-source "${EPREFIX}"/etc/init.d/functions.sh || {
-	echo "${argv0}: Could not source ${EPREFIX}/etc/init.d/functions.sh!" 1>&2
+functions_script="${EPREFIX}/lib/gentoo/functions.sh"
+source ${functions_script} || {
+	echo "${argv0}: Could not source ${functions_script}!" 1>&2
 	exit 1
 }
 esyslog() { :; }


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2015-08-05  7:52 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2015-08-05  7:52 UTC (permalink / raw
  To: gentoo-commits

commit:     6c6073d076b805cfb6c5d8705bc84c0b792f788e
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 07:52:51 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 07:52:51 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=6c6073d0

gcc-config: quote expanded paths

Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 4fccc8c..7fcde15 100755
--- a/gcc-config
+++ b/gcc-config
@@ -19,7 +19,7 @@ trap ":" INT QUIT TSTP
 
 argv0=${0##*/}
 functions_script="${EPREFIX}/lib/gentoo/functions.sh"
-source ${functions_script} || {
+source "${functions_script}" || {
 	echo "${argv0}: Could not source ${functions_script}!" 1>&2
 	exit 1
 }


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2015-08-05  8:12 Mike Frysinger
  0 siblings, 0 replies; 83+ messages in thread
From: Mike Frysinger @ 2015-08-05  8:12 UTC (permalink / raw
  To: gentoo-commits

commit:     db595876a93d194b2ac98c9e1804d0772edb1635
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 08:04:54 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 08:04:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=db595876

gcc.eselect: add an eselect module

This wraps gcc-config so that people can use the standard eselect
interface to manage gcc profiles.

URL: https://bugs.gentoo.org/507870
Reported-by: Ulrich Müller <ulm <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 Makefile    |  5 ++++-
 gcc.eselect | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index db14af9..e20f9f8 100644
--- a/Makefile
+++ b/Makefile
@@ -10,12 +10,14 @@ P = $(PN)-$(PV)
 
 PREFIX = $(EPREFIX)/usr
 BINDIR = $(PREFIX)/bin
+ESELECTDIR = $(PREFIX)/share/eselect/modules
 SUBLIBDIR = lib
 LIBDIR = $(PREFIX)/$(SUBLIBDIR)
 LIBEXECDIR = $(LIBDIR)/misc
 
 MKDIR_P = mkdir -p -m 755
 INSTALL_EXE = install -m 755
+INSTALL_DATA = install -m 644
 
 all: .gcc-config wrapper
 
@@ -32,9 +34,10 @@ clean:
 	chmod a+rx $@
 
 install: all
-	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR)
+	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR) $(DESTDIR)$(ESELECTDIR)
 	$(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
 	$(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
+	$(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR)
 
 test check: .gcc-config
 	cd tests && ./run_tests

diff --git a/gcc.eselect b/gcc.eselect
new file mode 100644
index 0000000..02606dc
--- /dev/null
+++ b/gcc.eselect
@@ -0,0 +1,45 @@
+# -*-eselect-*-  vim: ft=eselect
+# Copyright 2005-2015 Gentoo Foundation
+# Distributed under the terms of the GNU GPL version 2 or later
+
+DESCRIPTION="Manage installed versions of sys-devel/gcc"
+MAINTAINER="toolchain@gentoo.org"
+
+### list action
+
+describe_list() {
+	echo "List all installed version of gcc"
+}
+
+do_list() {
+	gcc-config -l
+}
+
+### set action
+
+describe_set() {
+	echo "Activate one of the installed gcc"
+}
+
+describe_set_parameters() {
+	echo "<target>"
+}
+
+describe_set_options() {
+	echo "target : Target name or number (from 'list' action)"
+}
+
+do_set() {
+	[[ $# -eq 1 ]] || die -q "Please specify exactly one version to activate!"
+	gcc-config "$1"
+}
+
+### show action
+
+describe_show() {
+	echo "Print the currently active gcc version"
+}
+
+do_show() {
+	gcc-config -c
+}


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2017-12-15  8:33 Fabian Groffen
  0 siblings, 0 replies; 83+ messages in thread
From: Fabian Groffen @ 2017-12-15  8:33 UTC (permalink / raw
  To: gentoo-commits

commit:     748d20380aa1b27149dc1b80c7eaf15fde7c6aba
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 15 08:30:17 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Dec 15 08:30:17 2017 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=748d2038

gcc-config: ensure we run env-update for prefix too

The intention of commit cfbb9e94ca23c360d5801946e39da29c7d422dfc was to
disable running ldconfig and updating ld.so.conf for prefix, but the
implementation was too greedy and also disabled env-update, which we
need to activate a compiler, see bug #641096.

Bug: https://bugs.gentoo.org/641096

 gcc-config | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/gcc-config b/gcc-config
index 7fcde15..ff8d8ac 100755
--- a/gcc-config
+++ b/gcc-config
@@ -693,16 +693,18 @@ switch_profile() {
 	   [[ ${FORCE} == "yes" || ${envd_changed} -gt 0 ]]
 	then
 		# in case python is broken ...
-		if [[ -z ${EPREFIX} ]] && ! env-update ; then
+		if ! env-update ; then
 			echo ""
 			ewarn "env-update failed to work properly; making sure ld.so.conf paths"
 			ewarn "are setup properly.  Please rerun gcc-config with the -f option."
 			echo ""
-			if [[ ! -d /etc/ld.so.conf.d ]] ; then
-				show_var LDPATH "${ROOT}"/etc/env.d/05gcc-${CTARGET} \
-					| ${SED} -e 's|:|\n|g' >> /etc/ld.so.conf
+			if [[ -z ${EPREFIX} ]] ; then
+				if [[ ! -d /etc/ld.so.conf.d ]] ; then
+					show_var LDPATH "${ROOT}"/etc/env.d/05gcc-${CTARGET} \
+						| ${SED} -e 's|:|\n|g' >> /etc/ld.so.conf
+				fi
+				ldconfig
 			fi
-			ldconfig
 		fi
 	else
 		envd_changed=0


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2017-12-16 20:15 Andreas Hüttel
  0 siblings, 0 replies; 83+ messages in thread
From: Andreas Hüttel @ 2017-12-16 20:15 UTC (permalink / raw
  To: gentoo-commits

commit:     aab6bf7095a0ab921c78b07a202db207ce07a5f8
Author:     Shane Peelar <lookatyouhacker <AT> gmail <DOT> com>
AuthorDate: Thu Sep 21 17:05:14 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 16 20:13:41 2017 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=aab6bf70

Add support for symlinking appropriate LTO plugin

Since Binutils 2.25, automatic loading of LTO plugins is supported from
binutils, but the LTO plugins must be in the bfd-plugins directory in
order to be found.  This patches gcc-config to automatically do this.

Signed-off-by: Shane Peelar <lookatyouhacker <AT> gmail.com>

 gcc-config | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/gcc-config b/gcc-config
index ff8d8ac..e9afa24 100755
--- a/gcc-config
+++ b/gcc-config
@@ -689,6 +689,19 @@ switch_profile() {
 
 	update_wrappers ${CTARGET}
 
+	# Update LTO plugin for GCC.  Supported as of binutils 2.25.
+	local BFD_PLUGINS_DIR
+	local LIBLTO_PLUGIN
+	LIBLTO_PLUGIN="${EROOT}usr/libexec/gcc/${CTARGET}/${CC_COMP_VERSION}/liblto_plugin.so"
+	if is_cross_compiler; then
+		BFD_PLUGINS_DIR="${EROOT}usr/${CHOST}/${CTARGET}/binutils-bin/lib/bfd-plugins"
+	else
+		BFD_PLUGINS_DIR="${EROOT}usr/${CHOST}/binutils-bin/lib/bfd-plugins"
+	fi
+	ewarn "Updating LTO plugin symlink in ${BFD_PLUGINS_DIR}"
+	mkdir -p "${BFD_PLUGINS_DIR}"
+	ln -sf "${LIBLTO_PLUGIN}" "${BFD_PLUGINS_DIR}"
+
 	if [[ ${ROOT} == "/" ]] && \
 	   [[ ${FORCE} == "yes" || ${envd_changed} -gt 0 ]]
 	then


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2017-12-16 21:11 Andreas Hüttel
  0 siblings, 0 replies; 83+ messages in thread
From: Andreas Hüttel @ 2017-12-16 21:11 UTC (permalink / raw
  To: gentoo-commits

commit:     dd7248dbf6c1d44eebe00fa89165fce228cf9225
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 16 21:10:42 2017 +0000
Commit:     Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Dec 16 21:10:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=dd7248db

Inform, not warn, about LTO symlinks

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index e9afa24..e42008e 100755
--- a/gcc-config
+++ b/gcc-config
@@ -698,7 +698,7 @@ switch_profile() {
 	else
 		BFD_PLUGINS_DIR="${EROOT}usr/${CHOST}/binutils-bin/lib/bfd-plugins"
 	fi
-	ewarn "Updating LTO plugin symlink in ${BFD_PLUGINS_DIR}"
+	einfo "Updating LTO plugin symlink in ${BFD_PLUGINS_DIR}"
 	mkdir -p "${BFD_PLUGINS_DIR}"
 	ln -sf "${LIBLTO_PLUGIN}" "${BFD_PLUGINS_DIR}"
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2018-08-13 21:55 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2018-08-13 21:55 UTC (permalink / raw
  To: gentoo-commits

commit:     7261a618b03699cbbeac56b1e43463af7328b186
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 13 21:54:10 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Aug 13 21:54:10 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=7261a618

wrapper.c: inhibit "unused argc" warning

Before the change the warning was:
  wrapper.c: In function 'main':
  wrapper.c:281:14: warning: unused parameter 'argc' [-Wunused-parameter]
   int main(int argc, char *argv[])
            ~~~~^~~~

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 wrapper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/wrapper.c b/wrapper.c
index b00e818..c245dbb 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -281,6 +281,7 @@ static void modify_path(struct wrapper_data *data)
 int main(int argc, char *argv[])
 {
 	struct wrapper_data data;
+	(void)argc; /* unused variable */
 
 	memset(&data, 0, sizeof(data));
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2018-08-13 22:39 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2018-08-13 22:39 UTC (permalink / raw
  To: gentoo-commits

commit:     39af3214ed29d9a3ca867988f7f2f3b995cafd66
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 13 22:36:20 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Mon Aug 13 22:36:20 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=39af3214

rename installed binary wrapper from 'gcc-config' to 'wrapper'

Before the change installed directory was:
    /usr/$(libexecdir)/misc/gcc-config
    /usr/bin/gcc-config
After the change:
    /usr/$(libexecdir)/gcc-config/wrapper
    /usr/bin/gcc-config

Should decrease confusion between a script and wrapper binary.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 Makefile   | 4 ++--
 gcc-config | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index e20f9f8..3cbb915 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ BINDIR = $(PREFIX)/bin
 ESELECTDIR = $(PREFIX)/share/eselect/modules
 SUBLIBDIR = lib
 LIBDIR = $(PREFIX)/$(SUBLIBDIR)
-LIBEXECDIR = $(LIBDIR)/misc
+LIBEXECDIR = $(LIBDIR)/$(PN)
 
 MKDIR_P = mkdir -p -m 755
 INSTALL_EXE = install -m 755
@@ -35,7 +35,7 @@ clean:
 
 install: all
 	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR) $(DESTDIR)$(ESELECTDIR)
-	$(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
+	$(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/wrapper
 	$(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
 	$(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR)
 

diff --git a/gcc-config b/gcc-config
index db173f3..521e3ba 100755
--- a/gcc-config
+++ b/gcc-config
@@ -198,9 +198,9 @@ update_wrappers() {
 	local x CTARGET=$1
 
 	# Find the bin wrapper
-	local wrapper
-	for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
-		wrapper="${EROOT}usr/${wrapper}/misc/gcc-config"
+	local libdir wrapper
+	for libdir in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
+		wrapper="${EROOT}usr/${libdir}/gcc-config/wrapper"
 		[[ -e ${wrapper} ]] && break
 	done
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2018-08-24  0:23 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2018-08-24  0:23 UTC (permalink / raw
  To: gentoo-commits

commit:     153b36029749d2635a5b87d40e6cf8100b1340f2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 24 00:22:47 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Aug 24 00:22:47 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=153b3602

README: add basic description of how gcc-config works

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)

diff --git a/README b/README
new file mode 100644
index 0000000..06bf8fe
--- /dev/null
+++ b/README
@@ -0,0 +1,103 @@
+What is gcc-config?
+-------------------
+
+Gentoo allows switching gcc as system runs via gcc-config:
+    $ gcc-config x86_64-pc-linux-gnu-8.1.0
+    $ gcc-config x86_64-pc-linux-gnu-7.2.0
+
+Ideally changes should be visible instantly and atomically
+without shell restart. Practially see TODOs and BUGs on PATH/ROOTPATH.
+
+Files, variables, things.
+-------------------------
+
+- Wrappers (copies of /usr/$(libexec)/gcc-config/wrapper)
+    /usr/bin/gcc
+    /usr/bin/g++
+    /usr/bin/${CTARGET}-gcc
+    ...
+    (all files from /usr/${CTARGET}/gcc-bin/$GCC_VERSION/*)
+
+      Wrapper reads env config and re-execs binary from `GCC_PATH`.
+
+      See `gcc-config` script for wrapping details.
+
+- private gcc configs (provided by `toolchain.eclass`, gcc ebuilds)
+
+    /etc/env.d/gcc/.NATIVE -> x86_64-pc-linux-gnu-8.1.0 (link to target config)
+    /etc/env.d/gcc/x86_64-pc-linux-gnu-8.1.0
+
+      Contains variables that describe tolchain layout:
+
+          LDPATH="/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0"
+          MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.1.0/man"
+          INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.1.0/info"
+          STDCXX_INCDIR="g++-v8"
+          CTARGET="x86_64-pc-linux-gnu"
+          GCC_SPECS=""
+          MULTIOSDIRS="../lib64"
+          GCC_PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/8.1.0"
+
+      Used by gcc-config to generate wrappers and 05gcc- env.d files.
+      Used by wrapper to extract GCC_PATH and re-exec().
+
+- gcc env.d cross-compiler entries (provided by gcc-config)
+
+    /etc/env.d/05gcc-${CTARGET}
+
+      Populates paths for cross-compilers
+
+        PATH="/usr/x86_64-pc-linux-gnu/powerpc64le-unknown-linux-gnu/gcc-bin/7.3.0"
+        ROOTPATH="/usr/x86_64-pc-linux-gnu/powerpc64le-unknown-linux-gnu/gcc-bin/7.3.0"
+
+      Used by wrapper to extract PATH and re-exec().
+
+How does gcc-config work?
+-------------------------
+
+/usr/bin/gcc (or /usr/bin/<tool>) is a wrapper (wrapper.c).
+gcc-config allows runtime gcc switch via level of indirection.
+
+Tool name is ${CTARGET}-<tool> or <tool>. TODO: doesn't it break
+on ${CTARGET}-<tool>-<version>? Doesn't ${CTARGET} get misdetected?
+
+Today's resolution order is the following:
+
+1. Searches PATH for <tool> and reexecute if found. Some
+   target paths are ignored:
+   - itself (/usr/bin/<tool>) is ignored to avoid recursion
+   - */gcc-bin/* (/usr/${CHOST}/${CTARGET}/gcc-bin/7.3.0) is ignored
+     as those should precede in PATH to avoid wrapping entirely or be
+     selected via gcc-config.
+2. If [1.] failed search for /etc/env.d/: /etc/env.d/gcc/.NATIVE (native compiler),
+   /etc/env.d/05gcc-${CTARGET} (cross-compiler).
+
+   There GCC_PATH= (native) or PATH= (cross) directory entry is searched.
+
+   Usually it's GCC_PATH="${EPREFIX}/usr/${CHOST}/gcc-bin/<gcc-version>" (native)
+   or GCC_PATH="${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/<gcc-version>" (cross)
+
+3. If [2.] failed run 'ROOT= gcc-config --get-bin-path' and use it's output.
+
+4. Prepend path fetched from above to PATH environment variable and re-exec().
+
+5. Done
+
+`gcc-config` script maintains binaries in `/usr/bin/` to make the above model work.
+
+To make compiler switchable in active shell `/usr/bin/` path must precede
+'/usr/${CHOST}/gcc-bin/<gcc-version>'. Otherwise wrapper is skipped.
+
+TODOs
+-----
+
+- Write proper `gcc-config` manpage off this readme to be more discoverable.
+
+- Make /usr/bin/<tool> a symlink of /usr/$(libexec)/gcc-config/wrapper,
+  not a file copy. This will make the fact that Gentoo uses wrappers more obvious.
+  It's essential to know for people using ccache cache or similar.
+
+- Move /etc/env.d/05gcc-${CTARGET} and /etc/env.d/04gcc-${CTARGET} after
+  /usr/bin PATH injection to restore gcc-config wrapping.
+
+  See https://bugs.gentoo.org/255695 for some details.


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2018-08-24  8:50 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2018-08-24  8:50 UTC (permalink / raw
  To: gentoo-commits

commit:     4634a0f8d453ebc311eec751cb4a97ab5a2b0b65
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 24 08:49:30 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Aug 24 08:49:30 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=4634a0f8

README: fix typos s/Practially/Practically and s/tolchain/toolchain/

Noticed by [Arfrever].

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README b/README
index 06bf8fe..aef9e98 100644
--- a/README
+++ b/README
@@ -6,7 +6,7 @@ Gentoo allows switching gcc as system runs via gcc-config:
     $ gcc-config x86_64-pc-linux-gnu-7.2.0
 
 Ideally changes should be visible instantly and atomically
-without shell restart. Practially see TODOs and BUGs on PATH/ROOTPATH.
+without shell restart. Practically see TODOs and BUGs on PATH/ROOTPATH.
 
 Files, variables, things.
 -------------------------
@@ -27,7 +27,7 @@ Files, variables, things.
     /etc/env.d/gcc/.NATIVE -> x86_64-pc-linux-gnu-8.1.0 (link to target config)
     /etc/env.d/gcc/x86_64-pc-linux-gnu-8.1.0
 
-      Contains variables that describe tolchain layout:
+      Contains variables that describe toolchain layout:
 
           LDPATH="/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0"
           MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.1.0/man"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2018-08-24 16:40 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2018-08-24 16:40 UTC (permalink / raw
  To: gentoo-commits

commit:     9fb81748c138eb4e0ce71af7aed9cbd400cab35a
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 24 16:39:48 2018 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Aug 24 16:39:48 2018 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=9fb81748

README: document /etc/env.d/04gcc-${CTARGET}

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/README b/README
index aef9e98..e7933d8 100644
--- a/README
+++ b/README
@@ -41,9 +41,21 @@ Files, variables, things.
       Used by gcc-config to generate wrappers and 05gcc- env.d files.
       Used by wrapper to extract GCC_PATH and re-exec().
 
-- gcc env.d cross-compiler entries (provided by gcc-config)
+- gcc env.d compiler entries (provided by gcc-config)
 
-    /etc/env.d/05gcc-${CTARGET}
+    /etc/env.d/04gcc-${CTARGET} (native)
+
+      Populates paths for native-compilers
+
+        PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0"
+        ROOTPATH="/usr/x86_64-pc-linux-gnu/gcc-bin/8.2.0"
+        GCC_SPECS=""
+        MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/man"
+        INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/info"
+
+      Used by env-update to populate PATH and more (TODO: remove PATH population).
+
+    /etc/env.d/05gcc-${CTARGET} (cross)
 
       Populates paths for cross-compilers
 
@@ -51,6 +63,7 @@ Files, variables, things.
         ROOTPATH="/usr/x86_64-pc-linux-gnu/powerpc64le-unknown-linux-gnu/gcc-bin/7.3.0"
 
       Used by wrapper to extract PATH and re-exec().
+      Used by env-update to populate PATH (TODO: remove PATH population).
 
 How does gcc-config work?
 -------------------------


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-04 19:00 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-04 19:00 UTC (permalink / raw
  To: gentoo-commits

commit:     f4139631463fe56aebf3c04a44f8691ccd044c01
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  4 18:53:38 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Sep  4 18:53:38 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=f4139631

gcc-config: don't perform a cleanup for prefix systems

Patch by [Arfrever]. No changes in actual handling of
/lib*/ file on non-prefix systems yet.

Bug: https://bugs.gentoo.org/667020
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc-config b/gcc-config
index e7f3fb9..998a165 100755
--- a/gcc-config
+++ b/gcc-config
@@ -287,7 +287,10 @@ handle_split_usr() {
 	# http://bugs.gentoo.org/60190
 	#
 	# The funky move magic is required for proper updating of in-use files.
-	#
+
+	# Gentoo Prefix systems don't "boot", so no need to handle split-/usr
+	[[ -n ${EPREFIX} ]] && return 0
+
 	# We use the same ordering logic as mentioned in the MY_LDPATH setup.
 	# We get the libs from the latest version available.
 	local LDPATH
@@ -306,9 +309,6 @@ handle_split_usr() {
 		return 0
 	fi
 
-	# Gentoo Prefix systems don't "boot", so no need to handle split-/usr
-	[[ -n ${EPREFIX} ]] && return 0
-
 	# Only bother with this stuff for the native ABI.  We assume the user
 	# doesn't have critical binaries for non-native ABIs which is fair.
 	local gcclib


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-04 19:00 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-04 19:00 UTC (permalink / raw
  To: gentoo-commits

commit:     17c4c852f979668387b1b965d48470cb730df5b6
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  4 18:59:31 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Sep  4 18:59:31 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=17c4c852

gcc-config: clarify why libunwind.so* is needed at all

Bug: https://bugs.gentoo.org/667020
Bug: https://bugs.gentoo.org/693252
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc-config b/gcc-config
index 998a165..835f873 100755
--- a/gcc-config
+++ b/gcc-config
@@ -286,6 +286,11 @@ handle_split_usr() {
 	# but on other systems (arm/mips/etc...), this is quite critical.
 	# http://bugs.gentoo.org/60190
 	#
+	# Note: libunwind.so is is a DT_NEEDED dependency only on ia64 systems
+	# where libunwind.so.7 is provided by gcc itself, see:
+	#    https://bugs.gentoo.org/667020
+	#    https://bugs.gentoo.org/693252
+	#
 	# The funky move magic is required for proper updating of in-use files.
 
 	# Gentoo Prefix systems don't "boot", so no need to handle split-/usr


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-05  6:28 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-05  6:28 UTC (permalink / raw
  To: gentoo-commits

commit:     ff954c6b20686d490d1382f90d2a4d64754bb18e
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed Sep  4 19:29:58 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 06:28:11 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=ff954c6b

gcc-config: During initial clean-up, delete only libunwind.so.7*, but not other files matching libunwind.so*.

libunwind.so belongs to sys-libs/libunwind.
libunwind.so.7* is copied by gcc-config (only on ia64) from active version of sys-devel/gcc.
libunwind.so.8* belong to sys-libs/libunwind since 1.0.1 version released on 2011-09-11.

[slyfox@: sumplified 'return' statement]
Bug: https://bugs.gentoo.org/667020
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>

 gcc-config | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gcc-config b/gcc-config
index 835f873..34ff3e0 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 2002-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # Format of /etc/env.d/gcc/:
@@ -286,7 +286,7 @@ handle_split_usr() {
 	# but on other systems (arm/mips/etc...), this is quite critical.
 	# http://bugs.gentoo.org/60190
 	#
-	# Note: libunwind.so is is a DT_NEEDED dependency only on ia64 systems
+	# Note: libunwind.so.7 is a DT_NEEDED dependency only on ia64 systems
 	# where libunwind.so.7 is provided by gcc itself, see:
 	#    https://bugs.gentoo.org/667020
 	#    https://bugs.gentoo.org/693252
@@ -306,12 +306,15 @@ handle_split_usr() {
 	# If /usr isn't a sep mount, then don't bother with linking stuff.
 	if ln "${ROOT}/${LDPATH}/libgcc.a" "${EROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
 		rm -f "${EROOT}"/lib/.gcc.config.$$
-		if [[ -n $(find "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib} 2>/dev/null) ]] ; then
+		local lib old_libs=0 saved_nullglob=$(shopt -p nullglob)
+		shopt -s nullglob
+		for lib in "${EROOT}"/lib*/libgcc_s{.so*,*dylib} "${EROOT}"/lib*/libunwind.so.7* ; do
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
-			rm -f "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib}
-			return 1
-		fi
-		return 0
+			rm -f "${lib}"
+			old_libs=1
+		done
+		${saved_nullglob}
+		return ${old_libs}
 	fi
 
 	# Only bother with this stuff for the native ABI.  We assume the user


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-05  6:42 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-05  6:42 UTC (permalink / raw
  To: gentoo-commits

commit:     d698117fad62162cec3c8812b28e5848fcb07601
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  5 06:42:08 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 06:42:08 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d698117f

gcc-config: tweak comment around 'gsed' use.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc-config b/gcc-config
index 34ff3e0..2f5c34f 100755
--- a/gcc-config
+++ b/gcc-config
@@ -28,9 +28,7 @@ has() { [[ " ${*:2} " == *" $1 "* ]]; }
 die() { eerror "${argv0}: $*"; exit 1; }
 umask 022
 
-# *BSD are plain stupid ... copy a GNU extension but don't just copy it,
-# change it so it works differently.  Wish Darwin did selective evolution
-# on software developers.
+# *BSD sed does not work as-is, use GNU sed. TODO: find details.
 SED=$(type -P gsed)
 : ${SED:=$(type -P sed)}
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-05  6:47 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-05  6:47 UTC (permalink / raw
  To: gentoo-commits

commit:     64a1cb1454d8dc4bc1fb92e4cd3f74d351ecb7ac
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  5 06:47:06 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 06:47:06 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=64a1cb14

gcc-config: update comment about env.d format

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc-config b/gcc-config
index 2f5c34f..762695f 100755
--- a/gcc-config
+++ b/gcc-config
@@ -2,9 +2,9 @@
 # Copyright 2002-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# Format of /etc/env.d/gcc/:
-#  config-TARGET:	CURRENT=version for TARGET
-#  TARGET-VER:		has a TARGET and VER variable
+# Format of /etc/env.d/gcc/ contents:
+#  config-<TARGET>:	CURRENT=<TARGET>-<VER>
+#  <TARGET>-<VER>:	has gcc-specific variables (provided by sys-devel/gcc)
 
 : ${ROOT:=/}
 [[ ${ROOT} != */ ]] && ROOT="${ROOT}/"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-05  7:24 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-05  7:24 UTC (permalink / raw
  To: gentoo-commits

commit:     231bc60d6fa6b8eb309ac2ca308f7c60213f81a3
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  5 07:20:05 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 07:20:05 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=231bc60d

gcc-config: drop GCC_PATH reconstruction in /etc/env.d/gcc

toolchain.eclass constructs correct GCC_PATH since 2007:
commit 7d9f89700a2ee50674c0d871ec6d21b468ac6206
("start moving to GCC_PATH for env.d #174422 and cleanup "
"gcc-config logic so that it doesnt matter what the ROOT value is")

We don't need to rewrite /etc/env.d/gcc/<TARGET>-<VER>
files anymore (owned by gcc ebuilds).

Bug: https://bugs.gentoo.org/174422
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/gcc-config b/gcc-config
index 762695f..7f2d69f 100755
--- a/gcc-config
+++ b/gcc-config
@@ -145,26 +145,6 @@ is_cross_compiler() {
 	[[ ${CC_COMP/${CHOST}} == ${CC_COMP} ]]
 }
 
-convert_profile_paths() {
-	# Older gcc's used PATH= and ROOTPATH= in the env.d files.
-	# Newer one's only use GCC_PATH=.  Convert old to new here.
-	cp -p "${GCC_ENV_D}/${CC_COMP}" "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
-	GCC_PATH=$(
-		unset GCC_PATH PATH ROOTPATH
-		source "${GCC_ENV_D}/${CC_COMP}"
-		echo ${GCC_PATH:-${PATH:-${ROOTPATH}}}
-	)
-	${SED} -i \
-		-e '/^PATH=/d' \
-		-e '/^ROOTPATH=/d' \
-		-e '/^GCC_PATH=/d' \
-		"${GCC_ENV_D}/${CC_COMP}" || return 1
-	echo "GCC_PATH=\"${GCC_PATH}\"" >> "${GCC_ENV_D}/${CC_COMP}" || return 1
-	touch -r "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" "${GCC_ENV_D}/${CC_COMP}" || return 1
-	rm -f "${GCC_ENV_D}/${CC_COMP}.gcc-config-ref" || return 1
-	return 0
-}
-
 # Usage: atomic_ln <source file> <destination dir> <destination file name>
 atomic_ln() {
 	local src=$1 dst=$2 dstfile=$3 tmp
@@ -585,10 +565,6 @@ switch_profile() {
 		ebegin "Switching native-compiler to ${CC_COMP}"
 	fi
 
-	if egrep -q '^(PATH|ROOTPATH)=' "${GCC_ENV_D}/${CC_COMP}" ; then
-		convert_profile_paths "${GCC_ENV_D}/${CC_COMP}" || return 1
-	fi
-
 	# Setup things properly again for this profile
 	unset GCC_SPECS LDPATH MULTIOSDIRS
 	source "${GCC_ENV_D}/${CC_COMP}"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-05 22:35 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-05 22:35 UTC (permalink / raw
  To: gentoo-commits

commit:     2aff500d7b04329dd5ec5baec785a2bcfd72fcaa
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  5 22:35:35 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 22:35:35 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=2aff500d

gcc-config: change comment to clarify why env-udate is still useful

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 7f2d69f..9e5abf8 100755
--- a/gcc-config
+++ b/gcc-config
@@ -696,7 +696,7 @@ switch_profile() {
 
 	eend 0
 
-	# Not needed since Aug 2018. Can be removed later (say, in a year).
+	# This is needed mainly for MANPATH and INFOPATH updates.
 	if [[ ${envd_changed} -ne 0 ]] ; then
 		echo
 		ewarn "If you intend to use the gcc from the new profile in an already"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-06  6:53 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-06  6:53 UTC (permalink / raw
  To: gentoo-commits

commit:     33f5f6f18e39a49e398fc81c1b7251d50e6cb9b0
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  6 06:51:19 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Sep  6 06:53:10 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=33f5f6f1

gcc-config: linewrap long comment

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 169f8bc..99489f9 100755
--- a/gcc-config
+++ b/gcc-config
@@ -311,7 +311,8 @@ handle_split_usr() {
 	eval $(grep -h '^LDPATH=' "${GCC_ENV_D}"/${CHOST}-* | tail -1)
 	LDPATH=${LDPATH%%:*}
 
-	# If GCC directory is not in separate mountpoint than /lib, then do not bother with copying libraries to /lib.
+	# If GCC directory is not in separate mountpoint than /lib,
+	# then do not bother with copying libraries to /lib.
 	if is_same_mountpoint "${EROOT}/lib" "${ROOT}/${LDPATH}" ; then
 		local lib old_libs=0 saved_nullglob=$(shopt -p nullglob)
 		shopt -s nullglob


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-06  6:53 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-06  6:53 UTC (permalink / raw
  To: gentoo-commits

commit:     4e5b7557ea50bc7e6b037e67ac222fb65766646d
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Fri Sep  6 00:59:02 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Sep  6 06:53:10 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=4e5b7557

gcc-config: Use findmnt for mountpoint check when available.

Closes: https://bugs.gentoo.org/693588
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 37 +++++++++++++++++++++++++++++++++----
 1 file changed, 33 insertions(+), 4 deletions(-)

diff --git a/gcc-config b/gcc-config
index 9e5abf8..169f8bc 100755
--- a/gcc-config
+++ b/gcc-config
@@ -145,6 +145,37 @@ is_cross_compiler() {
 	[[ ${CC_COMP/${CHOST}} == ${CC_COMP} ]]
 }
 
+is_same_mountpoint() {
+	local file1=$1 file2=$2
+
+	if type -P findmnt > /dev/null ; then
+		local file1_mountpoint=$(findmnt -n -o TARGET -T "${file1}")
+		local file2_mountpoint=$(findmnt -n -o TARGET -T "${file2}")
+
+		[[ ${file1_mountpoint} == ${file2_mountpoint} ]]
+		return
+	else
+		local file1_check_file file2_check_file result
+		if [[ -d ${file1} ]] ; then
+			file1_check_file=${file1}/.gcc.config.mountpoint_check_file1.$$
+		else
+			file1_check_file=${file1%/*}/.gcc.config.mountpoint_check_file1.$$
+		fi
+		if [[ -d ${file2} ]] ; then
+			file2_check_file=${file2}/.gcc.config.mountpoint_check_file2.$$
+		else
+			file2_check_file=${file2%/*}/.gcc.config.mountpoint_check_file2.$$
+		fi
+
+		rm -f "${file1_check_file}" "${file2_check_file}"
+		touch "${file1_check_file}"
+		ln "${file1_check_file}" "${file2_check_file}" 2> /dev/null
+		result=$?
+		rm -f "${file1_check_file}" "${file2_check_file}"
+		return ${result}
+	fi
+}
+
 # Usage: atomic_ln <source file> <destination dir> <destination file name>
 atomic_ln() {
 	local src=$1 dst=$2 dstfile=$3 tmp
@@ -277,13 +308,11 @@ handle_split_usr() {
 	# We use the same ordering logic as mentioned in the MY_LDPATH setup.
 	# We get the libs from the latest version available.
 	local LDPATH
-
 	eval $(grep -h '^LDPATH=' "${GCC_ENV_D}"/${CHOST}-* | tail -1)
 	LDPATH=${LDPATH%%:*}
 
-	# If /usr isn't a sep mount, then don't bother with linking stuff.
-	if ln "${ROOT}/${LDPATH}/libgcc.a" "${EROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
-		rm -f "${EROOT}"/lib/.gcc.config.$$
+	# If GCC directory is not in separate mountpoint than /lib, then do not bother with copying libraries to /lib.
+	if is_same_mountpoint "${EROOT}/lib" "${ROOT}/${LDPATH}" ; then
 		local lib old_libs=0 saved_nullglob=$(shopt -p nullglob)
 		shopt -s nullglob
 		for lib in "${EROOT}"/lib*/libgcc_s{.so*,*dylib} "${EROOT}"/lib*/libunwind.so.7* ; do


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-06  7:23 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-06  7:23 UTC (permalink / raw
  To: gentoo-commits

commit:     44a6eb45fbc5f3e081d4a53a8a3a5c75944f2b32
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  6 07:22:50 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Sep  6 07:22:50 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=44a6eb45

README: clarify status of /etc/env.d/gcc/.NATIVE

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/README b/README
index bea5e30..c3bf427 100644
--- a/README
+++ b/README
@@ -22,7 +22,6 @@ Files, variables, things.
 
 - private gcc configs (provided by `toolchain.eclass`, gcc ebuilds)
 
-    /etc/env.d/gcc/.NATIVE -> x86_64-pc-linux-gnu-8.1.0 (link to target config)
     /etc/env.d/gcc/x86_64-pc-linux-gnu-8.1.0
 
       Contains variables that describe toolchain layout:
@@ -54,9 +53,15 @@ Files, variables, things.
 
       Empty.
 
-      Until Aug 2018 used to contain paths for cross-compilers.
+      Before Aug 2018 used to contain paths for cross-compilers.
       To be removed eventually.
 
+    /etc/env.d/gcc/.NATIVE -> x86_64-pc-linux-gnu-8.1.0 (link to target config)
+
+      Link to current native toolchain.
+
+    Before Aug 2018 was used by gcc binary wrapper. Not used nowadays.
+
 TODOs
 -----
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-06  7:29 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-06  7:29 UTC (permalink / raw
  To: gentoo-commits

commit:     8cd0c018d26ed6c61ee499b8673ef19266be1aa9
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  6 07:28:18 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Sep  6 07:28:18 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=8cd0c018

gcc-config: drop /etc/env.d/gcc/config migration code

/etc/env.d/gcc/config migraion was enabled 7 years ago.
Let's assume everyone migrated by now.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/gcc-config b/gcc-config
index 99489f9..21d54c1 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1017,20 +1017,6 @@ get_chost
 	&& : ${CTARGET:=${CC_COMP:-${CHOST}}} \
 	|| : ${CTARGET:=${CHOST}}
 
-# Do migration of old files
-if [[ -e ${GCC_ENV_D}/config ]] ; then
-	(
-	unset CURRENT
-	. "${GCC_ENV_D}"/config
-	if [[ ${CURRENT} == ${CTARGET}-* ]] ; then
-		mv "${GCC_ENV_D}"/config "${GCC_ENV_D}"/config-${CTARGET} || exit 1
-	else
-		# who knows; force a refresh by punting it
-		rm -f "${GCC_ENV_D}"/config || exit 1
-	fi
-	) || die "could not get rid of old ${GCC_ENV_D}/config"
-fi
-
 if [[ -z ${CC_COMP} ]] ; then
 	CC_COMP=$(get_current_profile)
 	if [[ $? -ne 0 ]] ; then


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-07  8:22 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-07  8:22 UTC (permalink / raw
  To: gentoo-commits

commit:     dedcf28c4c922d9c724339e83896f54df59796e2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 08:21:16 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 08:21:16 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=dedcf28c

gcc-config: avoid false-positive detection of 'sed' use

Noticed when ran 'make check':
    * Running source/test.sed ... due to log difference; see tests/source/test.sed.log [ !! ]

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 21d54c1..aefdbc4 100755
--- a/gcc-config
+++ b/gcc-config
@@ -28,7 +28,7 @@ has() { [[ " ${*:2} " == *" $1 "* ]]; }
 die() { eerror "${argv0}: $*"; exit 1; }
 umask 022
 
-# *BSD sed does not work as-is, use GNU sed. TODO: find details.
+# *BSD SED does not work as-is, use GNU SED. TODO: find details.
 SED=$(type -P gsed)
 : ${SED:=$(type -P sed)}
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-07  8:47 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-07  8:47 UTC (permalink / raw
  To: gentoo-commits

commit:     e8e4dd8786f39b2d2c682f385ea2c70b2b44022f
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 08:46:16 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 08:46:16 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=e8e4dd87

gcc-config: don't recreate unused '.NATIVE' symlink.

As gcc-wrapper is gone nothing should use it anymore.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README     | 6 ------
 gcc-config | 7 ++++---
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/README b/README
index c3bf427..48183b2 100644
--- a/README
+++ b/README
@@ -56,12 +56,6 @@ Files, variables, things.
       Before Aug 2018 used to contain paths for cross-compilers.
       To be removed eventually.
 
-    /etc/env.d/gcc/.NATIVE -> x86_64-pc-linux-gnu-8.1.0 (link to target config)
-
-      Link to current native toolchain.
-
-    Before Aug 2018 was used by gcc binary wrapper. Not used nowadays.
-
 TODOs
 -----
 

diff --git a/gcc-config b/gcc-config
index aefdbc4..92e9014 100755
--- a/gcc-config
+++ b/gcc-config
@@ -656,14 +656,15 @@ switch_profile() {
 		fi
 
 		# Punt old files; maybe globs too much, but oh well
+		# 'NATIVE' and '.NATIVE' were used by gcc-wrapper before Aug 2018
+		# and are not used as wrapper is removed.
+		# '.NATIVE' was created before Sept 2019.
+		# We clean up both for now. Should be safe to remove in 2021.
 		rm -f \
 			"${GCC_ENV_D}/NATIVE" "${GCC_ENV_D}/.NATIVE" \
 			"${ENV_D}/05gcc" "${ENV_D}/05gcc-${CTARGET}" \
 			"${ENV_D}/05gcc-${CTARGET}"-* "${GCC_ENV_D}/config-${CTARGET}"-*
 
-		# Help out the gcc wrapper
-		ln -sf ${CC_COMP} "${GCC_ENV_D}/.NATIVE"
-
 		# Relocate random crap
 		local x libdir pkgconfdir
 		local mver=${CC_COMP_VERSION:0:3}


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-07  9:01 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-07  9:01 UTC (permalink / raw
  To: gentoo-commits

commit:     afe41adc6db361e43a32ea12966246eae6c68f18
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 08:59:38 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 08:59:38 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=afe41adc

gcc-config: drop empty /etc/env.d/05gcc-${CTARGET} files

Thesse files are generated for cross-gcc only. Were empty
since Aug 2018.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README     |  7 -------
 gcc-config | 15 ++++++++++-----
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/README b/README
index 48183b2..bba2517 100644
--- a/README
+++ b/README
@@ -49,13 +49,6 @@ Files, variables, things.
 
       Used by env-update to populate PATH and more (TODO: remove PATH population).
 
-    /etc/env.d/05gcc-${CTARGET} (cross)
-
-      Empty.
-
-      Before Aug 2018 used to contain paths for cross-compilers.
-      To be removed eventually.
-
 TODOs
 -----
 

diff --git a/gcc-config b/gcc-config
index 92e9014..01e2b90 100755
--- a/gcc-config
+++ b/gcc-config
@@ -615,9 +615,8 @@ switch_profile() {
 
 	echo "CURRENT=${CC_COMP}" > "${GCC_ENV_D}/config-${CTARGET}"
 
-	# Give the native gcc a higher precedence so its PATH gets
-	# searched first.  After all, we tend to run the native
-	# compiler a *lot* more than the cross-compilers.
+	# Give native configs slight distinction from cross-compilers
+	# by giving it higher priority.
 	local envd envd_num envd_changed=0
 	is_cross_compiler && envd_num="05" || envd_num="04"
 	envd="${ENV_D}/${envd_num}gcc-${CTARGET}"
@@ -686,9 +685,15 @@ switch_profile() {
 		prefix_copy_gcc_libs
 		handle_split_usr
 		: $(( envd_changed += $? ))
+
+		mv_if_diff "${envd}.tmp" "${envd}"
+		: $(( envd_changed += $? ))
+	else
+		# cross-case
+		# env.d file is empty since Aug 2018 and is cleaned up by
+		# gcc-config since Sept 2019. Should be safe to remove in 2021.
+		rm -f "${envd}.tmp" "${envd}"
 	fi
-	mv_if_diff "${envd}.tmp" "${envd}"
-	: $(( envd_changed += $? ))
 
 	update_wrappers ${CTARGET}
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-07  9:15 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-07  9:15 UTC (permalink / raw
  To: gentoo-commits

commit:     3b5575b633bd50338d09091c09858fff725b1d60
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 09:14:47 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 09:14:47 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=3b5575b6

README: add examples of querying facts about toolchains

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/README b/README
index bba2517..b260a28 100644
--- a/README
+++ b/README
@@ -1,12 +1,21 @@
 What is gcc-config?
 -------------------
 
-Gentoo allows switching gcc as system runs via gcc-config:
+gcc-config allows Gentoo users to switch active gcc safely
+and allows querying facts about installed toolchains.
+
+To switch active gcc while system runs:
     $ gcc-config x86_64-pc-linux-gnu-8.1.0
     $ gcc-config x86_64-pc-linux-gnu-7.2.0
 
-Ideally changes should be visible instantly and atomically
-without shell restart.
+    Ideally changes should be visible instantly and atomically
+    without shell restart.
+
+To query where real gcc binaries are hiding:
+    $ gcc-config -B $(gcc-config -c)
+
+To parse a profile into TARGET and toolchain version:
+    $ gcc-config -S sparc64-unknown-linux-gnu-9.2.0
 
 Files, variables, things.
 -------------------------


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-07  9:39 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-07  9:39 UTC (permalink / raw
  To: gentoo-commits

commit:     6032199022e3af4140afaf2f3f3efb0de07db24a
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 09:36:53 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 09:36:53 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=60321990

Makefile: install README

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 3e9e5a3..b6d694c 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,9 @@ P = $(PN)-$(PV)
 
 PREFIX = $(EPREFIX)/usr
 BINDIR = $(PREFIX)/bin
+DOCDIR = $(PREFIX)/share/doc/$(P)
 ESELECTDIR = $(PREFIX)/share/eselect/modules
+
 SUBLIBDIR = lib
 LIBDIR = $(PREFIX)/$(SUBLIBDIR)
 
@@ -33,9 +35,10 @@ clean:
 	chmod a+rx $@
 
 install: all
-	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ESELECTDIR)
+	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ESELECTDIR) $(DESTDIR)$(DOCDIR)
 	$(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
 	$(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR)
+	$(INSTALL_DATA) README $(DESTDIR)$(DOCDIR)
 
 test check: .gcc-config
 	cd tests && ./run_tests


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-07  9:39 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-07  9:39 UTC (permalink / raw
  To: gentoo-commits

commit:     23106e86cfa81b36b5bb9c8cdf6189bd79fc6575
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 09:38:29 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 09:38:29 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=23106e86

Makefile: drop C*FLAGS from Makefile as gcc-wrapper is no more

gcc-config doec not contain C code nowadays.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/Makefile b/Makefile
index b6d694c..2b3b235 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,5 @@
 EPREFIX ?=
 
-CFLAGS ?= -O2 -g
-CFLAGS += -Wall -Wextra
-CPPFLAGS += '-DEPREFIX="$(EPREFIX)"'
-
 PN = gcc-config
 PV = git
 P = $(PN)-$(PV)


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-07 22:08 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-07 22:08 UTC (permalink / raw
  To: gentoo-commits

commit:     1bcd38512f35ab0724279d7fc5bb8e5e1213a9d2
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  7 22:07:05 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  7 22:07:05 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=1bcd3851

gcc-config: add einfo logging around library backup

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc-config b/gcc-config
index 65b30bc..b1cda70 100755
--- a/gcc-config
+++ b/gcc-config
@@ -324,6 +324,7 @@ handle_split_usr() {
 		# Can be removed in 2021.
 		for lib in "${EROOT}"/lib*/libgcc_s{.so*,*dylib} "${EROOT}"/lib*/libunwind.so.7* ; do
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
+			einfo "Removing '${lib}'"
 			rm -f "${lib}"
 			old_libs=1
 		done
@@ -332,6 +333,7 @@ handle_split_usr() {
 			"${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libgcc_s.so.* \
 			"${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libunwind.so.* ; do
 			# If we previously had stuff in /, make sure ldconfig gets re-run.
+			einfo "Removing '${lib}'"
 			rm -f "${lib}"
 			old_libs=1
 		done
@@ -350,6 +352,7 @@ handle_split_usr() {
 		# but for now, that should be safe ...
 		for gcclib in "${ROOT}${LDPATH}"/lib${gcclib}.so.* ; do
 			[[ -e ${gcclib} ]] || continue
+			einfo "Backing up '${gcclib}' to '${libdir}"
 			cp -pP "${gcclib}" "${libdir}"/.gcc.config.new/
 			# no need to sanity `rm` this as the `mv` should take care
 			# of it.  we also need this step to be completely atomic


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-08  8:29 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-08  8:29 UTC (permalink / raw
  To: gentoo-commits

commit:     1e2e76a2b23caef964de881b14146c58b0a0ee77
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Sun Sep  8 06:48:14 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Sep  8 08:29:31 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=1e2e76a2

gcc-config: Ignore PATH set in profile files.

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 <AT> Apache.Org>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/gcc-config b/gcc-config
index b8f695f..9965449 100755
--- a/gcc-config
+++ b/gcc-config
@@ -80,6 +80,18 @@ show_var() {
 	echo "${!1}"
 }
 
+# Compatibility with profile files created before 2019-09-05.
+# These profile files were setting PATH variable.
+# Sourcing them without restoring previous PATH value breaks gcc-config.
+source_profile_pre() {
+	__PATH__=${PATH}
+}
+
+source_profile_post() {
+	PATH=${__PATH__}
+	unset __PATH__
+}
+
 try_real_hard_to_find_CHOST() {
 	#
 	# First we read make.conf
@@ -533,7 +545,9 @@ prefix_copy_gcc_libs() {
 	for x in ${GCC_PROFILES} ; do
 		unset GCC_PATH LDPATH
 		eval $(
+			source_profile_pre
 			source "${x}"
+			source_profile_post
 			echo "GCC_PATH='${GCC_PATH}'"
 			echo "LDPATH='${LDPATH%%:*}'"
 		)
@@ -599,7 +613,9 @@ switch_profile() {
 
 	# Setup things properly again for this profile
 	unset GCC_SPECS LDPATH MULTIOSDIRS
+	source_profile_pre
 	source "${GCC_ENV_D}/${CC_COMP}"
+	source_profile_post
 	# Support older configs that did not setup MULTIOSDIRS for us.
 	: ${MULTIOSDIRS:=../${GENTOO_LIBDIR}}
 
@@ -814,7 +830,9 @@ list_profiles() {
 		if [[ ${x} == ${CURRENT_NATIVE} ]] ; then
 			x="${x} ${GOOD}*${NORMAL}"
 		elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then
+			source_profile_pre
 			source "${GCC_ENV_D}/config-${target}"
+			source_profile_post
 			[[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}"
 		fi
 		echo " [${i}] ${x}"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2019-09-08  8:37 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2019-09-08  8:37 UTC (permalink / raw
  To: gentoo-commits

commit:     84ba7d0ccde1869bed07f9d9b9c2fac09f48c13a
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Sep  8 08:35:51 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Sep  8 08:35:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=84ba7d0c

gcc-config: consolidate profiles sourcing logic in a single function

Bug: https://bugs.gentoo.org/174422
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/gcc-config b/gcc-config
index 9965449..dd11c71 100755
--- a/gcc-config
+++ b/gcc-config
@@ -80,16 +80,15 @@ show_var() {
 	echo "${!1}"
 }
 
-# Compatibility with profile files created before 2019-09-05.
-# These profile files were setting PATH variable.
-# Sourcing them without restoring previous PATH value breaks gcc-config.
-source_profile_pre() {
-	__PATH__=${PATH}
-}
+source_profile() {
+	# Compatibility with profile files created before 2019-09-05.
+	# These profile files were setting PATH variable.
+	# Sourcing them without restoring previous PATH value breaks gcc-config.
+	local backup_PATH=${PATH}
+
+	source "$1"
 
-source_profile_post() {
-	PATH=${__PATH__}
-	unset __PATH__
+	PATH=${backup_PATH}
 }
 
 try_real_hard_to_find_CHOST() {
@@ -545,9 +544,7 @@ prefix_copy_gcc_libs() {
 	for x in ${GCC_PROFILES} ; do
 		unset GCC_PATH LDPATH
 		eval $(
-			source_profile_pre
-			source "${x}"
-			source_profile_post
+			source_profile "${x}"
 			echo "GCC_PATH='${GCC_PATH}'"
 			echo "LDPATH='${LDPATH%%:*}'"
 		)
@@ -613,9 +610,7 @@ switch_profile() {
 
 	# Setup things properly again for this profile
 	unset GCC_SPECS LDPATH MULTIOSDIRS
-	source_profile_pre
-	source "${GCC_ENV_D}/${CC_COMP}"
-	source_profile_post
+	source_profile "${GCC_ENV_D}/${CC_COMP}"
 	# Support older configs that did not setup MULTIOSDIRS for us.
 	: ${MULTIOSDIRS:=../${GENTOO_LIBDIR}}
 
@@ -830,9 +825,7 @@ list_profiles() {
 		if [[ ${x} == ${CURRENT_NATIVE} ]] ; then
 			x="${x} ${GOOD}*${NORMAL}"
 		elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then
-			source_profile_pre
-			source "${GCC_ENV_D}/config-${target}"
-			source_profile_post
+			source_profile "${GCC_ENV_D}/config-${target}"
 			[[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}"
 		fi
 		echo " [${i}] ${x}"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-01-26 13:26 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-01-26 13:26 UTC (permalink / raw
  To: gentoo-commits

commit:     4e9362688c95ac02bafc014a16bbfd399b86ca8c
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 26 13:23:54 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 26 13:23:54 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=4e936268

gcc-config: fix numbered access to toolchains

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 <AT> o2.pl
Bug: https://bugs.gentoo.org/706318
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 1ab646b..8b4fd20 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1015,7 +1015,7 @@ for x in "$@" ; do
 			if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
 				# User gave us a # representing the profile
 				i=1
-				for y in "${GCC_ENV_D}"/* ; do
+				for y in $(version_sorted_paths "${GCC_ENV_D}"/*) ; do
 					[[ -f ${y} ]] || continue
 					[[ ${y} == */config* ]] && continue
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-01-26 13:44 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-01-26 13:44 UTC (permalink / raw
  To: gentoo-commits

commit:     9eaff8513518c35d9dfd8ade68460a912f76f62e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 26 13:41:39 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jan 26 13:41:39 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=9eaff851

gcc-config: distinguish errors between bad profile and bad compiler

The distinction is useful when making tests: compiler is often
missing when config is present.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc-config b/gcc-config
index 8b4fd20..f03a46a 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1083,14 +1083,17 @@ if [[ ${DOIT} != "get_current_profile" ]] ; then
 		CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
 	fi
 
-	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
+	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] ; then
 		CC_COMP_VERSION=${CC_COMP_VERSION%-*}
 	fi
 
-	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
-	   [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
-	then
-		eerror "${argv0}: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2
+	if [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]] ; then
+		eerror "${argv0}: Profile '${GCC_ENV_D}/${CC_COMP}' does not exist" 1>&2
+		#exit 1
+	fi
+
+	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] ; then
+		eerror "${argv0}: Did not find compiler at '${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION}'" 1>&2
 		#exit 1
 	fi
 fi


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-04-10 10:08 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-04-10 10:08 UTC (permalink / raw
  To: gentoo-commits

commit:     5c1dd653a4f88528af7ceb37c215b75439211e64
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 10 10:06:52 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Apr 10 10:06:52 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=5c1dd653

gcc-config: add a TODO to use 'sort -V'

Was suggested by Jason A. Donenfeld and jthill.

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index f03a46a..beeb82a 100755
--- a/gcc-config
+++ b/gcc-config
@@ -74,7 +74,8 @@ usage() {
 # Normalizer:
 #    echo "hello-world-1.2.3.444.56778" | ${SED} -e 's/[0-9]\+/0000&/g' | ${SED} -e 's/0*\([0-9]\{4\}\)/\1/g'
 #    hello-world-0001.0002.0003.0444.56778
-# That way we can have 9.0 < 10.0 roder.
+# That way we can have 9.0 < 10.0 order.
+# TODO: explore how portable 'sort -V' is and try using that instead.
 version_sorted_paths() {
 	local p mangled_v
 	for p in "$@"; do


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-05-22  9:40 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-05-22  9:40 UTC (permalink / raw
  To: gentoo-commits

commit:     d91cd5bdc56a6fcb71a998fd8ba81b47c9a13246
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 22 09:39:26 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 22 09:39:26 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d91cd5bd

gcc-config: add build-time and runtime switches to disable native symlinks

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 <AT> gentoo.org>

 Makefile   | 8 ++++++++
 gcc-config | 8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2b3b235..c74adec 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,10 @@
+# configurable options:
+# Avoid installing native symlinks like:
+#     /usr/bin/gcc -> ${CTARGET}-gcc
+# and keep only
+#     ${CTARGET}-gcc
+USE_NATIVE_LINKS ?= yes
+
 EPREFIX ?=
 
 PN = gcc-config
@@ -27,6 +34,7 @@ clean:
 		-e 's:@GENTOO_EPREFIX@:$(EPREFIX):g' \
 		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
 		-e 's:@PV@:$(PV):g' \
+		-e 's:@USE_NATIVE_LINKS@:$(USE_NATIVE_LINKS):g' \
 		$< > $@
 	chmod a+rx $@
 

diff --git a/gcc-config b/gcc-config
index beeb82a..9dc09e0 100755
--- a/gcc-config
+++ b/gcc-config
@@ -261,9 +261,10 @@ update_wrappers() {
 	done
 
 	# For all toolchains, we want to create the fully qualified
-	# `tuple-foo`.  Only native ones do we want the simple `foo`.
+	# `tuple-foo`.  Only native ones do we want the simple `foo`
+	# and only for USE_NATIVE_LINKS=yes mode.
 	local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
-	if ! is_cross_compiler ; then
+	if ! is_cross_compiler && [[ ${USE_NATIVE_LINKS} == yes ]] ; then
 		all_wrappers+=( "${new_wrappers[@]}" )
 		# There are a few fun extra progs which we have to handle #412319
 		all_wrappers+=( cc:gcc f77:g77 )
@@ -952,6 +953,7 @@ FORCE="no"
 CC_COMP=
 ENV_D="${EROOT}etc/env.d"
 GCC_ENV_D="${ENV_D}/gcc"
+USE_NATIVE_LINKS="@USE_NATIVE_LINKS@"
 
 for x in "$@" ; do
 	case "${x}" in
@@ -1005,6 +1007,8 @@ for x in "$@" ; do
 			echo "${argv0}: @PV@"
 			exit 0
 			;;
+		--enable-native-links)  USE_NATIVE_LINKS="yes" ;;
+		--disable-native-links) USE_NATIVE_LINKS="no" ;;
 		-*)
 			die "Invalid switch!  Run ${argv0} without parameters for help."
 			;;


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-05-22 10:03 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-05-22 10:03 UTC (permalink / raw
  To: gentoo-commits

commit:     d52506c8d5e78e26ae607d8805a5436cb9c89c05
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 22 10:00:07 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 22 10:00:07 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d52506c8

gcc-config: link /lib/cpp to qualified 'cpp'

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 <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 9dc09e0..95d2632 100755
--- a/gcc-config
+++ b/gcc-config
@@ -307,7 +307,7 @@ update_wrappers() {
 
 	# install the canonical cpp wrapper
 	if ! is_cross_compiler ; then
-		atomic_ln "${EPREFIX%/}/usr/bin/cpp" "${EROOT}lib" "cpp"
+		atomic_ln "${EPREFIX%/}/usr/bin/${CTARGET}-cpp" "${EROOT}lib" "cpp"
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-05-22 10:39 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-05-22 10:39 UTC (permalink / raw
  To: gentoo-commits

commit:     d0c8542b2ea3b6234c50e78c0067713202f4eb18
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 22 10:39:07 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 22 10:39:07 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d0c8542b

gcc-config: add facts around tool names

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gcc-config b/gcc-config
index 95d2632..87f466c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -235,6 +235,29 @@ update_wrappers() {
 	# for new functionality (like a version bump).
 	local x CTARGET=$1
 
+	# Facts on gcc's private binary dir contents:
+	#
+	# Native directory looks like:
+	#     /usr/x86_64-pc-linux-gnu/gcc-bin/11.0.0
+	#   Contents looks like:
+	#   - 'foo' ('gcc', 'c++', 'gcc-ar', 'lto-dump')
+	#   - 'foo-${v}' (go-11, gofmt-11)
+	#   - ${CTARGET}-foo (${CTARGET}-gcc
+	#
+	#   Not each 'foo' has it's ${CTARGET}-foo match.
+	#   Examples are:
+	#   - lto-dump, gcov-dump, gcov-tool (no ${CTARGET}-lto-dump equvalent)
+	#   - go-${MAJOR}, gofmt-${MAJOR} (no ${CTARGET}-go-${MAJOR} equivalent)
+	#   - ${CTARGET}-gcc-11.0.0 (no gcc-11.0.0 equivalent)
+	#   TODO: is it a gcc or toolchain.eclass bug?
+	#
+	# Cross directory looks liks:
+	#     /usr/x86_64-pc-linux-gnu/ia64-unknown-linux-gnu/gcc-bin/10.1.0
+	#   Contents look like:
+	#   - ${CTARGET}-foo (${CTARGET}-gcc
+	#
+	#   Every tool is prefixed.
+
 	# Use the old dir to see what we wrapped up previously.
 	local old_wrappers=( $(
 		[[ -n ${OLD_GCC_PATH} ]] || exit 1


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-05-22 11:33 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-05-22 11:33 UTC (permalink / raw
  To: gentoo-commits

commit:     218cc249eb2324b802c7a70a91ae5663d8e12594
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 22 11:32:48 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 22 11:32:48 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=218cc249

gcc-config: clarify comments on how aliases are expanded

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc-config b/gcc-config
index 87f466c..847cde2 100755
--- a/gcc-config
+++ b/gcc-config
@@ -251,7 +251,7 @@ update_wrappers() {
 	#   - ${CTARGET}-gcc-11.0.0 (no gcc-11.0.0 equivalent)
 	#   TODO: is it a gcc or toolchain.eclass bug?
 	#
-	# Cross directory looks liks:
+	# Cross directory looks like:
 	#     /usr/x86_64-pc-linux-gnu/ia64-unknown-linux-gnu/gcc-bin/10.1.0
 	#   Contents look like:
 	#   - ${CTARGET}-foo (${CTARGET}-gcc
@@ -277,7 +277,7 @@ update_wrappers() {
 	[[ -z ${new_wrappers} ]] && return 1
 
 	# First delete the wrappers that the old one provided but the
-	# new one does not.
+	# new ones do not.
 	for x in "${old_wrappers[@]}" ; do
 		has "${x}" "${new_wrappers[@]}" && continue
 		rm -f "${EROOT}usr/bin/${x}" "${EROOT}usr/bin/${CTARGET}-${x}"
@@ -300,11 +300,14 @@ update_wrappers() {
 		# wrapper (the binary we're 'wrapping') so that we can
 		# sync mtimes together.  This makes things like ccache
 		# happy.  See Bug #70548 for more info.
+		#
+		# x=cc:gcc -> ref=/path/to/gcc
 		ref="${ROOT}${GCC_PATH}/${x#*:}"
 		if [[ ${x} == *:* ]] ; then
 			# Only install a wrapper if the reference binary exists ...
 			[[ -x ${ref} ]] || continue
 		fi
+		# x=cc:gcc -> x=cc
 		x=${x%:*}
 		if [[ ! -x ${ref} ]] ; then
 			if is_cross_compiler ; then


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-05-22 13:20 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-05-22 13:20 UTC (permalink / raw
  To: gentoo-commits

commit:     8a4854aec042fc347066a8e73053490c403d7649
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 22 13:18:58 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 22 13:18:58 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=8a4854ae

gcc-config: make USE_NATIVE_LINKS=no to clean stale symlinks

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 <AT> gentoo.org>

 gcc-config | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/gcc-config b/gcc-config
index 847cde2..8f9d64c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -287,7 +287,7 @@ update_wrappers() {
 	# `tuple-foo`.  Only native ones do we want the simple `foo`
 	# and only for USE_NATIVE_LINKS=yes mode.
 	local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
-	if ! is_cross_compiler && [[ ${USE_NATIVE_LINKS} == yes ]] ; then
+	if ! is_cross_compiler ; then
 		all_wrappers+=( "${new_wrappers[@]}" )
 		# There are a few fun extra progs which we have to handle #412319
 		all_wrappers+=( cc:gcc f77:g77 )
@@ -303,12 +303,9 @@ update_wrappers() {
 		#
 		# x=cc:gcc -> ref=/path/to/gcc
 		ref="${ROOT}${GCC_PATH}/${x#*:}"
-		if [[ ${x} == *:* ]] ; then
-			# Only install a wrapper if the reference binary exists ...
-			[[ -x ${ref} ]] || continue
-		fi
 		# x=cc:gcc -> x=cc
 		x=${x%:*}
+
 		if [[ ! -x ${ref} ]] ; then
 			if is_cross_compiler ; then
 				ewarn "insanity with ${x} and ${ref}"
@@ -320,10 +317,12 @@ update_wrappers() {
 		fi
 
 		# Now do the actual linking to the target binary
-		if [[ -x ${ref} ]] ; then
+		if [[ ${x#${CTARGET}-} == ${x} && ${USE_NATIVE_LINKS} != yes ]]; then
+			# Delete stale native symlink.
+			rm -f "${EROOT}usr/bin/${x}"
+		elif [[ -x ${ref} ]] ; then
 			atomic_ln "${ref#${ROOT}}" "${EROOT}usr/bin" "${x}"
 		else
-			ewarn "double insanity with ${x} and ${ref}"
 			# Make sure we have no stale wrappers
 			rm -f "${EROOT}usr/bin/${x}"
 		fi


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-05-22 13:23 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-05-22 13:23 UTC (permalink / raw
  To: gentoo-commits

commit:     7afca3b66cac89ed09172181252aed8fde9836c7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 22 13:22:48 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 22 13:22:48 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=7afca3b6

gcc-config: make USE_NATIVE_LINKS=no to clean /lib/cpp

Bug: https://bugs.gentoo.org/724454
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 8f9d64c..09d38f5 100755
--- a/gcc-config
+++ b/gcc-config
@@ -332,7 +332,11 @@ update_wrappers() {
 
 	# install the canonical cpp wrapper
 	if ! is_cross_compiler ; then
-		atomic_ln "${EPREFIX%/}/usr/bin/${CTARGET}-cpp" "${EROOT}lib" "cpp"
+		if [[ ${USE_NATIVE_LINKS} == yes ]]; then
+			atomic_ln "${EPREFIX%/}/usr/bin/${CTARGET}-cpp" "${EROOT}lib" "cpp"
+		else
+			rm -f "${EROOT}lib/cpp"
+		fi
 	fi
 }
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-05-23  7:28 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-05-23  7:28 UTC (permalink / raw
  To: gentoo-commits

commit:     4b695f08bfa9270a5e6096d2e1fe415a4a205833
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat May 23 07:27:46 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat May 23 07:27:46 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=4b695f08

gcc-config: finish comment lines

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc-config b/gcc-config
index 09d38f5..ad69b9b 100755
--- a/gcc-config
+++ b/gcc-config
@@ -242,7 +242,7 @@ update_wrappers() {
 	#   Contents looks like:
 	#   - 'foo' ('gcc', 'c++', 'gcc-ar', 'lto-dump')
 	#   - 'foo-${v}' (go-11, gofmt-11)
-	#   - ${CTARGET}-foo (${CTARGET}-gcc
+	#   - ${CTARGET}-foo ('${CTARGET}-gcc', ...)
 	#
 	#   Not each 'foo' has it's ${CTARGET}-foo match.
 	#   Examples are:
@@ -254,7 +254,7 @@ update_wrappers() {
 	# Cross directory looks like:
 	#     /usr/x86_64-pc-linux-gnu/ia64-unknown-linux-gnu/gcc-bin/10.1.0
 	#   Contents look like:
-	#   - ${CTARGET}-foo (${CTARGET}-gcc
+	#   - ${CTARGET}-foo ('${CTARGET}-gcc', ...)
 	#
 	#   Every tool is prefixed.
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-06-21 11:50 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-06-21 11:50 UTC (permalink / raw
  To: gentoo-commits

commit:     b5efdda30d9b865840ce17a81cdbc8f9ccfc42d7
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 21 11:50:06 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 21 11:50:06 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=b5efdda3

README: document c89/c99 wrapper presence

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README b/README
index b260a28..ac9d44d 100644
--- a/README
+++ b/README
@@ -29,6 +29,9 @@ Files, variables, things.
 
       See `gcc-config` script for wrapping details.
 
+    /usr/bin/c89 (native)
+    /usr/bin/c99 (native)
+
 - private gcc configs (provided by `toolchain.eclass`, gcc ebuilds)
 
     /etc/env.d/gcc/x86_64-pc-linux-gnu-8.1.0


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-06-21 11:53 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-06-21 11:53 UTC (permalink / raw
  To: gentoo-commits

commit:     d5b717b593c0da3977fb4f40c6a5f3d3864caf8e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 21 11:52:55 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 21 11:52:55 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d5b717b5

README: add 'Releasing' section

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 README | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/README b/README
index ac9d44d..1321f63 100644
--- a/README
+++ b/README
@@ -69,3 +69,9 @@ TODOs
 - Figure out symlink ownership story. Today symlinks don't belong to any package.
 
   See https://bugs.gentoo.org/626606
+
+Releasing
+---------
+
+  $ release=2.3.1; git tag -a -s -m "release ${release}" v${release}; make dist PV=${release}
+  $ git push --tags origin


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-06-24 20:47 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-06-24 20:47 UTC (permalink / raw
  To: gentoo-commits

commit:     1b3cea081588bd5e3491b66f65035c5772733eff
Author:     Manoj Gupta <manojgupta <AT> google <DOT> com>
AuthorDate: Wed Jun 24 17:40:14 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Jun 24 20:46:24 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=1b3cea08

gcc-config: make USE_CC_WRAPPERS=yes to install cc/f77 links

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 <AT> google.com>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 Makefile   | 3 +++
 gcc-config | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 61ba0d9..b143b3c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,8 @@
 # and keep only
 #     ${CTARGET}-gcc
 USE_NATIVE_LINKS ?= yes
+# Install cc/f77 symlinks to gcc/g77.
+USE_CC_WRAPPERS ?= yes
 
 # Prepend toolchain prefix to 'gcc' in c89/c99 wrapeprs.
 #    Should usually be '${CHOST}-'.
@@ -41,6 +43,7 @@ clean:
 		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
 		-e 's:@PV@:$(PV):g' \
 		-e 's:@USE_NATIVE_LINKS@:$(USE_NATIVE_LINKS):g' \
+		-e 's:@USE_CC_WRAPPERS@:$(USE_CC_WRAPPERS):g' \
 		$< > $@
 	chmod a+rx $@
 

diff --git a/gcc-config b/gcc-config
index d05dabe..dee6f98 100755
--- a/gcc-config
+++ b/gcc-config
@@ -289,8 +289,10 @@ update_wrappers() {
 	local all_wrappers=( ${new_wrappers[@]/#/${CTARGET}-} )
 	if ! is_cross_compiler ; then
 		all_wrappers+=( "${new_wrappers[@]}" )
-		# There are a few fun extra progs which we have to handle #412319
-		all_wrappers+=( cc:gcc f77:g77 )
+		if [[ ${USE_CC_WRAPPERS} == "yes" ]]; then
+			# There are a few fun extra progs which we have to handle #412319
+			all_wrappers+=( cc:gcc f77:g77 )
+		fi
 	fi
 
 	# Then install wrappers for anything new to this profile.
@@ -995,6 +997,7 @@ CC_COMP=
 ENV_D="${EROOT}etc/env.d"
 GCC_ENV_D="${ENV_D}/gcc"
 USE_NATIVE_LINKS="@USE_NATIVE_LINKS@"
+USE_CC_WRAPPERS="@USE_CC_WRAPPERS@"
 
 for x in "$@" ; do
 	case "${x}" in
@@ -1050,6 +1053,8 @@ for x in "$@" ; do
 			;;
 		--enable-native-links)  USE_NATIVE_LINKS="yes" ;;
 		--disable-native-links) USE_NATIVE_LINKS="no" ;;
+		--enable-cc-wrappers)  USE_CC_WRAPPERS="yes" ;;
+		--disable-cc-wrappers) USE_CC_WRAPPERS="no" ;;
 		-*)
 			die "Invalid switch!  Run ${argv0} without parameters for help."
 			;;


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2020-09-05 18:11 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2020-09-05 18:11 UTC (permalink / raw
  To: gentoo-commits

commit:     74bdd9e7cc01112a7bdacc82730f6492113e37f6
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  5 18:06:28 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Sep  5 18:06:28 2020 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=74bdd9e7

gcc-config: maintain ABI ordering for LDPATH

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 <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index dee6f98..615e43b 100755
--- a/gcc-config
+++ b/gcc-config
@@ -720,7 +720,7 @@ switch_profile() {
 		local MY_LDPATH
 		MY_LDPATH=$(${SED} -n \
 			-e '/^LDPATH=/{s|LDPATH=||;s|"||g;s|:|\n|g;p}' \
-			$(version_sorted_paths "${GCC_ENV_D}"/${CHOST}-*) | tac
+			$(version_sorted_paths "${GCC_ENV_D}"/${CHOST}-* | tac)
 		)
 
 		# Pass all by default


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-01-23 17:51 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2021-01-23 17:51 UTC (permalink / raw
  To: gentoo-commits

commit:     79af2476b55a6b01e612c9eb0cb98755a51da780
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Sat Jan 23 00:00:00 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 17:50:41 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=79af2476

gcc-config: Do not call 'python' directly.

'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 <AT> Apache.Org>
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/gcc-config b/gcc-config
index 615e43b..0eb1b5f 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 2002-2019 Gentoo Authors
+# Copyright 2002-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # Format of /etc/env.d/gcc/ contents:
@@ -155,11 +155,10 @@ get_chost() {
 
 	export CHOST
 
-	# make sure portage isnt broken
-	if python -V &>/dev/null ; then
-		CHOST=$(portageq envvar CHOST 2>/dev/null)
-	else
-		ewarn "Python seems to be broken, attempting to locate CHOST ourselves ..."
+	# Make sure Portage isn't broken.
+	CHOST=$(portageq envvar CHOST 2>/dev/null)
+	if [[ $? != 0 || -z ${CHOST} ]] ; then
+		ewarn "Python or Portage seems to be broken, attempting to locate CHOST ourselves ..."
 		CHOST=$(try_real_hard_to_find_CHOST)
 	fi
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-02-26  8:40 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2021-02-26  8:40 UTC (permalink / raw
  To: gentoo-commits

commit:     271432c86304a4724c500df532d41f184ac76c55
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 26 08:39:12 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Feb 26 08:39:12 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=271432c8

gcc-config: add examples of profile formats

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc-config b/gcc-config
index 0eb1b5f..eadea0b 100755
--- a/gcc-config
+++ b/gcc-config
@@ -61,8 +61,9 @@ usage() {
 	  -L, --get-lib-path         Print path where libraries of the given/current
 	                             profile are located.
 
-	Profile names are of the form:  <CTARGET>-<version>
-	For example:                    i686-pc-linux-gnu-3.2.1
+	Profile names are of the form:  <CTARGET>-<version> (like 'i686-pc-linux-gnu-3.2.1')
+	                                <version> (like '3.2.1')
+	                                <profile-number> (as specified in '--list-profiles')
 	EOF
 	exit ${1:-1}
 }


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-02-26  9:36 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2021-02-26  9:36 UTC (permalink / raw
  To: gentoo-commits

commit:     47ccdd7e2e51d88c439b347c8e9bc9d1c4c20dcc
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 26 08:44:35 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Feb 26 08:44:35 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=47ccdd7e

gcc-config: clarify comment around profile version selection

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc-config b/gcc-config
index 1a58c56..594c7d2 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1080,12 +1080,12 @@ for x in "$@" ; do
 					die "Could not locate profile #$x !"
 				fi
 			else
-				# User gave us a full HOST-gccver
+				# User gave us a full <CTARGET-version> or <version>
 				x=${x##*/}
 				if [[ ${DOIT} == "get_current_profile" && -z $(ls "${GCC_ENV_D}"/${x}-* 2>/dev/null) ]] || \
 				   [[ ${DOIT} != "get_current_profile" && ! -f ${GCC_ENV_D}/${x} ]]
 				then
-					# Maybe they just gave us a gccver ...
+					# Maybe they just gave us a <version>. Infer <CTARGET>.
 					get_chost
 					if [[ -f ${GCC_ENV_D}/${CHOST}-${x} ]] ; then
 						x=${CHOST}-${x}


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-02-26  9:36 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2021-02-26  9:36 UTC (permalink / raw
  To: gentoo-commits

commit:     3efd8ef43c07a53663d8a1f53f1c13ffb0447b87
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 26 09:34:52 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Feb 26 09:34:52 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=3efd8ef4

gcc-config: add support for special 'latest' version for profile switch

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 <AT> gentoo.org>

 gcc-config | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gcc-config b/gcc-config
index e8e3d58..6b2a1a7 100755
--- a/gcc-config
+++ b/gcc-config
@@ -65,6 +65,8 @@ usage() {
 	Profile names are of the form:  <CTARGET>-<version> (like 'i686-pc-linux-gnu-3.2.1')
 	                                <version> (like '3.2.1')
 	                                <profile-number> (as specified in '--list-profiles')
+	                                latest
+	                                <CTARGET>-latest (like mmix-latest)
 	EOF
 	exit ${1:-1}
 }
@@ -1081,6 +1083,14 @@ for x in "$@" ; do
 					die "Could not locate profile #$x !"
 				fi
 			else
+				# User gave us "latest" or "<CTARGET>-latest".
+				if [[ ${x} == latest ]]; then
+					get_chost
+					x=$(version_sorted_paths "${GCC_ENV_D}"/${CHOST}-* | tail -1)
+				elif [[ ${x} == *-latest ]]; then
+					x=$(version_sorted_paths "${GCC_ENV_D}"/${x%-latest}-* | tail -1)
+				fi
+
 				# User gave us a full <CTARGET-version>, <CTARGET> or <version>
 				x=${x##*/}
 				if [[ ${DOIT} == "get_current_profile" && -z $(ls "${GCC_ENV_D}"/${x}-* 2>/dev/null) ]] || \


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-02-26  9:36 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2021-02-26  9:36 UTC (permalink / raw
  To: gentoo-commits

commit:     0bbe090dda2c504177b9fe2e38c0db4f16e6d20e
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 26 08:42:23 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Feb 26 08:42:23 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=0bbe090d

gcc-config: clarify comment around index number choice

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index eadea0b..1a58c56 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1064,7 +1064,7 @@ for x in "$@" ; do
 			fi
 
 			if [[ -z $(echo ${x} | tr -d '[:digit:]') ]] ; then
-				# User gave us a # representing the profile
+				# User gave us a profile index number from '--list-profiles'
 				i=1
 				for y in $(version_sorted_paths "${GCC_ENV_D}"/*) ; do
 					[[ -f ${y} ]] || continue


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-02-26  9:36 Sergei Trofimovich
  0 siblings, 0 replies; 83+ messages in thread
From: Sergei Trofimovich @ 2021-02-26  9:36 UTC (permalink / raw
  To: gentoo-commits

commit:     c952a087e482b7dfe067172754ce832f78aa8c80
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 26 08:50:36 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Feb 26 08:50:36 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=c952a087

gcc-config: provide 'gcc-config --get-current-profile [CTARGET]' example

Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 gcc-config | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 594c7d2..e8e3d58 100755
--- a/gcc-config
+++ b/gcc-config
@@ -45,6 +45,7 @@ GENTOO_LIBDIR="@GENTOO_LIBDIR@"
 usage() {
 	cat <<-EOF
 	Usage: gcc-config [options] [CC Profile]
+	       gcc-config [options] --get-current-profile [CTARGET]
 	Change the current compiler profile, or give info about profiles.
 
 	Options:
@@ -1080,7 +1081,7 @@ for x in "$@" ; do
 					die "Could not locate profile #$x !"
 				fi
 			else
-				# User gave us a full <CTARGET-version> or <version>
+				# User gave us a full <CTARGET-version>, <CTARGET> or <version>
 				x=${x##*/}
 				if [[ ${DOIT} == "get_current_profile" && -z $(ls "${GCC_ENV_D}"/${x}-* 2>/dev/null) ]] || \
 				   [[ ${DOIT} != "get_current_profile" && ! -f ${GCC_ENV_D}/${x} ]]


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-11-13  4:49 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2021-11-13  4:49 UTC (permalink / raw
  To: gentoo-commits

commit:     5a7cc0acb21bb44c8246d8fc11bdf3823f921b3b
Author:     Jason Zaman <perfinion <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 12 00:34:04 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 13 04:49:06 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=5a7cc0ac

gcc-config: Check writability in env.d instead of EROOT

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 <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 6b2a1a7..70bb388 100755
--- a/gcc-config
+++ b/gcc-config
@@ -668,7 +668,7 @@ switch_profile() {
 
 	# Make sure we have write access to the dirs.  Do not require `root`
 	# so that we work with prefix/cross/etc... setups that run as user.
-	[[ ! -w ${EROOT} ]] && die "need write access to ${EROOT}"
+	[[ ! -w ${ENV_D} ]] && die "need write access to ${ENV_D}"
 
 	if is_cross_compiler ; then
 		ebegin "Switching cross-compiler to ${CC_COMP}"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2021-11-13  4:49 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2021-11-13  4:49 UTC (permalink / raw
  To: gentoo-commits

commit:     6c4d82dde134b4e947480759c125e9389f09ae01
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 13 04:48:00 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 13 04:49:06 2021 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=6c4d82dd

gcc-config: add comment explaining SELinux-related writable check

Bug: https://bugs.gentoo.org/823203
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc-config b/gcc-config
index 70bb388..eff9cca 100755
--- a/gcc-config
+++ b/gcc-config
@@ -668,6 +668,11 @@ switch_profile() {
 
 	# Make sure we have write access to the dirs.  Do not require `root`
 	# so that we work with prefix/cross/etc... setups that run as user.
+	#
+	# [It's important we use ${ENV_D} and not e.g. ${EROOT} because for, say
+	# SELinux, we may not actually be able to write to ${EROOT}, but would
+	# be allowed for specific paths like the gcc wrappers we need to
+	# modify. bug #823203.]
 	[[ ! -w ${ENV_D} ]] && die "need write access to ${ENV_D}"
 
 	if is_cross_compiler ; then


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-09-22 23:46 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-09-22 23:46 UTC (permalink / raw
  To: gentoo-commits

commit:     1ff1ed38697ed3b376db5c5157fcec24df67aa91
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 22 23:41:28 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 22 23:45:43 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=1ff1ed38

gcc-config: create ${CTARGET}-cc symlink

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 <AT> gentoo.org>

 gcc-config | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 65a7ceb..512c41c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -332,9 +332,16 @@ update_wrappers() {
 			rm -f "${EROOT}usr/bin/${x}"
 		fi
 	done
-	# legacy cruft, make sure we dont leave it laying around #143205
+
+	# Legacy cruft, make sure we don't leave it laying around, as we used to install
+	# genuine wrappers like python-exec, bug #143205
 	rm -f "${EROOT}usr/bin/${CTARGET}-cc" "${EROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
 
+	# But create our own ${CTARGET}-cc in /usr/bin to avoid fallbacks
+	# to the symlinks LLVM creates (sys-devel/clang-toolchain-symlinks).
+	# bug #872416.
+	atomic_ln "${EROOT}usr/bin/${CTARGET}-gcc" "${EROOT}usr/bin" "${CTARGET}-cc"
+
 	# handle the canonical cpp wrapper
 	if ! is_cross_compiler ; then
 		if [[ ${USE_NATIVE_LINKS} == yes ]]; then


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-09-29 22:36 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-09-29 22:36 UTC (permalink / raw
  To: gentoo-commits

commit:     3e49f724d090d65b739be1a67f6c40574337a2f7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 29 22:12:12 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 29 22:35:57 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=3e49f724

gcc-config: set CCACHE_COMPILERCHECK to major GCC version

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 <AT> gentoo.org>

 gcc-config | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc-config b/gcc-config
index 44a3869..dfc01d0 100755
--- a/gcc-config
+++ b/gcc-config
@@ -747,6 +747,14 @@ switch_profile() {
 			echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
 		fi
 
+		# Avoid ccache cache invalidations where possible between
+		# snapshots and minor GCC versions, bug #872971.
+		# For GCC 10, we changed the slotting from e.g. 10.4 -> 10.
+		local gcc_major_version="${CC_COMP_VERSION%%.*}"
+		if [[ "${gcc_major_version}" -ge 10 ]] ; then
+			echo "CCACHE_COMPILERCHECK=\"string:gcc-${gcc_major_version}\"" >> "${envd}.tmp"
+		fi
+
 		# Punt old files; maybe globs too much, but oh well
 		# 'NATIVE' and '.NATIVE' were used by gcc-wrapper before Aug 2018
 		# and are not used as wrapper is removed.


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-09-29 22:36 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-09-29 22:36 UTC (permalink / raw
  To: gentoo-commits

commit:     0388b3c1344e6d05e42769e291163f3532439334
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 29 21:59:52 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 29 22:35:57 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=0388b3c1

gcc-config: improve language

Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 512c41c..44a3869 100755
--- a/gcc-config
+++ b/gcc-config
@@ -128,7 +128,7 @@ try_real_hard_to_find_CHOST() {
 	local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
 	if [[ -z ${ret} ]] ; then
 		# newer portage supports spaces between the var and =
-		# CHOST     =  "this-is-retarded"
+		# CHOST     =  "this-is-silly"
 		ret=$(eval $(
 			${SED} -n \
 				-e 's:[[:space:]]::g' \


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-10-08 22:02 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-10-08 22:02 UTC (permalink / raw
  To: gentoo-commits

commit:     11c3a59b2395f25ac869573a361ac937a0144427
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  8 22:01:38 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct  8 22:01:38 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=11c3a59b

Makefile: drop excessive EPREFIXing

Bug: https://bugs.gentoo.org/875377
Signed-off-by: Sam James <sam <AT> gentoo.org>

 Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Makefile b/Makefile
index b143b3c..5d84b50 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,6 @@ clean:
 
 .gcc-config: gcc-config
 	sed \
-		-e '1s:/:$(EPREFIX)/:' \
 		-e 's:@GENTOO_EPREFIX@:$(EPREFIX):g' \
 		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
 		-e 's:@PV@:$(PV):g' \


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-10-09 20:55 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-10-09 20:55 UTC (permalink / raw
  To: gentoo-commits

commit:     3ba93fbb30984b59eb99883292f336e6a0b1ea8b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  9 20:33:59 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct  9 20:55:26 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=3ba93fbb

gcc-config: update /etc/clang/gentoo-gcc-install.cfg if exists

* 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 <AT> gentoo.org>

 gcc-config | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gcc-config b/gcc-config
index dfc01d0..31a7f4a 100755
--- a/gcc-config
+++ b/gcc-config
@@ -783,6 +783,21 @@ switch_profile() {
 			find "${pkgconfdir}"/libgcj*.pc -xtype l -delete 2>/dev/null
 		done
 
+		# Only update the file if it already exists to allow us to
+		# walk it back if necessary by dropping it from clang-common.
+		# See bug #868639 for background.
+		if [[ -f "${EROOT}/etc/clang/gentoo-gcc-install.cfg" ]] ; then
+			local gcc_lib_path="$(get_lib_path)"
+			gcc_lib_path="${gcc_lib_path%%:*}"
+			cat > "${EROOT}/etc/clang/gentoo-gcc-install.cfg.tmp" <<-EOF
+				# This file is maintained by gcc-config.
+				# It is used to specify the selected GCC installation.
+				--gcc-install-dir="${gcc_lib_path}"
+			EOF
+
+			mv_if_diff "${EROOT}/etc/clang/gentoo-gcc-install.cfg.tmp" "${EROOT}/etc/clang/gentoo-gcc-install.cfg"
+		fi
+
 		prefix_copy_gcc_libs
 		handle_split_usr
 		: $(( envd_changed += $? ))


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-10-10 14:09 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-10-10 14:09 UTC (permalink / raw
  To: gentoo-commits

commit:     681d39425a71977ba0850eb88448f831f84dd6eb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 10 14:07:23 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 14:07:23 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=681d3942

Revert "gcc-config: set CCACHE_COMPILERCHECK to major GCC version"

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 <AT> gentoo.org>

 gcc-config | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/gcc-config b/gcc-config
index 31a7f4a..08002fd 100755
--- a/gcc-config
+++ b/gcc-config
@@ -747,14 +747,6 @@ switch_profile() {
 			echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
 		fi
 
-		# Avoid ccache cache invalidations where possible between
-		# snapshots and minor GCC versions, bug #872971.
-		# For GCC 10, we changed the slotting from e.g. 10.4 -> 10.
-		local gcc_major_version="${CC_COMP_VERSION%%.*}"
-		if [[ "${gcc_major_version}" -ge 10 ]] ; then
-			echo "CCACHE_COMPILERCHECK=\"string:gcc-${gcc_major_version}\"" >> "${envd}.tmp"
-		fi
-
 		# Punt old files; maybe globs too much, but oh well
 		# 'NATIVE' and '.NATIVE' were used by gcc-wrapper before Aug 2018
 		# and are not used as wrapper is removed.


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-12-28 19:12 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-12-28 19:12 UTC (permalink / raw
  To: gentoo-commits

commit:     fc3edfcd1cc277a3457c0d17041f74452b4d3465
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 10:14:34 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 19:11:59 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=fc3edfcd

Read LIBDIR with portageq from EROOT instead of hardcoding the / value

We fall back to the hardcoded / value if that fails.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Closes: https://github.com/gentoo/gcc-config/pull/1
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index 236c433..a44fced 100755
--- a/gcc-config
+++ b/gcc-config
@@ -41,7 +41,10 @@ fi
 
 PV="@PV@"
 [[ ${PV} == @*@ ]] && PV="git"
-GENTOO_LIBDIR="@GENTOO_LIBDIR@"
+
+ABI=$(portageq envvar DEFAULT_ABI 2>/dev/null)
+GENTOO_LIBDIR=$(portageq envvar LIBDIR_"${ABI}" 2>/dev/null)
+[[ $? != 0 || -z ${GENTOO_LIBDIR} ]] && GENTOO_LIBDIR="@GENTOO_LIBDIR@"
 [[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
 
 usage() {


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-12-28 19:12 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-12-28 19:12 UTC (permalink / raw
  To: gentoo-commits

commit:     77d64fc9897a157aafec35515848c907b4661bb0
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 10:13:03 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 19:11:59 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=77d64fc9

Read CHOST with portageq from EROOT and not /

Failing that, the fallback method still reads from EROOT as before.

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc-config b/gcc-config
index c5d907c..236c433 100755
--- a/gcc-config
+++ b/gcc-config
@@ -13,6 +13,7 @@ BROOT="@GENTOO_EPREFIX@"
 [[ ${BROOT} == @*@ ]] && BROOT=""
 : ${EPREFIX="${BROOT}"}
 EROOT="${ROOT%/}${EPREFIX}/"
+export PORTAGE_CONFIGROOT="${EROOT}"
 
 cd /
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2022-12-28 19:12 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2022-12-28 19:12 UTC (permalink / raw
  To: gentoo-commits

commit:     9fbedc2a1aa8b71daaafc4598f69d312914c191d
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 26 10:09:17 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 19:11:58 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=9fbedc2a

Allow EPREFIX to be overridden for manipulating prefixed ROOT

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 <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc-config b/gcc-config
index 08002fd..c5d907c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -9,8 +9,9 @@
 : ${ROOT:=/}
 [[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
 [[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
-EPREFIX="@GENTOO_EPREFIX@"
-[[ ${EPREFIX} == @*@ ]] && EPREFIX=""
+BROOT="@GENTOO_EPREFIX@"
+[[ ${BROOT} == @*@ ]] && BROOT=""
+: ${EPREFIX="${BROOT}"}
 EROOT="${ROOT%/}${EPREFIX}/"
 
 cd /
@@ -18,7 +19,7 @@ cd /
 trap ":" INT QUIT TSTP
 
 argv0=${0##*/}
-functions_script="${EPREFIX}/lib/gentoo/functions.sh"
+functions_script="${BROOT}/lib/gentoo/functions.sh"
 source "${functions_script}" || {
 	echo "${argv0}: Could not source ${functions_script}!" 1>&2
 	exit 1


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2023-01-05  0:16 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2023-01-05  0:16 UTC (permalink / raw
  To: gentoo-commits

commit:     d245197378818f66c978d4427b6d0d81fbfaefc6
Author:     Krzesimir Nowak <knowak <AT> microsoft <DOT> com>
AuthorDate: Thu Nov 10 15:45:48 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan  5 00:16:31 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=d2451973

gcc-config: Use relative paths for liblto and cc symlink targets

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 <AT> microsoft.com>
Closes: https://github.com/gentoo/gcc-config/pull/2
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gcc-config b/gcc-config
index a44fced..f39dd5c 100755
--- a/gcc-config
+++ b/gcc-config
@@ -345,7 +345,7 @@ update_wrappers() {
 	# But create our own ${CTARGET}-cc in /usr/bin to avoid fallbacks
 	# to the symlinks LLVM creates (sys-devel/clang-toolchain-symlinks).
 	# bug #872416.
-	atomic_ln "${EROOT}usr/bin/${CTARGET}-gcc" "${EROOT}usr/bin" "${CTARGET}-cc"
+	atomic_ln "${CTARGET}-gcc" "${EROOT}usr/bin" "${CTARGET}-cc"
 
 	# handle the canonical cpp wrapper
 	if ! is_cross_compiler ; then
@@ -813,11 +813,12 @@ switch_profile() {
 	# Update LTO plugin for GCC.  Supported as of binutils 2.25.
 	local BFD_PLUGINS_DIR
 	local LIBLTO_PLUGIN
-	LIBLTO_PLUGIN="${EROOT}usr/libexec/gcc/${CTARGET}/${CC_COMP_VERSION}/liblto_plugin.so"
 	if is_cross_compiler; then
 		BFD_PLUGINS_DIR="${EROOT}usr/${CHOST}/${CTARGET}/binutils-bin/lib/bfd-plugins"
+		LIBLTO_PLUGIN="../../../../../libexec/gcc/${CTARGET}/${CC_COMP_VERSION}/liblto_plugin.so"
 	else
 		BFD_PLUGINS_DIR="${EROOT}usr/${CHOST}/binutils-bin/lib/bfd-plugins"
+	        LIBLTO_PLUGIN="../../../../libexec/gcc/${CTARGET}/${CC_COMP_VERSION}/liblto_plugin.so"
 	fi
 	mkdir -p "${BFD_PLUGINS_DIR}"
 	ln -sf "${LIBLTO_PLUGIN}" "${BFD_PLUGINS_DIR}"


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2023-04-30  2:59 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2023-04-30  2:59 UTC (permalink / raw
  To: gentoo-commits

commit:     22b58d511521fea50e0f6797a39b1750b3764c85
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 30 02:58:53 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 30 02:59:56 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=22b58d51

gcc-config: Add missing terminating quote for 'backing up' path message

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 <AT> gentoo.org>

 gcc-config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc-config b/gcc-config
index f39dd5c..80951b4 100755
--- a/gcc-config
+++ b/gcc-config
@@ -426,7 +426,7 @@ handle_split_usr() {
 		# but for now, that should be safe ...
 		for gcclib in "${ROOT}${LDPATH}"/lib${gcclib}.so.* ; do
 			[[ -e ${gcclib} ]] || continue
-			einfo "Backing up '${gcclib}' to '${libdir}"
+			einfo "Backing up '${gcclib}' to '${libdir}'"
 			cp -pP "${gcclib}" "${libdir}"/.gcc.config.new/
 			# no need to sanity `rm` this as the `mv` should take care
 			# of it.  we also need this step to be completely atomic


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2023-05-14 17:25 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2023-05-14 17:25 UTC (permalink / raw
  To: gentoo-commits

commit:     6d83aec7a8d26035d81b1cafdf007135aa4ea094
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun May 14 15:45:32 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 14 17:24:32 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=6d83aec7

gcc-config: Don't call portageq if the variable is already set

Bug: https://bugs.gentoo.org/906329
Acked-by: James Le Cuirot <chewi <AT> gentoo.org>
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
Closes: https://github.com/gentoo/gcc-config/pull/3
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc-config b/gcc-config
index 80951b4..404ab29 100755
--- a/gcc-config
+++ b/gcc-config
@@ -42,9 +42,10 @@ fi
 PV="@PV@"
 [[ ${PV} == @*@ ]] && PV="git"
 
-ABI=$(portageq envvar DEFAULT_ABI 2>/dev/null)
-GENTOO_LIBDIR=$(portageq envvar LIBDIR_"${ABI}" 2>/dev/null)
-[[ $? != 0 || -z ${GENTOO_LIBDIR} ]] && GENTOO_LIBDIR="@GENTOO_LIBDIR@"
+ABI=${DEFAULT_ABI:-$(portageq envvar DEFAULT_ABI 2>/dev/null)}
+LIBDIR_VAR=LIBDIR_${ABI}
+GENTOO_LIBDIR=${!LIBDIR_VAR:-$(portageq envvar "${LIBDIR_VAR}" 2>/dev/null)}
+[[ $? -ne 0 || -z ${GENTOO_LIBDIR} ]] && GENTOO_LIBDIR="@GENTOO_LIBDIR@"
 [[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
 
 usage() {
@@ -166,7 +167,7 @@ get_chost() {
 
 	# Make sure Portage isn't broken.
 	CHOST=$(portageq envvar CHOST 2>/dev/null)
-	if [[ $? != 0 || -z ${CHOST} ]] ; then
+	if [[ $? -ne 0 || -z ${CHOST} ]] ; then
 		ewarn "Python or Portage seems to be broken, attempting to locate CHOST ourselves ..."
 		CHOST=$(try_real_hard_to_find_CHOST)
 	fi


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2023-05-31  5:54 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2023-05-31  5:54 UTC (permalink / raw
  To: gentoo-commits

commit:     8eed426e460d51a59353895d574d7d4b2d4b1388
Author:     Berin Aniesh <berinaniesh <AT> gmail <DOT> com>
AuthorDate: Tue May 30 01:45:03 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 31 05:54:09 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=8eed426e

README: Convert README from rST to markdown

Signed-off-by: Berin Aniesh <berinaniesh <AT> gmail.com>
Closes: https://github.com/gentoo/gcc-config/pull/4
Signed-off-by: Sam James <sam <AT> gentoo.org>

 README    | 77 --------------------------------------------------
 README.md | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+), 77 deletions(-)

diff --git a/README b/README
deleted file mode 100644
index 1321f63..0000000
--- a/README
+++ /dev/null
@@ -1,77 +0,0 @@
-What is gcc-config?
--------------------
-
-gcc-config allows Gentoo users to switch active gcc safely
-and allows querying facts about installed toolchains.
-
-To switch active gcc while system runs:
-    $ gcc-config x86_64-pc-linux-gnu-8.1.0
-    $ gcc-config x86_64-pc-linux-gnu-7.2.0
-
-    Ideally changes should be visible instantly and atomically
-    without shell restart.
-
-To query where real gcc binaries are hiding:
-    $ gcc-config -B $(gcc-config -c)
-
-To parse a profile into TARGET and toolchain version:
-    $ gcc-config -S sparc64-unknown-linux-gnu-9.2.0
-
-Files, variables, things.
--------------------------
-
-- Wrappers (symlinks to compiler binary like /usr/${CTARGET}/gcc-bin/${GCC_VERSION}/gcc)
-    /usr/bin/gcc (native)
-    /usr/bin/g++ (native)
-    /usr/bin/${CTARGET}-gcc (native and cross)
-    ...
-    (all files from /usr/${CTARGET}/gcc-bin/$GCC_VERSION/*)
-
-      See `gcc-config` script for wrapping details.
-
-    /usr/bin/c89 (native)
-    /usr/bin/c99 (native)
-
-- private gcc configs (provided by `toolchain.eclass`, gcc ebuilds)
-
-    /etc/env.d/gcc/x86_64-pc-linux-gnu-8.1.0
-
-      Contains variables that describe toolchain layout:
-
-          LDPATH="/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0"
-          MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.1.0/man"
-          INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.1.0/info"
-          STDCXX_INCDIR="g++-v8"
-          CTARGET="x86_64-pc-linux-gnu"
-          GCC_SPECS=""
-          MULTIOSDIRS="../lib64"
-          GCC_PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/8.1.0"
-
-      Used by gcc-config to generate wrappers and 05gcc- env.d files.
-
-- gcc env.d compiler entries (provided by gcc-config)
-
-    /etc/env.d/04gcc-${CTARGET} (native)
-
-      Populates paths for native-compilers
-
-        GCC_SPECS=""
-        MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/man"
-        INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/info"
-
-      Used by env-update to populate PATH and more (TODO: remove PATH population).
-
-TODOs
------
-
-- Write proper `gcc-config` manpage off this readme to be more discoverable.
-
-- Figure out symlink ownership story. Today symlinks don't belong to any package.
-
-  See https://bugs.gentoo.org/626606
-
-Releasing
----------
-
-  $ release=2.3.1; git tag -a -s -m "release ${release}" v${release}; make dist PV=${release}
-  $ git push --tags origin

diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e4effa0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,96 @@
+# What is gcc-config?
+
+`gcc-config` allows Gentoo users to switch active gcc safely
+and allows querying facts about installed toolchains.
+
+## Usage
+
+To switch active `gcc` while system runs:
+
+```
+    $ gcc-config x86_64-pc-linux-gnu-8.1.0
+    $ gcc-config x86_64-pc-linux-gnu-7.2.0
+```
+
+Ideally changes should be visible instantly and atomically
+without shell restart.
+
+To query where real `gcc` binaries are hiding:
+
+```
+    $ gcc-config -B $(gcc-config -c)
+```
+
+To parse a profile into TARGET and toolchain version:
+
+```
+    $ gcc-config -S sparc64-unknown-linux-gnu-9.2.0
+```
+
+## Files, variables, things.
+
+- Wrappers (symlinks to compiler binary like `/usr/${CTARGET}/gcc-bin/${GCC_VERSION}/gcc`)
+
+  `/usr/bin/gcc` (native)
+
+  `/usr/bin/g++` (native)
+
+  `/usr/bin/${CTARGET}-gcc` (native and cross)
+
+  ...
+
+  (all files from `/usr/${CTARGET}/gcc-bin/$GCC_VERSION/*`)
+
+  See `gcc-config` script for wrapping details.
+
+  `/usr/bin/c89` (native)
+
+  `/usr/bin/c99` (native)
+
+- private `gcc` configs (provided by `toolchain.eclass`, gcc ebuilds)
+
+  `/etc/env.d/gcc/x86_64-pc-linux-gnu-8.1.0`
+
+Contains variables that describe toolchain layout:
+
+```
+          LDPATH="/usr/lib/gcc/x86_64-pc-linux-gnu/8.1.0"
+          MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.1.0/man"
+          INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.1.0/info"
+          STDCXX_INCDIR="g++-v8"
+          CTARGET="x86_64-pc-linux-gnu"
+          GCC_SPECS=""
+          MULTIOSDIRS="../lib64"
+          GCC_PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/8.1.0"
+```
+
+      Used by `gcc-config` to generate wrappers and `05gcc-` `env.d` files.
+
+- `gcc` `env.d` compiler entries (provided by `gcc-config`)
+
+  `/etc/env.d/04gcc-${CTARGET}` (native)
+
+      Populates paths for native-compilers
+
+```
+        GCC_SPECS=""
+        MANPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/man"
+        INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/8.2.0/info"
+```
+
+Used by `env-update` to populate `$PATH` and more (TODO: remove `$PATH` population).
+
+## TODOs
+
+- Write proper `gcc-config` manpage off this readme to be more discoverable.
+
+- Figure out symlink ownership story. Today symlinks don't belong to any package.
+
+  See [bug 626606](https://bugs.gentoo.org/626606)
+
+## Releasing
+
+```
+  $ release=2.3.1; git tag -a -s -m "release ${release}" v${release}; make dist PV=${release}
+  $ git push --tags origin
+```


^ permalink raw reply related	[flat|nested] 83+ messages in thread

* [gentoo-commits] proj/gcc-config:master commit in: /
@ 2023-05-31  5:55 Sam James
  0 siblings, 0 replies; 83+ messages in thread
From: Sam James @ 2023-05-31  5:55 UTC (permalink / raw
  To: gentoo-commits

commit:     504c56095f81ad41e8d843120df5a27031bce7bd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed May 31 05:55:18 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed May 31 05:55:18 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=504c5609

README: grammar tweaks

Signed-off-by: Sam James <sam <AT> gentoo.org>

 README.md | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index e4effa0..6af211e 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 # What is gcc-config?
 
-`gcc-config` allows Gentoo users to switch active gcc safely
-and allows querying facts about installed toolchains.
+`gcc-config` allows Gentoo users to switch active gcc safely and allows
+querying facts about installed toolchains.
 
 ## Usage
 
@@ -12,10 +12,9 @@ To switch active `gcc` while system runs:
     $ gcc-config x86_64-pc-linux-gnu-7.2.0
 ```
 
-Ideally changes should be visible instantly and atomically
-without shell restart.
+Ideally changes should be visible instantly and atomically without shell restart.
 
-To query where real `gcc` binaries are hiding:
+To query where the real `gcc` binaries are hiding:
 
 ```
     $ gcc-config -B $(gcc-config -c)
@@ -82,11 +81,11 @@ Used by `env-update` to populate `$PATH` and more (TODO: remove `$PATH` populati
 
 ## TODOs
 
-- Write proper `gcc-config` manpage off this readme to be more discoverable.
+- Write proper `gcc-config` manpage based on this readme to be more discoverable.
 
-- Figure out symlink ownership story. Today symlinks don't belong to any package.
+- Figure out symlink ownership story. Right now, symlinks don't belong to any package.
 
-  See [bug 626606](https://bugs.gentoo.org/626606)
+  See [bug 626606](https://bugs.gentoo.org/626606).
 
 ## Releasing
 


^ permalink raw reply related	[flat|nested] 83+ messages in thread

end of thread, other threads:[~2023-05-31  5:55 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-05  6:42 [gentoo-commits] proj/gcc-config:master commit in: / Sergei Trofimovich
  -- strict thread matches above, loose matches on Subject: below --
2023-05-31  5:55 Sam James
2023-05-31  5:54 Sam James
2023-05-14 17:25 Sam James
2023-04-30  2:59 Sam James
2023-01-05  0:16 Sam James
2022-12-28 19:12 Sam James
2022-12-28 19:12 Sam James
2022-12-28 19:12 Sam James
2022-10-10 14:09 Sam James
2022-10-09 20:55 Sam James
2022-10-08 22:02 Sam James
2022-09-29 22:36 Sam James
2022-09-29 22:36 Sam James
2022-09-22 23:46 Sam James
2021-11-13  4:49 Sam James
2021-11-13  4:49 Sam James
2021-02-26  9:36 Sergei Trofimovich
2021-02-26  9:36 Sergei Trofimovich
2021-02-26  9:36 Sergei Trofimovich
2021-02-26  9:36 Sergei Trofimovich
2021-02-26  8:40 Sergei Trofimovich
2021-01-23 17:51 Sergei Trofimovich
2020-09-05 18:11 Sergei Trofimovich
2020-06-24 20:47 Sergei Trofimovich
2020-06-21 11:53 Sergei Trofimovich
2020-06-21 11:50 Sergei Trofimovich
2020-05-23  7:28 Sergei Trofimovich
2020-05-22 13:23 Sergei Trofimovich
2020-05-22 13:20 Sergei Trofimovich
2020-05-22 11:33 Sergei Trofimovich
2020-05-22 10:39 Sergei Trofimovich
2020-05-22 10:03 Sergei Trofimovich
2020-05-22  9:40 Sergei Trofimovich
2020-04-10 10:08 Sergei Trofimovich
2020-01-26 13:44 Sergei Trofimovich
2020-01-26 13:26 Sergei Trofimovich
2019-09-08  8:37 Sergei Trofimovich
2019-09-08  8:29 Sergei Trofimovich
2019-09-07 22:08 Sergei Trofimovich
2019-09-07  9:39 Sergei Trofimovich
2019-09-07  9:39 Sergei Trofimovich
2019-09-07  9:15 Sergei Trofimovich
2019-09-07  9:01 Sergei Trofimovich
2019-09-07  8:47 Sergei Trofimovich
2019-09-07  8:22 Sergei Trofimovich
2019-09-06  7:29 Sergei Trofimovich
2019-09-06  7:23 Sergei Trofimovich
2019-09-06  6:53 Sergei Trofimovich
2019-09-06  6:53 Sergei Trofimovich
2019-09-05 22:35 Sergei Trofimovich
2019-09-05  7:24 Sergei Trofimovich
2019-09-05  6:47 Sergei Trofimovich
2019-09-05  6:28 Sergei Trofimovich
2019-09-04 19:00 Sergei Trofimovich
2019-09-04 19:00 Sergei Trofimovich
2018-08-24 16:40 Sergei Trofimovich
2018-08-24  8:50 Sergei Trofimovich
2018-08-24  0:23 Sergei Trofimovich
2018-08-13 22:39 Sergei Trofimovich
2018-08-13 21:55 Sergei Trofimovich
2017-12-16 21:11 Andreas Hüttel
2017-12-16 20:15 Andreas Hüttel
2017-12-15  8:33 Fabian Groffen
2015-08-05  8:12 Mike Frysinger
2015-08-05  7:52 Mike Frysinger
2015-05-13  4:26 Ryan Hill
2013-05-22 23:54 Mike Frysinger
2013-01-12 17:20 Mike Frysinger
2013-01-12 17:17 Mike Frysinger
2013-01-12 17:14 Mike Frysinger
2013-01-12 17:05 Mike Frysinger
2013-01-02 18:30 Mike Frysinger
2013-01-02  3:52 Mike Frysinger
2012-12-29 21:08 Mike Frysinger
2012-11-19  6:52 Mike Frysinger
2012-11-19  1:11 Mike Frysinger
2012-11-19  1:11 Mike Frysinger
2012-06-10  4:00 Mike Frysinger
2012-06-10  4:00 Mike Frysinger
2012-04-14  1:22 Mike Frysinger
2012-04-14  1:22 Mike Frysinger
2012-04-14  1:22 Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox