public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-03-25 14:19 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-03-25 14:19 UTC (permalink / raw
  To: gentoo-commits

commit:     84b9f582e8c8db69a3b3677de702c7cc00ac3dab
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 20 09:35:34 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 25 14:18:51 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84b9f582

app-portage/prefix-toolkit: new package

* For any Gentoo Prefix, provides the 'startprefix' script, and should
provide some 'runprefix' script later on, as inspired in
Bug: https://bugs.gentoo.org/673816

* For base Gentoo Prefix (as in "not stacked"), provides the
'prefix-stack-setup' script, superseding app-portage/prefix-chain-setup,
does force the prefix-stack implit USE flag in the stacked Prefix.
* For stacked Gentoo Prefix (set up using 'prefix-stack-setup'),
provides the toolchain wrapper, superseding sys-apps/prefix-chain-utils.
Bug: https://bugs.gentoo.org/658572

Closes: https://bugs.gentoo.org/509142
Package-Manager: Portage-2.3.51, Repoman-2.3.11
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/metadata.xml            |   8 +
 app-portage/prefix-toolkit/prefix-toolkit-0.ebuild | 565 +++++++++++++++++++++
 2 files changed, 573 insertions(+)

diff --git a/app-portage/prefix-toolkit/metadata.xml b/app-portage/prefix-toolkit/metadata.xml
new file mode 100644
index 00000000000..d33cce94b0d
--- /dev/null
+++ b/app-portage/prefix-toolkit/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+	<email>prefix@gentoo.org</email>
+	<name>Gentoo Prefix</name>
+</maintainer>
+</pkgmetadata>

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
new file mode 100644
index 00000000000..23f48453f6e
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
@@ -0,0 +1,565 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~x86-winnt"
+
+DEPEND=""
+RDEPEND="
+	>sys-apps/portage-2.3.62
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*)	CHILD_EPREFIX="${arg#--eprefix=}"	;;
+	--profile=*)	CHILD_PROFILE="${arg#--profile=}"	;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# The following values where taken from the parent prefix's"
+	echo "# environment. Feel free to adopt them as you like."
+	echo "#"
+	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
+	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+#	# this -pv is there to avoid the global update output, which is
+#	# there on the first emerge run. (thus, just cosmetics).
+#	emerge --pretend --oneshot --nodeps baselayout-prefix
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# Record the prefix-toolkit into @world file, as it provides the
+	# env.d telling the PM to manage this stacked Prefix, but may not
+	# (unlike baselayout) be part of @system set per the profile.
+	emerge --verbose --nodeps \
+		prefix-toolkit
+
+	emerge --verbose --nodeps --oneshot \
+		gentoo-functions \
+		elt-patches \
+		gnuconfig \
+		gcc-config
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+
+	# do this _after_ selecting the correct compiler!
+	emerge --verbose --nodeps --oneshot \
+		libtool
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+# parity (winnt) understands -rpath only ...
+case "${chost}" in
+*-winnt*) rpath_opt="-Wl,-rpath," ;;
+*) rpath_opt="-Wl,-R," ;;
+esac
+
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+pfx_link_r=("${rpath_opt}${prefix}/lib" "${rpath_opt}${prefix}/usr/lib")
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-03-26 15:58 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-03-26 15:58 UTC (permalink / raw
  To: gentoo-commits

commit:     96da0d371a69519b2c9d30c887a8fdbb6776020b
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 26 15:57:01 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue Mar 26 15:58:33 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=96da0d37

app-portage/prefix-toolkit: add keywords where prefix may go

As bootstrap-prefix.sh now does emerge prefix-toolkit, it requires any
keyword wherever Prefix may go - including RAP with non-Prefix keywords.

Package-Manager: Portage-2.3.51, Repoman-2.3.11
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-0.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
index 23f48453f6e..ec2ac9f17b8 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~x86-winnt"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 
 DEPEND=""
 RDEPEND="


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-03-26 16:11 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-03-26 16:11 UTC (permalink / raw
  To: gentoo-commits

commit:     c5d81d96d4c2686650764240950f0d4cbe11d1b5
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 26 16:09:45 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue Mar 26 16:11:05 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5d81d96

app-portage/prefix-toolkit: restore ~x86-winnt keyword

As x86-winnt is stacked prefix only, no portage does have that keyword,
so it was accidentally dropped in last commit.

Package-Manager: Portage-2.3.51, Repoman-2.3.11
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-0.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
index ec2ac9f17b8..ae2ca111bab 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND=""
 RDEPEND="


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-05-21  8:48 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-05-21  8:48 UTC (permalink / raw
  To: gentoo-commits

commit:     f6390b8bb5cea47bb3aef53f9b25dde6e154ada1
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue May 21 08:46:57 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue May 21 08:47:45 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6390b8b

app-portage/prefix-toolkit: BDEPEND on portage, not RDEPEND

Package-Manager: Portage-2.3.62, Repoman-2.3.11
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-1.ebuild | 567 +++++++++++++++++++++
 1 file changed, 567 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild
new file mode 100644
index 00000000000..0b61ff48687
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild
@@ -0,0 +1,567 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+BDEPEND="
+	>sys-apps/portage-2.3.62
+"
+DEPEND=""
+RDEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*)	CHILD_EPREFIX="${arg#--eprefix=}"	;;
+	--profile=*)	CHILD_PROFILE="${arg#--profile=}"	;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# The following values where taken from the parent prefix's"
+	echo "# environment. Feel free to adopt them as you like."
+	echo "#"
+	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
+	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+#	# this -pv is there to avoid the global update output, which is
+#	# there on the first emerge run. (thus, just cosmetics).
+#	emerge --pretend --oneshot --nodeps baselayout-prefix
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# Record the prefix-toolkit into @world file, as it provides the
+	# env.d telling the PM to manage this stacked Prefix, but may not
+	# (unlike baselayout) be part of @system set per the profile.
+	emerge --verbose --nodeps \
+		prefix-toolkit
+
+	emerge --verbose --nodeps --oneshot \
+		gentoo-functions \
+		elt-patches \
+		gnuconfig \
+		gcc-config
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+
+	# do this _after_ selecting the correct compiler!
+	emerge --verbose --nodeps --oneshot \
+		libtool
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+# parity (winnt) understands -rpath only ...
+case "${chost}" in
+*-winnt*) rpath_opt="-Wl,-rpath," ;;
+*) rpath_opt="-Wl,-R," ;;
+esac
+
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+pfx_link_r=("${rpath_opt}${prefix}/lib" "${rpath_opt}${prefix}/usr/lib")
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-06-05 15:39 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-06-05 15:39 UTC (permalink / raw
  To: gentoo-commits

commit:     37ce4db03cdef74a6ae97466405133bcc85c7b60
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  5 15:35:39 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Wed Jun  5 15:37:04 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37ce4db0

app-portage/prefix-toolkit: revbump

* In prefix-stack, maintain @system set independent of profile, as in
explicitly removing everything found per etc/portage/make.profile, but
adding prefix-toolkit, having RDEPENDs for additional @system packages.
* Do not install libtool into prefix-stack any more, packages really
should not use any installed libtool script, but configure their own.
* In prefix-stack toolchain on Linux, use -isystem to avoid warnings
from installed header files.  Remember: This is known to break on AIX.

Package-Manager: Portage-2.3.67-prefix, Repoman-2.3.13
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-2.ebuild | 614 +++++++++++++++++++++
 1 file changed, 614 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild
new file mode 100644
index 00000000000..21c172139b1
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild
@@ -0,0 +1,614 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-apps/gentoo-functions
+		app-portage/elt-patches
+		sys-devel/gnuconfig
+		sys-devel/gcc-config
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*)	CHILD_EPREFIX="${arg#--eprefix=}"	;;
+	--profile=*)	CHILD_PROFILE="${arg#--profile=}"	;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# The following values where taken from the parent prefix's"
+	echo "# environment. Feel free to adopt them as you like."
+	echo "#"
+	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
+	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-06-12 15:32 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-06-12 15:32 UTC (permalink / raw
  To: gentoo-commits

commit:     7c05ed37cfc125aa8c66fc8dd98811a5e8c64414
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 12 15:16:13 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Wed Jun 12 15:32:29 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c05ed37

app-portage/prefix-toolkit(prefix-stack-setup): accept --chost argument

Allow to override the CHOST value for the stacked Prefix.
Require the --chost argument if the profile does not set CHOST.

Package-Manager: Portage-2.3.67-prefix, Repoman-2.3.14
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-3.ebuild | 647 +++++++++++++++++++++
 1 file changed, 647 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild
new file mode 100644
index 00000000000..e4719f87c3a
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild
@@ -0,0 +1,647 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-apps/gentoo-functions
+		app-portage/elt-patches
+		sys-devel/gnuconfig
+		sys-devel/gcc-config
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+CHILD_CHOST=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
+		einfo "                         the profile does not set CHOST, or to override."
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+if [[ -z ${CHILD_CHOST} ]]
+then
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+
+	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+	do
+		if [[ ${profile} == missing ]]
+		then
+		  eerror "profile does not set CHOST, need --chost argument"
+		  exit 1
+		fi
+		[[ -s "${profile}/make.defaults" ]] || continue
+		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
+	done
+fi
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# The following values where taken from the parent prefix's"
+	echo "# environment. Feel free to adopt them as you like."
+	echo "#"
+	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
+	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+	if [[ -n ${CHILD_CHOST} ]] ; then
+		echo "CHOST=\"${CHILD_CHOST}\""
+	fi
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-06-17  9:44 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-06-17  9:44 UTC (permalink / raw
  To: gentoo-commits

commit:     5e3e580aa799fd7849b974179f894fcef2a25d5e
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 17 09:42:57 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Jun 17 09:44:42 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e3e580a

app-portage/prefix-toolkit (prefix-stack-setup): revbump

We do not want to have CBUILD build deps in prefix-stack, but CHOST
build deps only.  Since EAPI 7 there is BDEPEND, but EAPI 6 and older
have both CBUILD and CHOST build deps in DEPEND.  As most CHOST build
deps also are in RDEPEND anyway, we omit EAPI 6 DEPEND from prefix-stack
by setting EMERGE_DEFAULT_OPTS="--root-deps=rdeps" - ignored for EAPI 7.

Package-Manager: Portage-2.3.66, Repoman-2.3.11
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-4.ebuild | 650 +++++++++++++++++++++
 1 file changed, 650 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-4.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-4.ebuild
new file mode 100644
index 00000000000..511787e0f6b
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-4.ebuild
@@ -0,0 +1,650 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-apps/gentoo-functions
+		app-portage/elt-patches
+		sys-devel/gnuconfig
+		sys-devel/gcc-config
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+CHILD_CHOST=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
+		einfo "                         the profile does not set CHOST, or to override."
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+if [[ -z ${CHILD_CHOST} ]]
+then
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+
+	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+	do
+		if [[ ${profile} == missing ]]
+		then
+		  eerror "profile does not set CHOST, need --chost argument"
+		  exit 1
+		fi
+		[[ -s "${profile}/make.defaults" ]] || continue
+		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
+	done
+fi
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# The following values where taken from the parent prefix's"
+	echo "# environment. Feel free to adopt them as you like."
+	echo "#"
+	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
+	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
+	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
+	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
+	if [[ -n ${CHILD_CHOST} ]] ; then
+		echo "CHOST=\"${CHILD_CHOST}\""
+	fi
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-06-25  9:21 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-06-25  9:21 UTC (permalink / raw
  To: gentoo-commits

commit:     028e1033d6b22f0b9d7af5f796d232a912923547
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 25 09:20:34 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue Jun 25 09:21:01 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=028e1033

app-portage/prefix-toolkit: old

Package-Manager: Portage-2.3.66, Repoman-2.3.11
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-0.ebuild | 565 -------------------
 app-portage/prefix-toolkit/prefix-toolkit-1.ebuild | 567 -------------------
 app-portage/prefix-toolkit/prefix-toolkit-2.ebuild | 614 ---------------------
 3 files changed, 1746 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
deleted file mode 100644
index ae2ca111bab..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild
+++ /dev/null
@@ -1,565 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-DEPEND=""
-RDEPEND="
-	>sys-apps/portage-2.3.62
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*)	CHILD_EPREFIX="${arg#--eprefix=}"	;;
-	--profile=*)	CHILD_PROFILE="${arg#--profile=}"	;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# The following values where taken from the parent prefix's"
-	echo "# environment. Feel free to adopt them as you like."
-	echo "#"
-	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
-	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-#	# this -pv is there to avoid the global update output, which is
-#	# there on the first emerge run. (thus, just cosmetics).
-#	emerge --pretend --oneshot --nodeps baselayout-prefix
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# Record the prefix-toolkit into @world file, as it provides the
-	# env.d telling the PM to manage this stacked Prefix, but may not
-	# (unlike baselayout) be part of @system set per the profile.
-	emerge --verbose --nodeps \
-		prefix-toolkit
-
-	emerge --verbose --nodeps --oneshot \
-		gentoo-functions \
-		elt-patches \
-		gnuconfig \
-		gcc-config
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-
-	# do this _after_ selecting the correct compiler!
-	emerge --verbose --nodeps --oneshot \
-		libtool
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-# parity (winnt) understands -rpath only ...
-case "${chost}" in
-*-winnt*) rpath_opt="-Wl,-rpath," ;;
-*) rpath_opt="-Wl,-R," ;;
-esac
-
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-pfx_link_r=("${rpath_opt}${prefix}/lib" "${rpath_opt}${prefix}/usr/lib")
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild
deleted file mode 100644
index 0b61ff48687..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild
+++ /dev/null
@@ -1,567 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-BDEPEND="
-	>sys-apps/portage-2.3.62
-"
-DEPEND=""
-RDEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*)	CHILD_EPREFIX="${arg#--eprefix=}"	;;
-	--profile=*)	CHILD_PROFILE="${arg#--profile=}"	;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# The following values where taken from the parent prefix's"
-	echo "# environment. Feel free to adopt them as you like."
-	echo "#"
-	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
-	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-#	# this -pv is there to avoid the global update output, which is
-#	# there on the first emerge run. (thus, just cosmetics).
-#	emerge --pretend --oneshot --nodeps baselayout-prefix
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# Record the prefix-toolkit into @world file, as it provides the
-	# env.d telling the PM to manage this stacked Prefix, but may not
-	# (unlike baselayout) be part of @system set per the profile.
-	emerge --verbose --nodeps \
-		prefix-toolkit
-
-	emerge --verbose --nodeps --oneshot \
-		gentoo-functions \
-		elt-patches \
-		gnuconfig \
-		gcc-config
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-
-	# do this _after_ selecting the correct compiler!
-	emerge --verbose --nodeps --oneshot \
-		libtool
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-# parity (winnt) understands -rpath only ...
-case "${chost}" in
-*-winnt*) rpath_opt="-Wl,-rpath," ;;
-*) rpath_opt="-Wl,-R," ;;
-esac
-
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-pfx_link_r=("${rpath_opt}${prefix}/lib" "${rpath_opt}${prefix}/usr/lib")
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild
deleted file mode 100644
index 21c172139b1..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild
+++ /dev/null
@@ -1,614 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# See als: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-apps/gentoo-functions
-		app-portage/elt-patches
-		sys-devel/gnuconfig
-		sys-devel/gcc-config
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*)	CHILD_EPREFIX="${arg#--eprefix=}"	;;
-	--profile=*)	CHILD_PROFILE="${arg#--profile=}"	;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# The following values where taken from the parent prefix's"
-	echo "# environment. Feel free to adopt them as you like."
-	echo "#"
-	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
-	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-09-04 10:31 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-09-04 10:31 UTC (permalink / raw
  To: gentoo-commits

commit:     54b026b7d865a5936b16d099da8fabc372d5bd10
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  4 10:27:33 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Wed Sep  4 10:30:45 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=54b026b7

app-portage/prefix-toolkit: revbump

startprefix:
* On Cygwin (assumed when /proc/registry/ is available), also preserve
SYSTEMDRIVE, COMSPEC and TEMP env vars, for native Windows programs.

prefix-stack-setup:
* Give the child prefix a private PORTAGE_TMPDIR, to not lock
PORTAGE_TMPDIR in base prefix when merging in multiple childs.
* Define clean CFLAGS/CXXFLAGS for the child prefix, it may use a
different compiler.  Instead, preserve the base prefix' CFLAGS/CXXFLAGS
via package.env only for packages using the base prefix compiler.

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-5.ebuild | 665 +++++++++++++++++++++
 1 file changed, 665 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild
new file mode 100644
index 00000000000..88068a06a24
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild
@@ -0,0 +1,665 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-apps/gentoo-functions
+		app-portage/elt-patches
+		sys-devel/gnuconfig
+		sys-devel/gcc-config
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+if [[ -d /proc/registry ]]; then # we're on Cygwin
+	# crucial to Windows but cannot be restored, see
+	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
+	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
+	# COMSPEC is to native Windows what SHELL is to *nix
+	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
+	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
+	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
+fi
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+CHILD_CHOST=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
+		einfo "                         the profile does not set CHOST, or to override."
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+if [[ -z ${CHILD_CHOST} ]]
+then
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+
+	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+	do
+		if [[ ${profile} == missing ]]
+		then
+		  eerror "profile does not set CHOST, need --chost argument"
+		  exit 1
+		fi
+		[[ -s "${profile}/make.defaults" ]] || continue
+		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
+	done
+fi
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# These are sane default compiler flags, feel free to adopt them as you like."
+	echo "# Extending the flags is done to respect flags probably set by some profile."
+	echo "#"
+	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
+	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp/portage\""
+	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
+	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
+	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
+	if [[ -n ${CHILD_CHOST} ]] ; then
+		echo "CHOST=\"${CHILD_CHOST}\""
+	fi
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	# Inherited compiler flags from parent prefix,
+	# as the child prefix may have a different compiler.
+	CFLAGS="$(portageq envvar CFLAGS)"
+	CXXFLAGS="$(portageq envvar CXXFLAGS)"
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-09-04 10:31 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-09-04 10:31 UTC (permalink / raw
  To: gentoo-commits

commit:     15412e3fc028c8b6cfc669b5ccb1117a27b12e3e
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  4 10:29:57 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Wed Sep  4 10:30:46 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15412e3f

app-portage/prefix-toolkit: old

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-3.ebuild | 647 ---------------------
 1 file changed, 647 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild
deleted file mode 100644
index e4719f87c3a..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild
+++ /dev/null
@@ -1,647 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# See als: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-apps/gentoo-functions
-		app-portage/elt-patches
-		sys-devel/gnuconfig
-		sys-devel/gcc-config
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-CHILD_CHOST=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
-	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
-	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
-		einfo "                         the profile does not set CHOST, or to override."
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-if [[ -z ${CHILD_CHOST} ]]
-then
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-
-	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
-	do
-		if [[ ${profile} == missing ]]
-		then
-		  eerror "profile does not set CHOST, need --chost argument"
-		  exit 1
-		fi
-		[[ -s "${profile}/make.defaults" ]] || continue
-		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
-	done
-fi
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# The following values where taken from the parent prefix's"
-	echo "# environment. Feel free to adopt them as you like."
-	echo "#"
-	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
-	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-	if [[ -n ${CHILD_CHOST} ]] ; then
-		echo "CHOST=\"${CHILD_CHOST}\""
-	fi
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2019-09-05 10:30 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2019-09-05 10:30 UTC (permalink / raw
  To: gentoo-commits

commit:     4cd61342d847cb65569cf938728b995b8f0c20ca
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Thu Sep  5 10:29:14 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 10:30:01 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cd61342

app-portage/prefix-toolkit: drop /portage from child's PORTAGE_TMPDIR

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-5.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild
index 88068a06a24..62f94528cc1 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild
@@ -455,7 +455,7 @@ ebegin "creating make.conf"
 	echo "EPREFIX=\"${CHILD_EPREFIX}\""
 	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
 	echo "BROOT=\"${PARENT_EPREFIX}\""
-	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp/portage\""
+	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
 	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
 	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
 	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2020-03-09 14:56 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2020-03-09 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     f2795c7e3b35c00c41cfc5a9937c55639a57783a
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  9 14:47:24 2020 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar  9 14:55:27 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2795c7e

app-portage/prefix-toolkit(winnt): pull pthreads4w, intercept -pthread

Some X11 library build system is dumb enough to just use -pthread,
while others do triage this, before trying with -lpthread.  So we
intercept the -pthread compiler flag and add -lpthread instead.
We cannot do that in parity because pthreads4w is installed in the
stacked prefix, where it is built using parity.

Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-6.ebuild | 685 +++++++++++++++++++++
 1 file changed, 685 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-6.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-6.ebuild
new file mode 100644
index 00000000000..a052312b8df
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-6.ebuild
@@ -0,0 +1,685 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-apps/gentoo-functions
+		app-portage/elt-patches
+		sys-devel/gnuconfig
+		sys-devel/gcc-config
+		elibc_Winnt? (
+			dev-libs/pthreads4w
+		)
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+if [[ -d /proc/registry ]]; then # we're on Cygwin
+	# crucial to Windows but cannot be restored, see
+	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
+	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
+	# COMSPEC is to native Windows what SHELL is to *nix
+	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
+	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
+	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
+fi
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+CHILD_CHOST=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
+		einfo "                         the profile does not set CHOST, or to override."
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+if [[ -z ${CHILD_CHOST} ]]
+then
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+
+	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+	do
+		if [[ ${profile} == missing ]]
+		then
+		  eerror "profile does not set CHOST, need --chost argument"
+		  exit 1
+		fi
+		[[ -s "${profile}/make.defaults" ]] || continue
+		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
+	done
+fi
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# These are sane default compiler flags, feel free to adopt them as you like."
+	echo "# Extending the flags is done to respect flags probably set by some profile."
+	echo "#"
+	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
+	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
+	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
+	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
+	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
+	if [[ -n ${CHILD_CHOST} ]] ; then
+		echo "CHOST=\"${CHILD_CHOST}\""
+	fi
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	# Inherited compiler flags from parent prefix,
+	# as the child prefix may have a different compiler.
+	CFLAGS="$(portageq envvar CFLAGS)"
+	CXXFLAGS="$(portageq envvar CXXFLAGS)"
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# get eventual dependencies, add to world
+	emerge --verbose --update --deep \
+		app-portage/prefix-toolkit
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+linkopts=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	if [[ ${chost} == *"-winnt"* ]]; then
+		# We depend on dev-libs/pthreads4w, no?
+		case ${opt} in
+		-pthread | -lpthread)
+			case " ${linkopts[*]} " in
+			*" -lpthread "*) ;;
+			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
+			esac
+			continue
+			;;
+		esac
+	fi
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2020-03-09 14:56 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2020-03-09 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     3f6fc129ad56558e154c0542686160c786bdc0a3
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  9 14:49:21 2020 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar  9 14:55:27 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f6fc129

app-portage/prefix-toolkit: stack: set AT_SYS_M4DIR, run gcc-config

In stacked Prefix, need to set AT_SYS_M4DIR so eautoreconf is able to
find the m4 files from stacked Prefix.
As prefix-toolkit does wrap the compiler found in base prefix to get the
additional system paths in, need to perform gcc-config at pkg_postinst.

Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-7.ebuild | 692 +++++++++++++++++++++
 1 file changed, 692 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-7.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-7.ebuild
new file mode 100644
index 00000000000..f401ec709a4
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-7.ebuild
@@ -0,0 +1,692 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-apps/gentoo-functions
+		app-portage/elt-patches
+		sys-devel/gnuconfig
+		sys-devel/gcc-config
+		elibc_Winnt? (
+			dev-libs/pthreads4w
+		)
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+pkg_postinst() {
+	use prefix-stack || return 0
+	[[ -x ${EROOT}/usr/bin/gcc-config ]] || return 0
+	"${EROOT}"/usr/bin/gcc-config ${CHOST}-${P}
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+if [[ -d /proc/registry ]]; then # we're on Cygwin
+	# crucial to Windows but cannot be restored, see
+	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
+	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
+	# COMSPEC is to native Windows what SHELL is to *nix
+	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
+	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
+	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
+fi
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+AT_SYS_M4DIR@=@"@GENTOO_PORTAGE_EPREFIX@/usr/share/aclocal"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+CHILD_CHOST=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
+		einfo "                         the profile does not set CHOST, or to override."
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+if [[ -z ${CHILD_CHOST} ]]
+then
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+
+	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+	do
+		if [[ ${profile} == missing ]]
+		then
+		  eerror "profile does not set CHOST, need --chost argument"
+		  exit 1
+		fi
+		[[ -s "${profile}/make.defaults" ]] || continue
+		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
+	done
+fi
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# These are sane default compiler flags, feel free to adopt them as you like."
+	echo "# Extending the flags is done to respect flags probably set by some profile."
+	echo "#"
+	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
+	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
+	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
+	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
+	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
+	if [[ -n ${CHILD_CHOST} ]] ; then
+		echo "CHOST=\"${CHILD_CHOST}\""
+	fi
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	# Inherited compiler flags from parent prefix,
+	# as the child prefix may have a different compiler.
+	CFLAGS="$(portageq envvar CFLAGS)"
+	CXXFLAGS="$(portageq envvar CXXFLAGS)"
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# get eventual dependencies, add to world
+	emerge --verbose --update --deep \
+		app-portage/prefix-toolkit
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+linkopts=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	if [[ ${chost} == *"-winnt"* ]]; then
+		# We depend on dev-libs/pthreads4w, no?
+		case ${opt} in
+		-pthread | -lpthread)
+			case " ${linkopts[*]} " in
+			*" -lpthread "*) ;;
+			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
+			esac
+			continue
+			;;
+		esac
+	fi
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2020-03-09 14:56 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2020-03-09 14:56 UTC (permalink / raw
  To: gentoo-commits

commit:     a9fd88abcbb33b8e2b01e056f8a21f59a9a62caf
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar  9 14:52:15 2020 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar  9 14:55:28 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9fd88ab

app-portage/prefix-toolkit: stack: keepdir /usr/share/aclocal

Avoid failing eautoreconf in prefix-stack when no package does install
into (stacked) usr/share/aclocal.

Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-8.ebuild | 693 +++++++++++++++++++++
 1 file changed, 693 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
new file mode 100644
index 00000000000..96f9ee69966
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
@@ -0,0 +1,693 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-apps/gentoo-functions
+		app-portage/elt-patches
+		sys-devel/gnuconfig
+		sys-devel/gcc-config
+		elibc_Winnt? (
+			dev-libs/pthreads4w
+		)
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	my_unpack startprefix
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+		keepdir /usr/share/aclocal
+	else
+		dobin prefix-stack-setup
+	fi
+	exeinto /
+	doexe startprefix
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+pkg_postinst() {
+	use prefix-stack || return 0
+	[[ -x ${EROOT}/usr/bin/gcc-config ]] || return 0
+	"${EROOT}"/usr/bin/gcc-config ${CHOST}-${P}
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+if [[ -d /proc/registry ]]; then # we're on Cygwin
+	# crucial to Windows but cannot be restored, see
+	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
+	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
+	# COMSPEC is to native Windows what SHELL is to *nix
+	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
+	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
+	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
+fi
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+AT_SYS_M4DIR@=@"@GENTOO_PORTAGE_EPREFIX@/usr/share/aclocal"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+CHILD_CHOST=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
+		einfo "                         the profile does not set CHOST, or to override."
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+if [[ -z ${CHILD_CHOST} ]]
+then
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+
+	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+	do
+		if [[ ${profile} == missing ]]
+		then
+		  eerror "profile does not set CHOST, need --chost argument"
+		  exit 1
+		fi
+		[[ -s "${profile}/make.defaults" ]] || continue
+		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
+	done
+fi
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# These are sane default compiler flags, feel free to adopt them as you like."
+	echo "# Extending the flags is done to respect flags probably set by some profile."
+	echo "#"
+	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
+	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
+	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
+	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
+	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
+	if [[ -n ${CHILD_CHOST} ]] ; then
+		echo "CHOST=\"${CHILD_CHOST}\""
+	fi
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	# Inherited compiler flags from parent prefix,
+	# as the child prefix may have a different compiler.
+	CFLAGS="$(portageq envvar CFLAGS)"
+	CXXFLAGS="$(portageq envvar CXXFLAGS)"
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# get eventual dependencies, add to world
+	emerge --verbose --update --deep \
+		app-portage/prefix-toolkit
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+linkopts=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	if [[ ${chost} == *"-winnt"* ]]; then
+		# We depend on dev-libs/pthreads4w, no?
+		case ${opt} in
+		-pthread | -lpthread)
+			case " ${linkopts[*]} " in
+			*" -lpthread "*) ;;
+			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
+			esac
+			continue
+			;;
+		esac
+	fi
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2020-03-13 14:35 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2020-03-13 14:35 UTC (permalink / raw
  To: gentoo-commits

commit:     d3088df8d4f537268af659f9910c4600186bbdcc
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 13 14:18:52 2020 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Fri Mar 13 14:34:18 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d3088df8

app-portage/prefix-toolkit: startprefix is for Prefix only

To allow for prefix-stack on top of vanilla Gentoo, prefix-stack-setup
does make sense there - but startprefix does not.
Add comment why prefix-stack does have some RDEPENDs, and reorder
RDEPEND to logically match the comment.

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 702 +++++++++++++++++++++
 1 file changed, 702 insertions(+)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
new file mode 100644
index 00000000000..05ebbcc42e8
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -0,0 +1,702 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# Strictly speaking, only baselayout and gcc-config are necessary
+# (and pthreads4w for Winnt), but it is easier for now to install
+# elt-patches, gentoo-functions and gnuconfig as well, instead of
+# fixing all uses that expect them in EPREFIX rather than BROOT.
+# See als: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-devel/gcc-config
+		elibc_Winnt? (
+			dev-libs/pthreads4w
+		)
+		app-portage/elt-patches
+		sys-apps/gentoo-functions
+		sys-devel/gnuconfig
+	)
+"
+
+S="${WORKDIR}"
+
+my_unpack() {
+	local infile=$1
+	local outfile=${2:-${infile}}
+	ebegin "extracting ${outfile}"
+	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
+		> "${outfile}" || die "Failed to unpack ${outfile}"
+	eend $?
+}
+
+src_unpack() {
+	if use prefix-stack ; then
+		my_unpack prefix-stack.bash_login
+		my_unpack prefix-stack.bashrc
+		my_unpack prefix-stack.envd.99stack
+		my_unpack prefix-stack-ccwrap
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	else
+		my_unpack prefix-stack-setup
+	fi
+	if use prefix; then
+		# does not make sense on vanilla Gentoo
+		my_unpack startprefix
+	fi
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+		keepdir /usr/share/aclocal
+	else
+		dobin prefix-stack-setup
+	fi
+	if use prefix; then
+		exeinto /
+		doexe startprefix
+	fi
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+pkg_postinst() {
+	use prefix-stack || return 0
+	[[ -x ${EROOT}/usr/bin/gcc-config ]] || return 0
+	"${EROOT}"/usr/bin/gcc-config ${CHOST}-${P}
+}
+
+return 0
+
+: startprefix <<'EOIN'
+#!@GENTOO_PORTAGE_EBASH@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
+# Enters the prefix environment by starting a login shell from the
+# prefix.  The SHELL environment variable is elevated in order to make
+# applications that start login shells to work, such as `screen`.
+
+# if you come from a substantially polluted environment (another
+# Prefix), a cleanup as follows resolves most oddities I've ever seen:
+# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
+# hence this script starts the Prefix shell like this
+
+if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
+then
+	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
+	exit -1
+elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
+	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
+then
+	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
+	exit -1
+fi
+
+# What is our prefix?
+EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
+BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
+
+# not all systems have the same location for shells, however what it
+# boils down to, is that we need to know what the shell is, and then we
+# can find it in the bin dir of our prefix
+for SHELL in \
+	"${EPREFIX}/bin/${SHELL##*/}" \
+	"${BPREFIX}/bin/${SHELL##*/}" \
+	${SHELL##*/}
+do
+	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
+done
+
+# check if the shell exists
+if [[ ${SHELL} != */* ]]
+then
+	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
+	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
+	exit 1
+fi
+
+# set the prefix shell in the environment
+export SHELL
+
+# give a small notice
+echo "Entering Gentoo Prefix ${EPREFIX}"
+# start the login shell, clean the entire environment but what's needed
+RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
+# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
+[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
+# ssh-agent is handy to keep, of if set, inherit it
+[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
+# if we're on some X terminal, makes sense to inherit that too
+[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
+if [[ -d /proc/registry ]]; then # we're on Cygwin
+	# crucial to Windows but cannot be restored, see
+	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
+	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
+	# COMSPEC is to native Windows what SHELL is to *nix
+	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
+	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
+	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
+fi
+# do it!
+if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
+	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
+elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
+	# shell coming from different prefix would load it's own
+	# etc/profile upon -l, so we have to override
+	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
+else
+	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
+	exit 1
+fi
+# and leave a message when we exit... the shell might return non-zero
+# without having real problems, so don't send alarming messages about
+# that
+echo "Leaving Gentoo Prefix with exit status $?"
+EOIN
+
+: prefix-stack.bashrc <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, yet
+# etc/bash/bashrc from base Prefix still is useful.
+#
+
+if [[ $- != *i* ]] ; then
+	# Shell is non-interactive, bashrc does not apply
+	return
+fi
+
+if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
+	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
+	# only if base Prefix does have an etc/bash/bashrc, we also
+	# run bashrc snippets provided by packages in stacked Prefix
+	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
+		[[ -r ${sh} ]] && source "${sh}"
+	done
+	unset sh
+else
+	# etc/profile does expect etc/bash/bashrc to set PS1
+	PS1='\u@\h \w \$ '
+fi
+EOIN
+
+: prefix-stack.bash_login <<'EOIN'
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# In stacked Prefix there is no bash installed, so there is
+# no bash able to load this Prefix' profile as login shell.
+# Instead, you can specify this one as bash rcfile to mimic
+# a bash login shell using this stacked Prefix profile.
+#
+
+if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
+	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
+fi
+if [[ -s ~/.bash_profile ]] ; then
+	. ~/.bash_profile
+elif [[ -s ~/.bash_login ]] ; then
+	. ~/.bash_login
+elif [[ -s ~/.profile ]] ; then
+	. ~/.profile
+fi
+EOIN
+
+: prefix-stack.envd.99stack <<'EOIN'
+PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
+AT_SYS_M4DIR@=@"@GENTOO_PORTAGE_EPREFIX@/usr/share/aclocal"
+PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
+EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
+EOIN
+
+: prefix-stack-setup <<'EOIN'
+#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
+CHILD_EPREFIX=
+CHILD_PROFILE=
+CHILD_CHOST=
+
+#
+# get ourselfs the functions.sh script for ebegin/eend/etc.
+#
+for f in \
+	/lib/gentoo/functions.sh \
+	/etc/init.d/functions.sh \
+	/sbin/functions.sh \
+; do
+	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
+		. "${PARENT_EPREFIX}${f}"
+		f=found
+		break
+	fi
+done
+
+if [[ ${f} != found ]] ; then
+	echo "Cannot find Gentoo functions, aborting." >&2
+	exit 1
+fi
+
+for arg in "$@"; do
+	case "${arg}" in
+	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
+	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
+	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
+
+	--help)
+		einfo "$0 usage:"
+		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
+		einfo "                         where this script is installed (${PARENT_EPREFIX})"
+		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
+		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
+		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
+		einfo "                         the profile does not set CHOST, or to override."
+		exit 0
+		;;
+	esac
+done
+
+#
+# sanity check of given values
+#
+
+test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
+test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
+test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
+test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
+
+if [[ -z ${CHILD_CHOST} ]]
+then
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+
+	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
+	do
+		if [[ ${profile} == missing ]]
+		then
+		  eerror "profile does not set CHOST, need --chost argument"
+		  exit 1
+		fi
+		[[ -s "${profile}/make.defaults" ]] || continue
+		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
+	done
+fi
+
+einfo "creating stacked prefix ${CHILD_EPREFIX}"
+
+#
+# functions needed below.
+#
+eend_exit() {
+	eend $1
+	[[ $1 != 0 ]] && exit 1
+}
+
+#
+# create the directories required to bootstrap the least.
+#
+ebegin "creating directory structure"
+(
+	set -e
+	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
+	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
+	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
+)
+eend_exit $?
+
+#
+# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
+#
+ebegin "creating make.conf"
+(
+	set -e
+	echo "#"
+	echo "# These are sane default compiler flags, feel free to adopt them as you like."
+	echo "# Extending the flags is done to respect flags probably set by some profile."
+	echo "#"
+	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
+	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
+	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
+	niceness=$(portageq envvar PORTAGE_NICENESS || true)
+	[[ -n ${niceness} ]] &&
+		echo "PORTAGE_NICENESS=\"${niceness}\""
+	echo
+	echo "# Mirrors from parent prefix."
+	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
+	echo
+	echo "# Below comes the prefix-stack setup. Only change things"
+	echo "# if you know exactly what you are doing!"
+	echo "EPREFIX=\"${CHILD_EPREFIX}\""
+	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
+	echo "BROOT=\"${PARENT_EPREFIX}\""
+	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
+	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
+	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
+	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
+	if [[ -n ${CHILD_CHOST} ]] ; then
+		echo "CHOST=\"${CHILD_CHOST}\""
+	fi
+) > "${CHILD_EPREFIX}"/etc/portage/make.conf
+eend_exit $?
+
+ebegin "creating use.mask/prefix-stack"
+printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
+eend_exit $?
+
+ebegin "creating use.force/prefix-stack"
+printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
+eend_exit $?
+
+ebegin "creating env/host-cc.conf"
+cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
+	CC=${PARENT_CHOST}-gcc
+	CXX=${PARENT_CHOST}-g++
+	# Inherited compiler flags from parent prefix,
+	# as the child prefix may have a different compiler.
+	CFLAGS="$(portageq envvar CFLAGS)"
+	CXXFLAGS="$(portageq envvar CXXFLAGS)"
+	EOM
+eend_exit $?
+
+ebegin "creating package.env/prefix-stack"
+cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
+	# merge with the parent's chost. this forces the use of the parent
+	# compiler, which generally would be illegal - this is an exception.
+	# This is required for example on winnt, because the wrapper has to
+	# be able to use/resolve symlinks, etc. native winnt binaries miss
+	# that ability, but cygwin binaries don't.
+	sys-devel/gcc-config host-cc.conf
+	sys-apps/gentoo-functions host-cc.conf
+	EOM
+eend_exit $?
+
+#
+# create the make.profile symlinks.
+#
+ebegin "creating make.profile"
+(
+	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
+)
+eend_exit $?
+
+#
+# adjust permissions of generated files.
+#
+ebegin "adjusting permissions"
+(
+	set -e
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
+	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
+)
+eend_exit $?
+
+#
+# now merge some basics.
+#
+ebegin "installing required basic packages"
+(
+	set -e
+	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
+	export EPREFIX@=@"${CHILD_EPREFIX}"
+	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
+
+	# let baselayout create the directories
+	USE@=@"${USE} build" \
+	emerge --verbose --nodeps --oneshot \
+		'>=baselayout-prefix-2.6'
+
+	# In prefix-stack, app-portage/prefix-toolkit does
+	# install/update an etc/portage/profile/packages file,
+	# removing all @system packages from current make.profile,
+	# and adding itself to @system set instead.
+	emerge --verbose --nodeps --oneshot \
+		app-portage/prefix-toolkit
+
+	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
+	# to hold them in the @system set.
+	emerge --verbose --nodeps --oneshot \
+		sys-apps/gentoo-functions \
+		app-portage/elt-patches \
+		sys-devel/gnuconfig \
+		sys-devel/gcc-config
+
+	# get eventual dependencies, add to world
+	emerge --verbose --update --deep \
+		app-portage/prefix-toolkit
+
+	# select the stack wrapper profile from gcc-config
+	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
+		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
+)
+eend_exit $?
+
+#
+# wow, all ok :)
+#
+ewarn
+ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
+ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
+ewarn
+EOIN
+
+: prefix-stack-ccwrap <<'EOIN'
+#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
+
+if [ -r /cygdrive/. ]; then
+	winpath2unix() { cygpath -u "$1"; }
+	unixpath2win() { cygpath -w "$1"; }
+fi
+
+myself=${0##*/} # basename $0
+link_dirs=()
+linkopts=()
+opts=()
+chost="@GENTOO_PORTAGE_CHOST@"
+prefix="@GENTOO_PORTAGE_EPREFIX@"
+absprefix=${prefix}
+if [[ ${chost} == *"-winnt"* ]]; then
+	# we may get called from windows binary, like pkgdata in dev-libs/icu
+	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
+	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
+fi
+[[ ${myself} == *windres* ]] && mode=compile || mode=link
+orig_args=("$@")
+
+for opt in "$@"
+do
+	if [[ ${chost} == *"-winnt"* ]]; then
+		# We depend on dev-libs/pthreads4w, no?
+		case ${opt} in
+		-pthread | -lpthread)
+			case " ${linkopts[*]} " in
+			*" -lpthread "*) ;;
+			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
+			esac
+			continue
+			;;
+		esac
+	fi
+	case "$opt" in
+	-L)
+		link_dirs=("${link_dirs[@]}" "-L$1")
+		shift
+		;;
+	-L*)
+		link_dirs=("${link_dirs[@]}" "${opt}")
+		;;
+	*)
+		case "${opt}" in
+		-v)
+			# -v done right: only use mode version if -v is the _only_
+			# argument on the command line.
+			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
+			;;
+		--version)	mode=version ;;
+		-c|-E|-S)	mode=compile ;;
+		-print-search-dirs) mode=dirs ;;
+		esac
+		opts=("${opts[@]}" "${opt}")
+		;;
+	esac
+done
+
+# remove any path to current prefix, need base prefix only
+new_path=
+save_ifs=$IFS
+IFS=':'
+for p in $PATH
+do
+	IFS=$save_ifs
+	[[ ${p#${absprefix}} != "${p}" ]] && continue
+	if [[ -z "${new_path}" ]]; then
+		new_path="${p}"
+	else
+		new_path="${new_path}:${p}"
+	fi
+done
+IFS=$save_ifs
+
+PATH=${new_path}
+
+pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
+pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
+# binutils-config's ldwrapper understands '-R' for aix and hpux too.
+pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
+case "${chost}" in
+*-winnt*)
+	# parity (winnt) understands -rpath only ...
+	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
+	;;
+*-linux*)
+	# With gcc, -isystem would avoid warning messages in installed headers,
+	# but that breaks with AIX host headers.
+	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
+	;;
+esac
+
+# ensure we run the right chost program in base prefix
+[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
+
+case "$mode" in
+link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
+compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
+version) exec "${myself}" "${orig_args[@]}" ;;
+dirs)
+	"${myself}" "${orig_args[@]}" | while read line; do
+		if [[ "${line}" == "libraries: ="* ]]; then
+			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
+		else
+			echo "${line}"
+		fi
+	done
+	;;
+*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
+esac
+EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2020-03-13 14:35 Michael Haubenwallner
  0 siblings, 0 replies; 30+ messages in thread
From: Michael Haubenwallner @ 2020-03-13 14:35 UTC (permalink / raw
  To: gentoo-commits

commit:     2e8c30cf33e96e274478e15d3daddb533674f117
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 13 14:35:02 2020 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Fri Mar 13 14:35:19 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e8c30cf

app-portage/prefix-toolkit: old

Package-Manager: Portage-2.3.89, Repoman-2.3.20
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-4.ebuild | 650 -------------------
 app-portage/prefix-toolkit/prefix-toolkit-5.ebuild | 665 --------------------
 app-portage/prefix-toolkit/prefix-toolkit-6.ebuild | 685 --------------------
 app-portage/prefix-toolkit/prefix-toolkit-7.ebuild | 692 ---------------------
 4 files changed, 2692 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-4.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-4.ebuild
deleted file mode 100644
index cfe11c4c353..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-4.ebuild
+++ /dev/null
@@ -1,650 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# See als: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-apps/gentoo-functions
-		app-portage/elt-patches
-		sys-devel/gnuconfig
-		sys-devel/gcc-config
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-CHILD_CHOST=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
-	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
-	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
-		einfo "                         the profile does not set CHOST, or to override."
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-if [[ -z ${CHILD_CHOST} ]]
-then
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-
-	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
-	do
-		if [[ ${profile} == missing ]]
-		then
-		  eerror "profile does not set CHOST, need --chost argument"
-		  exit 1
-		fi
-		[[ -s "${profile}/make.defaults" ]] || continue
-		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
-	done
-fi
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# The following values where taken from the parent prefix's"
-	echo "# environment. Feel free to adopt them as you like."
-	echo "#"
-	echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
-	echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
-	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
-	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
-	if [[ -n ${CHILD_CHOST} ]] ; then
-		echo "CHOST=\"${CHILD_CHOST}\""
-	fi
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild
deleted file mode 100644
index 61ea23e6a37..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-5.ebuild
+++ /dev/null
@@ -1,665 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# See als: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-apps/gentoo-functions
-		app-portage/elt-patches
-		sys-devel/gnuconfig
-		sys-devel/gcc-config
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-if [[ -d /proc/registry ]]; then # we're on Cygwin
-	# crucial to Windows but cannot be restored, see
-	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
-	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
-	# COMSPEC is to native Windows what SHELL is to *nix
-	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
-	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
-	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
-fi
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-CHILD_CHOST=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
-	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
-	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
-		einfo "                         the profile does not set CHOST, or to override."
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-if [[ -z ${CHILD_CHOST} ]]
-then
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-
-	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
-	do
-		if [[ ${profile} == missing ]]
-		then
-		  eerror "profile does not set CHOST, need --chost argument"
-		  exit 1
-		fi
-		[[ -s "${profile}/make.defaults" ]] || continue
-		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
-	done
-fi
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# These are sane default compiler flags, feel free to adopt them as you like."
-	echo "# Extending the flags is done to respect flags probably set by some profile."
-	echo "#"
-	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
-	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
-	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
-	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
-	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
-	if [[ -n ${CHILD_CHOST} ]] ; then
-		echo "CHOST=\"${CHILD_CHOST}\""
-	fi
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	# Inherited compiler flags from parent prefix,
-	# as the child prefix may have a different compiler.
-	CFLAGS="$(portageq envvar CFLAGS)"
-	CXXFLAGS="$(portageq envvar CXXFLAGS)"
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-6.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-6.ebuild
deleted file mode 100644
index a052312b8df..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-6.ebuild
+++ /dev/null
@@ -1,685 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# See als: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-apps/gentoo-functions
-		app-portage/elt-patches
-		sys-devel/gnuconfig
-		sys-devel/gcc-config
-		elibc_Winnt? (
-			dev-libs/pthreads4w
-		)
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-if [[ -d /proc/registry ]]; then # we're on Cygwin
-	# crucial to Windows but cannot be restored, see
-	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
-	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
-	# COMSPEC is to native Windows what SHELL is to *nix
-	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
-	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
-	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
-fi
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-CHILD_CHOST=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
-	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
-	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
-		einfo "                         the profile does not set CHOST, or to override."
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-if [[ -z ${CHILD_CHOST} ]]
-then
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-
-	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
-	do
-		if [[ ${profile} == missing ]]
-		then
-		  eerror "profile does not set CHOST, need --chost argument"
-		  exit 1
-		fi
-		[[ -s "${profile}/make.defaults" ]] || continue
-		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
-	done
-fi
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# These are sane default compiler flags, feel free to adopt them as you like."
-	echo "# Extending the flags is done to respect flags probably set by some profile."
-	echo "#"
-	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
-	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
-	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
-	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
-	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
-	if [[ -n ${CHILD_CHOST} ]] ; then
-		echo "CHOST=\"${CHILD_CHOST}\""
-	fi
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	# Inherited compiler flags from parent prefix,
-	# as the child prefix may have a different compiler.
-	CFLAGS="$(portageq envvar CFLAGS)"
-	CXXFLAGS="$(portageq envvar CXXFLAGS)"
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# get eventual dependencies, add to world
-	emerge --verbose --update --deep \
-		app-portage/prefix-toolkit
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-linkopts=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	if [[ ${chost} == *"-winnt"* ]]; then
-		# We depend on dev-libs/pthreads4w, no?
-		case ${opt} in
-		-pthread | -lpthread)
-			case " ${linkopts[*]} " in
-			*" -lpthread "*) ;;
-			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
-			esac
-			continue
-			;;
-		esac
-	fi
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-7.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-7.ebuild
deleted file mode 100644
index f401ec709a4..00000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-7.ebuild
+++ /dev/null
@@ -1,692 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# See als: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-apps/gentoo-functions
-		app-portage/elt-patches
-		sys-devel/gnuconfig
-		sys-devel/gcc-config
-		elibc_Winnt? (
-			dev-libs/pthreads4w
-		)
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-pkg_postinst() {
-	use prefix-stack || return 0
-	[[ -x ${EROOT}/usr/bin/gcc-config ]] || return 0
-	"${EROOT}"/usr/bin/gcc-config ${CHOST}-${P}
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-if [[ -d /proc/registry ]]; then # we're on Cygwin
-	# crucial to Windows but cannot be restored, see
-	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
-	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
-	# COMSPEC is to native Windows what SHELL is to *nix
-	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
-	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
-	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
-fi
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-AT_SYS_M4DIR@=@"@GENTOO_PORTAGE_EPREFIX@/usr/share/aclocal"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-CHILD_CHOST=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
-	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
-	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
-		einfo "                         the profile does not set CHOST, or to override."
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-if [[ -z ${CHILD_CHOST} ]]
-then
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-
-	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
-	do
-		if [[ ${profile} == missing ]]
-		then
-		  eerror "profile does not set CHOST, need --chost argument"
-		  exit 1
-		fi
-		[[ -s "${profile}/make.defaults" ]] || continue
-		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
-	done
-fi
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# These are sane default compiler flags, feel free to adopt them as you like."
-	echo "# Extending the flags is done to respect flags probably set by some profile."
-	echo "#"
-	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
-	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
-	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
-	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
-	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
-	if [[ -n ${CHILD_CHOST} ]] ; then
-		echo "CHOST=\"${CHILD_CHOST}\""
-	fi
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	# Inherited compiler flags from parent prefix,
-	# as the child prefix may have a different compiler.
-	CFLAGS="$(portageq envvar CFLAGS)"
-	CXXFLAGS="$(portageq envvar CXXFLAGS)"
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# get eventual dependencies, add to world
-	emerge --verbose --update --deep \
-		app-portage/prefix-toolkit
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-linkopts=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	if [[ ${chost} == *"-winnt"* ]]; then
-		# We depend on dev-libs/pthreads4w, no?
-		case ${opt} in
-		-pthread | -lpthread)
-			case " ${linkopts[*]} " in
-			*" -lpthread "*) ;;
-			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
-			esac
-			continue
-			;;
-		esac
-	fi
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2020-12-27 14:01 Fabian Groffen
  0 siblings, 0 replies; 30+ messages in thread
From: Fabian Groffen @ 2020-12-27 14:01 UTC (permalink / raw
  To: gentoo-commits

commit:     9cb6869673d7eefc0b248273a43fc777bc0d1a73
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 27 13:55:56 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Dec 27 13:55:56 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9cb68696

app-portage/prefix-toolkit: drop ppc-aix m68k-mint

Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-8.ebuild | 2 +-
 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
index 96f9ee69966..8f8c82541ff 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index 05ebbcc42e8..b16bfb3cf27 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2021-01-06 13:23 Fabian Groffen
  0 siblings, 0 replies; 30+ messages in thread
From: Fabian Groffen @ 2021-01-06 13:23 UTC (permalink / raw
  To: gentoo-commits

commit:     bf27e6e7854da1a018c70c79a9d67dc79f1ed3a9
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  6 13:23:04 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jan  6 13:23:04 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bf27e6e7

app-portage/prefix-toolkit: drop x86-macos

Package-Manager: Portage-3.0.12, Repoman-3.0.2
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-8.ebuild | 4 ++--
 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
index 8f8c82541ff..c7c9ab9e733 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index b16bfb3cf27..36e3ea4ea0e 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2021-06-02 19:01 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2021-06-02 19:01 UTC (permalink / raw
  To: gentoo-commits

commit:     8c7690ccb5f8c2556e300ad1c7cb0d27c7b0d577
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  2 19:00:50 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun  2 19:00:50 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c7690cc

app-portage/prefix-toolkit: Stabilize 9 amd64, #759427

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

 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index 36e3ea4ea0e..46aec0c1fb3 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2022-07-11 20:19 Jakov Smolić
  0 siblings, 0 replies; 30+ messages in thread
From: Jakov Smolić @ 2022-07-11 20:19 UTC (permalink / raw
  To: gentoo-commits

commit:     bc7c993287441e2cd6386eb0b63bc7caa992198c
Author:     Atharva <atharvaamritkar <AT> protonmail <DOT> com>
AuthorDate: Mon Jul 11 13:16:42 2022 +0000
Commit:     Jakov Smolić <jsmolic <AT> gentoo <DOT> org>
CommitDate: Mon Jul 11 20:17:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc7c9932

app-portage/prefix-toolkit: riscv keywording

Signed-off-by: Atharva <atharvaamritkar <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/26346
Signed-off-by: Jakov Smolić <jsmolic <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index 46aec0c1fb3e..08e66ff084da 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~riscv-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-04-24 20:13 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-04-24 20:13 UTC (permalink / raw
  To: gentoo-commits

commit:     ce82e5c723cdb6474458f53d8ebbe99ff54ff204
Author:     Yifeng Li <tomli <AT> tomli <DOT> me>
AuthorDate: Mon Apr 24 14:46:14 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 24 20:13:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce82e5c7

app-portage/prefix-toolkit: keyword ~arm64-macos.

Currently, Gentoo Prefix cannot be started on macOS w/ Apple Silicon
due to the missing ~arm64-macos in app-portage/prefix-toolkit, which
contains the script "startprefix". Adding the keyword allows the
prefix to start.

Bug: https://bugs.gentoo.org/904474
Signed-off-by: Yifeng Li <tomli <AT> tomli.me>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-portage/prefix-toolkit/prefix-toolkit-8.ebuild | 2 +-
 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
index c7c9ab9e7336..630090247f6f 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index 08e66ff084da..1e27820a440c 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -11,7 +11,7 @@ LICENSE="GPL-3"
 SLOT="0"
 
 [[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~riscv-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~riscv-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
 
 DEPEND="
 	!app-portage/prefix-chain-setup


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-04-24 20:15 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-04-24 20:15 UTC (permalink / raw
  To: gentoo-commits

commit:     125725b66fc39dacb6cc267a837d420848829013
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 24 20:14:27 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 24 20:14:27 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=125725b6

app-portage/prefix-toolkit: crank copyright year

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

 app-portage/prefix-toolkit/prefix-toolkit-8.ebuild | 2 +-
 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
index 630090247f6f..e48c3d2bcf18 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index 1e27820a440c..84d62c1b4741 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-04-24 20:15 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-04-24 20:15 UTC (permalink / raw
  To: gentoo-commits

commit:     8cc8bd4b8a190493615d9f37e5869d643f327e14
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 24 20:14:40 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 24 20:14:40 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8cc8bd4b

app-portage/prefix-toolkit: fix comment typo

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

 app-portage/prefix-toolkit/prefix-toolkit-8.ebuild | 2 +-
 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
index e48c3d2bcf18..78754f6175d0 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
@@ -23,7 +23,7 @@ BDEPEND="${DEPEND}
 # In prefix-stack, these dependencies actually are the @system set,
 # as we rely on the base prefix anyway for package management,
 # which should have a proper @system set.
-# See als: pkg_preinst
+# See also: pkg_preinst
 RDEPEND="${DEPEND}
 	prefix-stack? (
 		>=sys-apps/baselayout-prefix-2.6

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index 84d62c1b4741..f95a8588bbd6 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -27,7 +27,7 @@ BDEPEND="${DEPEND}
 # (and pthreads4w for Winnt), but it is easier for now to install
 # elt-patches, gentoo-functions and gnuconfig as well, instead of
 # fixing all uses that expect them in EPREFIX rather than BROOT.
-# See als: pkg_preinst
+# See also: pkg_preinst
 RDEPEND="${DEPEND}
 	prefix-stack? (
 		>=sys-apps/baselayout-prefix-2.6


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-05-26  6:23 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-05-26  6:23 UTC (permalink / raw
  To: gentoo-commits

commit:     6434e36bcd9982af6346413fd7a682041ddd3ca8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 26 05:34:49 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 05:34:49 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6434e36b

app-portage/prefix-toolkit: drop 8

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

 app-portage/prefix-toolkit/prefix-toolkit-8.ebuild | 693 ---------------------
 1 file changed, 693 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
deleted file mode 100644
index ddc9ef92ce84..000000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-8.ebuild
+++ /dev/null
@@ -1,693 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# See also: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-apps/gentoo-functions
-		app-portage/elt-patches
-		sys-devel/gnuconfig
-		sys-devel/gcc-config
-		elibc_Winnt? (
-			dev-libs/pthreads4w
-		)
-	)
-"
-
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
-src_unpack() {
-	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	my_unpack startprefix
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-		keepdir /usr/share/aclocal
-	else
-		dobin prefix-stack-setup
-	fi
-	exeinto /
-	doexe startprefix
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-pkg_postinst() {
-	use prefix-stack || return 0
-	[[ -x ${EROOT}/usr/bin/gcc-config ]] || return 0
-	"${EROOT}"/usr/bin/gcc-config ${CHOST}-${P}
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-if [[ -d /proc/registry ]]; then # we're on Cygwin
-	# crucial to Windows but cannot be restored, see
-	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
-	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
-	# COMSPEC is to native Windows what SHELL is to *nix
-	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
-	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
-	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
-fi
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-AT_SYS_M4DIR@=@"@GENTOO_PORTAGE_EPREFIX@/usr/share/aclocal"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-CHILD_CHOST=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
-	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
-	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
-		einfo "                         the profile does not set CHOST, or to override."
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-if [[ -z ${CHILD_CHOST} ]]
-then
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-
-	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
-	do
-		if [[ ${profile} == missing ]]
-		then
-		  eerror "profile does not set CHOST, need --chost argument"
-		  exit 1
-		fi
-		[[ -s "${profile}/make.defaults" ]] || continue
-		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
-	done
-fi
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# These are sane default compiler flags, feel free to adopt them as you like."
-	echo "# Extending the flags is done to respect flags probably set by some profile."
-	echo "#"
-	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
-	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
-	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
-	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
-	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
-	if [[ -n ${CHILD_CHOST} ]] ; then
-		echo "CHOST=\"${CHILD_CHOST}\""
-	fi
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	# Inherited compiler flags from parent prefix,
-	# as the child prefix may have a different compiler.
-	CFLAGS="$(portageq envvar CFLAGS)"
-	CXXFLAGS="$(portageq envvar CXXFLAGS)"
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# get eventual dependencies, add to world
-	emerge --verbose --update --deep \
-		app-portage/prefix-toolkit
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-linkopts=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	if [[ ${chost} == *"-winnt"* ]]; then
-		# We depend on dev-libs/pthreads4w, no?
-		case ${opt} in
-		-pthread | -lpthread)
-			case " ${linkopts[*]} " in
-			*" -lpthread "*) ;;
-			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
-			esac
-			continue
-			;;
-		esac
-	fi
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-05-26  6:23 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-05-26  6:23 UTC (permalink / raw
  To: gentoo-commits

commit:     8a828978763bf24ad1e4e5326788db90fbc00879
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 26 06:18:30 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 06:18:30 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a828978

app-portage/prefix-toolkit: drop crime-against-ebuild (don't self-extract files)

I've tried my best at a faithful conversion at https://gitweb.gentoo.org/proj/prefix/prefix-toolkit.git/
with the ebuilds, extracted contents from them, and original commit authorship & messages
(w/ cherry-picked reference to ::gentoo commits).

There's also a 'naive-conversion' branch with just me doing the extraction.

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

 app-portage/prefix-toolkit/Manifest                |  1 +
 app-portage/prefix-toolkit/prefix-toolkit-9.ebuild | 25 +++-------------------
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/app-portage/prefix-toolkit/Manifest b/app-portage/prefix-toolkit/Manifest
new file mode 100644
index 000000000000..da79406b5d2b
--- /dev/null
+++ b/app-portage/prefix-toolkit/Manifest
@@ -0,0 +1 @@
+DIST prefix-toolkit-9.tar.bz2 8642 BLAKE2B b81a2c5af56e123b74434512660783273a5af1ea3c193e97c48f4bcf84eaafce3b95df432f5571ef049f56a7f2fefa7a1da603a14bc3a3cef9465559e519e948 SHA512 45f7718e5ef72f05a6bd5ef3bdda3f62076c925b414bd8f2ca54207deb515adab37612c571e5e92b2a1ec400b3780043804814e1c1243f8ace90dca6a1ad2035

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
index a06537c1ebf4..50fe30e95cef 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
@@ -5,7 +5,7 @@ EAPI=7
 
 DESCRIPTION="Utilities for users of Gentoo Prefix"
 HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI=""
+SRC_URI="https://gitweb.gentoo.org/proj/prefix/prefix-toolkit.git/snapshot/${P}.tar.bz2"
 
 LICENSE="GPL-3"
 SLOT="0"
@@ -41,23 +41,10 @@ RDEPEND="${DEPEND}
 	)
 "
 
-S="${WORKDIR}"
-
-my_unpack() {
-	local infile=$1
-	local outfile=${2:-${infile}}
-	ebegin "extracting ${outfile}"
-	sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
-		> "${outfile}" || die "Failed to unpack ${outfile}"
-	eend $?
-}
-
 src_unpack() {
+	default
+
 	if use prefix-stack ; then
-		my_unpack prefix-stack.bash_login
-		my_unpack prefix-stack.bashrc
-		my_unpack prefix-stack.envd.99stack
-		my_unpack prefix-stack-ccwrap
 		local editor pager
 		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
 		do
@@ -68,12 +55,6 @@ src_unpack() {
 			[[ -x ${pager} ]] || continue
 		done
 		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	else
-		my_unpack prefix-stack-setup
-	fi
-	if use prefix; then
-		# does not make sense on vanilla Gentoo
-		my_unpack startprefix
 	fi
 }
 


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-05-26  6:23 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-05-26  6:23 UTC (permalink / raw
  To: gentoo-commits

commit:     7371beb3915143c16543434b61721bc482741b62
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 26 06:20:01 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 06:20:01 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7371beb3

app-portage/prefix-toolkit: add gentoo upstream metadata

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

 app-portage/prefix-toolkit/metadata.xml | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/app-portage/prefix-toolkit/metadata.xml b/app-portage/prefix-toolkit/metadata.xml
index 76983c31094e..1847ed2edf88 100644
--- a/app-portage/prefix-toolkit/metadata.xml
+++ b/app-portage/prefix-toolkit/metadata.xml
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
-<maintainer type="project">
-	<email>prefix@gentoo.org</email>
-	<name>Gentoo Prefix</name>
-</maintainer>
+	<maintainer type="project">
+		<email>prefix@gentoo.org</email>
+		<name>Gentoo Prefix</name>
+	</maintainer>
+	<upstream>
+		<remote-id type="gentoo">proj/prefix/prefix-toolkit</remote-id>
+	</upstream>
 </pkgmetadata>


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-05-26  6:25 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-05-26  6:25 UTC (permalink / raw
  To: gentoo-commits

commit:     40925478f0552e5e63c325232b9e66e143540af3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri May 26 06:25:28 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 06:25:28 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40925478

app-portage/prefix-toolkit: add 10, drop 9

Only change is that this is the first "new" tag post-conversion (and so
doesn't have the ebuild in the repo->tag->tarball fetched, which is a bit
icky).

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

 app-portage/prefix-toolkit/Manifest                                     | 2 +-
 .../{prefix-toolkit-9.ebuild => prefix-toolkit-10.ebuild}               | 0
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/app-portage/prefix-toolkit/Manifest b/app-portage/prefix-toolkit/Manifest
index da79406b5d2b..ebd30aa764bd 100644
--- a/app-portage/prefix-toolkit/Manifest
+++ b/app-portage/prefix-toolkit/Manifest
@@ -1 +1 @@
-DIST prefix-toolkit-9.tar.bz2 8642 BLAKE2B b81a2c5af56e123b74434512660783273a5af1ea3c193e97c48f4bcf84eaafce3b95df432f5571ef049f56a7f2fefa7a1da603a14bc3a3cef9465559e519e948 SHA512 45f7718e5ef72f05a6bd5ef3bdda3f62076c925b414bd8f2ca54207deb515adab37612c571e5e92b2a1ec400b3780043804814e1c1243f8ace90dca6a1ad2035
+DIST prefix-toolkit-10.tar.bz2 5715 BLAKE2B fe8b4642fc4f8fa97bd8c9dc4f9e907dd0ca464ddc20e28d2888354f766fce04dd6ebc3bfae23bc776c59986c8167cc94510fb950124917874c5dde4f68cddfe SHA512 58f7fabab8ce5e2c3b2f0725733d02e340efb714ecf3556c27dbe95e7cf9c4b2f4ae658c44749cf2c62111d1135c60c333bbf93ee1c7b79ea11b908cc923c730

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-9.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-10.ebuild
similarity index 100%
rename from app-portage/prefix-toolkit/prefix-toolkit-9.ebuild
rename to app-portage/prefix-toolkit/prefix-toolkit-10.ebuild


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-05-27  9:29 Sam James
  0 siblings, 0 replies; 30+ messages in thread
From: Sam James @ 2023-05-27  9:29 UTC (permalink / raw
  To: gentoo-commits

commit:     3649618556827b046d29993e9ce32ebb52be9a60
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May 27 09:28:27 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat May 27 09:29:10 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=36496185

app-portage/prefix-toolkit: cleanup remnants

Cloess: https://bugs.gentoo.org/866962
Fixes: 40925478f0552e5e63c325232b9e66e143540af3
Fixes: 8a828978763bf24ad1e4e5326788db90fbc00879
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../prefix-toolkit/prefix-toolkit-10-r1.ebuild     | 176 ++++++
 .../prefix-toolkit/prefix-toolkit-10.ebuild        | 683 ---------------------
 2 files changed, 176 insertions(+), 683 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
new file mode 100644
index 000000000000..638d73b10859
--- /dev/null
+++ b/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Utilities for users of Gentoo Prefix"
+HOMEPAGE="https://prefix.gentoo.org/"
+SRC_URI="https://gitweb.gentoo.org/proj/prefix/prefix-toolkit.git/snapshot/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+
+[[ ${PV} == 9999 ]] ||
+KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~riscv-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
+
+DEPEND="
+	!app-portage/prefix-chain-setup
+	!sys-apps/prefix-chain-utils
+"
+BDEPEND="${DEPEND}
+	>sys-apps/portage-2.3.62
+"
+# In prefix-stack, these dependencies actually are the @system set,
+# as we rely on the base prefix anyway for package management,
+# which should have a proper @system set.
+# Strictly speaking, only baselayout and gcc-config are necessary
+# (and pthreads4w for Winnt), but it is easier for now to install
+# elt-patches, gentoo-functions and gnuconfig as well, instead of
+# fixing all uses that expect them in EPREFIX rather than BROOT.
+# See also: pkg_preinst
+RDEPEND="${DEPEND}
+	prefix-stack? (
+		>=sys-apps/baselayout-prefix-2.6
+		sys-devel/gcc-config
+		elibc_Winnt? (
+			dev-libs/pthreads4w
+		)
+		app-portage/elt-patches
+		sys-apps/gentoo-functions
+		sys-devel/gnuconfig
+	)
+"
+
+src_unpack() {
+	default
+
+	if use prefix-stack ; then
+		local editor pager
+		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
+		do
+			[[ -x ${editor} ]] || continue
+		done
+		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
+		do
+			[[ -x ${pager} ]] || continue
+		done
+		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
+	fi
+}
+
+my_prefixify() {
+	local ebash eenv
+	if use prefix-stack ; then
+		ebash="${BROOT}/bin/bash"
+		eenv="${BROOT}/usr/bin/env"
+	else
+		ebash="${EPREFIX}/bin/bash"
+		eenv="${EPREFIX}/usr/bin/env"
+	fi
+
+	# the @=@ prevents repoman from believing we set readonly vars
+	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
+		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
+		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
+		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
+		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
+		-e "s,@=@,=,g" \
+		-i "$@" || die
+}
+
+src_configure() {
+	# do not eprefixify during unpack, to allow userpatches to apply
+	my_prefixify *
+}
+
+src_install-prefix-stack-ccwrap() {
+	# install toolchain wrapper.
+	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
+	local wrappercfg=${CHOST}-${P}
+
+	exeinto $wrapperdir
+	doexe prefix-stack-ccwrap
+
+	local cc
+	for cc in \
+		gcc \
+		g++ \
+		cpp \
+		c++ \
+		windres \
+	; do
+		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
+		dosym ${CHOST}-${cc} $wrapperdir/${cc}
+	done
+
+	# LDPATH is required to keep gcc-config happy :(
+	cat > ./${wrappercfg} <<-EOF
+		GCC_PATH="${EPREFIX}$wrapperdir"
+		LDPATH="${EPREFIX}$wrapperdir"
+		EOF
+
+	insinto /etc/env.d/gcc
+	doins ./${wrappercfg}
+}
+
+src_install() {
+	if use prefix-stack; then
+		src_install-prefix-stack-ccwrap
+		insinto /etc
+		doins prefix-stack.bash_login
+		insinto /etc/bash
+		newins prefix-stack.bashrc bashrc
+		newenvd prefix-stack.envd.99stack 99stack
+		doenvd 000fallback
+		keepdir /usr/share/aclocal
+	else
+		dobin prefix-stack-setup
+	fi
+	if use prefix; then
+		exeinto /
+		doexe startprefix
+	fi
+}
+
+pkg_preinst() {
+	use prefix-stack || return 0
+	ebegin "Purging @system package set for prefix stack"
+	# In prefix stack we empty out the @system set defined via make.profile,
+	# as we may be using some normal profile, but that @system set applies
+	# to the base prefix only.
+	# Instead, we only put ourselve into the @system set, and have additional
+	# @system packages in our RDEPEND.
+	my_lsprofile() {
+		(
+			cd -P "${1:-.}" || exit 1
+			[[ -r ./parent ]] &&
+				for p in $(<parent)
+				do
+					my_lsprofile "${p}" || exit 1
+				done
+			pwd -P
+		)
+	}
+	local systemset="/etc/portage/profile/packages"
+	dodir "${systemset%/*}"
+	[[ -s ${EROOT}${systemset} ]] &&
+		grep -v "# maintained by ${PN}" \
+			"${EROOT}${systemset}" \
+			> "${ED}${systemset}"
+	local p
+	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
+	do
+		[[ -s ${p}/${systemset##*/} ]] || continue
+		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
+			< "${p}"/packages || die
+	done | sort -u >> "${ED}${systemset}"
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
+	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
+	eend $?
+}
+
+pkg_postinst() {
+	use prefix-stack || return 0
+	[[ -x ${EROOT}/usr/bin/gcc-config ]] || return 0
+	"${EROOT}"/usr/bin/gcc-config ${CHOST}-${P}
+}

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-10.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-10.ebuild
deleted file mode 100644
index 50fe30e95cef..000000000000
--- a/app-portage/prefix-toolkit/prefix-toolkit-10.ebuild
+++ /dev/null
@@ -1,683 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DESCRIPTION="Utilities for users of Gentoo Prefix"
-HOMEPAGE="https://prefix.gentoo.org/"
-SRC_URI="https://gitweb.gentoo.org/proj/prefix/prefix-toolkit.git/snapshot/${P}.tar.bz2"
-
-LICENSE="GPL-3"
-SLOT="0"
-
-[[ ${PV} == 9999 ]] ||
-KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~riscv-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
-
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
-BDEPEND="${DEPEND}
-	>sys-apps/portage-2.3.62
-"
-# In prefix-stack, these dependencies actually are the @system set,
-# as we rely on the base prefix anyway for package management,
-# which should have a proper @system set.
-# Strictly speaking, only baselayout and gcc-config are necessary
-# (and pthreads4w for Winnt), but it is easier for now to install
-# elt-patches, gentoo-functions and gnuconfig as well, instead of
-# fixing all uses that expect them in EPREFIX rather than BROOT.
-# See also: pkg_preinst
-RDEPEND="${DEPEND}
-	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
-		sys-devel/gcc-config
-		elibc_Winnt? (
-			dev-libs/pthreads4w
-		)
-		app-portage/elt-patches
-		sys-apps/gentoo-functions
-		sys-devel/gnuconfig
-	)
-"
-
-src_unpack() {
-	default
-
-	if use prefix-stack ; then
-		local editor pager
-		for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
-		do
-			[[ -x ${editor} ]] || continue
-		done
-		for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
-		do
-			[[ -x ${pager} ]] || continue
-		done
-		printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
-	fi
-}
-
-my_prefixify() {
-	local ebash eenv
-	if use prefix-stack ; then
-		ebash="${BROOT}/bin/bash"
-		eenv="${BROOT}/usr/bin/env"
-	else
-		ebash="${EPREFIX}/bin/bash"
-		eenv="${EPREFIX}/usr/bin/env"
-	fi
-
-	# the @=@ prevents repoman from believing we set readonly vars
-	sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
-		-e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
-		-e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
-		-e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
-		-e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
-		-e "s,@=@,=,g" \
-		-i "$@" || die
-}
-
-src_configure() {
-	# do not eprefixify during unpack, to allow userpatches to apply
-	my_prefixify *
-}
-
-src_install-prefix-stack-ccwrap() {
-	# install toolchain wrapper.
-	local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
-	local wrappercfg=${CHOST}-${P}
-
-	exeinto $wrapperdir
-	doexe prefix-stack-ccwrap
-
-	local cc
-	for cc in \
-		gcc \
-		g++ \
-		cpp \
-		c++ \
-		windres \
-	; do
-		dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
-		dosym ${CHOST}-${cc} $wrapperdir/${cc}
-	done
-
-	# LDPATH is required to keep gcc-config happy :(
-	cat > ./${wrappercfg} <<-EOF
-		GCC_PATH="${EPREFIX}$wrapperdir"
-		LDPATH="${EPREFIX}$wrapperdir"
-		EOF
-
-	insinto /etc/env.d/gcc
-	doins ./${wrappercfg}
-}
-
-src_install() {
-	if use prefix-stack; then
-		src_install-prefix-stack-ccwrap
-		insinto /etc
-		doins prefix-stack.bash_login
-		insinto /etc/bash
-		newins prefix-stack.bashrc bashrc
-		newenvd prefix-stack.envd.99stack 99stack
-		doenvd 000fallback
-		keepdir /usr/share/aclocal
-	else
-		dobin prefix-stack-setup
-	fi
-	if use prefix; then
-		exeinto /
-		doexe startprefix
-	fi
-}
-
-pkg_preinst() {
-	use prefix-stack || return 0
-	ebegin "Purging @system package set for prefix stack"
-	# In prefix stack we empty out the @system set defined via make.profile,
-	# as we may be using some normal profile, but that @system set applies
-	# to the base prefix only.
-	# Instead, we only put ourselve into the @system set, and have additional
-	# @system packages in our RDEPEND.
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-	local systemset="/etc/portage/profile/packages"
-	dodir "${systemset%/*}"
-	[[ -s ${EROOT}${systemset} ]] &&
-		grep -v "# maintained by ${PN}" \
-			"${EROOT}${systemset}" \
-			> "${ED}${systemset}"
-	local p
-	for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
-	do
-		[[ -s ${p}/${systemset##*/} ]] || continue
-		awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
-			< "${p}"/packages || die
-	done | sort -u >> "${ED}${systemset}"
-	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
-	echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
-	eend $?
-}
-
-pkg_postinst() {
-	use prefix-stack || return 0
-	[[ -x ${EROOT}/usr/bin/gcc-config ]] || return 0
-	"${EROOT}"/usr/bin/gcc-config ${CHOST}-${P}
-}
-
-return 0
-
-: startprefix <<'EOIN'
-#!@GENTOO_PORTAGE_EBASH@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# Fabian Groffen <grobian@gentoo.org> -- 2007-03-10
-# Enters the prefix environment by starting a login shell from the
-# prefix.  The SHELL environment variable is elevated in order to make
-# applications that start login shells to work, such as `screen`.
-
-# if you come from a substantially polluted environment (another
-# Prefix), a cleanup as follows resolves most oddities I've ever seen:
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
-# hence this script starts the Prefix shell like this
-
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
-then
-	echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
-	exit -1
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
-	 [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
-then
-	echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
-	exit -1
-fi
-
-# What is our prefix?
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
-
-# not all systems have the same location for shells, however what it
-# boils down to, is that we need to know what the shell is, and then we
-# can find it in the bin dir of our prefix
-for SHELL in \
-	"${EPREFIX}/bin/${SHELL##*/}" \
-	"${BPREFIX}/bin/${SHELL##*/}" \
-	${SHELL##*/}
-do
-	[[ ${SHELL} == */* && -x ${SHELL} ]] && break
-done
-
-# check if the shell exists
-if [[ ${SHELL} != */* ]]
-then
-	echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
-	echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
-	exit 1
-fi
-
-# set the prefix shell in the environment
-export SHELL
-
-# give a small notice
-echo "Entering Gentoo Prefix ${EPREFIX}"
-# start the login shell, clean the entire environment but what's needed
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
-# ssh-agent is handy to keep, of if set, inherit it
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
-# if we're on some X terminal, makes sense to inherit that too
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
-if [[ -d /proc/registry ]]; then # we're on Cygwin
-	# crucial to Windows but cannot be restored, see
-	# https://cygwin.com/ml/cygwin/2019-08/msg00072.html
-	[[ -n ${SYSTEMDRIVE} ]] && RETAIN+=" SYSTEMDRIVE=$SYSTEMDRIVE"
-	# COMSPEC is to native Windows what SHELL is to *nix
-	[[ -n ${COMSPEC} ]] && RETAIN+=" COMSPEC=$COMSPEC"
-	# some Windows programs (e.g. devenv.exe) need TMP or TEMP
-	[[ -n ${TEMP} ]] && RETAIN+=" TEMP=$TEMP"
-fi
-# do it!
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
-	'@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
-	# shell coming from different prefix would load it's own
-	# etc/profile upon -l, so we have to override
-	'@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
-else
-	echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
-	exit 1
-fi
-# and leave a message when we exit... the shell might return non-zero
-# without having real problems, so don't send alarming messages about
-# that
-echo "Leaving Gentoo Prefix with exit status $?"
-EOIN
-
-: prefix-stack.bashrc <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, yet
-# etc/bash/bashrc from base Prefix still is useful.
-#
-
-if [[ $- != *i* ]] ; then
-	# Shell is non-interactive, bashrc does not apply
-	return
-fi
-
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
-	source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
-	# only if base Prefix does have an etc/bash/bashrc, we also
-	# run bashrc snippets provided by packages in stacked Prefix
-	for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
-		[[ -r ${sh} ]] && source "${sh}"
-	done
-	unset sh
-else
-	# etc/profile does expect etc/bash/bashrc to set PS1
-	PS1='\u@\h \w \$ '
-fi
-EOIN
-
-: prefix-stack.bash_login <<'EOIN'
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-#
-# In stacked Prefix there is no bash installed, so there is
-# no bash able to load this Prefix' profile as login shell.
-# Instead, you can specify this one as bash rcfile to mimic
-# a bash login shell using this stacked Prefix profile.
-#
-
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
-	. '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
-fi
-if [[ -s ~/.bash_profile ]] ; then
-	. ~/.bash_profile
-elif [[ -s ~/.bash_login ]] ; then
-	. ~/.bash_login
-elif [[ -s ~/.profile ]] ; then
-	. ~/.profile
-fi
-EOIN
-
-: prefix-stack.envd.99stack <<'EOIN'
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
-AT_SYS_M4DIR@=@"@GENTOO_PORTAGE_EPREFIX@/usr/share/aclocal"
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
-EOIN
-
-: prefix-stack-setup <<'EOIN'
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
-CHILD_EPREFIX=
-CHILD_PROFILE=
-CHILD_CHOST=
-
-#
-# get ourselfs the functions.sh script for ebegin/eend/etc.
-#
-for f in \
-	/lib/gentoo/functions.sh \
-	/etc/init.d/functions.sh \
-	/sbin/functions.sh \
-; do
-	if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
-		. "${PARENT_EPREFIX}${f}"
-		f=found
-		break
-	fi
-done
-
-if [[ ${f} != found ]] ; then
-	echo "Cannot find Gentoo functions, aborting." >&2
-	exit 1
-fi
-
-for arg in "$@"; do
-	case "${arg}" in
-	--eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
-	--profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
-	--chost=*)   CHILD_CHOST="${arg#--chost=}" ;;
-
-	--help)
-		einfo "$0 usage:"
-		einfo "  --eprefix=[PATH]       Path to new EPREFIX to create stacked to the prefix"
-		einfo "                         where this script is installed (${PARENT_EPREFIX})"
-		einfo "  --profile=[PATH]       The absolute path to the profile to use. This path"
-		einfo "                         must point to a directory within ${PARENT_EPREFIX}"
-		einfo "  --chost=[CHOST]        The CHOST to use for the new EPREFIX, required if"
-		einfo "                         the profile does not set CHOST, or to override."
-		exit 0
-		;;
-	esac
-done
-
-#
-# sanity check of given values
-#
-
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
-
-if [[ -z ${CHILD_CHOST} ]]
-then
-	my_lsprofile() {
-		(
-			cd -P "${1:-.}" || exit 1
-			[[ -r ./parent ]] &&
-				for p in $(<parent)
-				do
-					my_lsprofile "${p}" || exit 1
-				done
-			pwd -P
-		)
-	}
-
-	for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
-	do
-		if [[ ${profile} == missing ]]
-		then
-		  eerror "profile does not set CHOST, need --chost argument"
-		  exit 1
-		fi
-		[[ -s "${profile}/make.defaults" ]] || continue
-		grep -q '^[ 	]*CHOST@=@' "${profile}/make.defaults" && break
-	done
-fi
-
-einfo "creating stacked prefix ${CHILD_EPREFIX}"
-
-#
-# functions needed below.
-#
-eend_exit() {
-	eend $1
-	[[ $1 != 0 ]] && exit 1
-}
-
-#
-# create the directories required to bootstrap the least.
-#
-ebegin "creating directory structure"
-(
-	set -e
-	mkdir -p "${CHILD_EPREFIX}"/var/tmp/portage
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
-	mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
-	ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
-)
-eend_exit $?
-
-#
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
-#
-ebegin "creating make.conf"
-(
-	set -e
-	echo "#"
-	echo "# These are sane default compiler flags, feel free to adopt them as you like."
-	echo "# Extending the flags is done to respect flags probably set by some profile."
-	echo "#"
-	echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\""
-	echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\""
-	echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
-	niceness=$(portageq envvar PORTAGE_NICENESS || true)
-	[[ -n ${niceness} ]] &&
-		echo "PORTAGE_NICENESS=\"${niceness}\""
-	echo
-	echo "# Mirrors from parent prefix."
-	echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
-	echo
-	echo "# Below comes the prefix-stack setup. Only change things"
-	echo "# if you know exactly what you are doing!"
-	echo "EPREFIX=\"${CHILD_EPREFIX}\""
-	echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
-	echo "BROOT=\"${PARENT_EPREFIX}\""
-	echo "PORTAGE_TMPDIR=\"\${EPREFIX}/var/tmp\""
-	# Since EAPI 7 there is BDEPEND, which is DEPEND in EAPI up to 6.
-	# We do not want to pull DEPEND from EAPI <= 6, but RDEPEND only.
-	echo "EMERGE_DEFAULT_OPTS=\"--root-deps=rdeps\""
-	if [[ -n ${CHILD_CHOST} ]] ; then
-		echo "CHOST=\"${CHILD_CHOST}\""
-	fi
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf
-eend_exit $?
-
-ebegin "creating use.mask/prefix-stack"
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
-eend_exit $?
-
-ebegin "creating use.force/prefix-stack"
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
-eend_exit $?
-
-ebegin "creating env/host-cc.conf"
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
-	CC=${PARENT_CHOST}-gcc
-	CXX=${PARENT_CHOST}-g++
-	# Inherited compiler flags from parent prefix,
-	# as the child prefix may have a different compiler.
-	CFLAGS="$(portageq envvar CFLAGS)"
-	CXXFLAGS="$(portageq envvar CXXFLAGS)"
-	EOM
-eend_exit $?
-
-ebegin "creating package.env/prefix-stack"
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
-	# merge with the parent's chost. this forces the use of the parent
-	# compiler, which generally would be illegal - this is an exception.
-	# This is required for example on winnt, because the wrapper has to
-	# be able to use/resolve symlinks, etc. native winnt binaries miss
-	# that ability, but cygwin binaries don't.
-	sys-devel/gcc-config host-cc.conf
-	sys-apps/gentoo-functions host-cc.conf
-	EOM
-eend_exit $?
-
-#
-# create the make.profile symlinks.
-#
-ebegin "creating make.profile"
-(
-	ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
-)
-eend_exit $?
-
-#
-# adjust permissions of generated files.
-#
-ebegin "adjusting permissions"
-(
-	set -e
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
-	chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
-)
-eend_exit $?
-
-#
-# now merge some basics.
-#
-ebegin "installing required basic packages"
-(
-	set -e
-	export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
-	export EPREFIX@=@"${CHILD_EPREFIX}"
-	export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
-
-	# let baselayout create the directories
-	USE@=@"${USE} build" \
-	emerge --verbose --nodeps --oneshot \
-		'>=baselayout-prefix-2.6'
-
-	# In prefix-stack, app-portage/prefix-toolkit does
-	# install/update an etc/portage/profile/packages file,
-	# removing all @system packages from current make.profile,
-	# and adding itself to @system set instead.
-	emerge --verbose --nodeps --oneshot \
-		app-portage/prefix-toolkit
-
-	# In prefix-stack, prefix-toolkit does have an RDEPEND on them,
-	# to hold them in the @system set.
-	emerge --verbose --nodeps --oneshot \
-		sys-apps/gentoo-functions \
-		app-portage/elt-patches \
-		sys-devel/gnuconfig \
-		sys-devel/gcc-config
-
-	# get eventual dependencies, add to world
-	emerge --verbose --update --deep \
-		app-portage/prefix-toolkit
-
-	# select the stack wrapper profile from gcc-config
-	env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
-		"$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
-)
-eend_exit $?
-
-#
-# wow, all ok :)
-#
-ewarn
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
-ewarn
-EOIN
-
-: prefix-stack-ccwrap <<'EOIN'
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
-
-if [ -r /cygdrive/. ]; then
-	winpath2unix() { cygpath -u "$1"; }
-	unixpath2win() { cygpath -w "$1"; }
-fi
-
-myself=${0##*/} # basename $0
-link_dirs=()
-linkopts=()
-opts=()
-chost="@GENTOO_PORTAGE_CHOST@"
-prefix="@GENTOO_PORTAGE_EPREFIX@"
-absprefix=${prefix}
-if [[ ${chost} == *"-winnt"* ]]; then
-	# we may get called from windows binary, like pkgdata in dev-libs/icu
-	# in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
-	absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
-fi
-[[ ${myself} == *windres* ]] && mode=compile || mode=link
-orig_args=("$@")
-
-for opt in "$@"
-do
-	if [[ ${chost} == *"-winnt"* ]]; then
-		# We depend on dev-libs/pthreads4w, no?
-		case ${opt} in
-		-pthread | -lpthread)
-			case " ${linkopts[*]} " in
-			*" -lpthread "*) ;;
-			*) linkopts=( "${linkopts[@]}" "-lpthread" ) ;;
-			esac
-			continue
-			;;
-		esac
-	fi
-	case "$opt" in
-	-L)
-		link_dirs=("${link_dirs[@]}" "-L$1")
-		shift
-		;;
-	-L*)
-		link_dirs=("${link_dirs[@]}" "${opt}")
-		;;
-	*)
-		case "${opt}" in
-		-v)
-			# -v done right: only use mode version if -v is the _only_
-			# argument on the command line.
-			[[ ${#orig_args[@]} -gt 1 ]] || mode=version
-			;;
-		--version)	mode=version ;;
-		-c|-E|-S)	mode=compile ;;
-		-print-search-dirs) mode=dirs ;;
-		esac
-		opts=("${opts[@]}" "${opt}")
-		;;
-	esac
-done
-
-# remove any path to current prefix, need base prefix only
-new_path=
-save_ifs=$IFS
-IFS=':'
-for p in $PATH
-do
-	IFS=$save_ifs
-	[[ ${p#${absprefix}} != "${p}" ]] && continue
-	if [[ -z "${new_path}" ]]; then
-		new_path="${p}"
-	else
-		new_path="${new_path}:${p}"
-	fi
-done
-IFS=$save_ifs
-
-PATH=${new_path}
-
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
-# binutils-config's ldwrapper understands '-R' for aix and hpux too.
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
-case "${chost}" in
-*-winnt*)
-	# parity (winnt) understands -rpath only ...
-	pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
-	;;
-*-linux*)
-	# With gcc, -isystem would avoid warning messages in installed headers,
-	# but that breaks with AIX host headers.
-	pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
-	;;
-esac
-
-# ensure we run the right chost program in base prefix
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
-
-case "$mode" in
-link)    exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" "${linkopts[@]}" ;;
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
-version) exec "${myself}" "${orig_args[@]}" ;;
-dirs)
-	"${myself}" "${orig_args[@]}" | while read line; do
-		if [[ "${line}" == "libraries: ="* ]]; then
-			echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
-		else
-			echo "${line}"
-		fi
-	done
-	;;
-*)			echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
-esac
-EOIN


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-05-27 10:15 Fabian Groffen
  0 siblings, 0 replies; 30+ messages in thread
From: Fabian Groffen @ 2023-05-27 10:15 UTC (permalink / raw
  To: gentoo-commits

commit:     895a53672410e8e35b95a89f4c62f0008555fc0d
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 27 10:14:40 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 27 10:15:02 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=895a5367

app-portage/prefix-toolkit: drop deps on non-existing packages

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

 app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
index 638d73b10859..545051353617 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
@@ -13,10 +13,7 @@ SLOT="0"
 [[ ${PV} == 9999 ]] ||
 KEYWORDS="~alpha amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~riscv-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
 
-DEPEND="
-	!app-portage/prefix-chain-setup
-	!sys-apps/prefix-chain-utils
-"
+DEPEND=""
 BDEPEND="${DEPEND}
 	>sys-apps/portage-2.3.62
 "
@@ -30,7 +27,6 @@ BDEPEND="${DEPEND}
 # See also: pkg_preinst
 RDEPEND="${DEPEND}
 	prefix-stack? (
-		>=sys-apps/baselayout-prefix-2.6
 		sys-devel/gcc-config
 		elibc_Winnt? (
 			dev-libs/pthreads4w


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

* [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
@ 2023-05-27 10:44 Fabian Groffen
  0 siblings, 0 replies; 30+ messages in thread
From: Fabian Groffen @ 2023-05-27 10:44 UTC (permalink / raw
  To: gentoo-commits

commit:     08ab6901c5ad1772ea32738b4f3f0df3db153bcf
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat May 27 10:43:36 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat May 27 10:44:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08ab6901

app-portage/prefix-toolkit-10-r1: drop obsolete elibc_Winnt block

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

 app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
index 545051353617..b626552ad3e6 100644
--- a/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
+++ b/app-portage/prefix-toolkit/prefix-toolkit-10-r1.ebuild
@@ -20,17 +20,14 @@ BDEPEND="${DEPEND}
 # In prefix-stack, these dependencies actually are the @system set,
 # as we rely on the base prefix anyway for package management,
 # which should have a proper @system set.
-# Strictly speaking, only baselayout and gcc-config are necessary
-# (and pthreads4w for Winnt), but it is easier for now to install
-# elt-patches, gentoo-functions and gnuconfig as well, instead of
-# fixing all uses that expect them in EPREFIX rather than BROOT.
+# Strictly speaking, only baselayout and gcc-config are necessary, but
+# it is easier for now to install elt-patches, gentoo-functions and
+# gnuconfig as well, instead of fixing all uses that expect them in
+# EPREFIX rather than BROOT.
 # See also: pkg_preinst
 RDEPEND="${DEPEND}
 	prefix-stack? (
 		sys-devel/gcc-config
-		elibc_Winnt? (
-			dev-libs/pthreads4w
-		)
 		app-portage/elt-patches
 		sys-apps/gentoo-functions
 		sys-devel/gnuconfig


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

end of thread, other threads:[~2023-05-27 10:44 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-04 10:31 [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/ Michael Haubenwallner
  -- strict thread matches above, loose matches on Subject: below --
2023-05-27 10:44 Fabian Groffen
2023-05-27 10:15 Fabian Groffen
2023-05-27  9:29 Sam James
2023-05-26  6:25 Sam James
2023-05-26  6:23 Sam James
2023-05-26  6:23 Sam James
2023-05-26  6:23 Sam James
2023-04-24 20:15 Sam James
2023-04-24 20:15 Sam James
2023-04-24 20:13 Sam James
2022-07-11 20:19 Jakov Smolić
2021-06-02 19:01 Sam James
2021-01-06 13:23 Fabian Groffen
2020-12-27 14:01 Fabian Groffen
2020-03-13 14:35 Michael Haubenwallner
2020-03-13 14:35 Michael Haubenwallner
2020-03-09 14:56 Michael Haubenwallner
2020-03-09 14:56 Michael Haubenwallner
2020-03-09 14:56 Michael Haubenwallner
2019-09-05 10:30 Michael Haubenwallner
2019-09-04 10:31 Michael Haubenwallner
2019-06-25  9:21 Michael Haubenwallner
2019-06-17  9:44 Michael Haubenwallner
2019-06-12 15:32 Michael Haubenwallner
2019-06-05 15:39 Michael Haubenwallner
2019-05-21  8:48 Michael Haubenwallner
2019-03-26 16:11 Michael Haubenwallner
2019-03-26 15:58 Michael Haubenwallner
2019-03-25 14:19 Michael Haubenwallner

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