diff options
author | Michael Haubenwallner <haubi@gentoo.org> | 2019-09-04 12:27:33 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-05-26 07:05:52 +0100 |
commit | e1cbd953eca6c86724213363a8acc3a83c2d6b68 (patch) | |
tree | 60cd395638602dfce14f9ab9f272200721eeddf8 | |
parent | app-portage/prefix-toolkit (prefix-stack-setup): revbump (diff) | |
download | prefix-toolkit-e1cbd953eca6c86724213363a8acc3a83c2d6b68.tar.gz prefix-toolkit-e1cbd953eca6c86724213363a8acc3a83c2d6b68.tar.bz2 prefix-toolkit-e1cbd953eca6c86724213363a8acc3a83c2d6b68.zip |
app-portage/prefix-toolkit: revbumpprefix-toolkit-5
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@gentoo.org>
(cherry picked from commit 54b026b7d865a5936b16d099da8fabc372d5bd10)
-rw-r--r-- | prefix-stack-setup | 14 | ||||
-rw-r--r-- | prefix-toolkit-5.ebuild (renamed from prefix-toolkit-4.ebuild) | 23 | ||||
-rw-r--r-- | startprefix | 9 |
3 files changed, 38 insertions, 8 deletions
diff --git a/prefix-stack-setup b/prefix-stack-setup index 2b0d56e..428fa53 100644 --- a/prefix-stack-setup +++ b/prefix-stack-setup @@ -98,6 +98,7 @@ eend_exit() { 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 @@ -113,11 +114,11 @@ 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 "# 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=\"$(portageq envvar CFLAGS)\"" - echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\"" + echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\"" + echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\"" echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\"" niceness=$(portageq envvar PORTAGE_NICENESS || true) [[ -n ${niceness} ]] && @@ -131,6 +132,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\"" # 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\"" @@ -152,6 +154,10 @@ 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 $? diff --git a/prefix-toolkit-4.ebuild b/prefix-toolkit-5.ebuild index 511787e..88068a0 100644 --- a/prefix-toolkit-4.ebuild +++ b/prefix-toolkit-5.ebuild @@ -239,6 +239,15 @@ RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL" [[ -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 @@ -412,6 +421,7 @@ eend_exit() { 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 @@ -427,11 +437,11 @@ 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 "# 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=\"$(portageq envvar CFLAGS)\"" - echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\"" + echo "CFLAGS=\"\${CFLAGS} -O2 -pipe\"" + echo "CXXFLAGS=\"${CXXFLAGS} -O2 -pipe\"" echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\"" niceness=$(portageq envvar PORTAGE_NICENESS || true) [[ -n ${niceness} ]] && @@ -445,6 +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\"" # 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\"" @@ -466,6 +477,10 @@ 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 $? diff --git a/startprefix b/startprefix index 89ce10f..c720b1d 100644 --- a/startprefix +++ b/startprefix @@ -59,6 +59,15 @@ RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL" [[ -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 |