Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 417647 | Differences between
and this patch

Collapse All | Expand All

(-)a/a/Makefile (-1 / +8 lines)
Lines 5-11 PN = gcc-config Link Here
5
PV = git
5
PV = git
6
P = $(PN)-$(PV)
6
P = $(PN)-$(PV)
7
7
8
PREFIX = /usr
8
EPREFIX =
9
PREFIX = $(EPREFIX)/usr
9
BINDIR = $(PREFIX)/bin
10
BINDIR = $(PREFIX)/bin
10
SUBLIBDIR = lib
11
SUBLIBDIR = lib
11
LIBDIR = $(PREFIX)/$(SUBLIBDIR)
12
LIBDIR = $(PREFIX)/$(SUBLIBDIR)
Lines 16-21 INSTALL_EXE = install -m 755 Link Here
16
17
17
all: wrapper
18
all: wrapper
18
19
20
wrapper.c: wrapper.c.in
21
	sed \
22
		-e 's:@GENTOO_PORTAGE_EPREFIX@:$(EPREFIX):g' \
23
		wrapper.c.in > wrapper.c
24
19
clean:
25
clean:
20
	rm -f wrapper *.o core
26
	rm -f wrapper *.o core
21
27
Lines 23-28 install: all Link Here
23
	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR)
29
	$(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR)
24
	$(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
30
	$(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
25
	sed \
31
	sed \
32
		-e 's:@GENTOO_PORTAGE_EPREFIX@:$(EPREFIX):g' \
26
		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
33
		-e 's:@GENTOO_LIBDIR@:$(SUBLIBDIR):g' \
27
		-e 's:@PV@:$(PV):g' \
34
		-e 's:@PV@:$(PV):g' \
28
		gcc-config > $(DESTDIR)$(BINDIR)/gcc-config
35
		gcc-config > $(DESTDIR)$(BINDIR)/gcc-config
(-)a/a/gcc-config (-47 / +67 lines)
Lines 9-22 Link Here
9
: ${ROOT:=/}
9
: ${ROOT:=/}
10
[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
10
[[ ${ROOT} != */ ]] && ROOT="${ROOT}/"
11
[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
11
[[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}"
12
BPREFIX="@GENTOO_PORTAGE_EPREFIX@"
13
: ${EPREFIX:=${BPREFIX}}
14
EROOT="${ROOT%/}${EPREFIX}/"
12
15
13
cd /
16
cd /
14
17
15
trap ":" INT QUIT TSTP
18
trap ":" INT QUIT TSTP
16
19
17
argv0=${0##*/}
20
argv0=${0##*/}
18
source /etc/init.d/functions.sh || {
21
source "${BPREFIX}"/etc/init.d/functions.sh || {
19
	echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
22
	echo "${argv0}: Could not source ${BPREFIX}/etc/init.d/functions.sh!" 1>&2
20
	exit 1
23
	exit 1
21
}
24
}
22
esyslog() { :; }
25
esyslog() { :; }
Lines 84-99 try_real_hard_to_find_CHOST() { Link Here
84
	#
87
	#
85
88
86
	local varname=${1:-CHOST}
89
	local varname=${1:-CHOST}
87
	local conf=${ROOT}/etc/portage/make.conf
90
	local conf=${EROOT}/etc/portage/make.conf
88
	if [[ ! -e ${conf} && -e ${ROOT}/etc/make.conf ]] ; then
91
	if [[ ! -e ${conf} && -e ${EROOT}/etc/make.conf ]] ; then
89
		conf=${ROOT}/etc/make.conf
92
		conf=${EROOT}/etc/make.conf
90
	fi
93
	fi
91
	local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
94
	local ret=$(source "${conf}" 2>/dev/null ; echo ${!varname})
92
	if [[ -z ${ret} ]] ; then
95
	if [[ -z ${ret} ]] ; then
93
		# newer portage supports spaces between the var and =
96
		# newer portage supports spaces between the var and =
94
		# CHOST     =  "this-is-retarded"
97
		# CHOST     =  "this-is-retarded"
95
		ret=$(eval $(
98
		ret=$(eval $(
96
			sed -n \
99
			${SED} -n \
97
				-e 's:[[:space:]]::g' \
100
				-e 's:[[:space:]]::g' \
98
				-e "/^${varname}=/p" \
101
				-e "/^${varname}=/p" \
99
				"${conf}"
102
				"${conf}"
Lines 109-116 try_real_hard_to_find_CHOST() { Link Here
109
	#
112
	#
110
	# Then we try /etc/env.d/gcc/config-${CTARGET}
113
	# Then we try /etc/env.d/gcc/config-${CTARGET}
111
	#
114
	#
112
	if [[ -s ${ROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
115
	if [[ -s ${EROOT}/etc/env.d/gcc/config-${CTARGET} ]] ; then
113
		ret=$(split_gcc_ver $(show_var CURRENT "${ROOT}"/etc/env.d/gcc/config-${CTARGET}))
116
		ret=$(split_gcc_ver $(show_var CURRENT "${EROOT}"/etc/env.d/gcc/config-${CTARGET}))
114
		echo ${ret% *}
117
		echo ${ret% *}
115
	fi
118
	fi
116
}
119
}
Lines 124-130 get_chost() { Link Here
124
127
125
	# make sure portage isnt broken
128
	# make sure portage isnt broken
126
	if python -V &>/dev/null ; then
129
	if python -V &>/dev/null ; then
127
		CHOST=$(portageq envvar CHOST 2>/dev/null)
130
		CHOST=$(env -i EPREFIX="${BPREFIX}" "$(PATH="${BPREFIX}/usr/bin:${PATH}" type -P portageq)" envvar CHOST 2>/dev/null)
128
	else
131
	else
129
		ewarn "Python seems to be broken, attempting to locate CHOST ourselves ..."
132
		ewarn "Python seems to be broken, attempting to locate CHOST ourselves ..."
130
		CHOST=$(try_real_hard_to_find_CHOST)
133
		CHOST=$(try_real_hard_to_find_CHOST)
Lines 133-139 get_chost() { Link Here
133
	if [[ -z ${CHOST} ]] ; then
136
	if [[ -z ${CHOST} ]] ; then
134
		eerror "${argv0}: Could not get portage CHOST!"
137
		eerror "${argv0}: Could not get portage CHOST!"
135
		eerror "${argv0}: You should verify that CHOST is set in one of these places:"
138
		eerror "${argv0}: You should verify that CHOST is set in one of these places:"
136
		eerror "${argv0}:  - ${ROOT}/etc/portage/make.conf"
139
		eerror "${argv0}:  - ${EROOT}/etc/portage/make.conf"
137
		eerror "${argv0}:  - active environment"
140
		eerror "${argv0}:  - active environment"
138
		exit 1
141
		exit 1
139
	fi
142
	fi
Lines 196-202 update_wrappers() { Link Here
196
	# Find the bin wrapper
199
	# Find the bin wrapper
197
	local wrapper
200
	local wrapper
198
	for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
201
	for wrapper in ${GENTOO_LIBDIR} lib lib64 lib32 lib ; do
199
		wrapper="${ROOT}usr/${wrapper}/misc/gcc-config"
202
		wrapper="${EROOT}usr/${wrapper}/misc/gcc-config"
200
		[[ -e ${wrapper} ]] && break
203
		[[ -e ${wrapper} ]] && break
201
	done
204
	done
202
205
Lines 222-228 update_wrappers() { Link Here
222
	# new one does not.
225
	# new one does not.
223
	for x in "${old_wrappers[@]}" ; do
226
	for x in "${old_wrappers[@]}" ; do
224
		has "${x}" "${new_wrappers[@]}" && continue
227
		has "${x}" "${new_wrappers[@]}" && continue
225
		rm -f "${ROOT}usr/bin/${x}" "${ROOT}usr/bin/${CTARGET}-${x}"
228
		rm -f "${EROOT}usr/bin/${x}" "${EROOT}usr/bin/${CTARGET}-${x}"
226
	done
229
	done
227
230
228
	# For all toolchains, we want to create the fully qualified
231
	# For all toolchains, we want to create the fully qualified
Lines 259-278 update_wrappers() { Link Here
259
262
260
		# Now do the actual wrapper copy with paths to the reference binary
263
		# Now do the actual wrapper copy with paths to the reference binary
261
		if [[ -x ${ref} ]] ; then
264
		if [[ -x ${ref} ]] ; then
262
			atomic_cp "${wrapper}" "${ROOT}usr/bin" "${x}" "${ref}"
265
			atomic_cp "${wrapper}" "${EROOT}usr/bin" "${x}" "${ref}"
263
		else
266
		else
264
			ewarn "double insanity with ${x} and ${ref}"
267
			ewarn "double insanity with ${x} and ${ref}"
265
			# Make sure we have no stale wrappers
268
			# Make sure we have no stale wrappers
266
			rm -f "${ROOT}usr/bin/${x}"
269
			rm -f "${EROOT}usr/bin/${x}"
267
		fi
270
		fi
268
	done
271
	done
269
	# legacy cruft, make sure we dont leave it laying around #143205
272
	# legacy cruft, make sure we dont leave it laying around #143205
270
	rm -f "${ROOT}usr/bin/${CTARGET}-cc" "${ROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
273
	rm -f "${EROOT}usr/bin/${CTARGET}-cc" "${EROOT}usr/bin"/{${CTARGET}-,}g{cc,++}{32,64}
271
274
272
	# install the canonical cpp wrapper
275
	# install the canonical cpp wrapper
273
	[[ ${CTARGET} == *-solaris* ]] && return 0
274
	if ! is_cross_compiler ; then
276
	if ! is_cross_compiler ; then
275
		atomic_cp "${wrapper}" "${ROOT}lib" "cpp" "${ROOT}usr/bin/cpp"
277
		atomic_cp "${wrapper}" "${EROOT}lib" "cpp" "${EROOT}usr/bin/cpp"
276
	fi
278
	fi
277
}
279
}
278
280
Lines 301-333 handle_split_usr() { Link Here
301
	eval $(grep -h '^LDPATH=' "${GCC_ENV_D}"/${CHOST}-* | tail -1)
303
	eval $(grep -h '^LDPATH=' "${GCC_ENV_D}"/${CHOST}-* | tail -1)
302
	LDPATH=${LDPATH%%:*}
304
	LDPATH=${LDPATH%%:*}
303
305
304
	# If /usr isn't a sep mount, then don't bother with linking stuff.
306
	# If /usr isn't a sep mount or EPREFIX is set, then don't bother with linking stuff.
305
	if ln "${ROOT}/${LDPATH}/libgcc.a" "${ROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
307
	if [[ -n ${EPREFIX} ]] || ln "${ROOT}/${LDPATH}/libgcc.a" "${EROOT}"/lib/.gcc.config.$$ 2>/dev/null ; then
306
		rm -f "${ROOT}"/lib/.gcc.config.$$
308
		rm -f "${EROOT}"/lib/.gcc.config.$$
307
		if [[ -n $(find "${ROOT}"/lib*/lib{gcc_s,unwind}.so* 2>/dev/null) ]] ; then
309
		if [[ -n $(find "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib} 2>/dev/null) ]] ; then
308
			# If we previously had stuff in /, make sure ldconfig gets re-run.
310
			# If we previously had stuff in /, make sure ldconfig gets re-run.
309
			rm -f "${ROOT}"/lib*/lib{gcc_s,unwind}.so*
311
			rm -f "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib}
310
			return 1
312
			return 1
311
		fi
313
		fi
312
		return 0
314
		return 0
313
	fi
315
	fi
314
316
315
	# Only bother with this stuff for the native ABI.  We assume the user
317
	gcc="${ROOT}${LATEST_GCC_PATH}/gcc"
316
	# doesn't have critical binaries for non-native ABIs which is fair.
318
317
	local gcclib
319
	local multilib
318
	local libdir="${ROOT}${GENTOO_LIBDIR}"
320
	for multilib in $("${gcc}" -print-multi-lib); do
319
	mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
321
		local multiarg=${multilib#*;}
320
	for gcclib in gcc_s unwind ; do
322
		multiarg=${multiarg/@/-}
321
		# This assumes that we always have the .so symlink,
323
		local multilibdir=${multilib%;*}
322
		# but for now, that should be safe ...
324
		local libdir="${EROOT}lib/"$("${gcc}" ${multiarg} -print-multi-os-directory)
323
		for gcclib in "${ROOT}${LDPATH}"/lib${gcclib}.so.* ; do
325
324
			[[ -e ${gcclib} ]] || continue
326
		mkdir -p "${libdir}"/.gcc.config.new || continue # !?!?!
325
			cp -pP "${gcclib}" "${libdir}"/.gcc.config.new/
327
326
			# no need to sanity `rm` this as the `mv` should take care
328
		# Only bother with this stuff for the native ABI.  We assume the user
327
			# of it.  we also need this step to be completely atomic
329
		# doesn't have critical binaries for non-native ABIs which is fair.
328
			# for systems that have even `mv` linked against libgcc_s.so.
330
		local gcclib
329
			# http://bugs.gentoo.org/150257
331
		local libdir="${ROOT}${GENTOO_LIBDIR}"
330
			mv -f "${libdir}"/.gcc.config.new/* "${libdir}"/
332
		mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
333
		for gcclib in gcc_s unwind ; do
334
			# This assumes that we always have the .so symlink,
335
			# but for now, that should be safe ...
336
			for gcclib in "${ROOT}${LDPATH}"/lib${gcclib}.so.* ; do
337
				[[ -e ${gcclib} ]] || continue
338
				cp -pP "${gcclib}" "${libdir}"/.gcc.config.new/
339
				# no need to sanity `rm` this as the `mv` should take care
340
				# of it.  we also need this step to be completely atomic
341
				# for systems that have even `mv` linked against libgcc_s.so.
342
				# http://bugs.gentoo.org/150257
343
				mv -f "${libdir}"/.gcc.config.new/* "${libdir}"/
344
			done
331
		done
345
		done
332
	done
346
	done
333
	rmdir "${libdir}"/.gcc.config.new
347
	rmdir "${libdir}"/.gcc.config.new
Lines 341-347 switch_profile() { Link Here
341
355
342
	# Make sure we have write access to the dirs.  Do not require `root`
356
	# Make sure we have write access to the dirs.  Do not require `root`
343
	# so that we work with prefix/cross/etc... setups that run as user.
357
	# so that we work with prefix/cross/etc... setups that run as user.
344
	[[ ! -w ${ROOT} ]] && die "need write access to ${ROOT}"
358
	[[ ! -w ${EROOT} ]] && die "need write access to ${EROOT}"
345
359
346
	if is_cross_compiler ; then
360
	if is_cross_compiler ; then
347
		ebegin "Switching cross-compiler to ${CC_COMP}"
361
		ebegin "Switching cross-compiler to ${CC_COMP}"
Lines 408-414 switch_profile() { Link Here
408
		# Pass all by default
422
		# Pass all by default
409
		awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH|MULTIOSDIRS)=/ {print $0}' \
423
		awk '!/^(STDCXX_INCDIR|LDPATH|CC|CXX|CTARGET|GCCBITS|GCC_SPECS|GCC_PATH|MULTIOSDIRS)=/ {print $0}' \
410
			"${GCC_ENV_D}/${CC_COMP}" >> "${envd}.tmp"
424
			"${GCC_ENV_D}/${CC_COMP}" >> "${envd}.tmp"
411
		if [[ -d ${ROOT}/etc/ld.so.conf.d ]] ; then
425
		if [[ -z ${EPREFIX} && -d ${ROOT}/etc/ld.so.conf.d ]] ; then
412
			echo "${MY_LDPATH}" > "${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
426
			echo "${MY_LDPATH}" > "${ROOT}"/etc/ld.so.conf.d/05gcc-${CTARGET}.conf
413
		else
427
		else
414
			echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
428
			echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
Lines 427-433 switch_profile() { Link Here
427
		local x libdir pkgconfdir
441
		local x libdir pkgconfdir
428
		local mver=${CC_COMP_VERSION:0:3}
442
		local mver=${CC_COMP_VERSION:0:3}
429
		for libdir in ${MULTIOSDIRS//:/ } ; do
443
		for libdir in ${MULTIOSDIRS//:/ } ; do
430
			pkgconfdir="${ROOT}/usr/lib/${libdir}/pkgconfig"
444
			pkgconfdir="${EROOT}/usr/lib/${libdir}/pkgconfig"
431
			for x in "" "-${mver}" ; do
445
			for x in "" "-${mver}" ; do
432
				x="${pkgconfdir}/libgcj${x}.pc"
446
				x="${pkgconfdir}/libgcj${x}.pc"
433
				if [[ -e ${pkgconfdir}/libgcj-${CC_COMP_VERSION}.pc ]] ; then
447
				if [[ -e ${pkgconfdir}/libgcj-${CC_COMP_VERSION}.pc ]] ; then
Lines 458-464 switch_profile() { Link Here
458
			ewarn "env-update failed to work properly; making sure ld.so.conf paths"
472
			ewarn "env-update failed to work properly; making sure ld.so.conf paths"
459
			ewarn "are setup properly.  Please rerun gcc-config with the -f option."
473
			ewarn "are setup properly.  Please rerun gcc-config with the -f option."
460
			echo ""
474
			echo ""
461
			if [[ ! -d /etc/ld.so.conf.d ]] ; then
475
			if [[ -z ${EPREFIX} && ! -d /etc/ld.so.conf.d ]] ; then
462
				show_var LDPATH "${ROOT}"/etc/env.d/05gcc-${CTARGET} \
476
				show_var LDPATH "${ROOT}"/etc/env.d/05gcc-${CTARGET} \
463
					| sed -e 's|:|\n|g' >> /etc/ld.so.conf
477
					| sed -e 's|:|\n|g' >> /etc/ld.so.conf
464
			fi
478
			fi
Lines 475-481 switch_profile() { Link Here
475
		ewarn "If you intend to use the gcc from the new profile in an already"
489
		ewarn "If you intend to use the gcc from the new profile in an already"
476
		ewarn "running shell, please remember to do:"
490
		ewarn "running shell, please remember to do:"
477
		echo
491
		echo
478
		ewarn "  . /etc/profile"
492
		ewarn " (bash) # . ${EPREFIX}/etc/profile"
493
		ewarn "or"
494
		ewarn " (tcsh) # source ${EPREFIX}/etc/csh.login"
479
		echo
495
		echo
480
	fi
496
	fi
481
497
Lines 653-659 DOIT="" Link Here
653
FORCE="no"
669
FORCE="no"
654
670
655
CC_COMP=
671
CC_COMP=
656
ENV_D="${ROOT}etc/env.d"
672
ENV_D="${EROOT}etc/env.d"
657
GCC_ENV_D="${ENV_D}/gcc"
673
GCC_ENV_D="${ENV_D}/gcc"
658
674
659
for x in "$@" ; do
675
for x in "$@" ; do
Lines 784-790 if [[ -z ${CC_COMP} ]] ; then Link Here
784
fi
800
fi
785
801
786
if [[ ${DOIT} != "get_current_profile" ]] ; then
802
if [[ ${DOIT} != "get_current_profile" ]] ; then
787
	GCC_LIB=$(get_lib_path | awk -F/ '{ print  "/"$2"/"$3"/"$4"/" }')
803
	GCC_LIB=$(
804
		get_lib_path | \
805
 			sed -e "s|${EPREFIX}/*|/|g" | \
806
			awk -F/ '{ print "/"$2"/"$3"/"$4"/" }'
807
	)
788
808
789
	# For people who insist on using funky version strings ("4.6.x"
809
	# For people who insist on using funky version strings ("4.6.x"
790
	# rather than "4.6.2"), allow them to manually specify it.
810
	# rather than "4.6.2"), allow them to manually specify it.
Lines 797-807 if [[ ${DOIT} != "get_current_profile" ]] ; then Link Here
797
		CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
817
		CC_COMP_TARGET=${CC_COMP%-${CC_COMP_VERSION}*}
798
	fi
818
	fi
799
819
800
	if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
820
	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]]; then
801
		CC_COMP_VERSION=${CC_COMP_VERSION%-*}
821
		CC_COMP_VERSION=${CC_COMP_VERSION%-*}
802
	fi
822
	fi
803
823
804
	if [[ ! -d ${ROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
824
	if [[ ! -d ${EROOT}/${GCC_LIB}/${CC_COMP_TARGET}/${CC_COMP_VERSION} ]] || \
805
	   [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
825
	   [[ ! -f ${GCC_ENV_D}/${CC_COMP} ]]
806
	then
826
	then
807
		eerror "${argv0}: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2
827
		eerror "${argv0}: Profile does not exist or invalid setting for ${GCC_ENV_D}/${CC_COMP}" 1>&2
(-)a/a/wrapper.c.in (-6 / +6 lines)
Lines 21-28 Link Here
21
#include <sys/stat.h>
21
#include <sys/stat.h>
22
#include <sys/types.h>
22
#include <sys/types.h>
23
23
24
#define GCC_CONFIG "/usr/bin/gcc-config"
24
#define GCC_CONFIG "@GENTOO_PORTAGE_EPREFIX@/usr/bin/gcc-config"
25
#define ENVD_BASE  "/etc/env.d/05gcc"
25
#define ENVD_BASE  "@GENTOO_PORTAGE_EPREFIX@/etc/env.d/05gcc"
26
26
27
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
27
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
28
28
Lines 146-152 static int find_target_in_envd(struct wrapper_data *data, int cross_compile) Link Here
146
		/* for the sake of speed, we'll keep a symlink around for
146
		/* for the sake of speed, we'll keep a symlink around for
147
		 * the native compiler.  #190260
147
		 * the native compiler.  #190260
148
		 */
148
		 */
149
		snprintf(envd_file, sizeof(envd_file)-1, "/etc/env.d/gcc/.NATIVE");
149
		snprintf(envd_file, sizeof(envd_file)-1, "@GENTOO_PORTAGE_EPREFIX@/etc/env.d/gcc/.NATIVE");
150
	} else {
150
	} else {
151
		char *ctarget, *end = strrchr(data->name, '-');
151
		char *ctarget, *end = strrchr(data->name, '-');
152
		if (end == NULL)
152
		if (end == NULL)
Lines 213-219 static void find_wrapper_target(struct wrapper_data *data) Link Here
213
	/* Only our wrapper is in PATH, so get the CC path using
213
	/* Only our wrapper is in PATH, so get the CC path using
214
	 * gcc-config and execute the real binary in there ...
214
	 * gcc-config and execute the real binary in there ...
215
	 */
215
	 */
216
	FILE *inpipe = popen("ROOT= " GCC_CONFIG " --get-bin-path", "r");
216
	FILE *inpipe = popen("ROOT= EPREFIX=\"@GENTOO_PORTAGE_EPREFIX@\" " GCC_CONFIG " --get-bin-path", "r");
217
	if (inpipe == NULL)
217
	if (inpipe == NULL)
218
		wrapper_errp("could not open pipe");
218
		wrapper_errp("could not open pipe");
219
219
Lines 289-296 int main(int argc, char *argv[]) Link Here
289
			data.name = wrapper_aliases[i].target;
289
			data.name = wrapper_aliases[i].target;
290
290
291
	/* What is the full name of our wrapper? */
291
	/* What is the full name of our wrapper? */
292
	data.fullname = xmalloc(strlen(data.name) + sizeof("/usr/bin/") + 1);
292
	data.fullname = xmalloc(strlen(data.name) + sizeof("@GENTOO_PORTAGE_EPREFIX@/usr/bin/") + 1);
293
	sprintf(data.fullname, "/usr/bin/%s", data.name);
293
	sprintf(data.fullname, "@GENTOO_PORTAGE_EPREFIX@/usr/bin/%s", data.name);
294
294
295
	find_wrapper_target(&data);
295
	find_wrapper_target(&data);
296
296

Return to bug 417647