diff options
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r-- | eclass/toolchain.eclass | 141 |
1 files changed, 71 insertions, 70 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 5acaa2ffc688..03e335dac5c5 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -9,7 +9,11 @@ HOMEPAGE="https://gcc.gnu.org/" inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix -if [[ ${PV} == *9999* ]] ; then +tc_is_live() { + [[ ${PV} == *9999* ]] +} + +if tc_is_live ; then EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git" # naming style: # gcc-10.1.0_pre9999 -> gcc-10-branch @@ -69,26 +73,25 @@ GCCMAJOR=$(ver_cut 1 ${GCC_PV}) GCCMINOR=$(ver_cut 2 ${GCC_PV}) GCCMICRO=$(ver_cut 3 ${GCC_PV}) -# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex. -# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? -GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(ver_rs 3 '-' ${GCC_PV})} - -# Pre-release support -if [[ ${GCC_PV} == *_pre* ]] ; then - PRERELEASE=${GCC_PV/_pre/-} -elif [[ ${GCC_PV} == *_alpha* ]] ; then - SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_alpha} -elif [[ ${GCC_PV} == *_beta* ]] ; then - SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_beta} +# gcc hardcodes it's internal version into gcc/BASE-VER +# and assumes various directories and tools to have the +# same name. +# TODO: once ada ebuilds are fixed turn it to +# GCC_CONFIG_VER=${GCC_RELEASE_VER} +GCC_CONFIG_VER=${GCC_CONFIG_VER:-${GCC_RELEASE_VER}} + +# Pre-release support. Versioning schema: +# 1.0.0_pre9999: live ebuild +# 1.2.3_alphaYYYYMMDD: weekly snapshots +# 1.2.3_rcYYYYMMDD: release candidates +if [[ ${GCC_PV} == *_alpha* ]] ; then + # weekly snapshots + SNAPSHOT=${GCCMAJOR}-${GCC_PV##*_alpha} elif [[ ${GCC_PV} == *_rc* ]] ; then + # release candidates SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc} fi -if [[ ${SNAPSHOT} == [56789].0-* ]] ; then - # The gcc-5+ releases have dropped the .0 for some reason. - SNAPSHOT=${SNAPSHOT/.0} -fi - PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr} if tc_version_is_at_least 3.4.0 ; then @@ -187,7 +190,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then fi if tc_version_is_at_least 10; then - # Note: currently we pull in prereleases, snapshots and + # Note: currently we pull in releases, snapshots and # git versions into the same SLOT. SLOT="${GCCMAJOR}" else @@ -256,12 +259,10 @@ PDEPEND=">=sys-devel/gcc-config-1.7" #---->> S + SRC_URI essentials <<---- # Set the source directory depending on whether we're using -# a prerelease, snapshot, or release tarball. +# a live git tree, snapshot, or release tarball. S=$( - if [[ ${PV} == *9999* ]]; then + if tc_is_live ; then echo ${EGIT_CHECKOUT_DIR} - elif [[ -n ${PRERELEASE} ]] ; then - echo ${WORKDIR}/gcc-${PRERELEASE} elif [[ -n ${SNAPSHOT} ]] ; then echo ${WORKDIR}/gcc-${SNAPSHOT} else @@ -285,6 +286,10 @@ gentoo_urls() { # Other than the variables normally set by portage, this function's behavior # can be altered by setting the following: # +# GCC_TARBALL_SRC_URI +# Override link to main tarball into SRC_URI. Used by dev-lang/gnat-gpl +# to provide gcc tarball snapshots. Patches are usually reused as-is. +# # SNAPSHOT # If set, this variable signals that we should be using a snapshot of # gcc. It is expected to be in the format "YYYY-MM-DD". Note that if @@ -343,18 +348,14 @@ get_gcc_src_uri() { export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}} # Set where to download gcc itself depending on whether we're using a - # prerelease, snapshot, or release tarball. - if [[ ${PV} == *9999* ]] ; then - # Nothing to do w/git snapshots. - : - elif [[ -n ${PRERELEASE} ]] ; then - GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2" + # live git tree, snapshot, or release tarball. + if tc_is_live ; then + : # Nothing to do w/git snapshots. + elif [[ -n ${GCC_TARBALL_SRC_URI} ]] ; then + # pull gcc tarball from another location. Frequently used by gnat-gpl. + GCC_SRC_URI="${GCC_TARBALL_SRC_URI}" elif [[ -n ${SNAPSHOT} ]] ; then - if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then - GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz" - else - GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2" - fi + GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz" else if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz" @@ -409,8 +410,12 @@ SRC_URI=$(get_gcc_src_uri) #---->> pkg_pretend <<---- +toolchain_is_unsupported() { + [[ -n ${SNAPSHOT} ]] || tc_is_live +} + toolchain_pkg_pretend() { - if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] && + if toolchain_is_unsupported && [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]] ; then die "Please \`export I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS=1\` or define it" \ "in your make.conf if you want to use this version." @@ -436,11 +441,17 @@ toolchain_pkg_setup() { #---->> src_unpack <<---- toolchain_src_unpack() { - if [[ ${PV} == *9999* ]]; then + if tc_is_live ; then git-r3_src_unpack fi - gcc_quick_unpack + if [[ -n ${GCC_A_FAKEIT} ]] ; then + eerror "Please migrate from 'GCC_A_FAKEIT' to 'default_src_unpack()'" + gcc_quick_unpack + else + # Just unpack every tarball from SRC_URI + default_src_unpack + fi } gcc_quick_unpack() { @@ -455,17 +466,11 @@ gcc_quick_unpack() { # 'GCC_A_FAKEIT' to specify it's own source and binary tarballs. if [[ -n ${GCC_A_FAKEIT} ]] ; then unpack ${GCC_A_FAKEIT} - elif [[ ${PV} == *9999* ]]; then + elif tc_is_live ; then : # sources comes from git, not tarball - elif [[ -n ${PRERELEASE} ]] ; then - unpack gcc-${PRERELEASE}.tar.bz2 elif [[ -n ${SNAPSHOT} ]] ; then - if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then - unpack gcc-${SNAPSHOT}.tar.xz - else - unpack gcc-${SNAPSHOT}.tar.bz2 - fi - elif [[ ${PV} != *9999* ]] ; then + unpack gcc-${SNAPSHOT}.tar.xz + else if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then unpack gcc-${GCC_RELEASE_VER}.tar.xz else @@ -473,21 +478,6 @@ gcc_quick_unpack() { fi fi - if [[ -n ${D_VER} ]] && use d ; then - pushd "${S}"/gcc > /dev/null - unpack gdc-${D_VER}-src.tar.bz2 - cd .. - ebegin "Adding support for the D language" - ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log - if ! eend $? ; then - eerror "The D GCC package failed to apply" - eerror "Please include this log file when posting a bug report:" - eerror " ${T}/dgcc.log" - die "failed to include the D language" - fi - popd > /dev/null - fi - [[ -n ${PATCH_VER} ]] && \ unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2 @@ -533,12 +523,24 @@ toolchain_src_prepare() { export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}" cd "${S}" + if [[ -n ${D_VER} ]] && use d ; then + mv "${WORKDIR}"/d gcc/d || die + ebegin "Adding support for the D language" + ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log + if ! eend $? ; then + eerror "The D GCC package failed to apply" + eerror "Please include this log file when posting a bug report:" + eerror " ${T}/dgcc.log" + die "failed to include the D language" + fi + fi + do_gcc_gentoo_patches do_gcc_HTB_patches do_gcc_PIE_patches do_gcc_CYGWINPORTS_patches - if [[ ${PV} == *9999* ]] ; then + if tc_is_live ; then BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, commit ${EGIT_VERSION}" fi @@ -579,13 +581,12 @@ toolchain_src_prepare() { gcc_version_patch if tc_version_is_at_least 4.1 ; then - if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then - # BASE-VER must be a three-digit version number - # followed by an optional -pre string - # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999 - # If BASE-VER differs from ${PV/_/-} then libraries get installed in - # the wrong directory. - echo ${PV/_/-} > "${S}"/gcc/BASE-VER + local actual_version=$(< "${S}"/gcc/BASE-VER) + if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then + eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'" + # TODO: once ada ebuilds are fixed turn it to 'die' + eerror "Please set GCC_RELEASE_VER to '${actual_version}'" + echo "${GCC_CONFIG_VER}" > "${S}"/gcc/BASE-VER fi fi @@ -815,7 +816,7 @@ gcc_version_patch() { # gcc-4.3+ has configure flags (whoo!) tc_version_is_at_least 4.3 && return 0 - local version_string=${GCC_CONFIG_VER} + local version_string=${GCC_RELEASE_VER} einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})" @@ -2255,7 +2256,7 @@ toolchain_pkg_postinst() { cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null fi - if [[ -n ${PRERELEASE}${SNAPSHOT} ]] ; then + if toolchain_is_unsupported ; then einfo "This GCC ebuild is provided for your convenience, and the use" einfo "of this compiler is not supported by the Gentoo Developers." einfo "Please report bugs to upstream at http://gcc.gnu.org/bugzilla/" |