summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-05-26 06:49:49 +0100
committerSam James <sam@gentoo.org>2023-05-26 06:49:49 +0100
commit3b7b0bcf765d9539e6bea324ad705c4a071cc59d (patch)
tree60cd395638602dfce14f9ab9f272200721eeddf8
parentImport prefix-toolkit-4 (diff)
downloadprefix-toolkit-3b7b0bcf765d9539e6bea324ad705c4a071cc59d.tar.gz
prefix-toolkit-3b7b0bcf765d9539e6bea324ad705c4a071cc59d.tar.bz2
prefix-toolkit-3b7b0bcf765d9539e6bea324ad705c4a071cc59d.zip
Import prefix-toolkit-5
From ::gentoo at 54b026b7d865a5936b16d099da8fabc372d5bd10. Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--prefix-stack-setup14
-rw-r--r--prefix-toolkit-5.ebuild (renamed from prefix-toolkit-4.ebuild)23
-rw-r--r--startprefix9
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