This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

HOWTO: Test in-src build without requiring much extra disk space


I wrote:
>>(BTW, I want to be quite clear: no offense to anyone doing that work
>> and I fully support it but I hereby suggest again that it would be
>> great if the people making *basic* reorganization and changes to the
>> build infrastructure would actually test the multiple configuration
>> styles we purport to support.)

Nathanael Nerode wrote:
> Adding build-in-src to that is really nasty, especially since it
> really means I have to put another copy of the source tree on disk
> (to keep my working copy in any kind of shape for the objdir!=srcdir
> builds).

Ah, if that is the only thing holding you back... ;-)  No, you don't!
Someone mailed me this cute little script called duptree which allows
you to create a cloned copy of e.g. a CVS src tree with much less disk
space that I presumed would be required:

$ rm -rf ~/tmp-ref4/GCC   # clear out yesterday's src clone & in-src build dir
$ duptree ~/tmp-ref4/outside-cvs-src/gcc ~/tmp-ref4/GCC
$ du -s ~/tmp-ref4/outside-cvs-src/gcc ~/tmp-ref4/GCC
146700  /home/ljrittle/tmp-ref4/outside-cvs-src/gcc
1144    /home/ljrittle/tmp-ref4/GCC
$ cd ~/tmp-ref4/GCC; ./configure; make bootstrap check install

One may also use this script to clone a CVS src tree to another area
to ensure that stuff written back to $src during a build may be easily
spotted and removed.

Regards,
Loren

#!/bin/sh

if [ $# != 2 ]; then
  echo usage: $0 source target
  echo creates in target any files or directories that exist in source
  exit 1
fi

CDPATH=:.
: ${LN=ln}
sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'

# Make sure source exists
test -d $1 || exit 1 &&
# Create target
test -d $2 || mkdir $2 &&
# Create missing directories
(cd $1 && find . -type d -print) |
  sed "$sed_quote_subst;s,.*,test -e \"$2/&\" || mkdir \"$2/&\"," |
  bash &&
# Create missing files
(cd $1 && find . ! -type d ! -type l -print) |
  sed "$sed_quote_subst;s,.*,test -e \"$2/&\" || $LN \"$1/&\" \"$2/&\"," |
  bash &&
# Create missing links
(cd $1 && find . -type l -print) |
  sed "$sed_quote_subst;s,.*,test -e \"$2/&\" || echo \"&\"," |
  bash |
  (cd $1 && tar -cf - -T-) |
  (cd $2 && tar -xkf -) &&
exit 0
exit 1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]