config: add an option not to remove the destination directory
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Fri Jan 28 22:06:49 2011 +0100 (2011-01-28)
changeset 22847ede374110e5
parent 2283 5d449fd83091
child 2285 7d1e018167b5
config: add an option not to remove the destination directory

In certain circumstances, removing the destination/installation directory
is a bad idea. For example, when the build environment is already taking
care of sanitising the build tree, and pre-installs stuff in there, it is
a very bad idea to remove the destination directory.

This happens now in buildroot, as the crostool-NG backend now installs the
toolchain in the common host-tools directory, and pre-install there a few
host-utilities (eg. host-automake and host-gawk).

Provide a config knob to turn on/off the removal of the destination
directory, defaulting to 'y' (previous behavior), and forced to 'n' when
used as a backend.

Reported-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
config/global/paths.in
scripts/crosstool-NG.sh.in
     1.1 --- a/config/global/paths.in	Wed Jan 26 00:12:27 2011 +0100
     1.2 +++ b/config/global/paths.in	Fri Jan 28 22:06:49 2011 +0100
     1.3 @@ -61,6 +61,28 @@
     1.4  #      The reason you might also want to install elsewhere is if you are going
     1.5  #      to package your shinny new toolchain for distribution.
     1.6  
     1.7 +config RM_RF_PREFIX_DIR
     1.8 +    bool
     1.9 +    prompt "|  Remove the prefix dir prior to building"
    1.10 +    default y
    1.11 +    depends on !BACKEND
    1.12 +    help
    1.13 +      If you say 'y' here, then PREFIX_DIR (above) will be eradicated
    1.14 +      prior to the toolchain is built.
    1.15 +      
    1.16 +      This can be usefull when you are trying different settings (due
    1.17 +      to build failures or feature tests). In this case, to avoid using
    1.18 +      a potentially broken previous toolchain, the install location is
    1.19 +      removed, to start afresh.
    1.20 +      
    1.21 +      On the oher hand, if you are building a final toolchain, and install
    1.22 +      it into a directory with pre-install, unrelated programs, it would be
    1.23 +      damageable to remove that directory. In this case, you may want to
    1.24 +      say 'n' here.
    1.25 +      
    1.26 +      Note that when acting as a backend, this option is not available, and
    1.27 +      is forced to 'n'.
    1.28 +
    1.29  config REMOVE_DOCS
    1.30      bool
    1.31      prompt "Remove documentation"
     2.1 --- a/scripts/crosstool-NG.sh.in	Wed Jan 26 00:12:27 2011 +0100
     2.2 +++ b/scripts/crosstool-NG.sh.in	Fri Jan 28 22:06:49 2011 +0100
     2.3 @@ -229,7 +229,7 @@
     2.4      if [ "${CT_FORCE_EXTRACT}" = "y" -a -d "${CT_SRC_DIR}" ]; then
     2.5          CT_DoForceRmdir "${CT_SRC_DIR}"
     2.6      fi
     2.7 -    if [ -d "${CT_INSTALL_DIR}" ]; then
     2.8 +    if [ -d "${CT_INSTALL_DIR}" -a "${CT_RM_RF_PREFIX_DIR}" = "y" ]; then
     2.9          CT_DoForceRmdir "${CT_INSTALL_DIR}"
    2.10      fi
    2.11      # In case we start anew, get rid of the previously saved state directory