1 |
commit: 028e1033d6b22f0b9d7af5f796d232a912923547 |
2 |
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jun 25 09:20:34 2019 +0000 |
4 |
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jun 25 09:21:01 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=028e1033 |
7 |
|
8 |
app-portage/prefix-toolkit: old |
9 |
|
10 |
Package-Manager: Portage-2.3.66, Repoman-2.3.11 |
11 |
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org> |
12 |
|
13 |
app-portage/prefix-toolkit/prefix-toolkit-0.ebuild | 565 ------------------- |
14 |
app-portage/prefix-toolkit/prefix-toolkit-1.ebuild | 567 ------------------- |
15 |
app-portage/prefix-toolkit/prefix-toolkit-2.ebuild | 614 --------------------- |
16 |
3 files changed, 1746 deletions(-) |
17 |
|
18 |
diff --git a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild |
19 |
deleted file mode 100644 |
20 |
index ae2ca111bab..00000000000 |
21 |
--- a/app-portage/prefix-toolkit/prefix-toolkit-0.ebuild |
22 |
+++ /dev/null |
23 |
@@ -1,565 +0,0 @@ |
24 |
-# Copyright 1999-2019 Gentoo Authors |
25 |
-# Distributed under the terms of the GNU General Public License v2 |
26 |
- |
27 |
-EAPI=7 |
28 |
- |
29 |
-DESCRIPTION="Utilities for users of Gentoo Prefix" |
30 |
-HOMEPAGE="https://prefix.gentoo.org/" |
31 |
-SRC_URI="" |
32 |
- |
33 |
-LICENSE="GPL-3" |
34 |
-SLOT="0" |
35 |
- |
36 |
-[[ ${PV} == 9999 ]] || |
37 |
-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" |
38 |
- |
39 |
-DEPEND="" |
40 |
-RDEPEND=" |
41 |
- >sys-apps/portage-2.3.62 |
42 |
- !app-portage/prefix-chain-setup |
43 |
- !sys-apps/prefix-chain-utils |
44 |
- prefix-stack? ( |
45 |
- >=sys-apps/baselayout-prefix-2.6 |
46 |
- ) |
47 |
-" |
48 |
- |
49 |
-S="${WORKDIR}" |
50 |
- |
51 |
-my_unpack() { |
52 |
- local infile=$1 |
53 |
- local outfile=${2:-${infile}} |
54 |
- ebegin "extracting ${outfile}" |
55 |
- sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \ |
56 |
- > "${outfile}" || die "Failed to unpack ${outfile}" |
57 |
- eend $? |
58 |
-} |
59 |
- |
60 |
-src_unpack() { |
61 |
- if use prefix-stack ; then |
62 |
- my_unpack prefix-stack.bash_login |
63 |
- my_unpack prefix-stack.bashrc |
64 |
- my_unpack prefix-stack.envd.99stack |
65 |
- my_unpack prefix-stack-ccwrap |
66 |
- local editor pager |
67 |
- for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano |
68 |
- do |
69 |
- [[ -x ${editor} ]] || continue |
70 |
- done |
71 |
- for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less |
72 |
- do |
73 |
- [[ -x ${pager} ]] || continue |
74 |
- done |
75 |
- printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback |
76 |
- else |
77 |
- my_unpack prefix-stack-setup |
78 |
- fi |
79 |
- my_unpack startprefix |
80 |
-} |
81 |
- |
82 |
-my_prefixify() { |
83 |
- local ebash eenv |
84 |
- if use prefix-stack ; then |
85 |
- ebash="${BROOT}/bin/bash" |
86 |
- eenv="${BROOT}/usr/bin/env" |
87 |
- else |
88 |
- ebash="${EPREFIX}/bin/bash" |
89 |
- eenv="${EPREFIX}/usr/bin/env" |
90 |
- fi |
91 |
- |
92 |
- # the @=@ prevents repoman from believing we set readonly vars |
93 |
- sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \ |
94 |
- -e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \ |
95 |
- -e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \ |
96 |
- -e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \ |
97 |
- -e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \ |
98 |
- -e "s,@=@,=,g" \ |
99 |
- -i "$@" || die |
100 |
-} |
101 |
- |
102 |
-src_configure() { |
103 |
- # do not eprefixify during unpack, to allow userpatches to apply |
104 |
- my_prefixify * |
105 |
-} |
106 |
- |
107 |
-src_install-prefix-stack-ccwrap() { |
108 |
- # install toolchain wrapper. |
109 |
- local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV} |
110 |
- local wrappercfg=${CHOST}-${P} |
111 |
- |
112 |
- exeinto $wrapperdir |
113 |
- doexe prefix-stack-ccwrap |
114 |
- |
115 |
- local cc |
116 |
- for cc in \ |
117 |
- gcc \ |
118 |
- g++ \ |
119 |
- cpp \ |
120 |
- c++ \ |
121 |
- windres \ |
122 |
- ; do |
123 |
- dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc} |
124 |
- dosym ${CHOST}-${cc} $wrapperdir/${cc} |
125 |
- done |
126 |
- |
127 |
- # LDPATH is required to keep gcc-config happy :( |
128 |
- cat > ./${wrappercfg} <<-EOF |
129 |
- GCC_PATH="${EPREFIX}$wrapperdir" |
130 |
- LDPATH="${EPREFIX}$wrapperdir" |
131 |
- EOF |
132 |
- |
133 |
- insinto /etc/env.d/gcc |
134 |
- doins ./${wrappercfg} |
135 |
-} |
136 |
- |
137 |
-src_install() { |
138 |
- if use prefix-stack; then |
139 |
- src_install-prefix-stack-ccwrap |
140 |
- insinto /etc |
141 |
- doins prefix-stack.bash_login |
142 |
- insinto /etc/bash |
143 |
- newins prefix-stack.bashrc bashrc |
144 |
- newenvd prefix-stack.envd.99stack 99stack |
145 |
- doenvd 000fallback |
146 |
- else |
147 |
- dobin prefix-stack-setup |
148 |
- fi |
149 |
- exeinto / |
150 |
- doexe startprefix |
151 |
-} |
152 |
- |
153 |
-return 0 |
154 |
- |
155 |
-: startprefix <<'EOIN' |
156 |
-#!@GENTOO_PORTAGE_EBASH@ |
157 |
-# Copyright 1999-2019 Gentoo Authors |
158 |
-# Distributed under the terms of the GNU General Public License v2 |
159 |
- |
160 |
-# Fabian Groffen <grobian@g.o> -- 2007-03-10 |
161 |
-# Enters the prefix environment by starting a login shell from the |
162 |
-# prefix. The SHELL environment variable is elevated in order to make |
163 |
-# applications that start login shells to work, such as `screen`. |
164 |
- |
165 |
-# if you come from a substantially polluted environment (another |
166 |
-# Prefix), a cleanup as follows resolves most oddities I've ever seen: |
167 |
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l |
168 |
-# hence this script starts the Prefix shell like this |
169 |
- |
170 |
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]] |
171 |
-then |
172 |
- echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr |
173 |
- exit -1 |
174 |
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] && |
175 |
- [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]] |
176 |
-then |
177 |
- echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr |
178 |
- exit -1 |
179 |
-fi |
180 |
- |
181 |
-# What is our prefix? |
182 |
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@' |
183 |
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@' |
184 |
- |
185 |
-# not all systems have the same location for shells, however what it |
186 |
-# boils down to, is that we need to know what the shell is, and then we |
187 |
-# can find it in the bin dir of our prefix |
188 |
-for SHELL in \ |
189 |
- "${EPREFIX}/bin/${SHELL##*/}" \ |
190 |
- "${BPREFIX}/bin/${SHELL##*/}" \ |
191 |
- ${SHELL##*/} |
192 |
-do |
193 |
- [[ ${SHELL} == */* && -x ${SHELL} ]] && break |
194 |
-done |
195 |
- |
196 |
-# check if the shell exists |
197 |
-if [[ ${SHELL} != */* ]] |
198 |
-then |
199 |
- echo "Failed to find the Prefix shell, this is probably" > /dev/stderr |
200 |
- echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr |
201 |
- exit 1 |
202 |
-fi |
203 |
- |
204 |
-# set the prefix shell in the environment |
205 |
-export SHELL |
206 |
- |
207 |
-# give a small notice |
208 |
-echo "Entering Gentoo Prefix ${EPREFIX}" |
209 |
-# start the login shell, clean the entire environment but what's needed |
210 |
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL" |
211 |
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start |
212 |
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD" |
213 |
-# ssh-agent is handy to keep, of if set, inherit it |
214 |
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK" |
215 |
-# if we're on some X terminal, makes sense to inherit that too |
216 |
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY" |
217 |
-# do it! |
218 |
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then |
219 |
- '@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l |
220 |
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then |
221 |
- # shell coming from different prefix would load it's own |
222 |
- # etc/profile upon -l, so we have to override |
223 |
- '@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i |
224 |
-else |
225 |
- echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr |
226 |
- exit 1 |
227 |
-fi |
228 |
-# and leave a message when we exit... the shell might return non-zero |
229 |
-# without having real problems, so don't send alarming messages about |
230 |
-# that |
231 |
-echo "Leaving Gentoo Prefix with exit status $?" |
232 |
-EOIN |
233 |
- |
234 |
-: prefix-stack.bashrc <<'EOIN' |
235 |
-# Copyright 1999-2019 Gentoo Authors |
236 |
-# Distributed under the terms of the GNU General Public License v2 |
237 |
-# |
238 |
-# In stacked Prefix there is no bash installed, yet |
239 |
-# etc/bash/bashrc from base Prefix still is useful. |
240 |
-# |
241 |
- |
242 |
-if [[ $- != *i* ]] ; then |
243 |
- # Shell is non-interactive, bashrc does not apply |
244 |
- return |
245 |
-fi |
246 |
- |
247 |
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then |
248 |
- source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc' |
249 |
- # only if base Prefix does have an etc/bash/bashrc, we also |
250 |
- # run bashrc snippets provided by packages in stacked Prefix |
251 |
- for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do |
252 |
- [[ -r ${sh} ]] && source "${sh}" |
253 |
- done |
254 |
- unset sh |
255 |
-else |
256 |
- # etc/profile does expect etc/bash/bashrc to set PS1 |
257 |
- PS1='\u@\h \w \$ ' |
258 |
-fi |
259 |
-EOIN |
260 |
- |
261 |
-: prefix-stack.bash_login <<'EOIN' |
262 |
-# Copyright 1999-2019 Gentoo Authors |
263 |
-# Distributed under the terms of the GNU General Public License v2 |
264 |
-# |
265 |
-# In stacked Prefix there is no bash installed, so there is |
266 |
-# no bash able to load this Prefix' profile as login shell. |
267 |
-# Instead, you can specify this one as bash rcfile to mimic |
268 |
-# a bash login shell using this stacked Prefix profile. |
269 |
-# |
270 |
- |
271 |
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then |
272 |
- . '@GENTOO_PORTAGE_EPREFIX@/etc/profile' |
273 |
-fi |
274 |
-if [[ -s ~/.bash_profile ]] ; then |
275 |
- . ~/.bash_profile |
276 |
-elif [[ -s ~/.bash_login ]] ; then |
277 |
- . ~/.bash_login |
278 |
-elif [[ -s ~/.profile ]] ; then |
279 |
- . ~/.profile |
280 |
-fi |
281 |
-EOIN |
282 |
- |
283 |
-: prefix-stack.envd.99stack <<'EOIN' |
284 |
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig" |
285 |
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@" |
286 |
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@" |
287 |
-EOIN |
288 |
- |
289 |
-: prefix-stack-setup <<'EOIN' |
290 |
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash |
291 |
-# Copyright 1999-2019 Gentoo Authors |
292 |
-# Distributed under the terms of the GNU General Public License v2 |
293 |
- |
294 |
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@" |
295 |
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@" |
296 |
-CHILD_EPREFIX= |
297 |
-CHILD_PROFILE= |
298 |
- |
299 |
-# |
300 |
-# get ourselfs the functions.sh script for ebegin/eend/etc. |
301 |
-# |
302 |
-for f in \ |
303 |
- /lib/gentoo/functions.sh \ |
304 |
- /etc/init.d/functions.sh \ |
305 |
- /sbin/functions.sh \ |
306 |
-; do |
307 |
- if [[ -r ${PARENT_EPREFIX}${f} ]] ; then |
308 |
- . "${PARENT_EPREFIX}${f}" |
309 |
- f=found |
310 |
- break |
311 |
- fi |
312 |
-done |
313 |
- |
314 |
-if [[ ${f} != found ]] ; then |
315 |
- echo "Cannot find Gentoo functions, aborting." >&2 |
316 |
- exit 1 |
317 |
-fi |
318 |
- |
319 |
-for arg in "$@"; do |
320 |
- case "${arg}" in |
321 |
- --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;; |
322 |
- --profile=*) CHILD_PROFILE="${arg#--profile=}" ;; |
323 |
- |
324 |
- --help) |
325 |
- einfo "$0 usage:" |
326 |
- einfo " --eprefix=[PATH] Path to new EPREFIX to create stacked to the prefix" |
327 |
- einfo " where this script is installed (${PARENT_EPREFIX})" |
328 |
- einfo " --profile=[PATH] The absolute path to the profile to use. This path" |
329 |
- einfo " must point to a directory within ${PARENT_EPREFIX}" |
330 |
- exit 0 |
331 |
- ;; |
332 |
- esac |
333 |
-done |
334 |
- |
335 |
-# |
336 |
-# sanity check of given values |
337 |
-# |
338 |
- |
339 |
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; } |
340 |
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; } |
341 |
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; } |
342 |
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; } |
343 |
- |
344 |
-einfo "creating stacked prefix ${CHILD_EPREFIX}" |
345 |
- |
346 |
-# |
347 |
-# functions needed below. |
348 |
-# |
349 |
-eend_exit() { |
350 |
- eend $1 |
351 |
- [[ $1 != 0 ]] && exit 1 |
352 |
-} |
353 |
- |
354 |
-# |
355 |
-# create the directories required to bootstrap the least. |
356 |
-# |
357 |
-ebegin "creating directory structure" |
358 |
-( |
359 |
- set -e |
360 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask |
361 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force |
362 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/env |
363 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env |
364 |
- ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf |
365 |
-) |
366 |
-eend_exit $? |
367 |
- |
368 |
-# |
369 |
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR |
370 |
-# |
371 |
-ebegin "creating make.conf" |
372 |
-( |
373 |
- set -e |
374 |
- echo "#" |
375 |
- echo "# The following values where taken from the parent prefix's" |
376 |
- echo "# environment. Feel free to adopt them as you like." |
377 |
- echo "#" |
378 |
- echo "CFLAGS=\"$(portageq envvar CFLAGS)\"" |
379 |
- echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\"" |
380 |
- echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\"" |
381 |
- niceness=$(portageq envvar PORTAGE_NICENESS || true) |
382 |
- [[ -n ${niceness} ]] && |
383 |
- echo "PORTAGE_NICENESS=\"${niceness}\"" |
384 |
- echo |
385 |
- echo "# Mirrors from parent prefix." |
386 |
- echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\"" |
387 |
- echo |
388 |
- echo "# Below comes the prefix-stack setup. Only change things" |
389 |
- echo "# if you know exactly what you are doing!" |
390 |
- echo "EPREFIX=\"${CHILD_EPREFIX}\"" |
391 |
- echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\"" |
392 |
- echo "BROOT=\"${PARENT_EPREFIX}\"" |
393 |
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf |
394 |
-eend_exit $? |
395 |
- |
396 |
-ebegin "creating use.mask/prefix-stack" |
397 |
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack |
398 |
-eend_exit $? |
399 |
- |
400 |
-ebegin "creating use.force/prefix-stack" |
401 |
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack |
402 |
-eend_exit $? |
403 |
- |
404 |
-ebegin "creating env/host-cc.conf" |
405 |
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM |
406 |
- CC=${PARENT_CHOST}-gcc |
407 |
- CXX=${PARENT_CHOST}-g++ |
408 |
- EOM |
409 |
-eend_exit $? |
410 |
- |
411 |
-ebegin "creating package.env/prefix-stack" |
412 |
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM' |
413 |
- # merge with the parent's chost. this forces the use of the parent |
414 |
- # compiler, which generally would be illegal - this is an exception. |
415 |
- # This is required for example on winnt, because the wrapper has to |
416 |
- # be able to use/resolve symlinks, etc. native winnt binaries miss |
417 |
- # that ability, but cygwin binaries don't. |
418 |
- sys-devel/gcc-config host-cc.conf |
419 |
- sys-apps/gentoo-functions host-cc.conf |
420 |
- EOM |
421 |
-eend_exit $? |
422 |
- |
423 |
-# |
424 |
-# create the make.profile symlinks. |
425 |
-# |
426 |
-ebegin "creating make.profile" |
427 |
-( |
428 |
- ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile" |
429 |
-) |
430 |
-eend_exit $? |
431 |
- |
432 |
-# |
433 |
-# adjust permissions of generated files. |
434 |
-# |
435 |
-ebegin "adjusting permissions" |
436 |
-( |
437 |
- set -e |
438 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf |
439 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf |
440 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack |
441 |
-) |
442 |
-eend_exit $? |
443 |
- |
444 |
-# |
445 |
-# now merge some basics. |
446 |
-# |
447 |
-ebegin "installing required basic packages" |
448 |
-( |
449 |
- set -e |
450 |
- export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}" |
451 |
- export EPREFIX@=@"${CHILD_EPREFIX}" |
452 |
- export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}" |
453 |
- |
454 |
-# # this -pv is there to avoid the global update output, which is |
455 |
-# # there on the first emerge run. (thus, just cosmetics). |
456 |
-# emerge --pretend --oneshot --nodeps baselayout-prefix |
457 |
- |
458 |
- # let baselayout create the directories |
459 |
- USE@=@"${USE} build" \ |
460 |
- emerge --verbose --nodeps --oneshot \ |
461 |
- '>=baselayout-prefix-2.6' |
462 |
- |
463 |
- # Record the prefix-toolkit into @world file, as it provides the |
464 |
- # env.d telling the PM to manage this stacked Prefix, but may not |
465 |
- # (unlike baselayout) be part of @system set per the profile. |
466 |
- emerge --verbose --nodeps \ |
467 |
- prefix-toolkit |
468 |
- |
469 |
- emerge --verbose --nodeps --oneshot \ |
470 |
- gentoo-functions \ |
471 |
- elt-patches \ |
472 |
- gnuconfig \ |
473 |
- gcc-config |
474 |
- |
475 |
- # select the stack wrapper profile from gcc-config |
476 |
- env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1 |
477 |
- |
478 |
- # do this _after_ selecting the correct compiler! |
479 |
- emerge --verbose --nodeps --oneshot \ |
480 |
- libtool |
481 |
-) |
482 |
-eend_exit $? |
483 |
- |
484 |
-# |
485 |
-# wow, all ok :) |
486 |
-# |
487 |
-ewarn |
488 |
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf." |
489 |
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"." |
490 |
-ewarn |
491 |
-EOIN |
492 |
- |
493 |
-: prefix-stack-ccwrap <<'EOIN' |
494 |
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash |
495 |
- |
496 |
-if [ -r /cygdrive/. ]; then |
497 |
- winpath2unix() { cygpath -u "$1"; } |
498 |
- unixpath2win() { cygpath -w "$1"; } |
499 |
-fi |
500 |
- |
501 |
-myself=${0##*/} # basename $0 |
502 |
-link_dirs=() |
503 |
-opts=() |
504 |
-chost="@GENTOO_PORTAGE_CHOST@" |
505 |
-prefix="@GENTOO_PORTAGE_EPREFIX@" |
506 |
-absprefix=${prefix} |
507 |
-if [[ ${chost} == *"-winnt"* ]]; then |
508 |
- # we may get called from windows binary, like pkgdata in dev-libs/icu |
509 |
- # in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix |
510 |
- absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")") |
511 |
-fi |
512 |
-[[ ${myself} == *windres* ]] && mode=compile || mode=link |
513 |
-orig_args=("$@") |
514 |
- |
515 |
-for opt in "$@" |
516 |
-do |
517 |
- case "$opt" in |
518 |
- -L) |
519 |
- link_dirs=("${link_dirs[@]}" "-L$1") |
520 |
- shift |
521 |
- ;; |
522 |
- -L*) |
523 |
- link_dirs=("${link_dirs[@]}" "${opt}") |
524 |
- ;; |
525 |
- *) |
526 |
- case "${opt}" in |
527 |
- -v) |
528 |
- # -v done right: only use mode version if -v is the _only_ |
529 |
- # argument on the command line. |
530 |
- [[ ${#orig_args[@]} -gt 1 ]] || mode=version |
531 |
- ;; |
532 |
- --version) mode=version ;; |
533 |
- -c|-E|-S) mode=compile ;; |
534 |
- -print-search-dirs) mode=dirs ;; |
535 |
- esac |
536 |
- opts=("${opts[@]}" "${opt}") |
537 |
- ;; |
538 |
- esac |
539 |
-done |
540 |
- |
541 |
-# remove any path to current prefix, need base prefix only |
542 |
-new_path= |
543 |
-save_ifs=$IFS |
544 |
-IFS=':' |
545 |
-for p in $PATH |
546 |
-do |
547 |
- IFS=$save_ifs |
548 |
- [[ ${p#${absprefix}} != "${p}" ]] && continue |
549 |
- if [[ -z "${new_path}" ]]; then |
550 |
- new_path="${p}" |
551 |
- else |
552 |
- new_path="${new_path}:${p}" |
553 |
- fi |
554 |
-done |
555 |
-IFS=$save_ifs |
556 |
- |
557 |
-PATH=${new_path} |
558 |
- |
559 |
-# binutils-config's ldwrapper understands '-R' for aix and hpux too. |
560 |
-# parity (winnt) understands -rpath only ... |
561 |
-case "${chost}" in |
562 |
-*-winnt*) rpath_opt="-Wl,-rpath," ;; |
563 |
-*) rpath_opt="-Wl,-R," ;; |
564 |
-esac |
565 |
- |
566 |
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib") |
567 |
-pfx_link_r=("${rpath_opt}${prefix}/lib" "${rpath_opt}${prefix}/usr/lib") |
568 |
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include") |
569 |
- |
570 |
-# ensure we run the right chost program in base prefix |
571 |
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-} |
572 |
- |
573 |
-case "$mode" in |
574 |
-link) exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;; |
575 |
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;; |
576 |
-version) exec "${myself}" "${orig_args[@]}" ;; |
577 |
-dirs) |
578 |
- "${myself}" "${orig_args[@]}" | while read line; do |
579 |
- if [[ "${line}" == "libraries: ="* ]]; then |
580 |
- echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}" |
581 |
- else |
582 |
- echo "${line}" |
583 |
- fi |
584 |
- done |
585 |
- ;; |
586 |
-*) echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;; |
587 |
-esac |
588 |
-EOIN |
589 |
|
590 |
diff --git a/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild |
591 |
deleted file mode 100644 |
592 |
index 0b61ff48687..00000000000 |
593 |
--- a/app-portage/prefix-toolkit/prefix-toolkit-1.ebuild |
594 |
+++ /dev/null |
595 |
@@ -1,567 +0,0 @@ |
596 |
-# Copyright 1999-2019 Gentoo Authors |
597 |
-# Distributed under the terms of the GNU General Public License v2 |
598 |
- |
599 |
-EAPI=7 |
600 |
- |
601 |
-DESCRIPTION="Utilities for users of Gentoo Prefix" |
602 |
-HOMEPAGE="https://prefix.gentoo.org/" |
603 |
-SRC_URI="" |
604 |
- |
605 |
-LICENSE="GPL-3" |
606 |
-SLOT="0" |
607 |
- |
608 |
-[[ ${PV} == 9999 ]] || |
609 |
-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" |
610 |
- |
611 |
-BDEPEND=" |
612 |
- >sys-apps/portage-2.3.62 |
613 |
-" |
614 |
-DEPEND="" |
615 |
-RDEPEND=" |
616 |
- !app-portage/prefix-chain-setup |
617 |
- !sys-apps/prefix-chain-utils |
618 |
- prefix-stack? ( |
619 |
- >=sys-apps/baselayout-prefix-2.6 |
620 |
- ) |
621 |
-" |
622 |
- |
623 |
-S="${WORKDIR}" |
624 |
- |
625 |
-my_unpack() { |
626 |
- local infile=$1 |
627 |
- local outfile=${2:-${infile}} |
628 |
- ebegin "extracting ${outfile}" |
629 |
- sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \ |
630 |
- > "${outfile}" || die "Failed to unpack ${outfile}" |
631 |
- eend $? |
632 |
-} |
633 |
- |
634 |
-src_unpack() { |
635 |
- if use prefix-stack ; then |
636 |
- my_unpack prefix-stack.bash_login |
637 |
- my_unpack prefix-stack.bashrc |
638 |
- my_unpack prefix-stack.envd.99stack |
639 |
- my_unpack prefix-stack-ccwrap |
640 |
- local editor pager |
641 |
- for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano |
642 |
- do |
643 |
- [[ -x ${editor} ]] || continue |
644 |
- done |
645 |
- for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less |
646 |
- do |
647 |
- [[ -x ${pager} ]] || continue |
648 |
- done |
649 |
- printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback |
650 |
- else |
651 |
- my_unpack prefix-stack-setup |
652 |
- fi |
653 |
- my_unpack startprefix |
654 |
-} |
655 |
- |
656 |
-my_prefixify() { |
657 |
- local ebash eenv |
658 |
- if use prefix-stack ; then |
659 |
- ebash="${BROOT}/bin/bash" |
660 |
- eenv="${BROOT}/usr/bin/env" |
661 |
- else |
662 |
- ebash="${EPREFIX}/bin/bash" |
663 |
- eenv="${EPREFIX}/usr/bin/env" |
664 |
- fi |
665 |
- |
666 |
- # the @=@ prevents repoman from believing we set readonly vars |
667 |
- sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \ |
668 |
- -e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \ |
669 |
- -e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \ |
670 |
- -e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \ |
671 |
- -e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \ |
672 |
- -e "s,@=@,=,g" \ |
673 |
- -i "$@" || die |
674 |
-} |
675 |
- |
676 |
-src_configure() { |
677 |
- # do not eprefixify during unpack, to allow userpatches to apply |
678 |
- my_prefixify * |
679 |
-} |
680 |
- |
681 |
-src_install-prefix-stack-ccwrap() { |
682 |
- # install toolchain wrapper. |
683 |
- local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV} |
684 |
- local wrappercfg=${CHOST}-${P} |
685 |
- |
686 |
- exeinto $wrapperdir |
687 |
- doexe prefix-stack-ccwrap |
688 |
- |
689 |
- local cc |
690 |
- for cc in \ |
691 |
- gcc \ |
692 |
- g++ \ |
693 |
- cpp \ |
694 |
- c++ \ |
695 |
- windres \ |
696 |
- ; do |
697 |
- dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc} |
698 |
- dosym ${CHOST}-${cc} $wrapperdir/${cc} |
699 |
- done |
700 |
- |
701 |
- # LDPATH is required to keep gcc-config happy :( |
702 |
- cat > ./${wrappercfg} <<-EOF |
703 |
- GCC_PATH="${EPREFIX}$wrapperdir" |
704 |
- LDPATH="${EPREFIX}$wrapperdir" |
705 |
- EOF |
706 |
- |
707 |
- insinto /etc/env.d/gcc |
708 |
- doins ./${wrappercfg} |
709 |
-} |
710 |
- |
711 |
-src_install() { |
712 |
- if use prefix-stack; then |
713 |
- src_install-prefix-stack-ccwrap |
714 |
- insinto /etc |
715 |
- doins prefix-stack.bash_login |
716 |
- insinto /etc/bash |
717 |
- newins prefix-stack.bashrc bashrc |
718 |
- newenvd prefix-stack.envd.99stack 99stack |
719 |
- doenvd 000fallback |
720 |
- else |
721 |
- dobin prefix-stack-setup |
722 |
- fi |
723 |
- exeinto / |
724 |
- doexe startprefix |
725 |
-} |
726 |
- |
727 |
-return 0 |
728 |
- |
729 |
-: startprefix <<'EOIN' |
730 |
-#!@GENTOO_PORTAGE_EBASH@ |
731 |
-# Copyright 1999-2019 Gentoo Authors |
732 |
-# Distributed under the terms of the GNU General Public License v2 |
733 |
- |
734 |
-# Fabian Groffen <grobian@g.o> -- 2007-03-10 |
735 |
-# Enters the prefix environment by starting a login shell from the |
736 |
-# prefix. The SHELL environment variable is elevated in order to make |
737 |
-# applications that start login shells to work, such as `screen`. |
738 |
- |
739 |
-# if you come from a substantially polluted environment (another |
740 |
-# Prefix), a cleanup as follows resolves most oddities I've ever seen: |
741 |
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l |
742 |
-# hence this script starts the Prefix shell like this |
743 |
- |
744 |
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]] |
745 |
-then |
746 |
- echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr |
747 |
- exit -1 |
748 |
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] && |
749 |
- [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]] |
750 |
-then |
751 |
- echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr |
752 |
- exit -1 |
753 |
-fi |
754 |
- |
755 |
-# What is our prefix? |
756 |
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@' |
757 |
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@' |
758 |
- |
759 |
-# not all systems have the same location for shells, however what it |
760 |
-# boils down to, is that we need to know what the shell is, and then we |
761 |
-# can find it in the bin dir of our prefix |
762 |
-for SHELL in \ |
763 |
- "${EPREFIX}/bin/${SHELL##*/}" \ |
764 |
- "${BPREFIX}/bin/${SHELL##*/}" \ |
765 |
- ${SHELL##*/} |
766 |
-do |
767 |
- [[ ${SHELL} == */* && -x ${SHELL} ]] && break |
768 |
-done |
769 |
- |
770 |
-# check if the shell exists |
771 |
-if [[ ${SHELL} != */* ]] |
772 |
-then |
773 |
- echo "Failed to find the Prefix shell, this is probably" > /dev/stderr |
774 |
- echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr |
775 |
- exit 1 |
776 |
-fi |
777 |
- |
778 |
-# set the prefix shell in the environment |
779 |
-export SHELL |
780 |
- |
781 |
-# give a small notice |
782 |
-echo "Entering Gentoo Prefix ${EPREFIX}" |
783 |
-# start the login shell, clean the entire environment but what's needed |
784 |
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL" |
785 |
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start |
786 |
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD" |
787 |
-# ssh-agent is handy to keep, of if set, inherit it |
788 |
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK" |
789 |
-# if we're on some X terminal, makes sense to inherit that too |
790 |
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY" |
791 |
-# do it! |
792 |
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then |
793 |
- '@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l |
794 |
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then |
795 |
- # shell coming from different prefix would load it's own |
796 |
- # etc/profile upon -l, so we have to override |
797 |
- '@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i |
798 |
-else |
799 |
- echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr |
800 |
- exit 1 |
801 |
-fi |
802 |
-# and leave a message when we exit... the shell might return non-zero |
803 |
-# without having real problems, so don't send alarming messages about |
804 |
-# that |
805 |
-echo "Leaving Gentoo Prefix with exit status $?" |
806 |
-EOIN |
807 |
- |
808 |
-: prefix-stack.bashrc <<'EOIN' |
809 |
-# Copyright 1999-2019 Gentoo Authors |
810 |
-# Distributed under the terms of the GNU General Public License v2 |
811 |
-# |
812 |
-# In stacked Prefix there is no bash installed, yet |
813 |
-# etc/bash/bashrc from base Prefix still is useful. |
814 |
-# |
815 |
- |
816 |
-if [[ $- != *i* ]] ; then |
817 |
- # Shell is non-interactive, bashrc does not apply |
818 |
- return |
819 |
-fi |
820 |
- |
821 |
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then |
822 |
- source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc' |
823 |
- # only if base Prefix does have an etc/bash/bashrc, we also |
824 |
- # run bashrc snippets provided by packages in stacked Prefix |
825 |
- for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do |
826 |
- [[ -r ${sh} ]] && source "${sh}" |
827 |
- done |
828 |
- unset sh |
829 |
-else |
830 |
- # etc/profile does expect etc/bash/bashrc to set PS1 |
831 |
- PS1='\u@\h \w \$ ' |
832 |
-fi |
833 |
-EOIN |
834 |
- |
835 |
-: prefix-stack.bash_login <<'EOIN' |
836 |
-# Copyright 1999-2019 Gentoo Authors |
837 |
-# Distributed under the terms of the GNU General Public License v2 |
838 |
-# |
839 |
-# In stacked Prefix there is no bash installed, so there is |
840 |
-# no bash able to load this Prefix' profile as login shell. |
841 |
-# Instead, you can specify this one as bash rcfile to mimic |
842 |
-# a bash login shell using this stacked Prefix profile. |
843 |
-# |
844 |
- |
845 |
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then |
846 |
- . '@GENTOO_PORTAGE_EPREFIX@/etc/profile' |
847 |
-fi |
848 |
-if [[ -s ~/.bash_profile ]] ; then |
849 |
- . ~/.bash_profile |
850 |
-elif [[ -s ~/.bash_login ]] ; then |
851 |
- . ~/.bash_login |
852 |
-elif [[ -s ~/.profile ]] ; then |
853 |
- . ~/.profile |
854 |
-fi |
855 |
-EOIN |
856 |
- |
857 |
-: prefix-stack.envd.99stack <<'EOIN' |
858 |
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig" |
859 |
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@" |
860 |
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@" |
861 |
-EOIN |
862 |
- |
863 |
-: prefix-stack-setup <<'EOIN' |
864 |
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash |
865 |
-# Copyright 1999-2019 Gentoo Authors |
866 |
-# Distributed under the terms of the GNU General Public License v2 |
867 |
- |
868 |
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@" |
869 |
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@" |
870 |
-CHILD_EPREFIX= |
871 |
-CHILD_PROFILE= |
872 |
- |
873 |
-# |
874 |
-# get ourselfs the functions.sh script for ebegin/eend/etc. |
875 |
-# |
876 |
-for f in \ |
877 |
- /lib/gentoo/functions.sh \ |
878 |
- /etc/init.d/functions.sh \ |
879 |
- /sbin/functions.sh \ |
880 |
-; do |
881 |
- if [[ -r ${PARENT_EPREFIX}${f} ]] ; then |
882 |
- . "${PARENT_EPREFIX}${f}" |
883 |
- f=found |
884 |
- break |
885 |
- fi |
886 |
-done |
887 |
- |
888 |
-if [[ ${f} != found ]] ; then |
889 |
- echo "Cannot find Gentoo functions, aborting." >&2 |
890 |
- exit 1 |
891 |
-fi |
892 |
- |
893 |
-for arg in "$@"; do |
894 |
- case "${arg}" in |
895 |
- --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;; |
896 |
- --profile=*) CHILD_PROFILE="${arg#--profile=}" ;; |
897 |
- |
898 |
- --help) |
899 |
- einfo "$0 usage:" |
900 |
- einfo " --eprefix=[PATH] Path to new EPREFIX to create stacked to the prefix" |
901 |
- einfo " where this script is installed (${PARENT_EPREFIX})" |
902 |
- einfo " --profile=[PATH] The absolute path to the profile to use. This path" |
903 |
- einfo " must point to a directory within ${PARENT_EPREFIX}" |
904 |
- exit 0 |
905 |
- ;; |
906 |
- esac |
907 |
-done |
908 |
- |
909 |
-# |
910 |
-# sanity check of given values |
911 |
-# |
912 |
- |
913 |
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; } |
914 |
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; } |
915 |
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; } |
916 |
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; } |
917 |
- |
918 |
-einfo "creating stacked prefix ${CHILD_EPREFIX}" |
919 |
- |
920 |
-# |
921 |
-# functions needed below. |
922 |
-# |
923 |
-eend_exit() { |
924 |
- eend $1 |
925 |
- [[ $1 != 0 ]] && exit 1 |
926 |
-} |
927 |
- |
928 |
-# |
929 |
-# create the directories required to bootstrap the least. |
930 |
-# |
931 |
-ebegin "creating directory structure" |
932 |
-( |
933 |
- set -e |
934 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask |
935 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force |
936 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/env |
937 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env |
938 |
- ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf |
939 |
-) |
940 |
-eend_exit $? |
941 |
- |
942 |
-# |
943 |
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR |
944 |
-# |
945 |
-ebegin "creating make.conf" |
946 |
-( |
947 |
- set -e |
948 |
- echo "#" |
949 |
- echo "# The following values where taken from the parent prefix's" |
950 |
- echo "# environment. Feel free to adopt them as you like." |
951 |
- echo "#" |
952 |
- echo "CFLAGS=\"$(portageq envvar CFLAGS)\"" |
953 |
- echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\"" |
954 |
- echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\"" |
955 |
- niceness=$(portageq envvar PORTAGE_NICENESS || true) |
956 |
- [[ -n ${niceness} ]] && |
957 |
- echo "PORTAGE_NICENESS=\"${niceness}\"" |
958 |
- echo |
959 |
- echo "# Mirrors from parent prefix." |
960 |
- echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\"" |
961 |
- echo |
962 |
- echo "# Below comes the prefix-stack setup. Only change things" |
963 |
- echo "# if you know exactly what you are doing!" |
964 |
- echo "EPREFIX=\"${CHILD_EPREFIX}\"" |
965 |
- echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\"" |
966 |
- echo "BROOT=\"${PARENT_EPREFIX}\"" |
967 |
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf |
968 |
-eend_exit $? |
969 |
- |
970 |
-ebegin "creating use.mask/prefix-stack" |
971 |
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack |
972 |
-eend_exit $? |
973 |
- |
974 |
-ebegin "creating use.force/prefix-stack" |
975 |
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack |
976 |
-eend_exit $? |
977 |
- |
978 |
-ebegin "creating env/host-cc.conf" |
979 |
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM |
980 |
- CC=${PARENT_CHOST}-gcc |
981 |
- CXX=${PARENT_CHOST}-g++ |
982 |
- EOM |
983 |
-eend_exit $? |
984 |
- |
985 |
-ebegin "creating package.env/prefix-stack" |
986 |
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM' |
987 |
- # merge with the parent's chost. this forces the use of the parent |
988 |
- # compiler, which generally would be illegal - this is an exception. |
989 |
- # This is required for example on winnt, because the wrapper has to |
990 |
- # be able to use/resolve symlinks, etc. native winnt binaries miss |
991 |
- # that ability, but cygwin binaries don't. |
992 |
- sys-devel/gcc-config host-cc.conf |
993 |
- sys-apps/gentoo-functions host-cc.conf |
994 |
- EOM |
995 |
-eend_exit $? |
996 |
- |
997 |
-# |
998 |
-# create the make.profile symlinks. |
999 |
-# |
1000 |
-ebegin "creating make.profile" |
1001 |
-( |
1002 |
- ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile" |
1003 |
-) |
1004 |
-eend_exit $? |
1005 |
- |
1006 |
-# |
1007 |
-# adjust permissions of generated files. |
1008 |
-# |
1009 |
-ebegin "adjusting permissions" |
1010 |
-( |
1011 |
- set -e |
1012 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf |
1013 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf |
1014 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack |
1015 |
-) |
1016 |
-eend_exit $? |
1017 |
- |
1018 |
-# |
1019 |
-# now merge some basics. |
1020 |
-# |
1021 |
-ebegin "installing required basic packages" |
1022 |
-( |
1023 |
- set -e |
1024 |
- export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}" |
1025 |
- export EPREFIX@=@"${CHILD_EPREFIX}" |
1026 |
- export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}" |
1027 |
- |
1028 |
-# # this -pv is there to avoid the global update output, which is |
1029 |
-# # there on the first emerge run. (thus, just cosmetics). |
1030 |
-# emerge --pretend --oneshot --nodeps baselayout-prefix |
1031 |
- |
1032 |
- # let baselayout create the directories |
1033 |
- USE@=@"${USE} build" \ |
1034 |
- emerge --verbose --nodeps --oneshot \ |
1035 |
- '>=baselayout-prefix-2.6' |
1036 |
- |
1037 |
- # Record the prefix-toolkit into @world file, as it provides the |
1038 |
- # env.d telling the PM to manage this stacked Prefix, but may not |
1039 |
- # (unlike baselayout) be part of @system set per the profile. |
1040 |
- emerge --verbose --nodeps \ |
1041 |
- prefix-toolkit |
1042 |
- |
1043 |
- emerge --verbose --nodeps --oneshot \ |
1044 |
- gentoo-functions \ |
1045 |
- elt-patches \ |
1046 |
- gnuconfig \ |
1047 |
- gcc-config |
1048 |
- |
1049 |
- # select the stack wrapper profile from gcc-config |
1050 |
- env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1 |
1051 |
- |
1052 |
- # do this _after_ selecting the correct compiler! |
1053 |
- emerge --verbose --nodeps --oneshot \ |
1054 |
- libtool |
1055 |
-) |
1056 |
-eend_exit $? |
1057 |
- |
1058 |
-# |
1059 |
-# wow, all ok :) |
1060 |
-# |
1061 |
-ewarn |
1062 |
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf." |
1063 |
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"." |
1064 |
-ewarn |
1065 |
-EOIN |
1066 |
- |
1067 |
-: prefix-stack-ccwrap <<'EOIN' |
1068 |
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash |
1069 |
- |
1070 |
-if [ -r /cygdrive/. ]; then |
1071 |
- winpath2unix() { cygpath -u "$1"; } |
1072 |
- unixpath2win() { cygpath -w "$1"; } |
1073 |
-fi |
1074 |
- |
1075 |
-myself=${0##*/} # basename $0 |
1076 |
-link_dirs=() |
1077 |
-opts=() |
1078 |
-chost="@GENTOO_PORTAGE_CHOST@" |
1079 |
-prefix="@GENTOO_PORTAGE_EPREFIX@" |
1080 |
-absprefix=${prefix} |
1081 |
-if [[ ${chost} == *"-winnt"* ]]; then |
1082 |
- # we may get called from windows binary, like pkgdata in dev-libs/icu |
1083 |
- # in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix |
1084 |
- absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")") |
1085 |
-fi |
1086 |
-[[ ${myself} == *windres* ]] && mode=compile || mode=link |
1087 |
-orig_args=("$@") |
1088 |
- |
1089 |
-for opt in "$@" |
1090 |
-do |
1091 |
- case "$opt" in |
1092 |
- -L) |
1093 |
- link_dirs=("${link_dirs[@]}" "-L$1") |
1094 |
- shift |
1095 |
- ;; |
1096 |
- -L*) |
1097 |
- link_dirs=("${link_dirs[@]}" "${opt}") |
1098 |
- ;; |
1099 |
- *) |
1100 |
- case "${opt}" in |
1101 |
- -v) |
1102 |
- # -v done right: only use mode version if -v is the _only_ |
1103 |
- # argument on the command line. |
1104 |
- [[ ${#orig_args[@]} -gt 1 ]] || mode=version |
1105 |
- ;; |
1106 |
- --version) mode=version ;; |
1107 |
- -c|-E|-S) mode=compile ;; |
1108 |
- -print-search-dirs) mode=dirs ;; |
1109 |
- esac |
1110 |
- opts=("${opts[@]}" "${opt}") |
1111 |
- ;; |
1112 |
- esac |
1113 |
-done |
1114 |
- |
1115 |
-# remove any path to current prefix, need base prefix only |
1116 |
-new_path= |
1117 |
-save_ifs=$IFS |
1118 |
-IFS=':' |
1119 |
-for p in $PATH |
1120 |
-do |
1121 |
- IFS=$save_ifs |
1122 |
- [[ ${p#${absprefix}} != "${p}" ]] && continue |
1123 |
- if [[ -z "${new_path}" ]]; then |
1124 |
- new_path="${p}" |
1125 |
- else |
1126 |
- new_path="${new_path}:${p}" |
1127 |
- fi |
1128 |
-done |
1129 |
-IFS=$save_ifs |
1130 |
- |
1131 |
-PATH=${new_path} |
1132 |
- |
1133 |
-# binutils-config's ldwrapper understands '-R' for aix and hpux too. |
1134 |
-# parity (winnt) understands -rpath only ... |
1135 |
-case "${chost}" in |
1136 |
-*-winnt*) rpath_opt="-Wl,-rpath," ;; |
1137 |
-*) rpath_opt="-Wl,-R," ;; |
1138 |
-esac |
1139 |
- |
1140 |
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib") |
1141 |
-pfx_link_r=("${rpath_opt}${prefix}/lib" "${rpath_opt}${prefix}/usr/lib") |
1142 |
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include") |
1143 |
- |
1144 |
-# ensure we run the right chost program in base prefix |
1145 |
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-} |
1146 |
- |
1147 |
-case "$mode" in |
1148 |
-link) exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;; |
1149 |
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;; |
1150 |
-version) exec "${myself}" "${orig_args[@]}" ;; |
1151 |
-dirs) |
1152 |
- "${myself}" "${orig_args[@]}" | while read line; do |
1153 |
- if [[ "${line}" == "libraries: ="* ]]; then |
1154 |
- echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}" |
1155 |
- else |
1156 |
- echo "${line}" |
1157 |
- fi |
1158 |
- done |
1159 |
- ;; |
1160 |
-*) echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;; |
1161 |
-esac |
1162 |
-EOIN |
1163 |
|
1164 |
diff --git a/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild b/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild |
1165 |
deleted file mode 100644 |
1166 |
index 21c172139b1..00000000000 |
1167 |
--- a/app-portage/prefix-toolkit/prefix-toolkit-2.ebuild |
1168 |
+++ /dev/null |
1169 |
@@ -1,614 +0,0 @@ |
1170 |
-# Copyright 1999-2019 Gentoo Authors |
1171 |
-# Distributed under the terms of the GNU General Public License v2 |
1172 |
- |
1173 |
-EAPI=7 |
1174 |
- |
1175 |
-DESCRIPTION="Utilities for users of Gentoo Prefix" |
1176 |
-HOMEPAGE="https://prefix.gentoo.org/" |
1177 |
-SRC_URI="" |
1178 |
- |
1179 |
-LICENSE="GPL-3" |
1180 |
-SLOT="0" |
1181 |
- |
1182 |
-[[ ${PV} == 9999 ]] || |
1183 |
-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" |
1184 |
- |
1185 |
-DEPEND=" |
1186 |
- !app-portage/prefix-chain-setup |
1187 |
- !sys-apps/prefix-chain-utils |
1188 |
-" |
1189 |
-BDEPEND="${DEPEND} |
1190 |
- >sys-apps/portage-2.3.62 |
1191 |
-" |
1192 |
-# In prefix-stack, these dependencies actually are the @system set, |
1193 |
-# as we rely on the base prefix anyway for package management, |
1194 |
-# which should have a proper @system set. |
1195 |
-# See als: pkg_preinst |
1196 |
-RDEPEND="${DEPEND} |
1197 |
- prefix-stack? ( |
1198 |
- >=sys-apps/baselayout-prefix-2.6 |
1199 |
- sys-apps/gentoo-functions |
1200 |
- app-portage/elt-patches |
1201 |
- sys-devel/gnuconfig |
1202 |
- sys-devel/gcc-config |
1203 |
- ) |
1204 |
-" |
1205 |
- |
1206 |
-S="${WORKDIR}" |
1207 |
- |
1208 |
-my_unpack() { |
1209 |
- local infile=$1 |
1210 |
- local outfile=${2:-${infile}} |
1211 |
- ebegin "extracting ${outfile}" |
1212 |
- sed -ne "/^: ${infile} /,/EOIN/{/EOIN/d;p}" "${EBUILD}" \ |
1213 |
- > "${outfile}" || die "Failed to unpack ${outfile}" |
1214 |
- eend $? |
1215 |
-} |
1216 |
- |
1217 |
-src_unpack() { |
1218 |
- if use prefix-stack ; then |
1219 |
- my_unpack prefix-stack.bash_login |
1220 |
- my_unpack prefix-stack.bashrc |
1221 |
- my_unpack prefix-stack.envd.99stack |
1222 |
- my_unpack prefix-stack-ccwrap |
1223 |
- local editor pager |
1224 |
- for editor in "${EDITOR}" {"${EPREFIX}","${BROOT}"}/bin/nano |
1225 |
- do |
1226 |
- [[ -x ${editor} ]] || continue |
1227 |
- done |
1228 |
- for pager in "${PAGER}" {"${EPREFIX}","${BROOT}"}/usr/bin/less |
1229 |
- do |
1230 |
- [[ -x ${pager} ]] || continue |
1231 |
- done |
1232 |
- printf '%s\n' "EDITOR=\"${editor}\"" "PAGER=\"${pager}\"" > 000fallback |
1233 |
- else |
1234 |
- my_unpack prefix-stack-setup |
1235 |
- fi |
1236 |
- my_unpack startprefix |
1237 |
-} |
1238 |
- |
1239 |
-my_prefixify() { |
1240 |
- local ebash eenv |
1241 |
- if use prefix-stack ; then |
1242 |
- ebash="${BROOT}/bin/bash" |
1243 |
- eenv="${BROOT}/usr/bin/env" |
1244 |
- else |
1245 |
- ebash="${EPREFIX}/bin/bash" |
1246 |
- eenv="${EPREFIX}/usr/bin/env" |
1247 |
- fi |
1248 |
- |
1249 |
- # the @=@ prevents repoman from believing we set readonly vars |
1250 |
- sed -e "s,@GENTOO_PORTAGE_BPREFIX@,${BROOT},g" \ |
1251 |
- -e "s,@GENTOO_PORTAGE_EPREFIX@,${EPREFIX},g" \ |
1252 |
- -e "s,@GENTOO_PORTAGE_CHOST@,${CHOST},g" \ |
1253 |
- -e "s,@GENTOO_PORTAGE_EBASH@,${ebash},g" \ |
1254 |
- -e "s,@GENTOO_PORTAGE_EENV@,${eenv},g" \ |
1255 |
- -e "s,@=@,=,g" \ |
1256 |
- -i "$@" || die |
1257 |
-} |
1258 |
- |
1259 |
-src_configure() { |
1260 |
- # do not eprefixify during unpack, to allow userpatches to apply |
1261 |
- my_prefixify * |
1262 |
-} |
1263 |
- |
1264 |
-src_install-prefix-stack-ccwrap() { |
1265 |
- # install toolchain wrapper. |
1266 |
- local wrapperdir=/usr/${CHOST}/gcc-bin/${CHOST}-${PN}/${PV} |
1267 |
- local wrappercfg=${CHOST}-${P} |
1268 |
- |
1269 |
- exeinto $wrapperdir |
1270 |
- doexe prefix-stack-ccwrap |
1271 |
- |
1272 |
- local cc |
1273 |
- for cc in \ |
1274 |
- gcc \ |
1275 |
- g++ \ |
1276 |
- cpp \ |
1277 |
- c++ \ |
1278 |
- windres \ |
1279 |
- ; do |
1280 |
- dosym prefix-stack-ccwrap $wrapperdir/${CHOST}-${cc} |
1281 |
- dosym ${CHOST}-${cc} $wrapperdir/${cc} |
1282 |
- done |
1283 |
- |
1284 |
- # LDPATH is required to keep gcc-config happy :( |
1285 |
- cat > ./${wrappercfg} <<-EOF |
1286 |
- GCC_PATH="${EPREFIX}$wrapperdir" |
1287 |
- LDPATH="${EPREFIX}$wrapperdir" |
1288 |
- EOF |
1289 |
- |
1290 |
- insinto /etc/env.d/gcc |
1291 |
- doins ./${wrappercfg} |
1292 |
-} |
1293 |
- |
1294 |
-src_install() { |
1295 |
- if use prefix-stack; then |
1296 |
- src_install-prefix-stack-ccwrap |
1297 |
- insinto /etc |
1298 |
- doins prefix-stack.bash_login |
1299 |
- insinto /etc/bash |
1300 |
- newins prefix-stack.bashrc bashrc |
1301 |
- newenvd prefix-stack.envd.99stack 99stack |
1302 |
- doenvd 000fallback |
1303 |
- else |
1304 |
- dobin prefix-stack-setup |
1305 |
- fi |
1306 |
- exeinto / |
1307 |
- doexe startprefix |
1308 |
-} |
1309 |
- |
1310 |
-pkg_preinst() { |
1311 |
- use prefix-stack || return 0 |
1312 |
- ebegin "Purging @system package set for prefix stack" |
1313 |
- # In prefix stack we empty out the @system set defined via make.profile, |
1314 |
- # as we may be using some normal profile, but that @system set applies |
1315 |
- # to the base prefix only. |
1316 |
- # Instead, we only put ourselve into the @system set, and have additional |
1317 |
- # @system packages in our RDEPEND. |
1318 |
- my_lsprofile() { |
1319 |
- ( |
1320 |
- cd -P "${1:-.}" || exit 1 |
1321 |
- [[ -r ./parent ]] && |
1322 |
- for p in $(<parent) |
1323 |
- do |
1324 |
- my_lsprofile "${p}" || exit 1 |
1325 |
- done |
1326 |
- pwd -P |
1327 |
- ) |
1328 |
- } |
1329 |
- local systemset="/etc/portage/profile/packages" |
1330 |
- dodir "${systemset%/*}" |
1331 |
- [[ -s ${EROOT}${systemset} ]] && |
1332 |
- grep -v "# maintained by ${PN}" \ |
1333 |
- "${EROOT}${systemset}" \ |
1334 |
- > "${ED}${systemset}" |
1335 |
- local p |
1336 |
- for p in $(my_lsprofile "${EPREFIX}"/etc/portage/make.profile) |
1337 |
- do |
1338 |
- [[ -s ${p}/${systemset##*/} ]] || continue |
1339 |
- awk '/^[ \t]*[^-#]/{print "-" $1 " # maintained by '"${PN}-${PVR}"'"}' \ |
1340 |
- < "${p}"/packages || die |
1341 |
- done | sort -u >> "${ED}${systemset}" |
1342 |
- [[ ${PIPESTATUS[@]} == "0 0" ]] || die "failed to collect for ${systemset}" |
1343 |
- echo "*${CATEGORY}/${PN} # maintained by ${PN}-${PVR}" >> "${ED}${systemset}" || die |
1344 |
- eend $? |
1345 |
-} |
1346 |
- |
1347 |
-return 0 |
1348 |
- |
1349 |
-: startprefix <<'EOIN' |
1350 |
-#!@GENTOO_PORTAGE_EBASH@ |
1351 |
-# Copyright 1999-2019 Gentoo Authors |
1352 |
-# Distributed under the terms of the GNU General Public License v2 |
1353 |
- |
1354 |
-# Fabian Groffen <grobian@g.o> -- 2007-03-10 |
1355 |
-# Enters the prefix environment by starting a login shell from the |
1356 |
-# prefix. The SHELL environment variable is elevated in order to make |
1357 |
-# applications that start login shells to work, such as `screen`. |
1358 |
- |
1359 |
-# if you come from a substantially polluted environment (another |
1360 |
-# Prefix), a cleanup as follows resolves most oddities I've ever seen: |
1361 |
-# env -i HOME=$HOME TERM=$TERM USER=$USER $SHELL -l |
1362 |
-# hence this script starts the Prefix shell like this |
1363 |
- |
1364 |
-if [[ ${SHELL#@GENTOO_PORTAGE_EPREFIX@} != ${SHELL} ]] |
1365 |
-then |
1366 |
- echo "You appear to be in prefix already (SHELL=${SHELL})" > /dev/stderr |
1367 |
- exit -1 |
1368 |
-elif [[ ${SHELL#@GENTOO_PORTAGE_BPREFIX@} != ${SHELL} ]] && |
1369 |
- [[ ${EPREFIX-unset} == '@GENTOO_PORTAGE_EPREFIX@' ]] |
1370 |
-then |
1371 |
- echo "You appear to be in stacked prefix already (EPREFIX=${EPREFIX})" > /dev/stderr |
1372 |
- exit -1 |
1373 |
-fi |
1374 |
- |
1375 |
-# What is our prefix? |
1376 |
-EPREFIX@=@'@GENTOO_PORTAGE_EPREFIX@' |
1377 |
-BPREFIX@=@'@GENTOO_PORTAGE_BPREFIX@' |
1378 |
- |
1379 |
-# not all systems have the same location for shells, however what it |
1380 |
-# boils down to, is that we need to know what the shell is, and then we |
1381 |
-# can find it in the bin dir of our prefix |
1382 |
-for SHELL in \ |
1383 |
- "${EPREFIX}/bin/${SHELL##*/}" \ |
1384 |
- "${BPREFIX}/bin/${SHELL##*/}" \ |
1385 |
- ${SHELL##*/} |
1386 |
-do |
1387 |
- [[ ${SHELL} == */* && -x ${SHELL} ]] && break |
1388 |
-done |
1389 |
- |
1390 |
-# check if the shell exists |
1391 |
-if [[ ${SHELL} != */* ]] |
1392 |
-then |
1393 |
- echo "Failed to find the Prefix shell, this is probably" > /dev/stderr |
1394 |
- echo "because you didn't emerge the shell ${SHELL}" > /dev/stderr |
1395 |
- exit 1 |
1396 |
-fi |
1397 |
- |
1398 |
-# set the prefix shell in the environment |
1399 |
-export SHELL |
1400 |
- |
1401 |
-# give a small notice |
1402 |
-echo "Entering Gentoo Prefix ${EPREFIX}" |
1403 |
-# start the login shell, clean the entire environment but what's needed |
1404 |
-RETAIN="HOME=$HOME TERM=$TERM USER=$USER SHELL=$SHELL" |
1405 |
-# PROFILEREAD is necessary on SUSE not to wipe the env on shell start |
1406 |
-[[ -n ${PROFILEREAD} ]] && RETAIN+=" PROFILEREAD=$PROFILEREAD" |
1407 |
-# ssh-agent is handy to keep, of if set, inherit it |
1408 |
-[[ -n ${SSH_AUTH_SOCK} ]] && RETAIN+=" SSH_AUTH_SOCK=$SSH_AUTH_SOCK" |
1409 |
-# if we're on some X terminal, makes sense to inherit that too |
1410 |
-[[ -n ${DISPLAY} ]] && RETAIN+=" DISPLAY=$DISPLAY" |
1411 |
-# do it! |
1412 |
-if [[ ${SHELL#${EPREFIX}} != ${SHELL} ]] ; then |
1413 |
- '@GENTOO_PORTAGE_EENV@' -i $RETAIN $SHELL -l |
1414 |
-elif [[ ' bash ' == *" ${SHELL##*/} "* ]] ; then |
1415 |
- # shell coming from different prefix would load it's own |
1416 |
- # etc/profile upon -l, so we have to override |
1417 |
- '@GENTOO_PORTAGE_EENV@' -i ${RETAIN} "${SHELL}" --rcfile "${EPREFIX}"/etc/prefix-stack.bash_login -i |
1418 |
-else |
1419 |
- echo "Only bash is supported with stacked Prefix (you have ${SHELL##*/}), sorry!" > /dev/stderr |
1420 |
- exit 1 |
1421 |
-fi |
1422 |
-# and leave a message when we exit... the shell might return non-zero |
1423 |
-# without having real problems, so don't send alarming messages about |
1424 |
-# that |
1425 |
-echo "Leaving Gentoo Prefix with exit status $?" |
1426 |
-EOIN |
1427 |
- |
1428 |
-: prefix-stack.bashrc <<'EOIN' |
1429 |
-# Copyright 1999-2019 Gentoo Authors |
1430 |
-# Distributed under the terms of the GNU General Public License v2 |
1431 |
-# |
1432 |
-# In stacked Prefix there is no bash installed, yet |
1433 |
-# etc/bash/bashrc from base Prefix still is useful. |
1434 |
-# |
1435 |
- |
1436 |
-if [[ $- != *i* ]] ; then |
1437 |
- # Shell is non-interactive, bashrc does not apply |
1438 |
- return |
1439 |
-fi |
1440 |
- |
1441 |
-if [[ -r @GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc ]] ; then |
1442 |
- source '@GENTOO_PORTAGE_BPREFIX@/etc/bash/bashrc' |
1443 |
- # only if base Prefix does have an etc/bash/bashrc, we also |
1444 |
- # run bashrc snippets provided by packages in stacked Prefix |
1445 |
- for sh in '@GENTOO_PORTAGE_EPREFIX@'/etc/bash/bashrc.d/* ; do |
1446 |
- [[ -r ${sh} ]] && source "${sh}" |
1447 |
- done |
1448 |
- unset sh |
1449 |
-else |
1450 |
- # etc/profile does expect etc/bash/bashrc to set PS1 |
1451 |
- PS1='\u@\h \w \$ ' |
1452 |
-fi |
1453 |
-EOIN |
1454 |
- |
1455 |
-: prefix-stack.bash_login <<'EOIN' |
1456 |
-# Copyright 1999-2019 Gentoo Authors |
1457 |
-# Distributed under the terms of the GNU General Public License v2 |
1458 |
-# |
1459 |
-# In stacked Prefix there is no bash installed, so there is |
1460 |
-# no bash able to load this Prefix' profile as login shell. |
1461 |
-# Instead, you can specify this one as bash rcfile to mimic |
1462 |
-# a bash login shell using this stacked Prefix profile. |
1463 |
-# |
1464 |
- |
1465 |
-if [[ -s '@GENTOO_PORTAGE_EPREFIX@/etc/profile' ]] ; then |
1466 |
- . '@GENTOO_PORTAGE_EPREFIX@/etc/profile' |
1467 |
-fi |
1468 |
-if [[ -s ~/.bash_profile ]] ; then |
1469 |
- . ~/.bash_profile |
1470 |
-elif [[ -s ~/.bash_login ]] ; then |
1471 |
- . ~/.bash_login |
1472 |
-elif [[ -s ~/.profile ]] ; then |
1473 |
- . ~/.profile |
1474 |
-fi |
1475 |
-EOIN |
1476 |
- |
1477 |
-: prefix-stack.envd.99stack <<'EOIN' |
1478 |
-PKG_CONFIG_PATH@=@"@GENTOO_PORTAGE_EPREFIX@/usr/lib/pkgconfig:@GENTOO_PORTAGE_EPREFIX@/usr/share/pkgconfig" |
1479 |
-PORTAGE_CONFIGROOT@=@"@GENTOO_PORTAGE_EPREFIX@" |
1480 |
-EPREFIX@=@"@GENTOO_PORTAGE_EPREFIX@" |
1481 |
-EOIN |
1482 |
- |
1483 |
-: prefix-stack-setup <<'EOIN' |
1484 |
-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash |
1485 |
-# Copyright 1999-2019 Gentoo Authors |
1486 |
-# Distributed under the terms of the GNU General Public License v2 |
1487 |
- |
1488 |
-PARENT_EPREFIX="@GENTOO_PORTAGE_EPREFIX@" |
1489 |
-PARENT_CHOST="@GENTOO_PORTAGE_CHOST@" |
1490 |
-CHILD_EPREFIX= |
1491 |
-CHILD_PROFILE= |
1492 |
- |
1493 |
-# |
1494 |
-# get ourselfs the functions.sh script for ebegin/eend/etc. |
1495 |
-# |
1496 |
-for f in \ |
1497 |
- /lib/gentoo/functions.sh \ |
1498 |
- /etc/init.d/functions.sh \ |
1499 |
- /sbin/functions.sh \ |
1500 |
-; do |
1501 |
- if [[ -r ${PARENT_EPREFIX}${f} ]] ; then |
1502 |
- . "${PARENT_EPREFIX}${f}" |
1503 |
- f=found |
1504 |
- break |
1505 |
- fi |
1506 |
-done |
1507 |
- |
1508 |
-if [[ ${f} != found ]] ; then |
1509 |
- echo "Cannot find Gentoo functions, aborting." >&2 |
1510 |
- exit 1 |
1511 |
-fi |
1512 |
- |
1513 |
-for arg in "$@"; do |
1514 |
- case "${arg}" in |
1515 |
- --eprefix=*) CHILD_EPREFIX="${arg#--eprefix=}" ;; |
1516 |
- --profile=*) CHILD_PROFILE="${arg#--profile=}" ;; |
1517 |
- |
1518 |
- --help) |
1519 |
- einfo "$0 usage:" |
1520 |
- einfo " --eprefix=[PATH] Path to new EPREFIX to create stacked to the prefix" |
1521 |
- einfo " where this script is installed (${PARENT_EPREFIX})" |
1522 |
- einfo " --profile=[PATH] The absolute path to the profile to use. This path" |
1523 |
- einfo " must point to a directory within ${PARENT_EPREFIX}" |
1524 |
- exit 0 |
1525 |
- ;; |
1526 |
- esac |
1527 |
-done |
1528 |
- |
1529 |
-# |
1530 |
-# sanity check of given values |
1531 |
-# |
1532 |
- |
1533 |
-test -n "${CHILD_EPREFIX}" || { eerror "no eprefix argument given"; exit 1; } |
1534 |
-test -d "${CHILD_EPREFIX}" && { eerror "${CHILD_EPREFIX} already exists"; exit 1; } |
1535 |
-test -n "${CHILD_PROFILE}" || { eerror "no profile argument given"; exit 1; } |
1536 |
-test -d "${CHILD_PROFILE}" || { eerror "${CHILD_PROFILE} does not exist"; exit 1; } |
1537 |
- |
1538 |
-einfo "creating stacked prefix ${CHILD_EPREFIX}" |
1539 |
- |
1540 |
-# |
1541 |
-# functions needed below. |
1542 |
-# |
1543 |
-eend_exit() { |
1544 |
- eend $1 |
1545 |
- [[ $1 != 0 ]] && exit 1 |
1546 |
-} |
1547 |
- |
1548 |
-# |
1549 |
-# create the directories required to bootstrap the least. |
1550 |
-# |
1551 |
-ebegin "creating directory structure" |
1552 |
-( |
1553 |
- set -e |
1554 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.mask |
1555 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/profile/use.force |
1556 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/env |
1557 |
- mkdir -p "${CHILD_EPREFIX}"/etc/portage/package.env |
1558 |
- ln -s "${PARENT_EPREFIX}"/etc/portage/repos.conf "${CHILD_EPREFIX}"/etc/portage/repos.conf |
1559 |
-) |
1560 |
-eend_exit $? |
1561 |
- |
1562 |
-# |
1563 |
-# create a make.conf and set PORTDIR and PORTAGE_TMPDIR |
1564 |
-# |
1565 |
-ebegin "creating make.conf" |
1566 |
-( |
1567 |
- set -e |
1568 |
- echo "#" |
1569 |
- echo "# The following values where taken from the parent prefix's" |
1570 |
- echo "# environment. Feel free to adopt them as you like." |
1571 |
- echo "#" |
1572 |
- echo "CFLAGS=\"$(portageq envvar CFLAGS)\"" |
1573 |
- echo "CXXFLAGS=\"$(portageq envvar CXXFLAGS)\"" |
1574 |
- echo "MAKEOPTS=\"$(portageq envvar MAKEOPTS)\"" |
1575 |
- niceness=$(portageq envvar PORTAGE_NICENESS || true) |
1576 |
- [[ -n ${niceness} ]] && |
1577 |
- echo "PORTAGE_NICENESS=\"${niceness}\"" |
1578 |
- echo |
1579 |
- echo "# Mirrors from parent prefix." |
1580 |
- echo "GENTOO_MIRRORS=\"$(portageq envvar GENTOO_MIRRORS || true)\"" |
1581 |
- echo |
1582 |
- echo "# Below comes the prefix-stack setup. Only change things" |
1583 |
- echo "# if you know exactly what you are doing!" |
1584 |
- echo "EPREFIX=\"${CHILD_EPREFIX}\"" |
1585 |
- echo "PORTAGE_OVERRIDE_EPREFIX=\"${PARENT_EPREFIX}\"" |
1586 |
- echo "BROOT=\"${PARENT_EPREFIX}\"" |
1587 |
-) > "${CHILD_EPREFIX}"/etc/portage/make.conf |
1588 |
-eend_exit $? |
1589 |
- |
1590 |
-ebegin "creating use.mask/prefix-stack" |
1591 |
-printf -- '-%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.mask/prefix-stack |
1592 |
-eend_exit $? |
1593 |
- |
1594 |
-ebegin "creating use.force/prefix-stack" |
1595 |
-printf -- '%s\n' prefix{,-guest,-stack} > "${CHILD_EPREFIX}"/etc/portage/profile/use.force/prefix-stack |
1596 |
-eend_exit $? |
1597 |
- |
1598 |
-ebegin "creating env/host-cc.conf" |
1599 |
-cat > "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf <<-EOM |
1600 |
- CC=${PARENT_CHOST}-gcc |
1601 |
- CXX=${PARENT_CHOST}-g++ |
1602 |
- EOM |
1603 |
-eend_exit $? |
1604 |
- |
1605 |
-ebegin "creating package.env/prefix-stack" |
1606 |
-cat > "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack <<-'EOM' |
1607 |
- # merge with the parent's chost. this forces the use of the parent |
1608 |
- # compiler, which generally would be illegal - this is an exception. |
1609 |
- # This is required for example on winnt, because the wrapper has to |
1610 |
- # be able to use/resolve symlinks, etc. native winnt binaries miss |
1611 |
- # that ability, but cygwin binaries don't. |
1612 |
- sys-devel/gcc-config host-cc.conf |
1613 |
- sys-apps/gentoo-functions host-cc.conf |
1614 |
- EOM |
1615 |
-eend_exit $? |
1616 |
- |
1617 |
-# |
1618 |
-# create the make.profile symlinks. |
1619 |
-# |
1620 |
-ebegin "creating make.profile" |
1621 |
-( |
1622 |
- ln -s "${CHILD_PROFILE}" "${CHILD_EPREFIX}/etc/portage/make.profile" |
1623 |
-) |
1624 |
-eend_exit $? |
1625 |
- |
1626 |
-# |
1627 |
-# adjust permissions of generated files. |
1628 |
-# |
1629 |
-ebegin "adjusting permissions" |
1630 |
-( |
1631 |
- set -e |
1632 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/make.conf |
1633 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/env/host-cc.conf |
1634 |
- chmod 644 "${CHILD_EPREFIX}"/etc/portage/package.env/prefix-stack |
1635 |
-) |
1636 |
-eend_exit $? |
1637 |
- |
1638 |
-# |
1639 |
-# now merge some basics. |
1640 |
-# |
1641 |
-ebegin "installing required basic packages" |
1642 |
-( |
1643 |
- set -e |
1644 |
- export PORTAGE_CONFIGROOT@=@"${CHILD_EPREFIX}" |
1645 |
- export EPREFIX@=@"${CHILD_EPREFIX}" |
1646 |
- export PORTAGE_OVERRIDE_EPREFIX@=@"${PARENT_EPREFIX}" |
1647 |
- |
1648 |
- # let baselayout create the directories |
1649 |
- USE@=@"${USE} build" \ |
1650 |
- emerge --verbose --nodeps --oneshot \ |
1651 |
- '>=baselayout-prefix-2.6' |
1652 |
- |
1653 |
- # In prefix-stack, app-portage/prefix-toolkit does |
1654 |
- # install/update an etc/portage/profile/packages file, |
1655 |
- # removing all @system packages from current make.profile, |
1656 |
- # and adding itself to @system set instead. |
1657 |
- emerge --verbose --nodeps --oneshot \ |
1658 |
- app-portage/prefix-toolkit |
1659 |
- |
1660 |
- # In prefix-stack, prefix-toolkit does have an RDEPEND on them, |
1661 |
- # to hold them in the @system set. |
1662 |
- emerge --verbose --nodeps --oneshot \ |
1663 |
- sys-apps/gentoo-functions \ |
1664 |
- app-portage/elt-patches \ |
1665 |
- sys-devel/gnuconfig \ |
1666 |
- sys-devel/gcc-config |
1667 |
- |
1668 |
- # select the stack wrapper profile from gcc-config |
1669 |
- env -i PORTAGE_CONFIGROOT="${CHILD_EPREFIX}" \ |
1670 |
- "$(type -P bash)" "${CHILD_EPREFIX}"/usr/bin/gcc-config 1 |
1671 |
-) |
1672 |
-eend_exit $? |
1673 |
- |
1674 |
-# |
1675 |
-# wow, all ok :) |
1676 |
-# |
1677 |
-ewarn |
1678 |
-ewarn "all done. don't forget to tune ${CHILD_EPREFIX}/etc/portage/make.conf." |
1679 |
-ewarn "to enter the new prefix, run \"${CHILD_EPREFIX}/startprefix\"." |
1680 |
-ewarn |
1681 |
-EOIN |
1682 |
- |
1683 |
-: prefix-stack-ccwrap <<'EOIN' |
1684 |
-#!@GENTOO_PORTAGE_BPREFIX@/bin/bash |
1685 |
- |
1686 |
-if [ -r /cygdrive/. ]; then |
1687 |
- winpath2unix() { cygpath -u "$1"; } |
1688 |
- unixpath2win() { cygpath -w "$1"; } |
1689 |
-fi |
1690 |
- |
1691 |
-myself=${0##*/} # basename $0 |
1692 |
-link_dirs=() |
1693 |
-opts=() |
1694 |
-chost="@GENTOO_PORTAGE_CHOST@" |
1695 |
-prefix="@GENTOO_PORTAGE_EPREFIX@" |
1696 |
-absprefix=${prefix} |
1697 |
-if [[ ${chost} == *"-winnt"* ]]; then |
1698 |
- # we may get called from windows binary, like pkgdata in dev-libs/icu |
1699 |
- # in this case, PATH elements get the "/dev/fs/C/WINDOWS/SUA" prefix |
1700 |
- absprefix=$(winpath2unix "$(unixpath2win "${absprefix}")") |
1701 |
-fi |
1702 |
-[[ ${myself} == *windres* ]] && mode=compile || mode=link |
1703 |
-orig_args=("$@") |
1704 |
- |
1705 |
-for opt in "$@" |
1706 |
-do |
1707 |
- case "$opt" in |
1708 |
- -L) |
1709 |
- link_dirs=("${link_dirs[@]}" "-L$1") |
1710 |
- shift |
1711 |
- ;; |
1712 |
- -L*) |
1713 |
- link_dirs=("${link_dirs[@]}" "${opt}") |
1714 |
- ;; |
1715 |
- *) |
1716 |
- case "${opt}" in |
1717 |
- -v) |
1718 |
- # -v done right: only use mode version if -v is the _only_ |
1719 |
- # argument on the command line. |
1720 |
- [[ ${#orig_args[@]} -gt 1 ]] || mode=version |
1721 |
- ;; |
1722 |
- --version) mode=version ;; |
1723 |
- -c|-E|-S) mode=compile ;; |
1724 |
- -print-search-dirs) mode=dirs ;; |
1725 |
- esac |
1726 |
- opts=("${opts[@]}" "${opt}") |
1727 |
- ;; |
1728 |
- esac |
1729 |
-done |
1730 |
- |
1731 |
-# remove any path to current prefix, need base prefix only |
1732 |
-new_path= |
1733 |
-save_ifs=$IFS |
1734 |
-IFS=':' |
1735 |
-for p in $PATH |
1736 |
-do |
1737 |
- IFS=$save_ifs |
1738 |
- [[ ${p#${absprefix}} != "${p}" ]] && continue |
1739 |
- if [[ -z "${new_path}" ]]; then |
1740 |
- new_path="${p}" |
1741 |
- else |
1742 |
- new_path="${new_path}:${p}" |
1743 |
- fi |
1744 |
-done |
1745 |
-IFS=$save_ifs |
1746 |
- |
1747 |
-PATH=${new_path} |
1748 |
- |
1749 |
-pfx_comp=("-I${prefix}/include" "-I${prefix}/usr/include") |
1750 |
-pfx_link=("-L${prefix}/usr/lib" "-L${prefix}/lib") |
1751 |
-# binutils-config's ldwrapper understands '-R' for aix and hpux too. |
1752 |
-pfx_link_r=("-Wl,-R,${prefix}/lib" "-Wl,-R,${prefix}/usr/lib") |
1753 |
-case "${chost}" in |
1754 |
-*-winnt*) |
1755 |
- # parity (winnt) understands -rpath only ... |
1756 |
- pfx_link_r=("-Wl,-rpath,${prefix}/lib" "-Wl,-rpath,${prefix}/usr/lib") |
1757 |
- ;; |
1758 |
-*-linux*) |
1759 |
- # With gcc, -isystem would avoid warning messages in installed headers, |
1760 |
- # but that breaks with AIX host headers. |
1761 |
- pfx_comp=("-isystem" "${prefix}/include" "-isystem" "${prefix}/usr/include") |
1762 |
- ;; |
1763 |
-esac |
1764 |
- |
1765 |
-# ensure we run the right chost program in base prefix |
1766 |
-[[ ${myself} == *-*-*-* ]] || myself=${chost}-${myself#${chost}-} |
1767 |
- |
1768 |
-case "$mode" in |
1769 |
-link) exec "${myself}" "${link_dirs[@]}" "${pfx_link[@]}" "${opts[@]}" "${pfx_comp[@]}" "${pfx_link_r[@]}" ;; |
1770 |
-compile) exec "${myself}" "${link_dirs[@]}" "${opts[@]}" "${pfx_comp[@]}" ;; |
1771 |
-version) exec "${myself}" "${orig_args[@]}" ;; |
1772 |
-dirs) |
1773 |
- "${myself}" "${orig_args[@]}" | while read line; do |
1774 |
- if [[ "${line}" == "libraries: ="* ]]; then |
1775 |
- echo "libraries: =${prefix}/usr/lib:${prefix}/lib:${line#"libraries: ="}" |
1776 |
- else |
1777 |
- echo "${line}" |
1778 |
- fi |
1779 |
- done |
1780 |
- ;; |
1781 |
-*) echo "cannot infer ${myself}'s mode from comamnd line arguments"; exit 1 ;; |
1782 |
-esac |
1783 |
-EOIN |