Patchwork [1,of,1] config+scripts: Custom gcc, binutils, libc, gdb version

login
register
mail settings
Submitter David Holsgrove
Date Oct. 4, 2012, 4:46 a.m.
Message ID <4d1c400c76a061ef1e5f.1349325989@localhost.localdomain>
Download mbox | patch
Permalink /patch/189047/
State Superseded
Headers show

Comments

David Holsgrove - Oct. 4, 2012, 4:46 a.m.
# HG changeset patch
# User David Holsgrove <david.holsgrove@xilinx.com>
# Date 1349321174 -36000
# Node ID 4d1c400c76a061ef1e5f8c3f28f1f8712e903e2d
# Parent  43ace4bb005eef085437e3d4fbaef528ef0ef005
config+scripts: Custom gcc, binutils, libc, gdb version

Extract CUSTOM / CUSTOM_LOCATION functionality currently in linux.sh
and generalise in scripts/functions as GetCustom

Add CUSTOM version and CUSTOM_LOCATION config options, along with call
to GetCustom for;
 * gcc
 * binutils
 * glibc
 * eglibc
 * newlib
 * gdb

CUSTOM_LOCATION config options only presented in menuconfig if component
CUSTOM version selected.

Add CUSTOM_LOCATION_ROOT_DIR to config/paths.in as a root directory
which will be used if CUSTOM is selected as version, and no CUSTOM_LOCATION
given for a component.

Allows a developer to have a source directory (eg ~/src) containing under-
developement source components (eg ~/src/gcc, ~/src/binutils, etc)

Will also take a custom tarball via CUSTOM_LOCATION, link into
CT_TARBALLS_DIR and extract as usual.

Bundled patches will not apply, as the version 'custom' will not match any
bundled patch directory. (Same as with custom linux currently)

If a user wishes patches to be applied, they can create the directory
${CT_LOCAL_PATCH_DIR}/${pkgname}/custom and insert manually any patches
which they have not applied to their custom source already.

Selecting CUSTOM version for gcc, binutils, eglibc, gdb also assumes
latest of these versions.


--
For unsubscribe information see http://sourceware.org/lists.html#faq
Florian Fainelli - Oct. 5, 2012, 8:46 a.m.
Hi David,

On Thursday 04 October 2012 14:46:29 David Holsgrove wrote:
> # HG changeset patch
> # User David Holsgrove <david.holsgrove@xilinx.com>
> # Date 1349321174 -36000
> # Node ID 4d1c400c76a061ef1e5f8c3f28f1f8712e903e2d
> # Parent  43ace4bb005eef085437e3d4fbaef528ef0ef005
> config+scripts: Custom gcc, binutils, libc, gdb version
> 
> Extract CUSTOM / CUSTOM_LOCATION functionality currently in linux.sh
> and generalise in scripts/functions as GetCustom
> 
> Add CUSTOM version and CUSTOM_LOCATION config options, along with call
> to GetCustom for;
>  * gcc
>  * binutils
>  * glibc
>  * eglibc
>  * newlib
>  * gdb

This sounds like an useful feature, especially when bisecting one of listed 
software component, could you also please consider adding uClibc in the list 
of supported "custom" locations?

Thanks!

> 
> CUSTOM_LOCATION config options only presented in menuconfig if component
> CUSTOM version selected.
> 
> Add CUSTOM_LOCATION_ROOT_DIR to config/paths.in as a root directory
> which will be used if CUSTOM is selected as version, and no CUSTOM_LOCATION
> given for a component.
> 
> Allows a developer to have a source directory (eg ~/src) containing under-
> developement source components (eg ~/src/gcc, ~/src/binutils, etc)
> 
> Will also take a custom tarball via CUSTOM_LOCATION, link into
> CT_TARBALLS_DIR and extract as usual.
> 
> Bundled patches will not apply, as the version 'custom' will not match any
> bundled patch directory. (Same as with custom linux currently)
> 
> If a user wishes patches to be applied, they can create the directory
> ${CT_LOCAL_PATCH_DIR}/${pkgname}/custom and insert manually any patches
> which they have not applied to their custom source already.
> 
> Selecting CUSTOM version for gcc, binutils, eglibc, gdb also assumes
> latest of these versions.
> 
> diff -r 43ace4bb005e -r 4d1c400c76a0 config/binutils/binutils.in
> --- a/config/binutils/binutils.in	Wed Sep 26 16:37:31 2012 +0200
> +++ b/config/binutils/binutils.in	Thu Oct 04 13:26:14 2012 +1000
> @@ -50,8 +50,26 @@
>      prompt "2.16.1a (OBSOLETE)"
>      depends on OBSOLETE
>  
> +config BINUTILS_CUSTOM
> +    bool
> +    prompt "Custom binutils"
> +    depends on EXPERIMENTAL
> +    select BINUTILS_2_22_or_later
> +
>  endchoice
>  
> +if BINUTILS_CUSTOM
> +
> +config BINUTILS_CUSTOM_LOCATION
> +    string
> +    prompt "full path to custom binutils source"
> +    default ""
> +    help
> +      Enter the path to the directory (or tarball) of your source for 
binutils,
> +      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/binutils
> +
> +endif # BINUTILS_CUSTOM
> +
>  config BINUTILS_VERSION
>      string
>  # Don't remove next line
> @@ -64,6 +82,7 @@
>      default "2.18a" if BINUTILS_V_2_18a
>      default "2.17a" if BINUTILS_V_2_17a
>      default "2.16.1a" if BINUTILS_V_2_16_1a
> +    default "custom" if BINUTILS_CUSTOM
>  
>  config BINUTILS_2_22_or_later
>      bool
> diff -r 43ace4bb005e -r 4d1c400c76a0 config/cc/gcc.in
> --- a/config/cc/gcc.in	Wed Sep 26 16:37:31 2012 +0200
> +++ b/config/cc/gcc.in	Thu Oct 04 13:26:14 2012 +1000
> @@ -239,6 +239,12 @@
>      prompt "3.4.6 (OBSOLETE)"
>      depends on OBSOLETE
>  
> +config CC_CUSTOM
> +    bool
> +    prompt "Custom gcc"
> +    depends on EXPERIMENTAL
> +    select CC_GCC_latest
> +
>  endchoice
>  
>  if CC_V_SVN
> @@ -297,6 +303,18 @@
>  
>  endif
>  
> +if CC_CUSTOM
> +
> +config CC_CUSTOM_LOCATION
> +    string
> +    prompt "full path to custom gcc source"
> +    default ""
> +    help
> +      Enter the path to the directory (or tarball) of your source for gcc,
> +      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/gcc
> +
> +endif #CC_CUSTOM
> +
>  config CC_GCC_4_2
>      bool
>      select CC_GCC_4_2_or_later
> @@ -484,6 +502,7 @@
>      default "4.1.2" if CC_V_4_1_2
>      default "4.0.4" if CC_V_4_0_4
>      default "3.4.6" if CC_V_3_4_6
> +    default "custom" if CC_CUSTOM
>  
>  config CC_LANG_JAVA_USE_ECJ
>      bool
> diff -r 43ace4bb005e -r 4d1c400c76a0 config/debug/gdb.in
> --- a/config/debug/gdb.in	Wed Sep 26 16:37:31 2012 +0200
> +++ b/config/debug/gdb.in	Thu Oct 04 13:26:14 2012 +1000
> @@ -119,6 +119,13 @@
>      bool
>      prompt "6.8a"
>  
> +config GDB_CUSTOM
> +    bool
> +    prompt "Custom gdb"
> +    depends on EXPERIMENTAL
> +    select GDB_7_0_or_later
> +    select GDB_7_2_or_later
> +
>  endchoice
>  
>  config GDB_7_2_or_later
> @@ -152,5 +159,19 @@
>      default "7.0.1a" if GDB_V_7_0_1a
>      default "7.0a" if GDB_V_7_0a
>      default "6.8a" if GDB_V_6_8a
> +    default "custom" if GDB_CUSTOM
> +
> +if GDB_CUSTOM
> +
> +config GDB_CUSTOM_LOCATION
> +    string
> +    prompt "full path to custom gdb source"
> +    default ""
> +    help
> +      Enter the path to the directory (or tarball) of your source for gdb,
> +      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/gdb
> +
> +endif # GDB_CUSTOM
>  
>  endif
> +
> diff -r 43ace4bb005e -r 4d1c400c76a0 config/global/paths.in
> --- a/config/global/paths.in	Wed Sep 26 16:37:31 2012 +0200
> +++ b/config/global/paths.in	Thu Oct 04 13:26:14 2012 +1000
> @@ -60,6 +60,15 @@
>  #      The reason you might also want to install elsewhere is if you are 
going
>  #      to package your shinny new toolchain for distribution.
>  
> +
> +config CUSTOM_LOCATION_ROOT_DIR
> +    string
> +    depends on EXPERIMENTAL
> +    prompt "directory containing custom source components"
> +    help
> +      This is the path CT-NG will attempt to use as a root for locating
> +      local copies of source components 
(CUSTOM_LOCATION_ROOT_DIR/component)
> +
>  config RM_RF_PREFIX_DIR
>      bool
>      prompt "|  Remove the prefix dir prior to building"
> diff -r 43ace4bb005e -r 4d1c400c76a0 config/libc/eglibc.in
> --- a/config/libc/eglibc.in	Wed Sep 26 16:37:31 2012 +0200
> +++ b/config/libc/eglibc.in	Thu Oct 04 13:26:14 2012 +1000
> @@ -85,6 +85,13 @@
>      help
>        Selecting this will export the trunk of the eglibc subversion 
repository.
>  
> +config LIBC_EGLIBC_CUSTOM
> +    bool
> +    prompt "Custom eglibc"
> +    depends on EXPERIMENTAL
> +    select LIBC_EGLIBC_2_16_or_later
> +    select LIBC_CUSTOM
> +
>  endchoice
>  
>  config LIBC_VERSION
> @@ -104,6 +111,7 @@
>      default "2_6" if LIBC_EGLIBC_V_2_6
>      default "2_5" if LIBC_EGLIBC_V_2_5
>      default "trunk" if LIBC_EGLIBC_V_TRUNK
> +    default "custom" if LIBC_EGLIBC_CUSTOM
>  
>  config LIBC_EGLIBC_2_16_or_later
>      bool
> @@ -140,6 +148,22 @@
>  config LIBC_EGLIBC_HAS_PKGVERSION_BUGURL
>      bool
>  
> +config LIBC_CUSTOM
> +    bool
> +
> +if LIBC_EGLIBC_CUSTOM
> +
> +config LIBC_EGLIBC_CUSTOM_LOCATION
> +    string
> +    prompt "full path to custom eglibc source"
> +    default ""
> +    help
> +      Enter the path to the directory (or tarball) of your source for 
eglibc,
> +      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/eglibc
> +
> +endif # LIBC_EGLIBC_CUSTOM
> +if ! LIBC_EGLIBC_CUSTOM
> +
>  if CONFIGURE_has_svn
>  
>  config EGLIBC_REVISION
> @@ -189,6 +213,7 @@
>  comment "otherwise you won't be able to download eglibc"
>  
>  endif # ! CONFIGURE_has_svn
> +endif # ! LIBC_EGLIBC_CUSTOM
>  
>  config EGLIBC_OPT_SIZE
>      bool
> diff -r 43ace4bb005e -r 4d1c400c76a0 config/libc/glibc.in
> --- a/config/libc/glibc.in	Wed Sep 26 16:37:31 2012 +0200
> +++ b/config/libc/glibc.in	Thu Oct 04 13:26:14 2012 +1000
> @@ -9,34 +9,6 @@
>  
>  choice
>      bool
> -    prompt "Retrieval method"
> -    default LIBC_GLIBC_TARBALL
> -
> -config LIBC_GLIBC_TARBALL
> -    bool
> -    prompt "Released tarball"
> -    help
> -      Until end of Februrary 2009, there was no tarball for glibc releases
> -      2.8 and later. This was intentional.
> -      
> -      Then, all of a sudden, tarballs for those releases have appeared at 
the
> -      traditional download place (ftp.gnu.org).
> -      
> -      Some of the glibc people argue that fixes are committed to the 
maintenance
> -      branch, and thus it is the best plac e to retrieve the glibc from.
> -      On the other hand, it might be preferable to always generate a 
toolchain
> -      using a known code-base, so the toolchain can be reproducible.
> -      
> -      For version prior to 2.8, tarballs were readily available.
> -      
> -      If you want your toolchain to really be reproducible, say 'Y' here.
> -      If you can live with a moving code-base, look at the other choice
> -      entries, below.
> -
> -endchoice
> -
> -choice
> -    bool
>      prompt "glibc version"
>  # Don't remove next line
>  # CT_INSERT_VERSION_BELOW
> @@ -109,8 +81,60 @@
>      depends on OBSOLETE
>      select LIBC_SUPPORT_LINUXTHREADS
>  
> +config LIBC_GLIBC_CUSTOM
> +    bool
> +    prompt "Custom glibc"
> +    depends on EXPERIMENTAL
> +    select LIBC_CUSTOM
> +
>  endchoice
>  
> +config LIBC_CUSTOM
> +    bool
> +
> +if LIBC_GLIBC_CUSTOM
> +
> +config LIBC_GLIBC_CUSTOM_LOCATION
> +    string
> +    prompt "full path to custom glibc source"
> +    default ""
> +    help
> +      Enter the path to the directory (or tarball) of your source for 
glibc,
> +      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/glibc
> +
> +endif # LIBC_GLIBC_CUSTOM
> +if ! LIBC_GLIBC_CUSTOM
> +
> +choice
> +    bool
> +    prompt "Retrieval method"
> +    default LIBC_GLIBC_TARBALL
> +
> +config LIBC_GLIBC_TARBALL
> +    bool
> +    prompt "Released tarball"
> +    help
> +      Until end of Februrary 2009, there was no tarball for glibc releases
> +      2.8 and later. This was intentional.
> +      
> +      Then, all of a sudden, tarballs for those releases have appeared at 
the
> +      traditional download place (ftp.gnu.org).
> +      
> +      Some of the glibc people argue that fixes are committed to the 
maintenance
> +      branch, and thus it is the best plac e to retrieve the glibc from.
> +      On the other hand, it might be preferable to always generate a 
toolchain
> +      using a known code-base, so the toolchain can be reproducible.
> +      
> +      For version prior to 2.8, tarballs were readily available.
> +      
> +      If you want your toolchain to really be reproducible, say 'Y' here.
> +      If you can live with a moving code-base, look at the other choice
> +      entries, below.
> +
> +endchoice
> +
> +endif # ! LIBC_GLIBC_CUSTOM
> +
>  config LIBC_VERSION
>      string
>  # Don't remove next line
> @@ -130,3 +154,4 @@
>      default "2.6" if LIBC_GLIBC_V_2_6
>      default "2.5.1" if LIBC_GLIBC_V_2_5_1
>      default "2.5" if LIBC_GLIBC_V_2_5
> +    default "custom" if LIBC_GLIBC_CUSTOM
> diff -r 43ace4bb005e -r 4d1c400c76a0 config/libc/newlib.in
> --- a/config/libc/newlib.in	Wed Sep 26 16:37:31 2012 +0200
> +++ b/config/libc/newlib.in	Thu Oct 04 13:26:14 2012 +1000
> @@ -52,8 +52,25 @@
>        
>        In a word: use the CVS snapshot at your own risk! 
>  
> +config LIBC_NEWLIB_CUSTOM
> +    bool
> +    prompt "Custom newlib"
> +    depends on EXPERIMENTAL
> +
>  endchoice
>  
> +if LIBC_NEWLIB_CUSTOM
> +
> +config LIBC_NEWLIB_CUSTOM_LOCATION
> +    string
> +    prompt "full path to custom newlib source"
> +    default ""
> +    help
> +      Enter the path to the directory (or tarball) of your source for 
newlib,
> +      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/newlib
> +
> +endif # LIBC_NEWLIB_CUSTOM
> +
>  config LIBC_VERSION
>      string
>      prompt "use CVS tag" if LIBC_NEWLIB_CVS
> @@ -63,6 +80,7 @@
>      default "1.19.0" if LIBC_NEWLIB_V_1_19_0
>      default "1.18.0" if LIBC_NEWLIB_V_1_18_0
>      default "1.17.0" if LIBC_NEWLIB_V_1_17_0
> +    default "custom" if LIBC_NEWLIB_CUSTOM
>      help
>        Enter the tag you want to use.
>        Leave empty to use the 'head' of the repository.
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/binutils/binutils.sh
> --- a/scripts/build/binutils/binutils.sh	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/build/binutils/binutils.sh	Thu Oct 04 13:26:14 2012 +1000
> @@ -4,14 +4,26 @@
>  
>  # Download binutils
>  do_binutils_get() {
> -    CT_GetFile "binutils-${CT_BINUTILS_VERSION}"                                        
\
> -               
{ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils   \
> -               ftp://gcc.gnu.org/pub/binutils/{releases,snapshots}
> +    if [ "${CT_BINUTILS_CUSTOM}" = "y" ]; then
> +        CT_TestAndAbort "Custom binutils: CT_CUSTOM_LOCATION_ROOT_DIR or 
CT_BINUTILS_CUSTOM_LOCATION must be set." \
> +        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_BINUTILS_CUSTOM_LOCATION}"
> +        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_BINUTILS_CUSTOM_LOCATION}" ]; then
> +            
CT_BINUTILS_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/binutils"
> +        fi
> +        CT_GetCustom "binutils-${CT_BINUTILS_VERSION}" 
"${CT_BINUTILS_CUSTOM_LOCATION}"
> +    else
> +        CT_GetFile "binutils-${CT_BINUTILS_VERSION}"                                        
\
> +                   
{ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils   \
> +                   ftp://gcc.gnu.org/pub/binutils/{releases,snapshots}
> +    fi
>  }
>  
>  # Extract binutils
>  do_binutils_extract() {
> -    CT_Extract "binutils-${CT_BINUTILS_VERSION}"
> +    if [ "${CT_BINUTILS_CUSTOM}" != "y" \
> +         -o ! -d "${CT_BINUTILS_CUSTOM_LOCATION}" ]; then
> +        CT_Extract "binutils-${CT_BINUTILS_VERSION}"
> +    fi
>      CT_Patch "binutils" "${CT_BINUTILS_VERSION}"
>  }
>  
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/cc/gcc.sh
> --- a/scripts/build/cc/gcc.sh	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/build/cc/gcc.sh	Thu Oct 04 13:26:14 2012 +1000
> @@ -4,7 +4,14 @@
>  
>  # Download gcc
>  do_cc_get() {
> -    if [ -n "${CT_CC_V_SVN}" ]; then
> +    if [ "${CT_CC_CUSTOM}" = "y" ]; then
> +        CT_TestAndAbort "Custom gcc: CT_CUSTOM_LOCATION_ROOT_DIR or 
CT_CC_CUSTOM_LOCATION must be set." \
> +        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_CC_CUSTOM_LOCATION}"
> +        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_CC_CUSTOM_LOCATION}" ]; then
> +            CT_CC_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/gcc"
> +        fi
> +        CT_GetCustom "gcc-${CT_CC_VERSION}" "${CT_CC_CUSTOM_LOCATION}"
> +    elif [ -n "${CT_CC_V_SVN}" ]; then
>          # Get gcc from SVN!
>          local svn_base
>  
> @@ -59,7 +66,10 @@
>  
>  # Extract gcc
>  do_cc_extract() {
> -    CT_Extract "gcc-${CT_CC_VERSION}"
> +    if [ "${CT_CC_CUSTOM}" != "y" \
> +         -o ! -d "${CT_CC_CUSTOM_LOCATION}" ]; then
> +        CT_Extract "gcc-${CT_CC_VERSION}"
> +    fi
>      CT_Patch "gcc" "${CT_CC_VERSION}"
>  
>      # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/debug/300-gdb.sh
> --- a/scripts/build/debug/300-gdb.sh	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/build/debug/300-gdb.sh	Thu Oct 04 13:26:14 2012 +1000
> @@ -48,10 +48,19 @@
>      do_debug_gdb_parts
>  
>      if [ "${do_gdb}" = "y" ]; then
> -        CT_GetFile "gdb-${CT_GDB_VERSION}"                          \
> -                   {ftp,http}://ftp.gnu.org/pub/gnu/gdb             \
> -                   ftp://sources.redhat.com/pub/gdb/{,old-}releases \
> -                   
"${linaro_base_url}/${linaro_series}/${linaro_version}/+download"
> +        if [ "${CT_GDB_CUSTOM}" = "y" ]; then
> +            CT_TestAndAbort "Custom gdb: CT_CUSTOM_LOCATION_ROOT_DIR or 
CT_GDB_CUSTOM_LOCATION must be set." \
> +            -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_GDB_CUSTOM_LOCATION}"
> +            if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_GDB_CUSTOM_LOCATION}" ]; then
> +                CT_GDB_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/gdb"
> +            fi
> +            CT_GetCustom "gdb-${CT_GDB_VERSION}" 
"${CT_GDB_CUSTOM_LOCATION}"
> +        else
> +            CT_GetFile "gdb-${CT_GDB_VERSION}"                          \
> +                       {ftp,http}://ftp.gnu.org/pub/gnu/gdb             \
> +                       ftp://sources.redhat.com/pub/gdb/{,old-}releases \
> +                       
"${linaro_base_url}/${linaro_series}/${linaro_version}/+download"
> +        fi
>      fi
>  
>      if [ "${do_ncurses}" = "y" ]; then
> @@ -70,7 +79,10 @@
>      do_debug_gdb_parts
>  
>      if [ "${do_gdb}" = "y" ]; then
> -        CT_Extract "gdb-${CT_GDB_VERSION}"
> +        if [ "${CT_GDB_CUSTOM}" != "y" \
> +             -o ! -d "${CT_GDB_CUSTOM_LOCATION}" ]; then
> +            CT_Extract "gdb-${CT_GDB_VERSION}"
> +        fi
>          CT_Patch "gdb" "${CT_GDB_VERSION}"
>      fi
>  
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/kernel/linux.sh
> --- a/scripts/build/kernel/linux.sh	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/build/kernel/linux.sh	Thu Oct 04 13:26:14 2012 +1000
> @@ -29,23 +29,12 @@
>      fi
>  
>      if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
> -        if [ ! -d "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
> -            # Wee need to know the custom tarball extension,
> -            # so we can create a properly-named symlink, which
> -            # we use later on in 'extract'
> -            case "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" in
> -                *.tar.bz2)      custom_name="linux-custom.tar.bz2";;
> -                *.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";;
> -                *.tar)          custom_name="linux-custom.tar";;
> -                *)  CT_Abort "Unknown extension for custom linux tarball 
'${CT_KERNEL_LINUX_CUSTOM_LOCATION}'";;
> -            esac
> -            CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  
\
> -                                      "${CT_TARBALLS_DIR}/${custom_name}"
> -        else
> -            custom_name="linux-custom"
> -            CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  
\
> -                                      "${CT_SRC_DIR}/${custom_name}"
> +        CT_TestAndAbort "Custom linux: CT_CUSTOM_LOCATION_ROOT_DIR or 
CT_KERNEL_LINUX_CUSTOM_LOCATION must be set." \
> +        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
> +        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
> +            
CT_KERNEL_LINUX_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/linux"
>          fi
> +        CT_GetCustom "linux-${CT_KERNEL_VERSION}" 
"${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
>      else # Not a custom tarball
>          case "${CT_KERNEL_VERSION}" in
>              2.6.*.*|3.*.*)
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/eglibc.sh
> --- a/scripts/build/libc/eglibc.sh	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/build/libc/eglibc.sh	Thu Oct 04 13:26:14 2012 +1000
> @@ -28,9 +28,19 @@
>          *)      svn_base+="/branches/eglibc-${CT_LIBC_VERSION}";;
>      esac
>  
> -    CT_GetSVN "eglibc-${CT_LIBC_VERSION}"   \
> -              "${svn_base}/libc"            \
> -              "${CT_EGLIBC_REVISION:-HEAD}"
> +    if [ "${CT_LIBC_CUSTOM}" = "y" ]; then
> +        CT_TestAndAbort "Custom eglibc: CT_CUSTOM_LOCATION_ROOT_DIR or 
CT_LIBC_EGLIBC_CUSTOM_LOCATION must be set." \
> +        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_LIBC_EGLIBC_CUSTOM_LOCATION}"
> +        CT_LIBC_CUSTOM_LOCATION="${CT_LIBC_EGLIBC_CUSTOM_LOCATION}"
> +        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_LIBC_EGLIBC_CUSTOM_LOCATION}" ]; then
> +            CT_LIBC_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/eglibc"
> +        fi
> +        CT_GetCustom "eglibc-${CT_LIBC_VERSION}" 
"${CT_LIBC_CUSTOM_LOCATION}"
> +    else
> +        CT_GetSVN "eglibc-${CT_LIBC_VERSION}"   \
> +                  "${svn_base}/libc"            \
> +                  "${CT_EGLIBC_REVISION:-HEAD}"
> +    fi
>  
>      if [ "${CT_LIBC_LOCALES}" = "y" ]; then
>          extra_addons+=("localedef")
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/glibc-eglibc.sh-
common
> --- a/scripts/build/libc/glibc-eglibc.sh-common	Wed Sep 26 16:37:31 2012 
+0200
> +++ b/scripts/build/libc/glibc-eglibc.sh-common	Thu Oct 04 13:26:14 2012 
+1000
> @@ -5,7 +5,10 @@
>      local addon
>  
>      # Extract the main tarball
> -    CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
> +    if [ "${CT_LIBC_CUSTOM}" != "y" \
> +         -o ! -d "${CT_LIBC_CUSTOM_LOCATION}" ]; then
> +        CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
> +    fi
>      CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
>      CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"
>  
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/glibc.sh
> --- a/scripts/build/libc/glibc.sh	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/build/libc/glibc.sh	Thu Oct 04 13:26:14 2012 +1000
> @@ -20,10 +20,20 @@
>      addons_list=($(do_libc_add_ons_list " "))
>  
>      # Main source
> -    CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
> -               {ftp,http}://ftp.gnu.org/gnu/glibc       \
> -               ftp://gcc.gnu.org/pub/glibc/releases     \
> -               ftp://gcc.gnu.org/pub/glibc/snapshots
> +    if [ "${CT_LIBC_CUSTOM}" = "y" ]; then
> +        CT_TestAndAbort "Custom glibc: CT_CUSTOM_LOCATION_ROOT_DIR or 
CT_LIBC_GLIBC_CUSTOM_LOCATION must be set." \
> +        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
> +        CT_LIBC_CUSTOM_LOCATION="${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
> +        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_LIBC_GLIBC_CUSTOM_LOCATION}" ]; then
> +            CT_LIBC_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/glibc"
> +        fi
> +        CT_GetCustom "glibc-${CT_LIBC_VERSION}" 
"${CT_LIBC_CUSTOM_LOCATION}"
> +    else
> +        CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
> +                   {ftp,http}://ftp.gnu.org/gnu/glibc       \
> +                   ftp://gcc.gnu.org/pub/glibc/releases     \
> +                   ftp://gcc.gnu.org/pub/glibc/snapshots
> +    fi
>  
>      # C library addons
>      for addon in "${addons_list[@]}"; do
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/newlib.sh
> --- a/scripts/build/libc/newlib.sh	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/build/libc/newlib.sh	Thu Oct 04 13:26:14 2012 +1000
> @@ -20,7 +20,14 @@
>      libc_src="ftp://sources.redhat.com/pub/newlib"
>      avr32headers_src="http://dev.doredevelopment.dk/avr32-
toolchain/sources"
>  
> -    if [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
> +    if [ "${CT_LIBC_NEWLIB_CUSTOM}" = "y" ]; then
> +        CT_TestAndAbort "Custom newlib: CT_CUSTOM_LOCATION_ROOT_DIR or 
CT_LIBC_NEWLIB_CUSTOM_LOCATION must be set." \
> +        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
> +        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z 
"${CT_LIBC_NEWLIB_CUSTOM_LOCATION}" ]; then
> +            
CT_LIBC_NEWLIB_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/newlib"
> +        fi
> +        CT_GetCustom "newlib-${CT_LIBC_VERSION}" 
"${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
> +    elif [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
>          CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src}
>      else
>          CT_GetCVS "newlib-$(libc_newlib_version)"                   \
> @@ -36,7 +43,10 @@
>  }
>  
>  do_libc_extract() {
> -    CT_Extract "newlib-$(libc_newlib_version)"
> +    if [ "${CT_LIBC_NEWLIB_CUSTOM}" != "y" \
> +         -o ! -d "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}" ]; then
> +        CT_Extract "newlib-$(libc_newlib_version)"
> +    fi
>      CT_Patch "newlib" "$(libc_newlib_version)"
>  
>      if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
> diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/functions
> --- a/scripts/functions	Wed Sep 26 16:37:31 2012 +0200
> +++ b/scripts/functions	Thu Oct 04 13:26:14 2012 +1000
> @@ -516,6 +516,32 @@
>      return 1
>  }
>  
> +# This function gets the custom source from either a tarball or directory
> +# Usage: CT_GetCustom custom_name <custom_location>
> +CT_GetCustom() {
> +    local custom_name="$1"
> +    local custom_location="$2"
> +
> +    if [ ! -d "${custom_location}" ]; then
> +        # We need to know the custom tarball extension,
> +        # so we can create a properly-named symlink, which
> +        # we use later on in 'extract'
> +        case "${custom_location}" in
> +            *.tar.bz2)      custom_name="${custom_name}.tar.bz2";;
> +            *.tar.gz|*.tgz) custom_name="${custom_name}.tar.gz";;
> +            *.tar)          custom_name="${custom_name}.tar";;
> +            *)  CT_Abort "Unknown extension for custom tarball 
'${custom_location}'";;
> +        esac
> +        CT_DoLog EXTRA "Using '${custom_name}' from local storage"
> +        CT_DoExecLog DEBUG ln -sf "${custom_location}"  \
> +                                  "${CT_TARBALLS_DIR}/${custom_name}"
> +    else
> +        CT_DoLog EXTRA "Using '${custom_name}' from local storage"
> +        CT_DoExecLog DEBUG ln -snf "${custom_location}"  \
> +                                  "${CT_SRC_DIR}/${custom_name}"
> +    fi
> +}
> +
>  # This function saves the specified to local storage if possible,
>  # and if so, symlinks it for later usage
>  # Usage: CT_SaveLocal </full/path/file.name>
> 
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
> 

--
For unsubscribe information see http://sourceware.org/lists.html#faq

Patch

diff -r 43ace4bb005e -r 4d1c400c76a0 config/binutils/binutils.in
--- a/config/binutils/binutils.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/binutils/binutils.in	Thu Oct 04 13:26:14 2012 +1000
@@ -50,8 +50,26 @@ 
     prompt "2.16.1a (OBSOLETE)"
     depends on OBSOLETE
 
+config BINUTILS_CUSTOM
+    bool
+    prompt "Custom binutils"
+    depends on EXPERIMENTAL
+    select BINUTILS_2_22_or_later
+
 endchoice
 
+if BINUTILS_CUSTOM
+
+config BINUTILS_CUSTOM_LOCATION
+    string
+    prompt "full path to custom binutils source"
+    default ""
+    help
+      Enter the path to the directory (or tarball) of your source for binutils,
+      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/binutils
+
+endif # BINUTILS_CUSTOM
+
 config BINUTILS_VERSION
     string
 # Don't remove next line
@@ -64,6 +82,7 @@ 
     default "2.18a" if BINUTILS_V_2_18a
     default "2.17a" if BINUTILS_V_2_17a
     default "2.16.1a" if BINUTILS_V_2_16_1a
+    default "custom" if BINUTILS_CUSTOM
 
 config BINUTILS_2_22_or_later
     bool
diff -r 43ace4bb005e -r 4d1c400c76a0 config/cc/gcc.in
--- a/config/cc/gcc.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/cc/gcc.in	Thu Oct 04 13:26:14 2012 +1000
@@ -239,6 +239,12 @@ 
     prompt "3.4.6 (OBSOLETE)"
     depends on OBSOLETE
 
+config CC_CUSTOM
+    bool
+    prompt "Custom gcc"
+    depends on EXPERIMENTAL
+    select CC_GCC_latest
+
 endchoice
 
 if CC_V_SVN
@@ -297,6 +303,18 @@ 
 
 endif
 
+if CC_CUSTOM
+
+config CC_CUSTOM_LOCATION
+    string
+    prompt "full path to custom gcc source"
+    default ""
+    help
+      Enter the path to the directory (or tarball) of your source for gcc,
+      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/gcc
+
+endif #CC_CUSTOM
+
 config CC_GCC_4_2
     bool
     select CC_GCC_4_2_or_later
@@ -484,6 +502,7 @@ 
     default "4.1.2" if CC_V_4_1_2
     default "4.0.4" if CC_V_4_0_4
     default "3.4.6" if CC_V_3_4_6
+    default "custom" if CC_CUSTOM
 
 config CC_LANG_JAVA_USE_ECJ
     bool
diff -r 43ace4bb005e -r 4d1c400c76a0 config/debug/gdb.in
--- a/config/debug/gdb.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/debug/gdb.in	Thu Oct 04 13:26:14 2012 +1000
@@ -119,6 +119,13 @@ 
     bool
     prompt "6.8a"
 
+config GDB_CUSTOM
+    bool
+    prompt "Custom gdb"
+    depends on EXPERIMENTAL
+    select GDB_7_0_or_later
+    select GDB_7_2_or_later
+
 endchoice
 
 config GDB_7_2_or_later
@@ -152,5 +159,19 @@ 
     default "7.0.1a" if GDB_V_7_0_1a
     default "7.0a" if GDB_V_7_0a
     default "6.8a" if GDB_V_6_8a
+    default "custom" if GDB_CUSTOM
+
+if GDB_CUSTOM
+
+config GDB_CUSTOM_LOCATION
+    string
+    prompt "full path to custom gdb source"
+    default ""
+    help
+      Enter the path to the directory (or tarball) of your source for gdb,
+      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/gdb
+
+endif # GDB_CUSTOM
 
 endif
+
diff -r 43ace4bb005e -r 4d1c400c76a0 config/global/paths.in
--- a/config/global/paths.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/global/paths.in	Thu Oct 04 13:26:14 2012 +1000
@@ -60,6 +60,15 @@ 
 #      The reason you might also want to install elsewhere is if you are going
 #      to package your shinny new toolchain for distribution.
 
+
+config CUSTOM_LOCATION_ROOT_DIR
+    string
+    depends on EXPERIMENTAL
+    prompt "directory containing custom source components"
+    help
+      This is the path CT-NG will attempt to use as a root for locating
+      local copies of source components (CUSTOM_LOCATION_ROOT_DIR/component)
+
 config RM_RF_PREFIX_DIR
     bool
     prompt "|  Remove the prefix dir prior to building"
diff -r 43ace4bb005e -r 4d1c400c76a0 config/libc/eglibc.in
--- a/config/libc/eglibc.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/libc/eglibc.in	Thu Oct 04 13:26:14 2012 +1000
@@ -85,6 +85,13 @@ 
     help
       Selecting this will export the trunk of the eglibc subversion repository.
 
+config LIBC_EGLIBC_CUSTOM
+    bool
+    prompt "Custom eglibc"
+    depends on EXPERIMENTAL
+    select LIBC_EGLIBC_2_16_or_later
+    select LIBC_CUSTOM
+
 endchoice
 
 config LIBC_VERSION
@@ -104,6 +111,7 @@ 
     default "2_6" if LIBC_EGLIBC_V_2_6
     default "2_5" if LIBC_EGLIBC_V_2_5
     default "trunk" if LIBC_EGLIBC_V_TRUNK
+    default "custom" if LIBC_EGLIBC_CUSTOM
 
 config LIBC_EGLIBC_2_16_or_later
     bool
@@ -140,6 +148,22 @@ 
 config LIBC_EGLIBC_HAS_PKGVERSION_BUGURL
     bool
 
+config LIBC_CUSTOM
+    bool
+
+if LIBC_EGLIBC_CUSTOM
+
+config LIBC_EGLIBC_CUSTOM_LOCATION
+    string
+    prompt "full path to custom eglibc source"
+    default ""
+    help
+      Enter the path to the directory (or tarball) of your source for eglibc,
+      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/eglibc
+
+endif # LIBC_EGLIBC_CUSTOM
+if ! LIBC_EGLIBC_CUSTOM
+
 if CONFIGURE_has_svn
 
 config EGLIBC_REVISION
@@ -189,6 +213,7 @@ 
 comment "otherwise you won't be able to download eglibc"
 
 endif # ! CONFIGURE_has_svn
+endif # ! LIBC_EGLIBC_CUSTOM
 
 config EGLIBC_OPT_SIZE
     bool
diff -r 43ace4bb005e -r 4d1c400c76a0 config/libc/glibc.in
--- a/config/libc/glibc.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/libc/glibc.in	Thu Oct 04 13:26:14 2012 +1000
@@ -9,34 +9,6 @@ 
 
 choice
     bool
-    prompt "Retrieval method"
-    default LIBC_GLIBC_TARBALL
-
-config LIBC_GLIBC_TARBALL
-    bool
-    prompt "Released tarball"
-    help
-      Until end of Februrary 2009, there was no tarball for glibc releases
-      2.8 and later. This was intentional.
-      
-      Then, all of a sudden, tarballs for those releases have appeared at the
-      traditional download place (ftp.gnu.org).
-      
-      Some of the glibc people argue that fixes are committed to the maintenance
-      branch, and thus it is the best plac e to retrieve the glibc from.
-      On the other hand, it might be preferable to always generate a toolchain
-      using a known code-base, so the toolchain can be reproducible.
-      
-      For version prior to 2.8, tarballs were readily available.
-      
-      If you want your toolchain to really be reproducible, say 'Y' here.
-      If you can live with a moving code-base, look at the other choice
-      entries, below.
-
-endchoice
-
-choice
-    bool
     prompt "glibc version"
 # Don't remove next line
 # CT_INSERT_VERSION_BELOW
@@ -109,8 +81,60 @@ 
     depends on OBSOLETE
     select LIBC_SUPPORT_LINUXTHREADS
 
+config LIBC_GLIBC_CUSTOM
+    bool
+    prompt "Custom glibc"
+    depends on EXPERIMENTAL
+    select LIBC_CUSTOM
+
 endchoice
 
+config LIBC_CUSTOM
+    bool
+
+if LIBC_GLIBC_CUSTOM
+
+config LIBC_GLIBC_CUSTOM_LOCATION
+    string
+    prompt "full path to custom glibc source"
+    default ""
+    help
+      Enter the path to the directory (or tarball) of your source for glibc,
+      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/glibc
+
+endif # LIBC_GLIBC_CUSTOM
+if ! LIBC_GLIBC_CUSTOM
+
+choice
+    bool
+    prompt "Retrieval method"
+    default LIBC_GLIBC_TARBALL
+
+config LIBC_GLIBC_TARBALL
+    bool
+    prompt "Released tarball"
+    help
+      Until end of Februrary 2009, there was no tarball for glibc releases
+      2.8 and later. This was intentional.
+      
+      Then, all of a sudden, tarballs for those releases have appeared at the
+      traditional download place (ftp.gnu.org).
+      
+      Some of the glibc people argue that fixes are committed to the maintenance
+      branch, and thus it is the best plac e to retrieve the glibc from.
+      On the other hand, it might be preferable to always generate a toolchain
+      using a known code-base, so the toolchain can be reproducible.
+      
+      For version prior to 2.8, tarballs were readily available.
+      
+      If you want your toolchain to really be reproducible, say 'Y' here.
+      If you can live with a moving code-base, look at the other choice
+      entries, below.
+
+endchoice
+
+endif # ! LIBC_GLIBC_CUSTOM
+
 config LIBC_VERSION
     string
 # Don't remove next line
@@ -130,3 +154,4 @@ 
     default "2.6" if LIBC_GLIBC_V_2_6
     default "2.5.1" if LIBC_GLIBC_V_2_5_1
     default "2.5" if LIBC_GLIBC_V_2_5
+    default "custom" if LIBC_GLIBC_CUSTOM
diff -r 43ace4bb005e -r 4d1c400c76a0 config/libc/newlib.in
--- a/config/libc/newlib.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/libc/newlib.in	Thu Oct 04 13:26:14 2012 +1000
@@ -52,8 +52,25 @@ 
       
       In a word: use the CVS snapshot at your own risk! 
 
+config LIBC_NEWLIB_CUSTOM
+    bool
+    prompt "Custom newlib"
+    depends on EXPERIMENTAL
+
 endchoice
 
+if LIBC_NEWLIB_CUSTOM
+
+config LIBC_NEWLIB_CUSTOM_LOCATION
+    string
+    prompt "full path to custom newlib source"
+    default ""
+    help
+      Enter the path to the directory (or tarball) of your source for newlib,
+      or leave blank to use default CT_CUSTOM_LOCATION_ROOT_DIR/newlib
+
+endif # LIBC_NEWLIB_CUSTOM
+
 config LIBC_VERSION
     string
     prompt "use CVS tag" if LIBC_NEWLIB_CVS
@@ -63,6 +80,7 @@ 
     default "1.19.0" if LIBC_NEWLIB_V_1_19_0
     default "1.18.0" if LIBC_NEWLIB_V_1_18_0
     default "1.17.0" if LIBC_NEWLIB_V_1_17_0
+    default "custom" if LIBC_NEWLIB_CUSTOM
     help
       Enter the tag you want to use.
       Leave empty to use the 'head' of the repository.
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/binutils/binutils.sh
--- a/scripts/build/binutils/binutils.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/binutils/binutils.sh	Thu Oct 04 13:26:14 2012 +1000
@@ -4,14 +4,26 @@ 
 
 # Download binutils
 do_binutils_get() {
-    CT_GetFile "binutils-${CT_BINUTILS_VERSION}"                                        \
-               {ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils   \
-               ftp://gcc.gnu.org/pub/binutils/{releases,snapshots}
+    if [ "${CT_BINUTILS_CUSTOM}" = "y" ]; then
+        CT_TestAndAbort "Custom binutils: CT_CUSTOM_LOCATION_ROOT_DIR or CT_BINUTILS_CUSTOM_LOCATION must be set." \
+        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_BINUTILS_CUSTOM_LOCATION}"
+        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_BINUTILS_CUSTOM_LOCATION}" ]; then
+            CT_BINUTILS_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/binutils"
+        fi
+        CT_GetCustom "binutils-${CT_BINUTILS_VERSION}" "${CT_BINUTILS_CUSTOM_LOCATION}"
+    else
+        CT_GetFile "binutils-${CT_BINUTILS_VERSION}"                                        \
+                   {ftp,http}://{ftp.gnu.org/gnu,ftp.kernel.org/pub/linux/devel}/binutils   \
+                   ftp://gcc.gnu.org/pub/binutils/{releases,snapshots}
+    fi
 }
 
 # Extract binutils
 do_binutils_extract() {
-    CT_Extract "binutils-${CT_BINUTILS_VERSION}"
+    if [ "${CT_BINUTILS_CUSTOM}" != "y" \
+         -o ! -d "${CT_BINUTILS_CUSTOM_LOCATION}" ]; then
+        CT_Extract "binutils-${CT_BINUTILS_VERSION}"
+    fi
     CT_Patch "binutils" "${CT_BINUTILS_VERSION}"
 }
 
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/cc/gcc.sh
--- a/scripts/build/cc/gcc.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/cc/gcc.sh	Thu Oct 04 13:26:14 2012 +1000
@@ -4,7 +4,14 @@ 
 
 # Download gcc
 do_cc_get() {
-    if [ -n "${CT_CC_V_SVN}" ]; then
+    if [ "${CT_CC_CUSTOM}" = "y" ]; then
+        CT_TestAndAbort "Custom gcc: CT_CUSTOM_LOCATION_ROOT_DIR or CT_CC_CUSTOM_LOCATION must be set." \
+        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_CC_CUSTOM_LOCATION}"
+        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_CC_CUSTOM_LOCATION}" ]; then
+            CT_CC_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/gcc"
+        fi
+        CT_GetCustom "gcc-${CT_CC_VERSION}" "${CT_CC_CUSTOM_LOCATION}"
+    elif [ -n "${CT_CC_V_SVN}" ]; then
         # Get gcc from SVN!
         local svn_base
 
@@ -59,7 +66,10 @@ 
 
 # Extract gcc
 do_cc_extract() {
-    CT_Extract "gcc-${CT_CC_VERSION}"
+    if [ "${CT_CC_CUSTOM}" != "y" \
+         -o ! -d "${CT_CC_CUSTOM_LOCATION}" ]; then
+        CT_Extract "gcc-${CT_CC_VERSION}"
+    fi
     CT_Patch "gcc" "${CT_CC_VERSION}"
 
     # Copy ecj-latest.jar to ecj.jar at the top of the GCC source tree
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/debug/300-gdb.sh
--- a/scripts/build/debug/300-gdb.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/debug/300-gdb.sh	Thu Oct 04 13:26:14 2012 +1000
@@ -48,10 +48,19 @@ 
     do_debug_gdb_parts
 
     if [ "${do_gdb}" = "y" ]; then
-        CT_GetFile "gdb-${CT_GDB_VERSION}"                          \
-                   {ftp,http}://ftp.gnu.org/pub/gnu/gdb             \
-                   ftp://sources.redhat.com/pub/gdb/{,old-}releases \
-                   "${linaro_base_url}/${linaro_series}/${linaro_version}/+download"
+        if [ "${CT_GDB_CUSTOM}" = "y" ]; then
+            CT_TestAndAbort "Custom gdb: CT_CUSTOM_LOCATION_ROOT_DIR or CT_GDB_CUSTOM_LOCATION must be set." \
+            -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_GDB_CUSTOM_LOCATION}"
+            if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_GDB_CUSTOM_LOCATION}" ]; then
+                CT_GDB_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/gdb"
+            fi
+            CT_GetCustom "gdb-${CT_GDB_VERSION}" "${CT_GDB_CUSTOM_LOCATION}"
+        else
+            CT_GetFile "gdb-${CT_GDB_VERSION}"                          \
+                       {ftp,http}://ftp.gnu.org/pub/gnu/gdb             \
+                       ftp://sources.redhat.com/pub/gdb/{,old-}releases \
+                       "${linaro_base_url}/${linaro_series}/${linaro_version}/+download"
+        fi
     fi
 
     if [ "${do_ncurses}" = "y" ]; then
@@ -70,7 +79,10 @@ 
     do_debug_gdb_parts
 
     if [ "${do_gdb}" = "y" ]; then
-        CT_Extract "gdb-${CT_GDB_VERSION}"
+        if [ "${CT_GDB_CUSTOM}" != "y" \
+             -o ! -d "${CT_GDB_CUSTOM_LOCATION}" ]; then
+            CT_Extract "gdb-${CT_GDB_VERSION}"
+        fi
         CT_Patch "gdb" "${CT_GDB_VERSION}"
     fi
 
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/kernel/linux.sh
--- a/scripts/build/kernel/linux.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/kernel/linux.sh	Thu Oct 04 13:26:14 2012 +1000
@@ -29,23 +29,12 @@ 
     fi
 
     if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
-        if [ ! -d "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
-            # Wee need to know the custom tarball extension,
-            # so we can create a properly-named symlink, which
-            # we use later on in 'extract'
-            case "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" in
-                *.tar.bz2)      custom_name="linux-custom.tar.bz2";;
-                *.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";;
-                *.tar)          custom_name="linux-custom.tar";;
-                *)  CT_Abort "Unknown extension for custom linux tarball '${CT_KERNEL_LINUX_CUSTOM_LOCATION}'";;
-            esac
-            CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  \
-                                      "${CT_TARBALLS_DIR}/${custom_name}"
-        else
-            custom_name="linux-custom"
-            CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  \
-                                      "${CT_SRC_DIR}/${custom_name}"
+        CT_TestAndAbort "Custom linux: CT_CUSTOM_LOCATION_ROOT_DIR or CT_KERNEL_LINUX_CUSTOM_LOCATION must be set." \
+        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
+        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
+            CT_KERNEL_LINUX_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/linux"
         fi
+        CT_GetCustom "linux-${CT_KERNEL_VERSION}" "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
     else # Not a custom tarball
         case "${CT_KERNEL_VERSION}" in
             2.6.*.*|3.*.*)
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/eglibc.sh
--- a/scripts/build/libc/eglibc.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/libc/eglibc.sh	Thu Oct 04 13:26:14 2012 +1000
@@ -28,9 +28,19 @@ 
         *)      svn_base+="/branches/eglibc-${CT_LIBC_VERSION}";;
     esac
 
-    CT_GetSVN "eglibc-${CT_LIBC_VERSION}"   \
-              "${svn_base}/libc"            \
-              "${CT_EGLIBC_REVISION:-HEAD}"
+    if [ "${CT_LIBC_CUSTOM}" = "y" ]; then
+        CT_TestAndAbort "Custom eglibc: CT_CUSTOM_LOCATION_ROOT_DIR or CT_LIBC_EGLIBC_CUSTOM_LOCATION must be set." \
+        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_LIBC_EGLIBC_CUSTOM_LOCATION}"
+        CT_LIBC_CUSTOM_LOCATION="${CT_LIBC_EGLIBC_CUSTOM_LOCATION}"
+        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_LIBC_EGLIBC_CUSTOM_LOCATION}" ]; then
+            CT_LIBC_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/eglibc"
+        fi
+        CT_GetCustom "eglibc-${CT_LIBC_VERSION}" "${CT_LIBC_CUSTOM_LOCATION}"
+    else
+        CT_GetSVN "eglibc-${CT_LIBC_VERSION}"   \
+                  "${svn_base}/libc"            \
+                  "${CT_EGLIBC_REVISION:-HEAD}"
+    fi
 
     if [ "${CT_LIBC_LOCALES}" = "y" ]; then
         extra_addons+=("localedef")
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/glibc-eglibc.sh-common
--- a/scripts/build/libc/glibc-eglibc.sh-common	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/libc/glibc-eglibc.sh-common	Thu Oct 04 13:26:14 2012 +1000
@@ -5,7 +5,10 @@ 
     local addon
 
     # Extract the main tarball
-    CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
+    if [ "${CT_LIBC_CUSTOM}" != "y" \
+         -o ! -d "${CT_LIBC_CUSTOM_LOCATION}" ]; then
+        CT_Extract "${CT_LIBC}-${CT_LIBC_VERSION}"
+    fi
     CT_Pushd "${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
     CT_Patch nochdir "${CT_LIBC}" "${CT_LIBC_VERSION}"
 
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/glibc.sh
--- a/scripts/build/libc/glibc.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/libc/glibc.sh	Thu Oct 04 13:26:14 2012 +1000
@@ -20,10 +20,20 @@ 
     addons_list=($(do_libc_add_ons_list " "))
 
     # Main source
-    CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
-               {ftp,http}://ftp.gnu.org/gnu/glibc       \
-               ftp://gcc.gnu.org/pub/glibc/releases     \
-               ftp://gcc.gnu.org/pub/glibc/snapshots
+    if [ "${CT_LIBC_CUSTOM}" = "y" ]; then
+        CT_TestAndAbort "Custom glibc: CT_CUSTOM_LOCATION_ROOT_DIR or CT_LIBC_GLIBC_CUSTOM_LOCATION must be set." \
+        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
+        CT_LIBC_CUSTOM_LOCATION="${CT_LIBC_GLIBC_CUSTOM_LOCATION}"
+        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_LIBC_GLIBC_CUSTOM_LOCATION}" ]; then
+            CT_LIBC_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/glibc"
+        fi
+        CT_GetCustom "glibc-${CT_LIBC_VERSION}" "${CT_LIBC_CUSTOM_LOCATION}"
+    else
+        CT_GetFile "glibc-${CT_LIBC_VERSION}"               \
+                   {ftp,http}://ftp.gnu.org/gnu/glibc       \
+                   ftp://gcc.gnu.org/pub/glibc/releases     \
+                   ftp://gcc.gnu.org/pub/glibc/snapshots
+    fi
 
     # C library addons
     for addon in "${addons_list[@]}"; do
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/build/libc/newlib.sh
--- a/scripts/build/libc/newlib.sh	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/build/libc/newlib.sh	Thu Oct 04 13:26:14 2012 +1000
@@ -20,7 +20,14 @@ 
     libc_src="ftp://sources.redhat.com/pub/newlib"
     avr32headers_src="http://dev.doredevelopment.dk/avr32-toolchain/sources"
 
-    if [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
+    if [ "${CT_LIBC_NEWLIB_CUSTOM}" = "y" ]; then
+        CT_TestAndAbort "Custom newlib: CT_CUSTOM_LOCATION_ROOT_DIR or CT_LIBC_NEWLIB_CUSTOM_LOCATION must be set." \
+        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
+        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}" ]; then
+            CT_LIBC_NEWLIB_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/newlib"
+        fi
+        CT_GetCustom "newlib-${CT_LIBC_VERSION}" "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}"
+    elif [ -z "${CT_LIBC_NEWLIB_CVS}" ]; then
         CT_GetFile "newlib-${CT_LIBC_VERSION}" ${libc_src}
     else
         CT_GetCVS "newlib-$(libc_newlib_version)"                   \
@@ -36,7 +43,10 @@ 
 }
 
 do_libc_extract() {
-    CT_Extract "newlib-$(libc_newlib_version)"
+    if [ "${CT_LIBC_NEWLIB_CUSTOM}" != "y" \
+         -o ! -d "${CT_LIBC_NEWLIB_CUSTOM_LOCATION}" ]; then
+        CT_Extract "newlib-$(libc_newlib_version)"
+    fi
     CT_Patch "newlib" "$(libc_newlib_version)"
 
     if [ "${CT_ATMEL_AVR32_HEADERS}" = "y" ]; then
diff -r 43ace4bb005e -r 4d1c400c76a0 scripts/functions
--- a/scripts/functions	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/functions	Thu Oct 04 13:26:14 2012 +1000
@@ -516,6 +516,32 @@ 
     return 1
 }
 
+# This function gets the custom source from either a tarball or directory
+# Usage: CT_GetCustom custom_name <custom_location>
+CT_GetCustom() {
+    local custom_name="$1"
+    local custom_location="$2"
+
+    if [ ! -d "${custom_location}" ]; then
+        # We need to know the custom tarball extension,
+        # so we can create a properly-named symlink, which
+        # we use later on in 'extract'
+        case "${custom_location}" in
+            *.tar.bz2)      custom_name="${custom_name}.tar.bz2";;
+            *.tar.gz|*.tgz) custom_name="${custom_name}.tar.gz";;
+            *.tar)          custom_name="${custom_name}.tar";;
+            *)  CT_Abort "Unknown extension for custom tarball '${custom_location}'";;
+        esac
+        CT_DoLog EXTRA "Using '${custom_name}' from local storage"
+        CT_DoExecLog DEBUG ln -sf "${custom_location}"  \
+                                  "${CT_TARBALLS_DIR}/${custom_name}"
+    else
+        CT_DoLog EXTRA "Using '${custom_name}' from local storage"
+        CT_DoExecLog DEBUG ln -snf "${custom_location}"  \
+                                  "${CT_SRC_DIR}/${custom_name}"
+    fi
+}
+
 # This function saves the specified to local storage if possible,
 # and if so, symlinks it for later usage
 # Usage: CT_SaveLocal </full/path/file.name>