public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] RFC: toolchain.eclass prefix support
@ 2017-01-07 15:07 Benda Xu
  2017-01-07 15:23 ` James Le Cuirot
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-07 15:07 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

Hi,

Please help me review the patch attached.

This patch has 5 main kinds of modifications to the eclass,

  * Define ED and EROOT for EAPI 0, 1 and 2.
  * Add ${EPREFIX} to ${PREFIX} and quote the variables.
  * Strip ${EPREFIX} if used with a ebuild helper.
  * call fix_libtool_files.sh by name, because /usr/sbin is in PATH,
    and no need to write as ${EPREFIX}/usr/sbin/fix_libtool_files.sh
  * Preserve PATH when calling gcc-config.

Benda


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: toolchain.patch --]
[-- Type: text/x-diff, Size: 12764 bytes --]

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 55249b0..ca64091 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -8,7 +8,7 @@ DESCRIPTION="The GNU Compiler Collection"
 HOMEPAGE="https://gcc.gnu.org/"
 RESTRICT="strip" # cross-compilers need controlled stripping
 
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator
+inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator prefix
 
 if [[ ${PV} == *_pre9999* ]] ; then
 	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
@@ -49,6 +49,11 @@ is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }
 
+if [[ ${EAPI:-0} == [012] ]] ; then
+		: ${ED:=${D}}
+		: ${EROOT:=${ROOT}}
+fi
+
 # General purpose version check.  Without a second arg matches up to minor version (x.x.x)
 tc_version_is_at_least() {
 	version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
@@ -93,7 +98,7 @@ fi
 
 export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
 
-PREFIX=${TOOLCHAIN_PREFIX:-/usr}
+PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
 
 if tc_version_is_at_least 3.4.0 ; then
 	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
@@ -983,10 +988,10 @@ toolchain_src_configure() {
 			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
 				confgcc+=(
 					"${confgcc_no_libc[@]}"
-					--with-sysroot=${PREFIX}/${CTARGET}
+					--with-sysroot="${PREFIX}"/${CTARGET}
 				)
 			else
-				confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
+				confgcc+=( --with-sysroot="${PREFIX}"/${CTARGET} )
 			fi
 		fi
 
@@ -1073,7 +1078,7 @@ toolchain_src_configure() {
 		[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
 		# See if this is a valid --with-arch flag
 		if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
-		    . "${srcdir}"/config.gcc) &>/dev/null
+			. "${srcdir}"/config.gcc) &>/dev/null
 		then
 			confgcc+=( --with-arch=${arm_arch} )
 		fi
@@ -1267,7 +1272,7 @@ toolchain_src_configure() {
 	echo "${S}"/configure "${confgcc[@]}"
 	# Older gcc versions did not detect bash and re-exec itself, so force the
 	# use of bash.  Newer ones will auto-detect, but this is not harmeful.
-	CONFIG_SHELL="/bin/bash" \
+	CONFIG_SHELL="${EPREFIX}/bin/bash" \
 	bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
 
 	# return to whatever directory we were in before
@@ -1703,11 +1708,11 @@ toolchain_src_install() {
 		if [[ -f ${CTARGET}-${x} ]] ; then
 			if ! is_crosscompile ; then
 				ln -sf ${CTARGET}-${x} ${x}
-				dosym ${BINPATH}/${CTARGET}-${x} \
+				dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
 					/usr/bin/${x}-${GCC_CONFIG_VER}
 			fi
 			# Create versioned symlinks
-			dosym ${BINPATH}/${CTARGET}-${x} \
+			dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
 				/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
 		fi
 
@@ -1727,7 +1732,7 @@ toolchain_src_install() {
 	# Now do the fun stripping stuff
 	env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
 	is_crosscompile && \
-		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}/${HOSTLIBPATH}"
+		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${HOSTLIBPATH}"
 	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
 	# gcc used to install helper binaries in lib/ but then moved to libexec/
 	[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
@@ -1735,7 +1740,7 @@ toolchain_src_install() {
 
 	cd "${S}"
 	if is_crosscompile; then
-		rm -rf "${D}"/usr/share/{man,info}
+		rm -rf "${ED}"usr/share/{man,info}
 		rm -rf "${D}"${DATAPATH}/{man,info}
 	else
 		if tc_version_is_at_least 3.0 ; then
@@ -1745,11 +1750,11 @@ toolchain_src_install() {
 			fi
 		fi
 		has noinfo ${FEATURES} \
-			&& rm -r "${D}/${DATAPATH}"/info \
-			|| prepinfo "${DATAPATH}"
+			&& rm -r "${D}${DATAPATH}"/info \
+			|| prepinfo "${DATAPATH#${EPREFIX}}"
 		has noman ${FEATURES} \
-			&& rm -r "${D}/${DATAPATH}"/man \
-			|| prepman "${DATAPATH}"
+			&& rm -r "${D}${DATAPATH}"/man \
+			|| prepman "${DATAPATH#${EPREFIX}}"
 	fi
 	# prune empty dirs left behind
 	find "${D}" -depth -type d -delete 2>/dev/null
@@ -1764,10 +1769,10 @@ toolchain_src_install() {
 	# Rather install the script, else portage with changing $FILESDIR
 	# between binary and source package borks things ....
 	if ! is_crosscompile ; then
-		insinto "${DATAPATH}"
-		newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
-		exeinto "${DATAPATH}"
-		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
+		insinto "${DATAPATH#${EPREFIX}}"
+		newins "$(prefixify_ro "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
+		exeinto "${DATAPATH#${EPREFIX}}"
+		doexe "$(prefixify_ro "${GCC_FILESDIR}"/fix_libtool_files.sh)" || die
 		doexe "${GCC_FILESDIR}"/c{89,99} || die
 	fi
 
@@ -1812,11 +1817,11 @@ toolchain_src_install() {
 	# Use gid of 0 because some stupid ports don't have
 	# the group 'root' set to gid 0.  Send to /dev/null
 	# for people who are testing as non-root.
-	chown -R root:0 "${D}"${LIBPATH} 2>/dev/null
+	chown -R root:0 "${D}${LIBPATH}" 2>/dev/null
 
 	# Move pretty-printers to gdb datadir to shut ldconfig up
 	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
-	pushd "${D}"${LIBPATH} >/dev/null
+	pushd "${D}${LIBPATH}" >/dev/null
 	for py in $(find . -name '*-gdb.py') ; do
 		local multidir=${py%/*}
 		insinto "${gdbdir}/${multidir}"
@@ -1849,8 +1854,8 @@ gcc_movelibs() {
 	# that you want to link against when building tools rather than building
 	# code to run on the target.
 	if tc_version_is_at_least 5 && is_crosscompile ; then
-		dodir "${HOSTLIBPATH}"
-		mv "${D}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
+		dodir "${HOSTLIBPATH#${EPREFIX}}"
+		mv "${ED}"usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
 	fi
 
 	# For all the libs that are built for CTARGET, move them into the
@@ -1862,16 +1867,16 @@ gcc_movelibs() {
 
 		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
 		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
-		local TODIR=${D}${LIBPATH}/${MULTIDIR}
+		local TODIR="${D}${LIBPATH}"/${MULTIDIR}
 		local FROMDIR=
 
 		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
 
 		for FROMDIR in \
-			${LIBPATH}/${OS_MULTIDIR} \
-			${LIBPATH}/../${MULTIDIR} \
-			${PREFIX}/lib/${OS_MULTIDIR} \
-			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
+			"${LIBPATH}"/${OS_MULTIDIR} \
+			"${LIBPATH}"/../${MULTIDIR} \
+			"${PREFIX}"/lib/${OS_MULTIDIR} \
+			"${PREFIX}"/${CTARGET}/lib/${OS_MULTIDIR}
 		do
 			removedirs="${removedirs} ${FROMDIR}"
 			FROMDIR=${D}${FROMDIR}
@@ -1935,7 +1940,7 @@ create_gcc_env_entry() {
 	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
 
 	local gcc_specs_file
-	local gcc_envd_file="${D}${gcc_envd_base}"
+	local gcc_envd_file="${ED}${gcc_envd_base}"
 	if [[ -z $1 ]] ; then
 		# I'm leaving the following commented out to remind me that it
 		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
@@ -1999,7 +2004,7 @@ copy_minispecs_gcc_specs() {
 		create_gcc_env_entry hardenednossp
 	fi
 	create_gcc_env_entry vanilla
-	insinto ${LIBPATH}
+	insinto ${LIBPATH#${EPREFIX}}
 	doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
 	# Build system specs file which, if it exists, must be a complete set of
 	# specs as it completely and unconditionally overrides the builtin specs.
@@ -2014,32 +2019,32 @@ gcc_slot_java() {
 	local x
 
 	# Move Java headers to compiler-specific dir
-	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
-		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
+	for x in "${D}${PREFIX}"/include/gc*.h "${D}${PREFIX}"/include/j*.h ; do
+		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/include/
 	done
 	for x in gcj gnu java javax org ; do
 		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
-			dodir /${LIBPATH}/include/${x}
-			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
-			rm -rf "${D}"${PREFIX}/include/${x}
+			dodir /${LIBPATH#${EPREFIX}}/include/${x}
+			mv -f "${D}${PREFIX}"/include/${x}/* "${D}${LIBPATH}"/include/${x}/
+			rm -rf "${D}${PREFIX}"/include/${x}
 		fi
 	done
 
 	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
-		dodir /${LIBPATH}/security
-		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
-		rm -rf "${D}"${PREFIX}/lib*/security
+		dodir /${LIBPATH#${EPREFIX}}/security
+		mv -f "${D}${PREFIX}"/lib*/security/* "${D}${LIBPATH}"/security
+		rm -rf "${D}${PREFIX}"/lib*/security
 	fi
 
 	# Move random gcj files to compiler-specific directories
 	for x in libgcj.spec logging.properties ; do
 		x="${D}${PREFIX}/lib/${x}"
-		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
+		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/
 	done
 
 	# Rename jar because it could clash with Kaffe's jar if this gcc is
 	# primary compiler (aka don't have the -<version> extension)
-	cd "${D}"${BINPATH}
+	cd "${D}${BINPATH}"
 	[[ -f jar ]] && mv -f jar gcj-jar
 }
 
@@ -2059,16 +2064,17 @@ toolchain_pkg_postinst() {
 		echo
 
 		# Clean up old paths
-		rm -f "${ROOT}"/*/rcscripts/awk/fixlafiles.awk "${ROOT}"/sbin/fix_libtool_files.sh
-		rmdir "${ROOT}"/*/rcscripts{/awk,} 2>/dev/null
+		rm -f "${EROOT}"*/rcscripts/awk/fixlafiles.awk "${EROOT}"sbin/fix_libtool_files.sh
+		rmdir "${EROOT}"*/rcscripts{/awk,} 2>/dev/null
 
-		mkdir -p "${ROOT}"/usr/{share/gcc-data,sbin,bin}
-		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/usr/share/gcc-data/ || die
-		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/usr/sbin/ || die
+		mkdir -p "${EROOT}"usr/{share/gcc-data,sbin,bin}
+		# DATAPATH has EPREFIX already, use ROOT with it
+		cp "${ROOT}${DATAPATH}"/fixlafiles.awk "${EROOT}"usr/share/gcc-data/ || die
+		cp "${ROOT}${DATAPATH}"/fix_libtool_files.sh "${EROOT}"usr/sbin/ || die
 
 		# Since these aren't critical files and portage sucks with
 		# handling of binpkgs, don't require these to be found
-		cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
+		cp "${ROOT}${DATAPATH}"/c{89,99} "${EROOT}"usr/bin/ 2>/dev/null
 	fi
 
 	if use regression-test ; then
@@ -2091,10 +2097,10 @@ toolchain_pkg_postrm() {
 
 	# clean up the cruft left behind by cross-compilers
 	if is_crosscompile ; then
-		if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
-			rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
-			rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
-			rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+		if [[ -z $(ls "${EROOT}"etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+			rm -f "${EROOT}"etc/env.d/gcc/config-${CTARGET}
+			rm -f "${EROOT}"etc/env.d/??gcc-${CTARGET}
+			rm -f "${EROOT}"usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
 		fi
 		return 0
 	fi
@@ -2107,10 +2113,10 @@ toolchain_pkg_postrm() {
 		do_gcc_config
 
 		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
-		/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
+		fix_libtool_files.sh ${GCC_RELEASE_VER}
 		if [[ -n ${BRANCH_UPDATE} ]] ; then
 			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
-			/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
+			fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
 		fi
 	fi
 
@@ -2119,13 +2125,13 @@ toolchain_pkg_postrm() {
 
 do_gcc_config() {
 	if ! should_we_gcc_config ; then
-		env -i ROOT="${ROOT}" gcc-config --use-old --force
+		env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config --use-old --force
 		return 0
 	fi
 
 	local current_gcc_config target
 
-	current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
+	current_gcc_config=$(env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
 	if [[ -n ${current_gcc_config} ]] ; then
 		local current_specs use_specs
 		# figure out which specs-specific config is active
@@ -2159,12 +2165,12 @@ should_we_gcc_config() {
 	# if the current config is invalid, we definitely want a new one
 	# Note: due to bash quirkiness, the following must not be 1 line
 	local curr_config
-	curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
+	curr_config=$(env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
 
 	# if the previously selected config has the same major.minor (branch) as
 	# the version we are installing, then it will probably be uninstalled
 	# for being in the same SLOT, make sure we run gcc-config.
-	local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
+	local curr_config_ver=$(env -i PATH="${PATH}" ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
 
 	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
 

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

* Re: [gentoo-dev] RFC: toolchain.eclass prefix support
  2017-01-07 15:07 [gentoo-dev] RFC: toolchain.eclass prefix support Benda Xu
@ 2017-01-07 15:23 ` James Le Cuirot
  2017-01-07 15:25   ` Benda Xu
  2017-01-07 15:40 ` Mike Gilbert
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
  2 siblings, 1 reply; 15+ messages in thread
From: James Le Cuirot @ 2017-01-07 15:23 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]

On Sun, 08 Jan 2017 00:07:05 +0900
Benda Xu <heroxbd@gentoo.org> wrote:

>   * Define ED and EROOT for EAPI 0, 1 and 2.

Why? All the ebuilds using this eclass that I can find are at least
EAPI 4.

-- 
James Le Cuirot (chewi)
Gentoo Linux Developer

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

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

* Re: [gentoo-dev] RFC: toolchain.eclass prefix support
  2017-01-07 15:23 ` James Le Cuirot
@ 2017-01-07 15:25   ` Benda Xu
  2017-01-07 15:37     ` David Seifert
  0 siblings, 1 reply; 15+ messages in thread
From: Benda Xu @ 2017-01-07 15:25 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 159 bytes --]

James Le Cuirot <chewi@gentoo.org> writes:

> Why? All the ebuilds using this eclass that I can find are at least
> EAPI 4.

Okay!  I will remove this.

Benda

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: [gentoo-dev] RFC: toolchain.eclass prefix support
  2017-01-07 15:25   ` Benda Xu
@ 2017-01-07 15:37     ` David Seifert
  0 siblings, 0 replies; 15+ messages in thread
From: David Seifert @ 2017-01-07 15:37 UTC (permalink / raw
  To: gentoo-dev

On Sun, 2017-01-08 at 00:25 +0900, Benda Xu wrote:
> James Le Cuirot <chewi@gentoo.org> writes:
> 
> > Why? All the ebuilds using this eclass that I can find are at least
> > EAPI 4.
> 
> Okay!  I will remove this.
> 
> Benda

https://qa-reports.gentoo.org/output/eapi-per-eclass/toolchain.eclass/S
TATS.txt

Chewi seems right, no use in defining them.


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

* Re: [gentoo-dev] RFC: toolchain.eclass prefix support
  2017-01-07 15:07 [gentoo-dev] RFC: toolchain.eclass prefix support Benda Xu
  2017-01-07 15:23 ` James Le Cuirot
@ 2017-01-07 15:40 ` Mike Gilbert
  2017-01-08  5:01   ` [gentoo-dev] " Benda Xu
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
  2 siblings, 1 reply; 15+ messages in thread
From: Mike Gilbert @ 2017-01-07 15:40 UTC (permalink / raw
  To: Gentoo Dev

On Sat, Jan 7, 2017 at 10:07 AM, Benda Xu <heroxbd@gentoo.org> wrote:
> Hi,
>
> Please help me review the patch attached.

Please send patches for review with the content as the email body. See
git format-patch and git send-email.

> This patch has 5 main kinds of modifications to the eclass,
>
>   * Define ED and EROOT for EAPI 0, 1 and 2.
>   * Add ${EPREFIX} to ${PREFIX} and quote the variables.
>   * Strip ${EPREFIX} if used with a ebuild helper.
>   * call fix_libtool_files.sh by name, because /usr/sbin is in PATH,
>     and no need to write as ${EPREFIX}/usr/sbin/fix_libtool_files.sh
>   * Preserve PATH when calling gcc-config.

You should split these changes into separate patches, each with it's
own meaningful commit message.

Regarding the PATH/gcc-config change, I'm thinking it would make more
sense to drop the env -i command than to add to he list of special
variables we pass through to it.


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

* [gentoo-dev] Re: RFC: toolchain.eclass prefix support
  2017-01-07 15:40 ` Mike Gilbert
@ 2017-01-08  5:01   ` Benda Xu
  0 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:01 UTC (permalink / raw
  To: gentoo-dev

Mike Gilbert <floppym@gentoo.org> writes:

> Regarding the PATH/gcc-config change, I'm thinking it would make more
> sense to drop the env -i command than to add to he list of special
> variables we pass through to it.

All the env -i has been introduced in this commit by vapier in 2005:

  https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/?id=a8a64d1886cc5c9f975353b97237f2900a3ee88c

"clean up/simplify the gcc-config and fix_libtool_files logic". The
reasonale was "clean-up".


"ROOT=${ROOT}" was added in 2007 by vapier,

  https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/?id=7d9f89700a2ee50674c0d871ec6d21b468ac6206

"cleanup gcc-config logic so that it doesnt matter what the ROOT value
is". The reasonale was "cleanup gcc-config logic"


So, from the two historical commits, it is safe to drop env -i without
breaking anything sacred.

Benda


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

* [gentoo-dev] [PATCH 0/7] RFC1: toolchain.eclass prefix support
  2017-01-07 15:07 [gentoo-dev] RFC: toolchain.eclass prefix support Benda Xu
  2017-01-07 15:23 ` James Le Cuirot
  2017-01-07 15:40 ` Mike Gilbert
@ 2017-01-08  5:44 ` Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 1/7] toolchain.eclass: Call fix_libtool_files.sh by name Benda Xu
                     ` (7 more replies)
  2 siblings, 8 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

Hi,

This patch series is splitted from the previous one

  https://archives.gentoo.org/gentoo-dev/message/8a7ac352cb047567309c70aaf7105305

Note that the splitting is not perfect when different kinds
of updates happen in adjacent lines.

Please review.

Benda

Benda Xu (7):
  toolchain.eclass: Call fix_libtool_files.sh by name
  toolchain.eclass: drop env -i from gcc-config calls.
  toolchain.eclass: D->ED ROOT->EROOT replacements.
  toolchain.eclass: prefixify helper scripts.
  toolchain.eclass: Prepend/strip EPREFIX.
  toolchain.eclass: Quote variables containing EPREFIX.
  toolchain.eclass: remove trailing slash of D.

 eclass/toolchain.eclass | 109 ++++++++++++++++++++++++------------------------
 1 file changed, 55 insertions(+), 54 deletions(-)

-- 
2.8.3



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

* [gentoo-dev] [PATCH 1/7] toolchain.eclass: Call fix_libtool_files.sh by name
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
@ 2017-01-08  5:44   ` Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 2/7] toolchain.eclass: drop env -i from gcc-config calls Benda Xu
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

  /usr/sbin is in PATH, avoid writing
  ${EPREFIX}/usr/sbin/fix_libtool_files.sh.
---
 eclass/toolchain.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 55249b0..ef932d2 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2107,10 +2107,10 @@ toolchain_pkg_postrm() {
 		do_gcc_config
 
 		einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
-		/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}
+		fix_libtool_files.sh ${GCC_RELEASE_VER}
 		if [[ -n ${BRANCH_UPDATE} ]] ; then
 			einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
-			/usr/sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
+			fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
 		fi
 	fi
 
-- 
2.8.3



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

* [gentoo-dev] [PATCH 2/7] toolchain.eclass: drop env -i from gcc-config calls.
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 1/7] toolchain.eclass: Call fix_libtool_files.sh by name Benda Xu
@ 2017-01-08  5:44   ` Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 3/7] toolchain.eclass: D->ED ROOT->EROOT replacements Benda Xu
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

  In Prefix, PATH should also be preserved, resulting in a mouthful of
  `env -i PATH=${PATH} ROOT=${ROOT}`.  The origin commit introducing
  env -i was for "cleanup".  Dropping env -i is cleaner.

Reference: https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/?id=a8a64d1886cc5c9f975353b97237f2900a3ee88c
Reference: https://gitweb.gentoo.org/repo/gentoo/historical.git/commit/?id=7d9f89700a2ee50674c0d871ec6d21b468ac6206
---
 eclass/toolchain.eclass | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index ef932d2..8e04864 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2119,13 +2119,13 @@ toolchain_pkg_postrm() {
 
 do_gcc_config() {
 	if ! should_we_gcc_config ; then
-		env -i ROOT="${ROOT}" gcc-config --use-old --force
+		gcc-config --use-old --force
 		return 0
 	fi
 
 	local current_gcc_config target
 
-	current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null)
+	current_gcc_config=$(gcc-config -c ${CTARGET} 2>/dev/null)
 	if [[ -n ${current_gcc_config} ]] ; then
 		local current_specs use_specs
 		# figure out which specs-specific config is active
@@ -2159,12 +2159,12 @@ should_we_gcc_config() {
 	# if the current config is invalid, we definitely want a new one
 	# Note: due to bash quirkiness, the following must not be 1 line
 	local curr_config
-	curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0
+	curr_config=$(gcc-config -c ${CTARGET} 2>&1) || return 0
 
 	# if the previously selected config has the same major.minor (branch) as
 	# the version we are installing, then it will probably be uninstalled
 	# for being in the same SLOT, make sure we run gcc-config.
-	local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}')
+	local curr_config_ver=$(gcc-config -S ${curr_config} | awk '{print $2}')
 
 	local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
 
-- 
2.8.3



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

* [gentoo-dev] [PATCH 3/7] toolchain.eclass: D->ED ROOT->EROOT replacements.
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 1/7] toolchain.eclass: Call fix_libtool_files.sh by name Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 2/7] toolchain.eclass: drop env -i from gcc-config calls Benda Xu
@ 2017-01-08  5:44   ` Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 4/7] toolchain.eclass: prefixify helper scripts Benda Xu
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

  Directory prefixify part 1.

  In addition, E/D and E/ROOT has trailing slashes. No need to write
  an additional slash.
---
 eclass/toolchain.eclass | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 8e04864..40759f5 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1735,7 +1735,7 @@ toolchain_src_install() {
 
 	cd "${S}"
 	if is_crosscompile; then
-		rm -rf "${D}"/usr/share/{man,info}
+		rm -rf "${ED}"usr/share/{man,info}
 		rm -rf "${D}"${DATAPATH}/{man,info}
 	else
 		if tc_version_is_at_least 3.0 ; then
@@ -1849,8 +1849,8 @@ gcc_movelibs() {
 	# that you want to link against when building tools rather than building
 	# code to run on the target.
 	if tc_version_is_at_least 5 && is_crosscompile ; then
-		dodir "${HOSTLIBPATH}"
-		mv "${D}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
+		dodir "${HOSTLIBPATH#${EPREFIX}}"
+		mv "${ED}"usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
 	fi
 
 	# For all the libs that are built for CTARGET, move them into the
@@ -1935,7 +1935,7 @@ create_gcc_env_entry() {
 	local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
 
 	local gcc_specs_file
-	local gcc_envd_file="${D}${gcc_envd_base}"
+	local gcc_envd_file="${ED}${gcc_envd_base}"
 	if [[ -z $1 ]] ; then
 		# I'm leaving the following commented out to remind me that it
 		# was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
@@ -2059,16 +2059,17 @@ toolchain_pkg_postinst() {
 		echo
 
 		# Clean up old paths
-		rm -f "${ROOT}"/*/rcscripts/awk/fixlafiles.awk "${ROOT}"/sbin/fix_libtool_files.sh
-		rmdir "${ROOT}"/*/rcscripts{/awk,} 2>/dev/null
+		rm -f "${EROOT}"*/rcscripts/awk/fixlafiles.awk "${EROOT}"sbin/fix_libtool_files.sh
+		rmdir "${EROOT}"*/rcscripts{/awk,} 2>/dev/null
 
-		mkdir -p "${ROOT}"/usr/{share/gcc-data,sbin,bin}
-		cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/usr/share/gcc-data/ || die
-		cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/usr/sbin/ || die
+		mkdir -p "${EROOT}"usr/{share/gcc-data,sbin,bin}
+		# DATAPATH has EPREFIX already, use ROOT with it
+		cp "${ROOT}${DATAPATH}"/fixlafiles.awk "${EROOT}"usr/share/gcc-data/ || die
+		cp "${ROOT}${DATAPATH}"/fix_libtool_files.sh "${EROOT}"usr/sbin/ || die
 
 		# Since these aren't critical files and portage sucks with
 		# handling of binpkgs, don't require these to be found
-		cp "${ROOT}/${DATAPATH}"/c{89,99} "${ROOT}"/usr/bin/ 2>/dev/null
+		cp "${ROOT}${DATAPATH}"/c{89,99} "${EROOT}"usr/bin/ 2>/dev/null
 	fi
 
 	if use regression-test ; then
@@ -2091,10 +2092,10 @@ toolchain_pkg_postrm() {
 
 	# clean up the cruft left behind by cross-compilers
 	if is_crosscompile ; then
-		if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
-			rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET}
-			rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET}
-			rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+		if [[ -z $(ls "${EROOT}"etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+			rm -f "${EROOT}"etc/env.d/gcc/config-${CTARGET}
+			rm -f "${EROOT}"etc/env.d/??gcc-${CTARGET}
+			rm -f "${EROOT}"usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
 		fi
 		return 0
 	fi
-- 
2.8.3



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

* [gentoo-dev] [PATCH 4/7] toolchain.eclass: prefixify helper scripts.
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
                     ` (2 preceding siblings ...)
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 3/7] toolchain.eclass: D->ED ROOT->EROOT replacements Benda Xu
@ 2017-01-08  5:44   ` Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 5/7] toolchain.eclass: Prepend/strip EPREFIX Benda Xu
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

  Directory prefixify part 2.
---
 eclass/toolchain.eclass | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 40759f5..17950c1 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -8,7 +8,7 @@ DESCRIPTION="The GNU Compiler Collection"
 HOMEPAGE="https://gcc.gnu.org/"
 RESTRICT="strip" # cross-compilers need controlled stripping
 
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator
+inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator prefix
 
 if [[ ${PV} == *_pre9999* ]] ; then
 	EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
@@ -1764,10 +1764,10 @@ toolchain_src_install() {
 	# Rather install the script, else portage with changing $FILESDIR
 	# between binary and source package borks things ....
 	if ! is_crosscompile ; then
-		insinto "${DATAPATH}"
-		newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
-		exeinto "${DATAPATH}"
-		doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
+		insinto "${DATAPATH#${EPREFIX}}"
+		newins "$(prefixify_ro "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
+		exeinto "${DATAPATH#${EPREFIX}}"
+		doexe "$(prefixify_ro "${GCC_FILESDIR}"/fix_libtool_files.sh)" || die
 		doexe "${GCC_FILESDIR}"/c{89,99} || die
 	fi
 
-- 
2.8.3



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

* [gentoo-dev] [PATCH 5/7] toolchain.eclass: Prepend/strip EPREFIX.
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
                     ` (3 preceding siblings ...)
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 4/7] toolchain.eclass: prefixify helper scripts Benda Xu
@ 2017-01-08  5:44   ` Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 6/7] toolchain.eclass: Quote variables containing EPREFIX Benda Xu
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

  Directory prefixify part 3.

  Raw directories are prepended by EPREFIX. Directories passed to
  ebuild helpers are EPREFIX stripped.
---
 eclass/toolchain.eclass | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 17950c1..f54316c 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -93,7 +93,7 @@ fi
 
 export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
 
-PREFIX=${TOOLCHAIN_PREFIX:-/usr}
+PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
 
 if tc_version_is_at_least 3.4.0 ; then
 	LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
@@ -1267,7 +1267,7 @@ toolchain_src_configure() {
 	echo "${S}"/configure "${confgcc[@]}"
 	# Older gcc versions did not detect bash and re-exec itself, so force the
 	# use of bash.  Newer ones will auto-detect, but this is not harmeful.
-	CONFIG_SHELL="/bin/bash" \
+	CONFIG_SHELL="${EPREFIX}/bin/bash" \
 	bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
 
 	# return to whatever directory we were in before
@@ -1703,11 +1703,11 @@ toolchain_src_install() {
 		if [[ -f ${CTARGET}-${x} ]] ; then
 			if ! is_crosscompile ; then
 				ln -sf ${CTARGET}-${x} ${x}
-				dosym ${BINPATH}/${CTARGET}-${x} \
+				dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
 					/usr/bin/${x}-${GCC_CONFIG_VER}
 			fi
 			# Create versioned symlinks
-			dosym ${BINPATH}/${CTARGET}-${x} \
+			dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
 				/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
 		fi
 
@@ -1745,11 +1745,11 @@ toolchain_src_install() {
 			fi
 		fi
 		has noinfo ${FEATURES} \
-			&& rm -r "${D}/${DATAPATH}"/info \
-			|| prepinfo "${DATAPATH}"
+			&& rm -r "${D}${DATAPATH}"/info \
+			|| prepinfo "${DATAPATH#${EPREFIX}}"
 		has noman ${FEATURES} \
-			&& rm -r "${D}/${DATAPATH}"/man \
-			|| prepman "${DATAPATH}"
+			&& rm -r "${D}${DATAPATH}"/man \
+			|| prepman "${DATAPATH#${EPREFIX}}"
 	fi
 	# prune empty dirs left behind
 	find "${D}" -depth -type d -delete 2>/dev/null
@@ -1999,7 +1999,7 @@ copy_minispecs_gcc_specs() {
 		create_gcc_env_entry hardenednossp
 	fi
 	create_gcc_env_entry vanilla
-	insinto ${LIBPATH}
+	insinto ${LIBPATH#${EPREFIX}}
 	doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
 	# Build system specs file which, if it exists, must be a complete set of
 	# specs as it completely and unconditionally overrides the builtin specs.
@@ -2014,21 +2014,21 @@ gcc_slot_java() {
 	local x
 
 	# Move Java headers to compiler-specific dir
-	for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
-		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
+	for x in "${D}${PREFIX}"/include/gc*.h "${D}${PREFIX}"/include/j*.h ; do
+		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/include/
 	done
 	for x in gcj gnu java javax org ; do
 		if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
-			dodir /${LIBPATH}/include/${x}
-			mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
-			rm -rf "${D}"${PREFIX}/include/${x}
+			dodir /${LIBPATH#${EPREFIX}}/include/${x}
+			mv -f "${D}${PREFIX}"/include/${x}/* "${D}${LIBPATH}"/include/${x}/
+			rm -rf "${D}${PREFIX}"/include/${x}
 		fi
 	done
 
 	if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
-		dodir /${LIBPATH}/security
-		mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
-		rm -rf "${D}"${PREFIX}/lib*/security
+		dodir /${LIBPATH#${EPREFIX}}/security
+		mv -f "${D}${PREFIX}"/lib*/security/* "${D}${LIBPATH}"/security
+		rm -rf "${D}${PREFIX}"/lib*/security
 	fi
 
 	# Move random gcj files to compiler-specific directories
-- 
2.8.3



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

* [gentoo-dev] [PATCH 6/7] toolchain.eclass: Quote variables containing EPREFIX.
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
                     ` (4 preceding siblings ...)
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 5/7] toolchain.eclass: Prepend/strip EPREFIX Benda Xu
@ 2017-01-08  5:44   ` Benda Xu
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 7/7] toolchain.eclass: remove trailing slash of D Benda Xu
  2017-01-09 16:19   ` [gentoo-dev] [PATCH 0/7] RFC1: toolchain.eclass prefix support Mike Gilbert
  7 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

  Directory prefixify part 4.

  LIBPATH, etc. now have EPREFIX prepended.  The latter need to be
  quoted.
---
 eclass/toolchain.eclass | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index f54316c..941e37b 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -983,10 +983,10 @@ toolchain_src_configure() {
 			elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
 				confgcc+=(
 					"${confgcc_no_libc[@]}"
-					--with-sysroot=${PREFIX}/${CTARGET}
+					--with-sysroot="${PREFIX}"/${CTARGET}
 				)
 			else
-				confgcc+=( --with-sysroot=${PREFIX}/${CTARGET} )
+				confgcc+=( --with-sysroot="${PREFIX}"/${CTARGET} )
 			fi
 		fi
 
@@ -1812,11 +1812,11 @@ toolchain_src_install() {
 	# Use gid of 0 because some stupid ports don't have
 	# the group 'root' set to gid 0.  Send to /dev/null
 	# for people who are testing as non-root.
-	chown -R root:0 "${D}"${LIBPATH} 2>/dev/null
+	chown -R root:0 "${D}${LIBPATH}" 2>/dev/null
 
 	# Move pretty-printers to gdb datadir to shut ldconfig up
 	local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
-	pushd "${D}"${LIBPATH} >/dev/null
+	pushd "${D}${LIBPATH}" >/dev/null
 	for py in $(find . -name '*-gdb.py') ; do
 		local multidir=${py%/*}
 		insinto "${gdbdir}/${multidir}"
@@ -1862,16 +1862,16 @@ gcc_movelibs() {
 
 		local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
 		local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
-		local TODIR=${D}${LIBPATH}/${MULTIDIR}
+		local TODIR="${D}${LIBPATH}"/${MULTIDIR}
 		local FROMDIR=
 
 		[[ -d ${TODIR} ]] || mkdir -p ${TODIR}
 
 		for FROMDIR in \
-			${LIBPATH}/${OS_MULTIDIR} \
-			${LIBPATH}/../${MULTIDIR} \
-			${PREFIX}/lib/${OS_MULTIDIR} \
-			${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
+			"${LIBPATH}"/${OS_MULTIDIR} \
+			"${LIBPATH}"/../${MULTIDIR} \
+			"${PREFIX}"/lib/${OS_MULTIDIR} \
+			"${PREFIX}"/${CTARGET}/lib/${OS_MULTIDIR}
 		do
 			removedirs="${removedirs} ${FROMDIR}"
 			FROMDIR=${D}${FROMDIR}
@@ -2034,12 +2034,12 @@ gcc_slot_java() {
 	# Move random gcj files to compiler-specific directories
 	for x in libgcj.spec logging.properties ; do
 		x="${D}${PREFIX}/lib/${x}"
-		[[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
+		[[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/
 	done
 
 	# Rename jar because it could clash with Kaffe's jar if this gcc is
 	# primary compiler (aka don't have the -<version> extension)
-	cd "${D}"${BINPATH}
+	cd "${D}${BINPATH}"
 	[[ -f jar ]] && mv -f jar gcj-jar
 }
 
-- 
2.8.3



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

* [gentoo-dev] [PATCH 7/7] toolchain.eclass: remove trailing slash of D.
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
                     ` (5 preceding siblings ...)
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 6/7] toolchain.eclass: Quote variables containing EPREFIX Benda Xu
@ 2017-01-08  5:44   ` Benda Xu
  2017-01-09 16:19   ` [gentoo-dev] [PATCH 0/7] RFC1: toolchain.eclass prefix support Mike Gilbert
  7 siblings, 0 replies; 15+ messages in thread
From: Benda Xu @ 2017-01-08  5:44 UTC (permalink / raw
  To: gentoo-dev; +Cc: Benda Xu

---
 eclass/toolchain.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 941e37b..0d8148f 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1727,7 +1727,7 @@ toolchain_src_install() {
 	# Now do the fun stripping stuff
 	env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
 	is_crosscompile && \
-		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}/${HOSTLIBPATH}"
+		env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${HOSTLIBPATH}"
 	env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
 	# gcc used to install helper binaries in lib/ but then moved to libexec/
 	[[ -d ${D}${PREFIX}/libexec/gcc ]] && \
-- 
2.8.3



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

* Re: [gentoo-dev] [PATCH 0/7] RFC1: toolchain.eclass prefix support
  2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
                     ` (6 preceding siblings ...)
  2017-01-08  5:44   ` [gentoo-dev] [PATCH 7/7] toolchain.eclass: remove trailing slash of D Benda Xu
@ 2017-01-09 16:19   ` Mike Gilbert
  7 siblings, 0 replies; 15+ messages in thread
From: Mike Gilbert @ 2017-01-09 16:19 UTC (permalink / raw
  To: Gentoo Dev; +Cc: Benda Xu

On Sun, Jan 8, 2017 at 12:44 AM, Benda Xu <heroxbd@gentoo.org> wrote:
> Hi,
>
> This patch series is splitted from the previous one
>
>   https://archives.gentoo.org/gentoo-dev/message/8a7ac352cb047567309c70aaf7105305
>
> Note that the splitting is not perfect when different kinds
> of updates happen in adjacent lines.
>
> Please review.

I applied this series locally, and re-built two cross compilers and a
native compiler. I have not noticed any problems.

I have not tested with EPREFX != "", but I assume you have that covered.


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

end of thread, other threads:[~2017-01-09 16:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-07 15:07 [gentoo-dev] RFC: toolchain.eclass prefix support Benda Xu
2017-01-07 15:23 ` James Le Cuirot
2017-01-07 15:25   ` Benda Xu
2017-01-07 15:37     ` David Seifert
2017-01-07 15:40 ` Mike Gilbert
2017-01-08  5:01   ` [gentoo-dev] " Benda Xu
2017-01-08  5:44 ` [gentoo-dev] [PATCH 0/7] RFC1: " Benda Xu
2017-01-08  5:44   ` [gentoo-dev] [PATCH 1/7] toolchain.eclass: Call fix_libtool_files.sh by name Benda Xu
2017-01-08  5:44   ` [gentoo-dev] [PATCH 2/7] toolchain.eclass: drop env -i from gcc-config calls Benda Xu
2017-01-08  5:44   ` [gentoo-dev] [PATCH 3/7] toolchain.eclass: D->ED ROOT->EROOT replacements Benda Xu
2017-01-08  5:44   ` [gentoo-dev] [PATCH 4/7] toolchain.eclass: prefixify helper scripts Benda Xu
2017-01-08  5:44   ` [gentoo-dev] [PATCH 5/7] toolchain.eclass: Prepend/strip EPREFIX Benda Xu
2017-01-08  5:44   ` [gentoo-dev] [PATCH 6/7] toolchain.eclass: Quote variables containing EPREFIX Benda Xu
2017-01-08  5:44   ` [gentoo-dev] [PATCH 7/7] toolchain.eclass: remove trailing slash of D Benda Xu
2017-01-09 16:19   ` [gentoo-dev] [PATCH 0/7] RFC1: toolchain.eclass prefix support Mike Gilbert

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