dca278c7370859d135e6395b2e50fc8e81cee0f7
[oweals/busybox.git] / pristine_setup.sh
1 #!/bin/sh
2 #
3 # To compile BusyBox without touching the original sources
4 # (as might be interesting for multi-target builds), create 
5 # an empty directory, cd into it, and run this program by
6 # giving its explicit path (kind of like how you would run
7 # configure, if BusyBox had one).  Then you should be ready
8 # to "make".  Files in the build tree, in particular Config.h,
9 # will override those in the pristine source tree.
10 #
11
12
13 # if you use a ? in your path name, you lose.
14 DIR=`basedir ${0%%/pristine_setup}`
15 if [ ! -d $DIR ]; then
16   echo "unexpected problem: $DIR is not a directory.  Aborting pristine setup"
17   exit
18 fi
19
20 echo " "
21
22 if [ -e ./Config.h ]; then
23   echo "./Config.h already exists: not overwriting"
24 else
25     cp $DIR/Config.h Config.h
26 fi
27
28 if [ -e ./Makefile ]; then
29     echo "./Makefile already exists: not overwriting"
30 else
31     sed -e "s?BB_SRC_DIR =?BB_SRC_DIR = $DIR?" <$DIR/Makefile >Makefile || exit
32 fi
33
34
35 echo " "
36 echo "You may now type 'make' to build busybox in this directory"
37 echo "($PWD) using the pristine sources in $DIR"
38 echo " "
39