From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QuTSD-0002dC-EM for garchives@archives.gentoo.org; Fri, 19 Aug 2011 18:06:04 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 04A6521C0BD; Fri, 19 Aug 2011 18:05:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 8C73C21C0BD for ; Fri, 19 Aug 2011 18:05:51 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CA39C1B4024 for ; Fri, 19 Aug 2011 18:05:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 128D980043 for ; Fri, 19 Aug 2011 18:05:50 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <39d187fbe4cef0a7f7720a003eb0578e7ff4f4cb.vapier@gentoo> Subject: [gentoo-commits] proj/crossdev:master commit in: / X-VCS-Repository: proj/crossdev X-VCS-Files: crossdev X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 39d187fbe4cef0a7f7720a003eb0578e7ff4f4cb Date: Fri, 19 Aug 2011 18:05:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 8fc6f018f85fc53608f850be584fb4c9 commit: 39d187fbe4cef0a7f7720a003eb0578e7ff4f4cb Author: Mike Frysinger gentoo org> AuthorDate: Fri Aug 19 18:01:54 2011 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Aug 19 18:01:54 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/crossdev.git;= a=3Dcommit;h=3D39d187fb crossdev: add overlay options for people to control sources The current auto-search aspect of crossdev can be confusing to people, an= d creating the overlay by hand is a pain for others, so add some command li= ne options for people to explicitly control the overlays that crossdev uses. Now you can tell crossdev where to search in general, where to find exact packages, and where to write its result -- all from the command line. Signed-off-by: Mike Frysinger gentoo.org> --- crossdev | 205 ++++++++++++++++++++++++++++++++++++--------------------= ----- 1 files changed, 121 insertions(+), 84 deletions(-) diff --git a/crossdev b/crossdev index f9d9517..5f60905 100755 --- a/crossdev +++ b/crossdev @@ -32,33 +32,43 @@ cat << EOF Usage: ${HILITE}crossdev${NORMAL} ${GOOD}[options]${NORMAL} ${BRACKET}--= target TARGET${NORMAL} =20 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 head= ers to use - ${GOOD}--l, --libc${NORMAL} ver Specify version of libc to use - ${GOOD}-A, --abis${NORMAL} abis Specify ABIs to build, first o= ne is the default - ${GOOD}--[bgkl]env${NORMAL} env Specify env settings for binut= ils/gcc/kernel/libc - ${GOOD}-f, --force${NORMAL} I don't need a seat belt! - ${GOOD}-S, --stable${NORMAL} Use latest stable versions as = default - ${GOOD}-C, --clean${NORMAL} target Uninstall specified target - ${GOOD}-P, --portage${NORMAL} opts Options to pass to emerge (see= emerge(1)) - ${GOOD}--with[out]-headers${NORMAL} Build C library headers before= C compiler? + ${GOOD}--b, --binutils${NORMAL} ver Specify version of binutils= to use + ${GOOD}--g, --gcc${NORMAL} ver Specify version of gcc to u= se + ${GOOD}--k, --kernel${NORMAL} ver Specify version of kernel h= eaders to use + ${GOOD}--l, --libc${NORMAL} ver Specify version of libc to = use + ${GOOD}-A, --abis${NORMAL} abis Specify ABIs to build, firs= t one is the default + ${GOOD}--[bgkl]env${NORMAL} env Specify env settings for bi= nutils/gcc/kernel/libc + ${GOOD}-f, --force${NORMAL} I don't need a seat belt! + ${GOOD}-S, --stable${NORMAL} Use latest stable versions = as default + ${GOOD}-C, --clean${NORMAL} target Uninstall specified target + ${GOOD}-P, --portage${NORMAL} opts Options to pass to emerge (= see emerge(1)) + ${GOOD}--with[out]-headers${NORMAL} Build C library headers bef= ore C compiler? Note: versions support depend atom syntaxes; e.g. ">=3D2.20" "~4.6.1" "=3D= 2.13.1-r3" =20 +Overlay Options: + ${GOOD}-oS, --overlays${NORMAL} list Space delimited list of ove= rlays to search + [default: \${PORTDIR_OVERLAY}] + ${GOOD}-oO, --ov-output${NORMAL} path Overlay to write crossdev p= ackage links + [default: last from --overlays list] + ${GOOD}-ob, --ov-binutils${NORMAL} path Overlay for binutils ebuild= s [default: search] + ${GOOD}-og, --ov-gcc${NORMAL} path Overlay for gcc ebuilds [de= fault: search] + ${GOOD}-ok, --ov-kernel${NORMAL} path Overlay for kernel ebuilds = [default: search] + ${GOOD}-ol, --ov-libc${NORMAL} path Overlay for C library ebuil= ds [default: search] + Stage Options: - ${GOOD}-s0, --stage0${NORMAL} Build just binutils - ${GOOD}-s1, --stage1${NORMAL} Also build a bare C compiler (= no C library/ - C++/shared GCC libs/C++ exceptions/etc...) - ${GOOD}-s2, --stage2${NORMAL} Also build kernel headers - ${GOOD}-s3, --stage3${NORMAL} Also build the C library - ${GOOD}-s4, --stage4${NORMAL} Also build a full compiler [de= fault] - (shared libs GCC/various lang frontends/etc= ...) + ${GOOD}-s0, --stage0${NORMAL} Build just binutils + ${GOOD}-s1, --stage1${NORMAL} Also build a bare C compile= r (no C library/ + C++/shared GCC libs/C++ exceptions/etc..= .) + ${GOOD}-s2, --stage2${NORMAL} Also build kernel headers + ${GOOD}-s3, --stage3${NORMAL} Also build the C library + ${GOOD}-s4, --stage4${NORMAL} Also build a full compiler = [default] + (shared libs GCC/various lang frontends/= etc...) =20 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/a= da/etc...) - ${GOOD}--ex-gdb${NORMAL} Build a cross gdb - ${GOOD}--ex-insight${NORMAL} Build a cross insight + ${GOOD}--ex-only${NORMAL} Skip the stage steps above + ${GOOD}--ex-gcc${NORMAL} Build extra gcc targets (gc= j/ada/etc...) + ${GOOD}--ex-gdb${NORMAL} Build a cross gdb + ${GOOD}--ex-insight${NORMAL} Build a cross insight =20 ${BRACKET}Target (-t)${NORMAL} takes a tuple ${BRACKET}ARCH-VENDOR-OS-LI= BC${NORMAL}; see 'crossdev -t help' EOF @@ -256,9 +266,14 @@ setup_portage_vars() { HCHOST=3D${CHOST} [[ ${chost_set} =3D=3D "set" ]] && CHOST=3D${chost} || unset CHOST =20 + # see if user gave us an overlay search list, otherwise + # default to whatever is configured in portage + : ${SEARCH_OVERLAYS:=3D${PORTDIR_OVERLAY}} + + # see if user told us where to write things, otherwise # install our stuff to the last overlay in the list - PORTDIR_OVERLAYS=3D${PORTDIR_OVERLAY} - PORTDIR_OVERLAY=3D${PORTDIR_OVERLAYS%% *} + : ${CROSSDEV_OVERLAY:=3D${SEARCH_OVERLAYS}} + CROSSDEV_OVERLAY=3D${CROSSDEV_OVERLAY%% *} =20 # make sure we have a valid logdir : ${PORT_LOGDIR:=3D/var/log/portage} @@ -270,8 +285,8 @@ uninstall() { =20 ewarn "Uninstalling target '${CTARGET}' ..." =20 - [[ -d ${PORTDIR_OVERLAY}/cross-${CTARGET} ]] \ - && rm -r ${PORTDIR_OVERLAY}/cross-${CTARGET} + [[ -d ${CROSSDEV_OVERLAY}/cross-${CTARGET} ]] \ + && rm -r ${CROSSDEV_OVERLAY}/cross-${CTARGET} sed -i -e "/^cross-${CTARGET}$/d" "${CONFIGROOT}"/categories for f in package.{mask,keywords,use} profile/package.use.force ; do f=3D"${CONFIGROOT}/${f}" @@ -425,11 +440,13 @@ HARCH=3D CTARGET=3D MULTILIB_ABIS=3D"default" STAGE=3D"" -BCAT=3D"sys-devel" ; BPKG=3D"binutils" ; BVER=3D"" ; BUSE=3D"" ; B= ENV=3D"" -GCAT=3D"sys-devel" ; GPKG=3D"gcc" ; GVER=3D"" ; GUSE=3D"" ; G= ENV=3D"" -KCAT=3D"sys-kernel" ; KPKG=3D"linux-headers" ; KVER=3D"" ; KUSE=3D"" ; K= ENV=3D"" -LCAT=3D"sys-libs" ; LPKG=3D"[none]" ; LVER=3D"" ; LUSE=3D"" ; L= ENV=3D"" +BCAT=3D"sys-devel" ; BPKG=3D"binutils" ; BVER=3D"" BUSE=3D"" BENV=3D= "" BOVL=3D"" +GCAT=3D"sys-devel" ; GPKG=3D"gcc" ; GVER=3D"" GUSE=3D"" GENV=3D= "" GOVL=3D"" +KCAT=3D"sys-kernel" ; KPKG=3D"linux-headers" ; KVER=3D"" KUSE=3D"" KENV=3D= "" KOVL=3D"" +LCAT=3D"sys-libs" ; LPKG=3D"[none]" ; LVER=3D"" LUSE=3D"" LENV=3D= "" LOVL=3D"" DEFAULT_VER=3D"[latest]" +SEARCH_OVERLAYS=3D"" +CROSSDEV_OVERLAY=3D"" # These flags are always disabled for cross-gcc; either usually/always b= roken, or # not tested, or doesn't make sense, or no one simply cares about them GUSE_DISABLE=3D"-boundschecking -d -gtk -gcj -libffi -mudflap -objc -obj= c++ -objc-gc" @@ -445,34 +462,40 @@ SET_X=3D"no" =20 while [[ $# -gt 0 ]] ; do case $1 in - -V|--version) echo "crossdev-${CROSSDEV_VER}"; exit 0;; - -t|--target) shift; parse_target $1;; - --b|--binutils) shift; BVER=3D$1;; - --benv) shift; BENV=3D$1;; - --g|--gcc) shift; GVER=3D$1;; - --genv) shift; GENV=3D$1;; - --k|--kernel) shift; KVER=3D$1;; - --kenv) shift; KENV=3D$1;; - --l|--libc) shift; LVER=3D$1;; - --lenv) shift; LENV=3D$1;; - -A|--abis) shift; MULTILIB_ABIS=3D$1;; - -S|--stable) DEFAULT_VER=3D"[stable]";; - -C|--clean) shift; parse_target $1; uninstall;; - -s?|--stage?) STAGE=3D${1:0-1};; - --ex-only) EX_FAST=3D"yes";; - --ex-gcc) EX_GCC=3D"yes";; - --ex-gdb) EX_GDB=3D"yes";; - --ex-insight) EX_INSIGHT=3D"yes";; - --with-*) eval $(set_withval $1);; - --without-*) eval $(set_withval $1);; - -f|--force) FORCE=3D"yes";; - -x) SET_X=3D"yes";; - -P|--portage) UOPTS=3D"${UOPTS} $2"; shift;; - -b|-d|-p|-v|-q) UOPTS=3D"${UOPTS} $1";; - -pv|-vp) UOPTS=3D"${UOPTS} -p -v";; - -h|--help) usage;; - -*) eerror "UNKNOWN OPTION: '$1'" ; usage 1;; - *) parse_target $1;; + -V|--version) echo "crossdev-${CROSSDEV_VER}"; exit 0;; + -t|--target) shift; parse_target $1;; + --b|--binutils) shift; BVER=3D$1;; + --benv) shift; BENV=3D$1;; + -ob|--ov-binutils) shift; BOVL=3D$1;; + --g|--gcc) shift; GVER=3D$1;; + --genv) shift; GENV=3D$1;; + -og|--ov-gcc) shift; GOVL=3D$1;; + --k|--kernel) shift; KVER=3D$1;; + --kenv) shift; KENV=3D$1;; + -ok|--ov-kernel) shift; KOVL=3D$1;; + --l|--libc) shift; LVER=3D$1;; + --lenv) shift; LENV=3D$1;; + -ol|--ov-libc) shift; LOVL=3D$1;; + -A|--abis) shift; MULTILIB_ABIS=3D$1;; + -S|--stable) DEFAULT_VER=3D"[stable]";; + -C|--clean) shift; parse_target $1; uninstall;; + -s?|--stage?) STAGE=3D${1:0-1};; + -oS|--overlays) shift; SEARCH_OVERLAYS=3D$1;; + -oO|--ov-output) shift; CROSSDEV_OVERLAY=3D$1;; + --ex-only) EX_FAST=3D"yes";; + --ex-gcc) EX_GCC=3D"yes";; + --ex-gdb) EX_GDB=3D"yes";; + --ex-insight) EX_INSIGHT=3D"yes";; + --with-*) eval $(set_withval $1);; + --without-*) eval $(set_withval $1);; + -f|--force) FORCE=3D"yes";; + -x) SET_X=3D"yes";; + -P|--portage) UOPTS=3D"${UOPTS} $2"; shift;; + -b|-d|-p|-v|-q) UOPTS=3D"${UOPTS} $1";; + -pv|-vp) UOPTS=3D"${UOPTS} -p -v";; + -h|--help) usage;; + -*) eerror "UNKNOWN OPTION: '$1'" ; usage 1;; + *) parse_target $1;; esac shift done @@ -506,9 +529,9 @@ if ! egrep -qs 'inherit.*toolchain( |$)' /var/db/pkg/= sys-devel/gcc-*/*.ebuild ; fi =20 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" +if [[ -z ${CROSSDEV_OVERLAY} ]] ; then + eerror "You need to specify an output overlay. Please use --ov-output = or set" + eerror "PORTDIR_OVERLAY in your make.conf. A standard setting is: /usr= /local/portage" exit 1 fi =20 @@ -570,7 +593,7 @@ ex_insight && { einfo "Extra: insight: DO IT" } echo -einfo "PORTDIR_OVERLAY: ${PORTDIR_OVERLAY}" +einfo "CROSSDEV_OVERLAY: ${CROSSDEV_OVERLAY}" einfo "PORT_LOGDIR: ${PORT_LOGDIR}" einfo "PORTAGE_CONFIGROOT: ${PORTAGE_CONFIGROOT}" hr @@ -639,23 +662,29 @@ set_use_force() { echo "cross-${CTARGET}/${pkg} ${use}" >> ${output} } set_links() { - local cat=3D$1 pkg=3D$2 + local cat=3D$1 pkg=3D$2 ovl=3D$3 local s srcdir=3D${PORTDIR} d =20 - d=3D"${PORTDIR_OVERLAY}"/cross-${CTARGET}/${pkg} - if [[ -e ${d} ]] ; then #211386 #347389 - einfo "Leaving existing path alone: ${d}" - else - rm -f "${d}" - for s in ${PORTDIR_OVERLAYS} ; do - if [[ -d ${s}/${cat}/${pkg} ]] ; then - einfo "Using ${cat}/${pkg} from ${s} instead of ${PORTDIR}" - srcdir=3D${s} - break - fi - done - ln -s "${srcdir}"/${cat}/${pkg} "${d}" + d=3D"${CROSSDEV_OVERLAY}"/cross-${CTARGET}/${pkg} + # if auto searching and something is already set, leave it be + if [[ -z ${ovl} ]] && [[ -e ${d} ]] ; then #211386 #347389 + einfo "leaving ${cat}/${pkg} in ${CROSSDEV_OVERLAY}" + return + fi + + rm -f "${d}" + if [[ -e ${d} ]] ; then + eerror "${d} still exists and isn't a symlink !?" + exit 1 fi + for s in ${ovl} ${SEARCH_OVERLAYS} ; do + if [[ -d ${s}/${cat}/${pkg} ]] ; then + srcdir=3D${s} + einfo "getting ${cat}/${pkg} from ${srcdir}" + break + fi + done + ln -s "${srcdir}"/${cat}/${pkg} "${d}" } set_env() { local pkg=3D$1 env=3D$2 @@ -675,8 +704,8 @@ set_env() { EOF } set_portage() { - local cat=3D$1 pkg=3D$2 ver=3D$3 env=3D$4 - shift ; shift ; shift + local cat=3D$1 pkg=3D$2 ver=3D$3 env=3D$4 ovl=3D$5 + shift 5 local use=3D$@ =20 [[ ${pkg} =3D=3D "[none]" ]] && return 0 @@ -684,7 +713,7 @@ set_portage() { set_keywords ${pkg} ${ver} set_use ${pkg} ${use} set_use_force ${pkg} -multilib - set_links ${cat} ${pkg} + set_links ${cat} ${pkg} "${ovl}" set_env ${pkg} "${env}" } =20 @@ -692,7 +721,7 @@ mkdir -p "${CONFIGROOT}" check_trailing_newline "${CONFIGROOT}"/categories grep -qs "^cross-${CTARGET}$" "${CONFIGROOT}"/categories \ || echo cross-${CTARGET} >> "${CONFIGROOT}"/categories -mkdir -p "${PORTDIR_OVERLAY}"/cross-${CTARGET} || exit 1 +mkdir -p "${CROSSDEV_OVERLAY}"/cross-${CTARGET} || exit 1 cd "${CONFIGROOT}" for f in package.{keywords,mask,use} env/cross-${CTARGET} profile/packag= e.use.force ; do [[ -f ${f} ]] && continue @@ -700,10 +729,10 @@ for f in package.{keywords,mask,use} env/cross-${CT= ARGET} profile/package.use.fo rm -f ${f}/cross-${CTARGET} done =20 -set_portage ${BCAT} ${BPKG} ${BVER} "${BENV}" -set_portage ${GCAT} ${GPKG} ${GVER} "${GENV}" -set_portage ${KCAT} ${KPKG} ${KVER} "${KENV}" -set_portage ${LCAT} ${LPKG} ${LVER} "${LENV}" +set_portage ${BCAT} ${BPKG} ${BVER} "${BENV}" "${BOVL}" +set_portage ${GCAT} ${GPKG} ${GVER} "${GENV}" "${GOVL}" +set_portage ${KCAT} ${KPKG} ${KVER} "${KENV}" "${KOVL}" +set_portage ${LCAT} ${LPKG} ${LVER} "${LENV}" "${LOVL}" set_portage sys-devel gdb set_portage dev-util insight =20 @@ -711,6 +740,8 @@ set_portage dev-util insight mkdir -p /etc/revdep-rebuild echo "SEARCH_DIRS_MASK=3D/usr/${CTARGET}" > /etc/revdep-rebuild/05cross-= ${CTARGET} =20 +hr + ####################################### ### Create links for helper scripts ### =20 @@ -752,6 +783,12 @@ doemerge() { eend 0 } =20 +# Make this "just work" rather than worrying about user not putting +# this overlay path into their system settings already. +if [[ -n ${CROSSDEV_OVERLAY} ]] ; then + export PORTDIR_OVERLAY=3D"${CROSSDEV_OVERLAY} ${PORTDIR_OVERLAY}" +fi + # We include the '-u' so that we don't re-emerge packages. Avoid # using --nodeps as packages have more host depends nowadays (like # gcc wanting updated mpfr/gmp). Don't use --oneshot anymore to