Gentoo Archives: gentoo-commits

From: Michael Haubenwallner <haubi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-portage/prefix-toolkit/
Date: Wed, 04 Sep 2019 10:31:35
Message-Id: 1567593046.15412e3fc028c8b6cfc669b5ccb1117a27b12e3e.haubi@gentoo
1 commit: 15412e3fc028c8b6cfc669b5ccb1117a27b12e3e
2 Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 4 10:29:57 2019 +0000
4 Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 4 10:30:46 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15412e3f
7
8 app-portage/prefix-toolkit: old
9
10 Package-Manager: Portage-2.3.69, Repoman-2.3.16
11 Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>
12
13 app-portage/prefix-toolkit/prefix-toolkit-3.ebuild | 647 ---------------------
14 1 file changed, 647 deletions(-)
15
16 diff --git a/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild
17 deleted file mode 100644
18 index e4719f87c3a..00000000000
19 --- a/app-portage/prefix-toolkit/prefix-toolkit-3.ebuild
20 +++ /dev/null
21 @@ -1,647 +0,0 @@
22 -# Copyright 1999-2019 Gentoo Authors
23 -# Distributed under the terms of the GNU General Public License v2
24 -
25 -EAPI=7
26 -
27 -DESCRIPTION="Utilities for users of Gentoo Prefix"
28 -HOMEPAGE="https://prefix.gentoo.org/"
29 -SRC_URI=""
30 -
31 -LICENSE="GPL-3"
32 -SLOT="0"
33 -
34 -[[ ${PV} == 9999 ]] ||
35 -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"
36 -
37 -DEPEND="
38 - !app-portage/prefix-chain-setup
39 - !sys-apps/prefix-chain-utils
40 -"
41 -BDEPEND="${DEPEND}
42 - >sys-apps/portage-2.3.62
43 -"
44 -# In prefix-stack, these dependencies actually are the @system set,
45 -# as we rely on the base prefix anyway for package management,
46 -# which should have a proper @system set.
47 -# See als: pkg_preinst
48 -RDEPEND="${DEPEND}
49 - prefix-stack? (
50 - >=sys-apps/baselayout-prefix-2.6
51 - sys-apps/gentoo-functions
52 - app-portage/elt-patches
53 - sys-devel/gnuconfig
54 - sys-devel/gcc-config
55 - )
56 -"
57 -
58 -S="${WORKDIR}"
59 -
60 -my_unpack() {
61 - local infile=$1
62 - local outfile=${2:-${infile}}
63 - ebegin "extracting ${outfile}"
64 - sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \
65 - > "${outfile}" || die "Failed to unpack ${outfile}"
66 - eend $?
67 -}
68 -
69 -src_unpack() {
70 - if use prefix-stack ; then
71 - my_unpack prefix-stack.bash_login
72 - my_unpack prefix-stack.bashrc
73 - my_unpack prefix-stack.envd.99stack
74 - my_unpack prefix-stack-ccwrap
75 - local editor pager
76 - for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano
77 - do
78 - [[ -x ${editor} ]] || continue
79 - done
80 - for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less
81 - do
82 - [[ -x ${pager} ]] || continue
83 - done
84 - printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback
85 - else
86 - my_unpack prefix-stack-setup
87 - fi
88 - my_unpack startprefix
89 -}
90 -
91 -my_prefixify() {
92 - local ebash eenv
93 - if use prefix-stack ; then
94 - ebash="${BROOT}/bin/bash"
95 - eenv="${BROOT}/usr/bin/env"
96 - else
97 - ebash="${EPREFIX}/bin/bash"
98 - eenv="${EPREFIX}/usr/bin/env"
99 - fi
100 -
101 - # the @=@ prevents repoman from believing we set readonly vars
102 - sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \
103 - -e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \
104 - -e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \
105 - -e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \
106 - -e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \
107 - -e "s,@=@,=,g" \
108 - -i "$@" || die
109 -}
110 -
111 -src_configure() {
112 - # do not eprefixify during unpack, to allow userpatches to apply
113 - my_prefixify *
114 -}
115 -
116 -src_install-prefix-stack-ccwrap() {
117 - # install toolchain wrapper.
118 - local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV}
119 - local wrappercfg=${CHOST}-${P}
120 -
121 - exeinto $wrapperdir
122 - doexe prefix-stack-ccwrap
123 -
124 - local cc
125 - for cc in \
126 - gcc \
127 - g++ \
128 - cpp \
129 - c++ \
130 - windres \
131 - ; do
132 - dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc}
133 - dosym ${CHOST}-${cc} $wrapperdir/${cc}
134 - done
135 -
136 - # LDPATH is required to keep gcc-config happy :(
137 - cat > ./${wrappercfg} <<-EOF
138 - GCC_PATH="${EPREFIX}$wrapperdir"
139 - LDPATH="${EPREFIX}$wrapperdir"
140 - EOF
141 -
142 - insinto /etc/env.d/gcc
143 - doins ./${wrappercfg}
144 -}
145 -
146 -src_install() {
147 - if use prefix-stack; then
148 - src_install-prefix-stack-ccwrap
149 - insinto /etc
150 - doins prefix-stack.bash_login
151 - insinto /etc/bash
152 - newins prefix-stack.bashrc bashrc
153 - newenvd prefix-stack.envd.99stack 99stack
154 - doenvd 000fallback
155 - else
156 - dobin prefix-stack-setup
157 - fi
158 - exeinto /
159 - doexe startprefix
160 -}
161 -
162 -pkg_preinst() {
163 - use prefix-stack || return 0
164 - ebegin "Purging @system package set for prefix stack"
165 - # In prefix stack we empty out the @system set defined via make.profile,
166 - # as we may be using some normal profile, but that @system set applies
167 - # to the base prefix only.
168 - # Instead, we only put ourselve into the @system set, and have additional
169 - # @system packages in our RDEPEND.
170 - my_lsprofile() {
171 - (
172 - cd -P "${1:-.}" || exit 1
173 - [[ -r ./parent ]] &&
174 - for p in $(<parent)
175 - do
176 - my_lsprofile "${p}" || exit 1
177 - done
178 - pwd -P
179 - )
180 - }
181 - local systemset="/etc/portage/profile/packages"
182 - dodir "${systemset%/*}"
183 - [[ -s ${EROOT}${systemset} ]] &&
184 - grep -v "# maintained by ${PN}" \
185 - "${EROOT}${systemset}" \
186 - > "${ED}${systemset}"
187 - local p
188 - for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile)
189 - do
190 - [[ -s ${p}/${systemset##*/} ]] || continue
191 - awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \
192 - < "${p}"/packages || die
193 - done | sort -u >> "${ED}${systemset}"
194 - [[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}"
195 - echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die
196 - eend $?
197 -}
198 -
199 -return 0
200 -
201 -: startprefix <<'EOIN'
202 -#!@GENTOO_PORTAGE_EBASH@
203 -# Copyright 1999-2019 Gentoo Authors
204 -# Distributed under the terms of the GNU General Public License v2
205 -
206 -# Fabian Groffen <grobian@g.o> -- 2007-03-10
207 -# Enters the prefix environment by starting a login shell from the
208 -# prefix. The SHELL environment variable is elevated in order to make
209 -# applications that start login shells to work, such as `screen`.
210 -
211 -# if you come from a substantially polluted environment (another
212 -# Prefix), a cleanup as follows resolves most oddities I've ever seen:
213 -# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l
214 -# hence this script starts the Prefix shell like this
215 -
216 -if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]]
217 -then
218 - echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr
219 - exit -1
220 -elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] &&
221 - [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]]
222 -then
223 - echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr
224 - exit -1
225 -fi
226 -
227 -# What is our prefix?
228 -EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@'
229 -BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@'
230 -
231 -# not all systems have the same location for shells, however what it
232 -# boils down to, is that we need to know what the shell is, and then we
233 -# can find it in the bin dir of our prefix
234 -for SHELL in \
235 - "${EPREFIX}/bin/${SHELL##*/}" \
236 - "${BPREFIX}/bin/${SHELL##*/}" \
237 - ${SHELL##*/}
238 -do
239 - [[ ${SHELL} == */* && -x ${SHELL} ]] && break
240 -done
241 -
242 -# check if the shell exists
243 -if [[ ${SHELL} != */* ]]
244 -then
245 - echo "Failed to find the Prefix shell, this is probably" > /dev/stderr
246 - echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr
247 - exit 1
248 -fi
249 -
250 -# set the prefix shell in the environment
251 -export SHELL
252 -
253 -# give a small notice
254 -echo "Entering Gentoo Prefix ${EPREFIX}"
255 -# start the login shell, clean the entire environment but what's needed
256 -RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL"
257 -# PROFILEREAD is necessary on SUSE not to wipe the env on shell start
258 -[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD"
259 -# ssh-agent is handy to keep, of if set, inherit it
260 -[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK"
261 -# if we're on some X terminal, makes sense to inherit that too
262 -[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY"
263 -# do it!
264 -if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then
265 - '@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l
266 -elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then
267 - # shell coming from different prefix would load it's own
268 - # etc/profile upon -l, so we have to override
269 - '@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i
270 -else
271 - echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr
272 - exit 1
273 -fi
274 -# and leave a message when we exit... the shell might return non-zero
275 -# without having real problems, so don't send alarming messages about
276 -# that
277 -echo "Leaving Gentoo Prefix with exit status $?"
278 -EOIN
279 -
280 -: prefix-stack.bashrc <<'EOIN'
281 -# Copyright 1999-2019 Gentoo Authors
282 -# Distributed under the terms of the GNU General Public License v2
283 -#
284 -# In stacked Prefix there is no bash installed, yet
285 -# etc/bash/bashrc from base Prefix still is useful.
286 -#
287 -
288 -if [[ $- != *i* ]] ; then
289 - # Shell is non-interactive, bashrc does not apply
290 - return
291 -fi
292 -
293 -if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then
294 - source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc'
295 - # only if base Prefix does have an etc/bash/bashrc, we also
296 - # run bashrc snippets provided by packages in stacked Prefix
297 - for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do
298 - [[ -r ${sh} ]] && source "${sh}"
299 - done
300 - unset sh
301 -else
302 - # etc/profile does expect etc/bash/bashrc to set PS1
303 - PS1='\u@\h \w \$ '
304 -fi
305 -EOIN
306 -
307 -: prefix-stack.bash_login <<'EOIN'
308 -# Copyright 1999-2019 Gentoo Authors
309 -# Distributed under the terms of the GNU General Public License v2
310 -#
311 -# In stacked Prefix there is no bash installed, so there is
312 -# no bash able to load this Prefix' profile as login shell.
313 -# Instead, you can specify this one as bash rcfile to mimic
314 -# a bash login shell using this stacked Prefix profile.
315 -#
316 -
317 -if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then
318 - . '@GENTOO_PORTAGE_EPREFIX@/etc/profile'
319 -fi
320 -if [[ -s ~/.bash_profile ]] ; then
321 - . ~/.bash_profile
322 -elif [[ -s ~/.bash_login ]] ; then
323 - . ~/.bash_login
324 -elif [[ -s ~/.profile ]] ; then
325 - . ~/.profile
326 -fi
327 -EOIN
328 -
329 -: prefix-stack.envd.99stack <<'EOIN'
330 -PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig"
331 -PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@"
332 -EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@"
333 -EOIN
334 -
335 -: prefix-stack-setup <<'EOIN'
336 -#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
337 -# Copyright 1999-2019 Gentoo Authors
338 -# Distributed under the terms of the GNU General Public License v2
339 -
340 -PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
341 -PARENT_CHOST="@GENTOO_PORTAGE_CHOST@"
342 -CHILD_EPREFIX=
343 -CHILD_PROFILE=
344 -CHILD_CHOST=
345 -
346 -#
347 -# get ourselfs the functions.sh script for ebegin/eend/etc.
348 -#
349 -for f in \
350 - /lib/gentoo/functions.sh \
351 - /etc/init.d/functions.sh \
352 - /sbin/functions.sh \
353 -; do
354 - if [[ -r ${PARENT_EPREFIX}${f} ]] ; then
355 - . "${PARENT_EPREFIX}${f}"
356 - f=found
357 - break
358 - fi
359 -done
360 -
361 -if [[ ${f} != found ]] ; then
362 - echo "Cannot find Gentoo functions, aborting." >&2
363 - exit 1
364 -fi
365 -
366 -for arg in "$@"; do
367 - case "${arg}" in
368 - --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;;
369 - --profile=*) CHILD_PROFILE="${arg#--profile=}" ;;
370 - --chost=*) CHILD_CHOST="${arg#--chost=}" ;;
371 -
372 - --help)
373 - einfo "$0 usage:"
374 - einfo " --eprefix=[PATH] Path to new EPREFIX to create stacked to the prefix"
375 - einfo " where this script is installed (${PARENT_EPREFIX})"
376 - einfo " --profile=[PATH] The absolute path to the profile to use. This path"
377 - einfo " must point to a directory within ${PARENT_EPREFIX}"
378 - einfo " --chost=[CHOST] The CHOST to use for the new EPREFIX, required if"
379 - einfo " the profile does not set CHOST, or to override."
380 - exit 0
381 - ;;
382 - esac
383 -done
384 -
385 -#
386 -# sanity check of given values
387 -#
388 -
389 -test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; }
390 -test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; }
391 -test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; }
392 -test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; }
393 -
394 -if [[ -z ${CHILD_CHOST} ]]
395 -then
396 - my_lsprofile() {
397 - (
398 - cd -P "${1:-.}" || exit 1
399 - [[ -r ./parent ]] &&
400 - for p in $(<parent)
401 - do
402 - my_lsprofile "${p}" || exit 1
403 - done
404 - pwd -P
405 - )
406 - }
407 -
408 - for profile in $(my_lsprofile "${CHILD_PROFILE}") missing
409 - do
410 - if [[ ${profile} == missing ]]
411 - then
412 - eerror "profile does not set CHOST, need --chost argument"
413 - exit 1
414 - fi
415 - [[ -s "${profile}/make.defaults" ]] || continue
416 - grep -q '^[ ]*CHOST@=@' "${profile}/make.defaults" && break
417 - done
418 -fi
419 -
420 -einfo "creating stacked prefix ${CHILD_EPREFIX}"
421 -
422 -#
423 -# functions needed below.
424 -#
425 -eend_exit() {
426 - eend $1
427 - [[ $1 != 0 ]] && exit 1
428 -}
429 -
430 -#
431 -# create the directories required to bootstrap the least.
432 -#
433 -ebegin "creating directory structure"
434 -(
435 - set -e
436 - mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask
437 - mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force
438 - mkdir -p "${CHILD_EPREFIX}"/etc/portage/env
439 - mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env
440 - ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf
441 -)
442 -eend_exit $?
443 -
444 -#
445 -# create a make.conf and set PORTDIR and PORTAGE_TMPDIR
446 -#
447 -ebegin "creating make.conf"
448 -(
449 - set -e
450 - echo "#"
451 - echo "# The following values where taken from the parent prefix's"
452 - echo "# environment. Feel free to adopt them as you like."
453 - echo "#"
454 - echo "CFLAGS=\"$(portageq envvar CFLAGS)\""
455 - echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\""
456 - echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\""
457 - niceness=$(portageq envvar PORTAGE_NICENESS || true)
458 - [[ -n ${niceness} ]] &&
459 - echo "PORTAGE_NICENESS=\"${niceness}\""
460 - echo
461 - echo "# Mirrors from parent prefix."
462 - echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\""
463 - echo
464 - echo "# Below comes the prefix-stack setup. Only change things"
465 - echo "# if you know exactly what you are doing!"
466 - echo "EPREFIX=\"${CHILD_EPREFIX}\""
467 - echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\""
468 - echo "BROOT=\"${PARENT_EPREFIX}\""
469 - if [[ -n ${CHILD_CHOST} ]] ; then
470 - echo "CHOST=\"${CHILD_CHOST}\""
471 - fi
472 -) > "${CHILD_EPREFIX}"/etc/portage/make.conf
473 -eend_exit $?
474 -
475 -ebegin "creating use.mask/prefix-stack"
476 -printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack
477 -eend_exit $?
478 -
479 -ebegin "creating use.force/prefix-stack"
480 -printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack
481 -eend_exit $?
482 -
483 -ebegin "creating env/host-cc.conf"
484 -cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM
485 - CC=${PARENT_CHOST}-gcc
486 - CXX=${PARENT_CHOST}-g++
487 - EOM
488 -eend_exit $?
489 -
490 -ebegin "creating package.env/prefix-stack"
491 -cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM'
492 - # merge with the parent's chost. this forces the use of the parent
493 - # compiler, which generally would be illegal - this is an exception.
494 - # This is required for example on winnt, because the wrapper has to
495 - # be able to use/resolve symlinks, etc. native winnt binaries miss
496 - # that ability, but cygwin binaries don't.
497 - sys-devel/gcc-config host-cc.conf
498 - sys-apps/gentoo-functions host-cc.conf
499 - EOM
500 -eend_exit $?
501 -
502 -#
503 -# create the make.profile symlinks.
504 -#
505 -ebegin "creating make.profile"
506 -(
507 - ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile"
508 -)
509 -eend_exit $?
510 -
511 -#
512 -# adjust permissions of generated files.
513 -#
514 -ebegin "adjusting permissions"
515 -(
516 - set -e
517 - chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf
518 - chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf
519 - chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack
520 -)
521 -eend_exit $?
522 -
523 -#
524 -# now merge some basics.
525 -#
526 -ebegin "installing required basic packages"
527 -(
528 - set -e
529 - export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}"
530 - export EPREFIX@=@"${CHILD_EPREFIX}"
531 - export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}"
532 -
533 - # let baselayout create the directories
534 - USE@=@"${USE} build" \
535 - emerge --verbose --nodeps --oneshot \
536 - '>=baselayout-prefix-2.6'
537 -
538 - # In prefix-stack, app-portage/prefix-toolkit does
539 - # install/update an etc/portage/profile/packages file,
540 - # removing all @system packages from current make.profile,
541 - # and adding itself to @system set instead.
542 - emerge --verbose --nodeps --oneshot \
543 - app-portage/prefix-toolkit
544 -
545 - # In prefix-stack, prefix-toolkit does have an RDEPEND on them,
546 - # to hold them in the @system set.
547 - emerge --verbose --nodeps --oneshot \
548 - sys-apps/gentoo-functions \
549 - app-portage/elt-patches \
550 - sys-devel/gnuconfig \
551 - sys-devel/gcc-config
552 -
553 - # select the stack wrapper profile from gcc-config
554 - env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \
555 - "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1
556 -)
557 -eend_exit $?
558 -
559 -#
560 -# wow, all ok :)
561 -#
562 -ewarn
563 -ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf."
564 -ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"."
565 -ewarn
566 -EOIN
567 -
568 -: prefix-stack-ccwrap <<'EOIN'
569 -#!@GENTOO_PORTAGE_BPREFIX@/bin/bash
570 -
571 -if [ -r /cygdrive/. ]; then
572 - winpath2unix() { cygpath -u "$1"; }
573 - unixpath2win() { cygpath -w "$1"; }
574 -fi
575 -
576 -myself=${0##*/} # basename $0
577 -link_dirs=()
578 -opts=()
579 -chost="@GENTOO_PORTAGE_CHOST@"
580 -prefix="@GENTOO_PORTAGE_EPREFIX@"
581 -absprefix=${prefix}
582 -if [[ ${chost} == *"-winnt"* ]]; then
583 - # we may get called from windows binary, like pkgdata in dev-libs/icu
584 - # in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix
585 - absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")")
586 -fi
587 -[[ ${myself} == *windres* ]] && mode=compile || mode=link
588 -orig_args=("$@")
589 -
590 -for opt in "$@"
591 -do
592 - case "$opt" in
593 - -L)
594 - link_dirs=("${link_dirs[@]}" "-L$1")
595 - shift
596 - ;;
597 - -L*)
598 - link_dirs=("${link_dirs[@]}" "${opt}")
599 - ;;
600 - *)
601 - case "${opt}" in
602 - -v)
603 - # -v done right: only use mode version if -v is the _only_
604 - # argument on the command line.
605 - [[ ${#orig_args[@]} -gt 1 ]] || mode=version
606 - ;;
607 - --version) mode=version ;;
608 - -c|-E|-S) mode=compile ;;
609 - -print-search-dirs) mode=dirs ;;
610 - esac
611 - opts=("${opts[@]}" "${opt}")
612 - ;;
613 - esac
614 -done
615 -
616 -# remove any path to current prefix, need base prefix only
617 -new_path=
618 -save_ifs=$IFS
619 -IFS=':'
620 -for p in $PATH
621 -do
622 - IFS=$save_ifs
623 - [[ ${p#${absprefix}} != "${p}" ]] && continue
624 - if [[ -z "${new_path}" ]]; then
625 - new_path="${p}"
626 - else
627 - new_path="${new_path}:${p}"
628 - fi
629 -done
630 -IFS=$save_ifs
631 -
632 -PATH=${new_path}
633 -
634 -pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include")
635 -pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib")
636 -# binutils-config's ldwrapper understands '-R' for aix and hpux too.
637 -pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib")
638 -case "${chost}" in
639 -*-winnt*)
640 - # parity (winnt) understands -rpath only ...
641 - pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib")
642 - ;;
643 -*-linux*)
644 - # With gcc, -isystem would avoid warning messages in installed headers,
645 - # but that breaks with AIX host headers.
646 - pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include")
647 - ;;
648 -esac
649 -
650 -# ensure we run the right chost program in base prefix
651 -[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-}
652 -
653 -case "$mode" in
654 -link) exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;;
655 -compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;;
656 -version) exec "${myself}" "${orig_args[@]}" ;;
657 -dirs)
658 - "${myself}" "${orig_args[@]}" | while read line; do
659 - if [[ "${line}" == "libraries: ="* ]]; then
660 - echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}"
661 - else
662 - echo "${line}"
663 - fi
664 - done
665 - ;;
666 -*) echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;;
667 -esac
668 -EOIN