diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-02-17 13:51:09 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-02-17 13:51:09 +0000 |
commit | 2e50aeb00b94e361a776d8d789dfeed1ac2512e6 (patch) | |
tree | 4f6c8c8aae06c66b426168b751c3929735f85dce | |
parent | make a stable version while working out bugs in target rewrite (diff) | |
download | historical-2e50aeb00b94e361a776d8d789dfeed1ac2512e6.tar.gz historical-2e50aeb00b94e361a776d8d789dfeed1ac2512e6.tar.bz2 historical-2e50aeb00b94e361a776d8d789dfeed1ac2512e6.zip |
Rewrite target handling to be more flexible and make sure the ex steps actually re-emerge the package #167332 by Jozef Maslik.
Package-Manager: portage-2.1.2-r9
-rw-r--r-- | sys-devel/crossdev/ChangeLog | 9 | ||||
-rw-r--r-- | sys-devel/crossdev/Manifest | 41 | ||||
-rw-r--r-- | sys-devel/crossdev/crossdev-0.9.18.ebuild | 21 | ||||
-rwxr-xr-x | sys-devel/crossdev/files/crossdev-stable | 637 | ||||
-rw-r--r-- | sys-devel/crossdev/files/digest-crossdev-0.9.18 | 0 |
5 files changed, 692 insertions, 16 deletions
diff --git a/sys-devel/crossdev/ChangeLog b/sys-devel/crossdev/ChangeLog index fc76decc4925..a25a7568caab 100644 --- a/sys-devel/crossdev/ChangeLog +++ b/sys-devel/crossdev/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for sys-devel/crossdev # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/crossdev/ChangeLog,v 1.47 2007/02/10 04:47:35 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-devel/crossdev/ChangeLog,v 1.48 2007/02/17 13:51:09 vapier Exp $ + +*crossdev-0.9.18 (17 Feb 2007) + + 17 Feb 2007; Mike Frysinger <vapier@gentoo.org> +files/crossdev-stable, + +crossdev-0.9.18.ebuild: + Rewrite target handling to be more flexible and make sure the ex steps + actually re-emerge the package #167332 by Jozef Maslik. *crossdev-0.9.17-r3 (10 Feb 2007) diff --git a/sys-devel/crossdev/Manifest b/sys-devel/crossdev/Manifest index a4c4cbcd63d8..2cd5960df828 100644 --- a/sys-devel/crossdev/Manifest +++ b/sys-devel/crossdev/Manifest @@ -1,18 +1,26 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -AUX crossdev 18224 RMD160 e07ca4ca2b58967f1296db3ff95bfdd3faf0e2ba SHA1 df49941e6438d5622e7dcab487746137383f2175 SHA256 40012f6d05167aafb8e3b86a05c65c44ec5e8f301fa317cdab49b0846a071f43 -MD5 faff301432f0f2098bc5b0ffe2c5d470 files/crossdev 18224 -RMD160 e07ca4ca2b58967f1296db3ff95bfdd3faf0e2ba files/crossdev 18224 -SHA256 40012f6d05167aafb8e3b86a05c65c44ec5e8f301fa317cdab49b0846a071f43 files/crossdev 18224 -EBUILD crossdev-0.9.17-r3.ebuild 611 RMD160 918963340a542e27395246411d126d134eeaf1a7 SHA1 31ea6088f6251d877e357200847bee1c760845ea SHA256 78895ce22baac08023862b4c3dd4b1894f1a77a27c08905c27f23461984f0173 -MD5 0ae060cc294533f78a7d22712a97496f crossdev-0.9.17-r3.ebuild 611 -RMD160 918963340a542e27395246411d126d134eeaf1a7 crossdev-0.9.17-r3.ebuild 611 -SHA256 78895ce22baac08023862b4c3dd4b1894f1a77a27c08905c27f23461984f0173 crossdev-0.9.17-r3.ebuild 611 -MISC ChangeLog 9635 RMD160 23da1d352c4cb2ef61df980a4a97234272283487 SHA1 cf6130811f2a35e46bf6d1981195d416386eb507 SHA256 9fc9cd7aedf708b036f7335d9ba73696a3606376e00767988846181078cde1e1 -MD5 bb16379b9ccf06d635f1e5052a6b70de ChangeLog 9635 -RMD160 23da1d352c4cb2ef61df980a4a97234272283487 ChangeLog 9635 -SHA256 9fc9cd7aedf708b036f7335d9ba73696a3606376e00767988846181078cde1e1 ChangeLog 9635 +AUX crossdev 17690 RMD160 56ce9556681989324a110ced15d82efefdcb64b2 SHA1 f1d8fcc6dca0461766ecd81bdbcc852a232922b2 SHA256 d3db7220f76b938e4503ebc67bec9eef6c63fa80e842bd347efdda164058c72c +MD5 e60ec99727aec2008a6f47917e1701b2 files/crossdev 17690 +RMD160 56ce9556681989324a110ced15d82efefdcb64b2 files/crossdev 17690 +SHA256 d3db7220f76b938e4503ebc67bec9eef6c63fa80e842bd347efdda164058c72c files/crossdev 17690 +AUX crossdev-stable 18230 RMD160 d96c9bca5e6ad87bc45141126a8922aaad76d9ae SHA1 f3dd6bc1569582c53fb5df3b655db7a28e99de32 SHA256 4420014cae659dc36cd5743388e6de081e45a9068d995543f1064d41b1fd41ad +MD5 7ed8796bab49f0f9722d615ff871b4fd files/crossdev-stable 18230 +RMD160 d96c9bca5e6ad87bc45141126a8922aaad76d9ae files/crossdev-stable 18230 +SHA256 4420014cae659dc36cd5743388e6de081e45a9068d995543f1064d41b1fd41ad files/crossdev-stable 18230 +EBUILD crossdev-0.9.17-r3.ebuild 618 RMD160 3574a9e328b5c0aaa24e23eca5d81dd4715a12d4 SHA1 70bfefa7a01a89c822ae03615802a3155b08540c SHA256 fc1eb1c2ea9481c1ddd2013c865dfd2ffb2afceedd806f2860a8cd451cfac057 +MD5 4f5b95d64a2756f89db1d3d083d7bc94 crossdev-0.9.17-r3.ebuild 618 +RMD160 3574a9e328b5c0aaa24e23eca5d81dd4715a12d4 crossdev-0.9.17-r3.ebuild 618 +SHA256 fc1eb1c2ea9481c1ddd2013c865dfd2ffb2afceedd806f2860a8cd451cfac057 crossdev-0.9.17-r3.ebuild 618 +EBUILD crossdev-0.9.18.ebuild 621 RMD160 7f36728949f3cc9185dd3152736afce33ce72fbc SHA1 aa49b42e22cf1b1bb636c2157828a7bee9fa0681 SHA256 8b1a330e824f9f0c275d960d673d78b332dde92cfb731b333d0c53ba39d1f998 +MD5 ecc14fc14a316c9449a1243a60b59779 crossdev-0.9.18.ebuild 621 +RMD160 7f36728949f3cc9185dd3152736afce33ce72fbc crossdev-0.9.18.ebuild 621 +SHA256 8b1a330e824f9f0c275d960d673d78b332dde92cfb731b333d0c53ba39d1f998 crossdev-0.9.18.ebuild 621 +MISC ChangeLog 9900 RMD160 1c1970cda1432416b2dde368baa3a10636bcf319 SHA1 f2a85615b426788ffc055b1ea0c2d3bed4903e60 SHA256 43a6b1b0f87c0f8431a7ecb68f7b525fbc77e231fd0ea590a4361597b10b36e0 +MD5 429a3414394e46a5d5280f5c4b443eae ChangeLog 9900 +RMD160 1c1970cda1432416b2dde368baa3a10636bcf319 ChangeLog 9900 +SHA256 43a6b1b0f87c0f8431a7ecb68f7b525fbc77e231fd0ea590a4361597b10b36e0 ChangeLog 9900 MISC metadata.xml 222 RMD160 0be0385efc240909b533447fe4ce586bf39c52f5 SHA1 e965b449efbf26435730e93c78602fb5d8cdce0e SHA256 c11360fafdb92d96d343530a7f5869494a27c5cc1fec703094b1221632b6163f MD5 e91cdaf464f515f3528da02cf06e54a1 metadata.xml 222 RMD160 0be0385efc240909b533447fe4ce586bf39c52f5 metadata.xml 222 @@ -20,10 +28,13 @@ SHA256 c11360fafdb92d96d343530a7f5869494a27c5cc1fec703094b1221632b6163f metadata MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-crossdev-0.9.17-r3 0 RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-crossdev-0.9.17-r3 0 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-crossdev-0.9.17-r3 0 +MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-crossdev-0.9.18 0 +RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 files/digest-crossdev-0.9.18 0 +SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 files/digest-crossdev-0.9.18 0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.2 (GNU/Linux) -iD8DBQFFzU528bi6rjpTunYRAh/XAKDD626gvi8kOji6tkLcQHMA0Z+SbQCeJrt8 -1kQGrVhxKvqCtO7XoClEcPU= -=jX6f +iD8DBQFF1wh78bi6rjpTunYRArC4AJ4nTW3fUsOPKTdB9AxV3UgA/Pz3ygCgtw0Y +hPnJWqPTb4ylGysMT1TLoRM= +=LvqK -----END PGP SIGNATURE----- diff --git a/sys-devel/crossdev/crossdev-0.9.18.ebuild b/sys-devel/crossdev/crossdev-0.9.18.ebuild new file mode 100644 index 000000000000..314c1d5acb26 --- /dev/null +++ b/sys-devel/crossdev/crossdev-0.9.18.ebuild @@ -0,0 +1,21 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/crossdev/crossdev-0.9.18.ebuild,v 1.1 2007/02/17 13:51:09 vapier Exp $ + +DESCRIPTION="Gentoo Cross-toolchain generator" +HOMEPAGE="http://www.gentoo.org/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="" + +RDEPEND=">=sys-apps/portage-2.1 + app-shells/bash + dev-util/unifdef" + +src_install() { + dosbin "${FILESDIR}"/crossdev || die + dosed "s:GENTOO_PV:${PV}:" /usr/sbin/crossdev +} diff --git a/sys-devel/crossdev/files/crossdev-stable b/sys-devel/crossdev/files/crossdev-stable new file mode 100755 index 000000000000..6255d6626999 --- /dev/null +++ b/sys-devel/crossdev/files/crossdev-stable @@ -0,0 +1,637 @@ +#!/bin/bash +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/crossdev/files/crossdev-stable,v 1.1 2007/02/17 13:51:09 vapier Exp $ + +cd / +umask 0022 #159111 + +if [[ ${ROOT:-/} != "/" ]] ; then + echo "Sorry, but crossdev does not support ROOT." + exit 2 +fi + +source /sbin/functions.sh || exit 1 +esyslog() { :; } +die() { + echo + eerror $* + eerror If you file a bug, please attach the following logfiles: + eerror ${PORT_LOGDIR}/cross-${CTARGET}-info.log + eerror ${logfile} + exit 1 +} + +usage() { + local exit_status=${1:-0} + shift +cat << EOF +Usage: ${HILITE}crossdev${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}--target TARGET${NORMAL} + +Options: + ${GOOD}--b, --binutils${NORMAL} ver Specify version of binutils to use + ${GOOD}--g, --gcc${NORMAL} ver Specify version of gcc to use + ${GOOD}--k, --kernel${NORMAL} ver Specify version of kernel headers to use + ${GOOD}--l, --libc${NORMAL} ver Specify version of libc to use + ${GOOD}-C, --clean${NORMAL} target Uninstall specified target + ${GOOD}-b, -d, -p, -v, -q${NORMAL} Options to pass to emerge (see emerge(1)) +Stage Options: + ${GOOD}-s0, --stage0${NORMAL} Build just binutils + ${GOOD}-s1, --stage1${NORMAL} Also build a C compiler (no libc/C++) + ${GOOD}-s2, --stage2${NORMAL} Also build kernel headers + ${GOOD}-s3, --stage3${NORMAL} Also build the C library (no C++) + ${GOOD}-s4, --stage4${NORMAL} Also build a C++ compiler [default] +Extra Fun (must be run after above stages): + ${GOOD}--ex-only${NORMAL} Skip the stage steps above + ${GOOD}--ex-gcc${NORMAL} Build extra gcc targets (gcj/ada/etc...) + ${GOOD}--ex-gdb${NORMAL} Build a cross gdb + +${BRACKET}Target (-t)${NORMAL}: takes the form: ${BRACKET}ARCH-VENDOR-OS-LIBC${NORMAL} + Run 'crossdev -t help' for examples +EOF + [[ -n $* ]] && echo && eerror "Error: $*" + exit ${exit_status} +} +STAGE_BINUTILS=0 +STAGE_C_ONLY=1 +STAGE_C_KERNEL=2 +STAGE_LIBC=3 +STAGE_C_CPP=4 +STAGE_DISP=( "binutils" "C compiler only" "kernel headers" "C compiler & libc" "C/C++ compiler" ) + +parse_target() { + [[ -z $1 ]] && usage 1 + CTARGET=${1#cross-} + local CPRE=${CTARGET%%-*} CPOST=${CTARGET#*-} + + # Did they give us just an ARCH or the full TARGET ? + if [[ ${CTARGET/-} == ${CTARGET} || -z ${CPOST} ]] ; then + case ${CPRE} in + x86|i?86*|amd64|x86_64*) CPOST="pc-linux-gnu";; + s390*) CPOST="ibm-linux-gnu";; + bfin*|h8300*|nios2*|spu*|xc16x*) + CPOST="elf";; + *) CPOST="unknown-linux-gnu";; + esac + fi + + # Let's accept ARCH in both the portage and the standard forms ... + # CTARGET is in the standard form while TARCH is in the portage form + case ${CPRE} in + + ##################### + ### linux targets ### + alpha*) TARCH=alpha;; + arm*) TARCH=arm;; + hppa*) TARCH=hppa;; + parisc) TARCH=hppa; CPRE="hppa";; + ia64*) TARCH=ia64 WITH_DEF_HEADERS="yes";; + i?86*) TARCH=x86;; + x86) TARCH=x86; CPRE="i386";; + m68*) TARCH=m68k;; + mips*) TARCH=mips ; KPKG="mips-headers";; + powerpc64*) TARCH=ppc64;; + ppc64) TARCH=ppc64; CPRE="powerpc64";; + powerpc*) TARCH=ppc;; + ppc) TARCH=ppc; CPRE="powerpc";; + sparc*) TARCH=sparc;; + s390*) TARCH=s390;; + sh*) TARCH=sh;; + x86_64*) TARCH=amd64;; + amd64) TARCH=amd64; CPRE="x86_64";; + + ##################### + ### other targets ### + avr*) TARCH=${HARCH}; CPOST=""; + KPKG="[none]"; STAGE=${STAGE_LIBC}; + LCAT="dev-embedded"; LPKG="avr-libc"; + GVER="3.4.6"; BVER="2.16.1-r3"; + GUSE=${GUSE_DISABLE};; + + bfin*) + TARCH=${HARCH}; + LPKG="uclibc";; + + h8300*) + TARCH=${HARCH}; + LPKG="uclibc";; + + cris*) + TARCH=${HARCH}; + LPKG="uclibc";; + + mingw*) + TARCH=${HARCH}; CPOST=""; + WITH_DEF_HEADERS="yes"; + KCAT="dev-util"; KPKG="w32api"; + LCAT="dev-util"; LPKG="mingw-runtime";; + + msp430) + TARCH=${HARCH}; CPOST=""; + STAGE=${STAGE_BINUTILS};; + + nios2*) + TARCH=${HARCH}; + BPKG="binutils-nios2"; + GPKG="gcc-nios2"; + LPKG="uclibc";; + + vax*) TARCH=${HARCH}; + LPKG="uclibc";; + + xc16x*) + TARCH=${HARCH}; + LPKG="newlib";; + + cell*)einfo "The cell target is really an alias for the spu/ppu targets" + ${CROSSDEV} -t ppu || exit 1 + ${CROSSDEV} -t spu-elf || exit 1 + exit 0;; + spu*) TARCH=ppc64; + KPKG="[none]"; + LPKG="newlib";; + ppu*) TARCH=ppc64; + CPRE=powerpc64;; + + ps2*) einfo "The ps2 target is really an alias for the ee/iop/dvp targets" + ${CROSSDEV} -t ee || exit 1 + ${CROSSDEV} -t iop || exit 1 + ${CROSSDEV} -t dvp || exit 1 + exit 0;; + ee*) TARCH=${HARCH}; CPOST=""; + KPKG="[none]" + GVER="3.2.2"; BVER="2.14"; + STAGE=${STAGE_C_ONLY}; + GUSE=${GUSE_DISABLE};; + iop*) TARCH=${HARCH}; CPOST=""; + GVER="3.2.2"; BVER="2.14"; + STAGE=${STAGE_C_ONLY}; + GUSE=${GUSE_DISABLE};; + dvp*) TARCH=${HARCH}; CPOST=""; + GVER="3.2.2"; BVER="2.14"; + STAGE=${STAGE_BINUTILS};; + + ############ + ### help ### + help) + cat <<-EOF + Supported Architectures: + - alpha - arm / armeb + - hppa (parisc) - ia64 + - i386 / i486 / i586 / i686 (x86) - m68k + - mips / mipsel / mips64 / mips64el + - powerpc (ppc) / powerpc64 (ppc64) + - sparc / sparc64 - s390 / s390x + - sh / sh[1-5] / sh64 - x86_64 (amd64) + Supported C Libraries: + - gnu (glibc) + - klibc [prob wont work] + - uclibc [not all arches are ported] + Special Targets: + - avr http://www.nongnu.org/avr-libc/ + - bfin http://blackfin.uclinux.org/ + - h8300 http://h8300-hms.sourceforge.net/ + - mingw32 http://www.mingw.org/ + - msp430 http://mspgcc.sourceforge.net/ + - nios2 http://www.altera.com/products/ip/processors/nios2/ni2-index.html + - xc16x http://www.infineon.com/ + - ee / iop / dvp (ps2) [Playstation 2 targets] + - ppu / spu (cell) [Cell/Playstation 3 targets] + Softfloat toolchains: + Include 'softfloat' in the 'vendor' field + e.g. armeb-softfloat-linux-uclibc powerpc-booya_softfloat-linux-gnu + EOF + exit 0 + ;; + + ####################### + ### unknown targets ### + *) usage 1 "Unknown target '$1'; bug vapier@gentoo.org to add it" ;; + esac + + CTARGET=${CPRE} + [[ -n ${CPOST} ]] && CTARGET=${CTARGET}-${CPOST} + + # Tweak packages based upon CTARGET + case ${CTARGET} in + # Normal Linux host, just diff libc + *-dietlibc) LPKG="dietlibc";; + *-klibc) LPKG="klibc";; + *-uclibc) LPKG="uclibc";; + *-gnu*) LPKG="glibc";; + + # Now for the BSDs ... + *-freebsd*) + TARCH="${TARCH}-fbsd" + LCAT="sys-freebsd" LPKG="freebsd-lib" + KPKG="[none]" + ;; + esac +} + +setup_portage_vars() { + PORTDIR_OVERLAYS=$(portageq envvar PORTDIR_OVERLAY) + PORTDIR_OVERLAY=${PORTDIR_OVERLAYS%% *} + PORTDIR=$(portageq envvar PORTDIR) + PORT_LOGDIR=$(portageq envvar PORT_LOGDIR) + PORT_LOGDIR=${PORT_LOGDIR:-/var/log/portage} + export PKGDIR=$(portageq envvar PKGDIR)/cross/${CTARGET} + export PORTAGE_TMPDIR=$(portageq envvar PORTAGE_TMPDIR)/cross/${CTARGET} + [[ ! -d ${PORT_LOGDIR} ]] && mkdir -p ${PORT_LOGDIR} + [[ ! -d ${PORTAGE_TMPDIR} ]] && mkdir -p ${PORTAGE_TMPDIR} +} + +uninstall() { + setup_portage_vars + + ewarn "Uninstalling target '${CTARGET}' ..." + + [[ -d ${PORTDIR_OVERLAY}/cross-${CTARGET} ]] \ + && rm -r ${PORTDIR_OVERLAY}/cross-${CTARGET} + sed -i -e "/^cross-${CTARGET}$/d" /etc/portage/categories + for f in package.{mask,keywords,use} ; do + f="/etc/portage/${f}" + if [[ -d ${f} ]] ; then + rm -f "${f}"/cross-${CTARGET} + elif [[ -f ${f} ]] ; then + sed -i -e "/cross-${CTARGET}\//d" "${f}" + fi + done + + if [[ ! -d /var/db/pkg/cross-${CTARGET} ]] ; then + eerror "${CTARGET} is not installed." + exit 1 + fi + + export CLEAN_DELAY=0 + cd /var/db/pkg + for p in cross-${CTARGET}/* ; do + emerge -C =${p} || exit 1 + done + for b in addr2line ar as c++filt ld nm objcopy objdump ranlib readelf size strings strip ; do + rm -f /usr/bin/${CTARGET}-${b} /usr/${CTARGET}/bin/${b} + done + rm -f /usr/${CTARGET}/{sys-include,usr} + rm -f /usr/bin/${CTARGET}-{gcc,{c,g}++,cpp} + rmdir /usr/${CTARGET}/{include/asm,include} &> /dev/null + for d in /usr/${CTARGET} /usr/lib/gcc{,-lib}/${CTARGET} ; do + if [[ ! -d ${d} ]] ; then + rm -f "${d}" &> /dev/null + else + rmdir "${d}" &> /dev/null && continue + rm -ri "${d}" + fi + done + rm -f /etc/env.d/{binutils,gcc}/config-${CTARGET} + rmdir /var/db/pkg/cross-${CTARGET} + + exit 0 +} + +set_withval() { + local withval varname + varname=${*#--with-} + varname=${varname#--without-} + varname=${varname%%=*} + if [[ $* == *=* ]] ; then + withval=${*#*=} + else + [[ $* == --with-* ]] && withval="yes" || withval="no" + fi + + echo WITH_`echo ${varname} | tr '[:lower:]' '[:upper:]'`=\"${withval}\" +} + +is_stage() { [[ ${STAGE} -ge $1 ]] ; } +is_s0() { is_stage 0 ; } +is_s1() { is_stage 1 ; } +is_s2() { is_stage 2 ; } +is_s3() { is_stage 3 ; } +is_s4() { is_stage 4 ; } +is_s5() { is_stage 5 ; } + +with_headers() { [[ ${WITH_HEADERS} == "yes" ]] ; } + +ex_fast() { [[ ${EX_FAST} == "yes" ]] ; } +ex_gcc() { [[ ${EX_GCC} == "yes" ]] ; } +ex_gdb() { [[ ${EX_GDB} == "yes" ]] ; } + +hr() { + local c=${COLUMNS:-0} + if [[ ${c} -eq 0 ]] ; then + c=$(stty size 2> /dev/null) + [[ -z ${c} ]] \ + && c=50 \ + || c=${c##* } + fi + local ext=${1:- _ - ~ -} br="" + while [[ ${#br} -lt ${c} ]] ; do + br=${br}${ext} + done + echo "${br:0:${c}}" +} + +################## +### setup vars ### +CROSSDEV=$0 +EOPTS= +UOPTS= +TARCH= +HARCH=$(unset ARCH ; portageq envvar ARCH) +CTARGET= +STAGE="COW" +BCAT="sys-devel" ; BPKG="binutils" ; BVER="[latest]" ; BUSE="" +GCAT="sys-devel" ; GPKG="gcc" ; GVER="[latest]" ; GUSE="" +KCAT="sys-kernel" ; KPKG="linux-headers" ; KVER="[latest]" ; KUSE="" +LCAT="sys-libs" ; LPKG="" ; LVER="[latest]" ; LUSE="" +GUSE_DISABLE="-boundschecking -fortran -gtk -gcj -mudflap -objc -objc++ -objc-gc" +GUSE_DISABLE_STAGE_2=${GUSE_DISABLE/-fortran} +WITH_HEADERS="COW" WITH_DEF_HEADERS="no" +EX_FAST="no" +EX_GCC="no" +EX_GDB="no" +SET_X="no" + +while [[ $# -gt 0 ]] ; do + case $1 in + -V|--version) echo "crossdev-GENTOO_PV"; exit 0;; + -t|--target) shift; parse_target $1;; + --b|--binutils) shift; BVER=$1;; + --g|--gcc) shift; GVER=$1;; + --k|--kernel) shift; KVER=$1;; + --l|--libc) shift; LVER=$1;; + -C|--clean) shift; parse_target $1; uninstall;; + -s?|--stage?) [[ ${STAGE} == "COW" ]] && STAGE=${1:0-1};; + --ex-only) EX_FAST="yes";; + --ex-gcc) EX_GCC="yes";; + --ex-gdb) EX_GDB="yes";; + --with-*) eval $(set_withval $1);; + --without-*) eval $(set_withval $1);; + -x) SET_X="yes";; + -b|-d|-p|-v|-q) UOPTS="${UOPTS} $1";; + -pv|-vp) UOPTS="${UOPTS} -p -v";; + -h|--help) usage;; + -*) eerror "UNKNOWN OPTION: '$1'" ; usage 1;; + *) parse_target $1;; + esac + shift +done +[[ ${SET_X} == "yes" ]] && set -x + +[[ -z ${CTARGET} ]] && usage 1 +[[ ${STAGE} == "COW" ]] && STAGE=${STAGE_C_CPP} +for with in HEADERS ; do + var=WITH_${with} defvar=WITH_DEF_${with} + [[ ${!var} == "COW" ]] && eval ${var}=${!defvar} +done + +##################### +### sanity checks ### +if ! binutils-config --version &> /dev/null ; then + eerror "Sorry, but your host system needs to have binutils-config" + eerror "in order to keep from screwing things up." + eerror "That means you must be running unstable versions of" + eerror "both binutils and binutils-config." + exit 1 +fi +if ! egrep -qs 'inherit.*toolchain( |$)' /var/db/pkg/sys-devel/gcc-*/*.ebuild ; then + eerror "Sorry, but your host system needs to have" + eerror "an unstable version of gcc in order to" + eerror "keep from screwing things up." + exit 1 +fi + +setup_portage_vars +if [[ -z ${PORTDIR_OVERLAY} ]] ; then + eerror "You need to set PORTDIR_OVERLAY in your make.conf." + eerror "A standard setting is /usr/local/portage" + exit 1 +fi + +if [[ $(unset CHOST ; portageq envvar CHOST) == ${CTARGET} ]] ; then + eerror "Refusing to create a cross-compiler using the same" + eerror "target name as your host utils." + exit 1 +fi + +# grab user settings +for v in ABI UCLIBC_CPU USE BVER GVER KVER LVER STAGE CFLAGS LDFLAGS ASFLAGS ; do + if [[ -e /etc/portage/crossdev/${CTARGET}/${v} ]] ; then + # yes, quotes are needed in this instance (export $var="...") + export ${v}="$(</etc/portage/crossdev/${CTARGET}/${v})" + einfo "Restoring user setting '${v}' to '${!v}'" + fi + if [[ -e /etc/portage/crossdev/${CTARGET}/env ]] ; then + einfo "Restoring generic user env settings" + source /etc/portage/crossdev/${CTARGET}/env + fi +done + +##################### +### do the emerge ### +( +hr - +einfo "Host Portage ARCH: ${HARCH}" +einfo "Target Portage ARCH: ${TARCH}" +einfo "Target System: ${CTARGET}" +einfo "Stage: ${STAGE} (${STAGE_DISP[${STAGE}]})" +echo +ex_fast || { +is_s0 && { +einfo "binutils: ${BPKG}-${BVER}" +} +is_s1 && { +einfo "gcc: ${GPKG}-${GVER}" +} +is_s2 && { +[[ ${KPKG} != "[none]" ]] && \ +einfo "headers: ${KPKG}-${KVER}" +} +is_s3 && { +einfo "libc: ${LPKG}-${LVER}" +} +} +ex_gcc && { +einfo "Extra: gcc pass: DO IT" +} +ex_gdb && { +einfo "Extra: gdb: DO IT" +} +echo +einfo "PORTDIR_OVERLAY: ${PORTDIR_OVERLAY}" +einfo "PORT_LOGDIR: ${PORT_LOGDIR}" +einfo "PKGDIR: ${PKGDIR}" +einfo "PORTAGE_TMPDIR: ${PORTAGE_TMPDIR}" +hr +) >& ${PORT_LOGDIR}/cross-${CTARGET}-info.log || exit 1 +cat ${PORT_LOGDIR}/cross-${CTARGET}-info.log +emerge -v --info >> ${PORT_LOGDIR}/cross-${CTARGET}-info.log + +#################################### +### Fix up portage files / paths ### + +set_keywords() { + local pkg=$1 ver=$2 output + [[ -z ${pkg} ]] && return 0 + if [[ -f package.keywords ]] ; then + output="package.keywords" + sed -i -e "/^cross-${CTARGET}\/${pkg} /d" ${output} + else + output="package.keywords/cross-${CTARGET}" + fi + if [[ ${ver} == "[latest]" ]] || [[ -z ${ver} ]] ; then + echo "cross-${CTARGET}/${pkg} $TARCH ~$TARCH" >> ${output} + else + echo "cross-${CTARGET}/${pkg} * ~* -*" >> ${output} + if [[ -f package.mask ]] ; then + output="package.mask" + sed -i -e "/cross-${CTARGET}\/${pkg}/d" ${output} + else + output="package.mask/cross-${CTARGET}" + fi + echo ">cross-${CTARGET}/${pkg}-${ver}" >> ${output} + fi +} +set_use() { + local pkg=$1 output + shift + local use=$@ + [[ -z ${use} ]] && return 0 + if [[ -f package.use ]] ; then + output="package.use" + else + output="package.use/cross-${CTARGET}" + fi + [[ -e ${output} ]] && sed -i -e "/cross-${CTARGET}\/${pkg}/d" ${output} + echo "cross-${CTARGET}/${pkg} ${use}" >> ${output} +} +set_links() { + local cat=$1 pkg=$2 + local s srcdir=${PORTDIR} + rm -f "${PORTDIR_OVERLAY}"/cross-${CTARGET}/${pkg} + for s in ${PORTDIR_OVERLAYS} ; do + if [[ -d ${s}/${cat}/${pkg} ]] ; then + einfo "Using ${cat}/${pkg} from ${s} instead of ${PORTDIR}" + srcdir=${s} + break + fi + done + ln -s "${srcdir}"/${cat}/${pkg} "${PORTDIR_OVERLAY}"/cross-${CTARGET}/${pkg} +} +set_portage() { + local cat=$1 pkg=$2 ver=$3 + shift ; shift ; shift + local use=$@ + + [[ ${pkg} == "[none]" ]] && return 0 + + set_keywords ${pkg} ${ver} + set_use ${pkg} ${use} + set_links ${cat} ${pkg} +} + +mkdir -p /etc/portage +grep -qs "^cross-${CTARGET}$" /etc/portage/categories \ + || echo cross-${CTARGET} >> /etc/portage/categories +mkdir -p "${PORTDIR_OVERLAY}"/cross-${CTARGET} +cd /etc/portage +for f in package.{keywords,mask,use} ; do + [[ -f ${f} ]] && continue + mkdir -p ${f} + rm -f ${f}/cross-${CTARGET} +done + +set_portage ${BCAT} ${BPKG} ${BVER} +set_portage ${GCAT} ${GPKG} ${GVER} +set_portage ${KCAT} ${KPKG} ${KVER} +set_portage ${LCAT} ${LPKG} ${LVER} +set_portage sys-devel gdb + +################# +emerged_with_use() { + local pkg=$1 use=$2 + grep -qs ${use} /var/db/pkg/cross-${CTARGET}/${pkg}-*/USE +} +set_eopts_on_pkg_status() { + emerged_with_use "$@" \ + && EOPTS=${EOPTS_DEF} \ + || EOPTS=${EOPTS_UP} +} +doemerge() { + [[ $1 == "[none]" ]] && return 0 + + local logfile=${PORT_LOGDIR}/cross-${CTARGET} + [[ -z $2 ]] \ + && logfile=${logfile}-$1.log \ + || logfile=${logfile}-$2.log + + einfo "Log: ${logfile}" + ebegin "Emerging cross-${2:-$1}" + + set_use $1 ${USE} + + if [[ ${UOPTS/-v} != ${UOPTS} ]] ; then + emerge cross-${CTARGET}/$1 ${EOPTS} \ + 2>&1 | tee ${logfile} + else + emerge cross-${CTARGET}/$1 ${EOPTS} \ + >& ${logfile} + fi + local _pipestatus=${PIPESTATUS[*]} + [[ "${_pipestatus// /}" -eq 0 ]] || die "$1 failed :(" + eend 0 +} + +# we include the '-u' so that we don't re-emerge packages +EOPTS_DEF="${UOPTS} --nodeps --oneshot" +EOPTS_UP="${EOPTS_DEF} -u" +EOPTS=${EOPTS_UP} +# keep things like --ask from screwing us up +export EMERGE_DEFAULT_OPTS="" + +# make sure multilib crap doesn't screw us over +export ABI=${ABI:-pos} LIBDIR_pos="lib" CFLAGS_pos="" LDFLAGS_pos="" + +# only allow UCLIBC_CPU from env, not from make.conf/profile +export UCLIBC_CPU=${UCLIBC_CPU} + +ex_fast || { + +ebegin "Forcing the latest versions of binutils-config/gcc-config" +emerge {binutils,gcc}-config -qu --ignore-default-opts &> /dev/null +eend $? || exit 1 + +doemerge ${BPKG} + +is_s1 || exit 0 +if with_headers ; then +USE="${KUSE} ${USE}" CROSSCOMPILE_OPTS="headers-only" \ + doemerge ${KPKG} ${KPKG}-quick +USE="${LUSE} ${USE}" CROSSCOMPILE_OPTS="headers-only" \ + doemerge ${LPKG} ${LPKG}-headers +fi +USE="${GUSE} ${USE} ${GUSE_DISABLE} nocxx" CROSSCOMPILE_OPTS="bootstrap" \ + doemerge ${GPKG} ${GPKG}-stage1 + +is_s2 || exit 0 +set_eopts_on_pkg_status ${KPKG} crosscompile_opts_headers-only +USE="${KUSE} ${USE}" CROSSCOMPILE_OPTS="" \ + doemerge ${KPKG} + +is_s3 || exit 0 +set_eopts_on_pkg_status ${LPKG} crosscompile_opts_headers-only +USE="${LUSE} ${USE}" CROSSCOMPILE_OPTS="" \ + doemerge ${LPKG} + +is_s4 || exit 0 +set_eopts_on_pkg_status ${GPKG} crosscompile_opts_bootstrap +USE="${GUSE} ${USE} ${GUSE_DISABLE_STAGE_2}" \ + doemerge ${GPKG} ${GPKG}-stage2 + +} + +EOPTS=${EOPTS_UP} +ex_gcc && USE="${GUSE} ${USE}" doemerge ${GPKG} ${GPKG}-extra +ex_gdb && doemerge gdb + +exit 0 diff --git a/sys-devel/crossdev/files/digest-crossdev-0.9.18 b/sys-devel/crossdev/files/digest-crossdev-0.9.18 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/sys-devel/crossdev/files/digest-crossdev-0.9.18 |