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

Collapse All | Expand All

(-)toolchain.eclass (-5 / +145 lines)
Lines 146-151 Link Here
146
	tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
146
	tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
147
	tc_version_is_at_least 4.2 && IUSE_DEF+=( openmp )
147
	tc_version_is_at_least 4.2 && IUSE_DEF+=( openmp )
148
	tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
148
	tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
149
	tc_version_is_at_least 4.4 && IUSE+=${BOOTGCC_SRC_URI:+" ada"}
149
	tc_version_is_at_least 4.7 && IUSE+=" go"
150
	tc_version_is_at_least 4.7 && IUSE+=" go"
150
	# Note: while <=gcc-4.7 also supported graphite, it required forked ppl
151
	# Note: while <=gcc-4.7 also supported graphite, it required forked ppl
151
	# versions which we dropped.  Since graphite was also experimental in
152
	# versions which we dropped.  Since graphite was also experimental in
Lines 304-309 Link Here
304
#			ten Brugge's bounds-checking patches. If you want to use a patch
305
#			ten Brugge's bounds-checking patches. If you want to use a patch
305
#			for an older gcc version with a new gcc, make sure you set
306
#			for an older gcc version with a new gcc, make sure you set
306
#			HTB_GCC_VER to that version of gcc.
307
#			HTB_GCC_VER to that version of gcc.
308
#
309
#	BOOTGCC_SRC_URI
310
#			This variable specifies the SRC_URI value for the gcc binary image
311
#			for bootstrap, where the filename needs to start with "bootgcc-".
312
#			See comments in prepare_bootgcc() for how to create such images.
313
#			An example:
314
#					BOOTGCC_SRC_URI="
315
#						amd64? ( mirror://gentoo/bootgcc-4.4.7-amd64.tar.xz )
316
#						x86?   ( mirror://gentoo/bootgcc-4.4.7-x86.tar.xz   )
317
#					"
318
#			That is, in a native build, the bootgcc-* filename in $A, if any,
319
#			is used as the bootstrap compiler for your native ARCH.
307
get_gcc_src_uri() {
320
get_gcc_src_uri() {
308
	export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
321
	export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
309
	export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
322
	export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
Lines 362-367 Link Here
362
		fi
375
		fi
363
	fi
376
	fi
364
377
378
	is_crosscompile || GCC_SRC_URI+="${BOOTGCC_SRC_URI:+ ${BOOTGCC_SRC_URI}}"
379
365
	echo "${GCC_SRC_URI}"
380
	echo "${GCC_SRC_URI}"
366
}
381
}
367
382
Lines 408-413 Link Here
408
	else
423
	else
409
		gcc_quick_unpack
424
		gcc_quick_unpack
410
	fi
425
	fi
426
427
	unpack_bootgcc
411
}
428
}
412
429
413
gcc_quick_unpack() {
430
gcc_quick_unpack() {
Lines 470-475 Link Here
470
	popd > /dev/null
487
	popd > /dev/null
471
}
488
}
472
489
490
unpack_bootgcc() {
491
	is_crosscompile && return 0
492
	tc-is-cross-compiler && return 0
493
494
	local a
495
	for a in ${A} ; do
496
		[[ ${a} == bootgcc-* ]] && unpack ${a}
497
		tc_version_is_at_least 4.8 && continue
498
		# support gnatboot images (c,ada) used by old gnatbuild.eclass
499
		[[ ${a} == gnatboot-* ]] && unpack ${a}
500
	done
501
}
502
473
#---->> src_prepare <<----
503
#---->> src_prepare <<----
474
504
475
toolchain_src_prepare() {
505
toolchain_src_prepare() {
Lines 590-595 Link Here
590
				einfo "  ${f%%...}"
620
				einfo "  ${f%%...}"
591
			done
621
			done
592
	fi
622
	fi
623
624
	prepare_bootgcc
593
}
625
}
594
626
595
guess_patch_type_in_dir() {
627
guess_patch_type_in_dir() {
Lines 781-786 Link Here
781
	done
813
	done
782
}
814
}
783
815
816
prepare_bootgcc() {
817
	local bootbin=
818
	local bootlib=
819
	if [[ -d ${WORKDIR}/etc/env.d/gcc ]] ; then
820
		#
821
		# How to create the bootstrap gcc binary image to be used here:
822
		#
823
		# $ USE="
824
		#       ada         # gnat needs Ada compiler for bootstrap (#547358)
825
		#       cxx         # >=gcc-4.8 needs C++ compiler for bootstrap
826
		#       -multilib   # needless for bootstrap (switch profile!)
827
		#       -nptl       # needless for bootstrap
828
		#       -openmp     # needless for bootstrap
829
		#       -anything   # needless for bootstrap
830
		#   " emerge --buildpkg =sys-devel/gcc-X.Y.Z-R
831
		#
832
		# $ bzip2 -dc /usr/portage/packages/sys-devel/gcc-X.Y.Z-R.tbz2 |
833
		#     xz -c -9 --extreme > bootgcc-X.Y.Z-R-ARCH.tar.xz
834
		#
835
		# For a new ARCH, you have to find out yourself where to get your
836
		# initial C,C++,Ada compiler from. Eventually there is an existing
837
		# one somewhere, or you have to cross-compile.
838
		#
839
		eval $(
840
			PATH=
841
			LDPATH=
842
			source "${WORKDIR}"/etc/env.d/gcc/*
843
			echo "bootbin='${WORKDIR}/${PATH##/}'"
844
			echo "bootlib='${WORKDIR}/${LDPATH##/}'"
845
		)
846
	elif [[ -d ${WORKDIR}/usr/lib/gnatgcc ]] ; then
847
		# <=gnatboot-4.1 image used by old gnatbuild.eclass
848
		bootbin=${WORKDIR}/usr/bin
849
		bootlib=$(echo "${WORKDIR}"/usr/lib/gnatgcc/*/*)
850
		if [[ -x ${bootbin}/gnatgcc_2wrap ]] ; then
851
			# gnatgcc wrapper script fails to properly quote args,
852
			# and we create wrappers anyway
853
			mv -f ${bootbin}/gnatgcc{_2wrap,} || die
854
		fi
855
	elif [[ -d ${WORKDIR}/usr/bin ]] ; then
856
		# >gnatboot-4.1 image used by old gnatbuild.eclass
857
		bootbin=${WORKDIR}/usr/bin
858
		bootlib=${WORKDIR}/usr/lib
859
	else
860
		#
861
		# nothing unpacked:
862
		# either we do cross compile, or there is no binary image for ARCH yet
863
		#
864
		return 0
865
	fi
866
867
	# Must not set tool variables into environment,
868
	# as they break the just-built stage compilers.
869
	_setup_bootgcc_tool() {
870
		local wrapdir=$1 envvar=$2 tool=$3 bootbin=$4 bootlib=$5
871
		mkdir -p "${wrapdir}" || die
872
		{
873
			echo "#! ${BASH}"
874
			echo "export CPATH='${bootlib}/include'"
875
			echo "export LIB_DIR='${bootlib}'"
876
			echo "export LDFLAGS='-L${bootlib}'"
877
			echo "export LIBRARY_PATH='${bootlib}'"
878
			echo "export ADA_OBJECTS_PATH='${bootlib}/adalib'"
879
			echo "export ADA_INCLUDE_PATH='${bootlib}/adainclude'"
880
			# need to find cc1, cc1plus, gnat1, ...
881
			echo "export PATH='${bootbin}:${PATH}'"
882
			echo "exec '${bootbin}/${tool}' \"\${@}\""
883
		} > "${wrapdir}/${tool}" || die
884
		chmod +x "${wrapdir}/${tool}" || die
885
		export ${envvar}=${wrapdir}/${tool}
886
	}
887
	local wrapdir=${WORKDIR}/bootgcc
888
	local wraplist=(
889
		CPP       cpp
890
		CC        gcc
891
		CXX       g++
892
		# do we really need all of them? more?
893
		GNATBIND  gnatbind
894
		GNATCHOP  gnatchop
895
		GNATCLEAN gnatclean
896
		GNATFIND  gnatfind
897
		GNATKR    gnatkr
898
		GNATLINK  gnatlink
899
		GNATLS    gnatls
900
		GNATMAKE  gnatmake
901
		GNATMEM   gnatmem
902
		GNATPREP  gnatprep
903
		GNATSYM   gnatsym
904
		GNATXREF  gnatxref
905
	)
906
	local i var tool
907
	for ((i = 0; i < ${#wraplist[@]}; i += 2)) ; do
908
		var=${wraplist[i]}
909
		tool=${wraplist[i + 1]}
910
		if [[ -x ${bootbin}/${tool} ]] ; then
911
			_setup_bootgcc_tool "${wrapdir}" ${var} "${tool}" "${bootbin}" "${bootlib}"
912
		elif [[ ${tool} != gnat* && -x ${bootbin}/gnat${tool} ]] ; then
913
			# gnatcpp,gnatgcc,gnatg++ in image used by old gnatbuild.eclass
914
			_setup_bootgcc_tool "${wrapdir}" ${var} "gnat${tool}" "${bootbin}" "${bootlib}"
915
		fi
916
	done
917
	# some (older) gcc do not use (enough) GNAT-tool environment vars
918
	export PATH=${wrapdir}:${PATH}
919
}
920
784
#---->> src_configure <<----
921
#---->> src_configure <<----
785
922
786
toolchain_src_configure() {
923
toolchain_src_configure() {
Lines 849-854 Link Here
849
		fi
986
		fi
850
		is_objcxx && GCC_LANG+=",obj-c++"
987
		is_objcxx && GCC_LANG+=",obj-c++"
851
	fi
988
	fi
989
	if is_ada ; then
990
		GCC_LANG+=",ada"
991
		confgcc+=( --enable-libada )
992
	fi
852
993
853
	# fortran support just got sillier! the lang value can be f77 for
994
	# fortran support just got sillier! the lang value can be f77 for
854
	# fortran77, f95 for fortran95, or just plain old fortran for the
995
	# fortran77, f95 for fortran95, or just plain old fortran for the
Lines 857-865 Link Here
857
	is_f77 && GCC_LANG+=",f77"
998
	is_f77 && GCC_LANG+=",f77"
858
	is_f95 && GCC_LANG+=",f95"
999
	is_f95 && GCC_LANG+=",f95"
859
1000
860
	# We do NOT want 'ADA support' in here!
861
	# is_ada && GCC_LANG+=",ada"
862
863
	confgcc+=( --enable-languages=${GCC_LANG} )
1001
	confgcc+=( --enable-languages=${GCC_LANG} )
864
1002
865
	### general options
1003
	### general options
Lines 1655-1661 Link Here
1655
	cd "${D}"${BINPATH}
1793
	cd "${D}"${BINPATH}
1656
	# Ugh: we really need to auto-detect this list.
1794
	# Ugh: we really need to auto-detect this list.
1657
	#      It's constantly out of date.
1795
	#      It's constantly out of date.
1658
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do
1796
	for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo \
1797
		gnat{bind,chop,clean,find,kr,link,ls,make,mem,name,prep,sym,xref} \
1798
	; do
1659
		# For some reason, g77 gets made instead of ${CTARGET}-g77...
1799
		# For some reason, g77 gets made instead of ${CTARGET}-g77...
1660
		# this should take care of that
1800
		# this should take care of that
1661
		[[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
1801
		[[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
Lines 2102-2108 Link Here
2102
2242
2103
is_ada() {
2243
is_ada() {
2104
	gcc-lang-supported ada || return 1
2244
	gcc-lang-supported ada || return 1
2105
	use ada
2245
	use_if_iuse ada
2106
}
2246
}
2107
2247
2108
is_cxx() {
2248
is_cxx() {

Return to bug 547358