aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-12-28 22:25:06 +0000
committerMike Buland <eichlan@xagasoft.com>2009-12-28 22:25:06 +0000
commitccc30fd28cb3e65195a6cea06ca00f95e16ac9f8 (patch)
tree2da9b16f402bbc125f010b9a5dd09bb87d7020bc
parentc5fcf682195b0b191d19a598844f734ebf5b2583 (diff)
downloadbuild-ccc30fd28cb3e65195a6cea06ca00f95e16ac9f8.tar.gz
build-ccc30fd28cb3e65195a6cea06ca00f95e16ac9f8.tar.bz2
build-ccc30fd28cb3e65195a6cea06ca00f95e16ac9f8.tar.xz
build-ccc30fd28cb3e65195a6cea06ca00f95e16ac9f8.zip
Added build.sh, it can build build when no libbu++ is present by downloading
what it needs, and it'll build a static version of build no problem. Semi-static, it won't build any plugins or link against a shared libbu++, system stuff may still be dynamic. It can also clean up behind itself.
Diffstat (limited to '')
-rwxr-xr-xbuild.sh68
1 files changed, 68 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..dd7e45b
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,68 @@
1#!/bin/bash
2
3BUSRC="stack.cpp fstring.cpp fbasicstring.cpp hash.cpp list.cpp trace.cpp stream.cpp formatter.cpp util.cpp sharedcore.cpp exceptionbase.cpp heap.cpp archivebase.cpp archive.cpp queue.cpp archival.cpp sio.cpp stdstream.cpp process.cpp plugger.cpp optparser.cpp signals.cpp array.cpp membuf.cpp"
4BUHDR="stack.h fstring.h fbasicstring.h hash.h list.h trace.h stream.h formatter.h util.h sharedcore.h exceptionbase.h heap.h archivebase.h archive.h queue.h archival.h sio.h stdstream.h process.h osx_compatibility.h win32_compatibility.h linux_compatibility.h plugger.h singleton.h optparser.h signals.h array.h membuf.h"
5
6function bld()
7{
8 OUTFILE="$1"
9 if [ ! -e "$OUTFILE" ]; then
10 return 1
11 fi
12 shift
13 for INFILE in $*; do
14 if [ "$INFILE" -nt "$OUTFILE" ]; then
15 return 1
16 fi
17 done
18 return 0
19}
20
21function cmd()
22{
23 printf "%8s $2\n" $1
24 shift 2
25 $* || exit
26}
27
28function gpp()
29{
30 bld "$1" "$2" || cmd CXX "$1" g++ -ggdb -W -Wall -Iminibu -Iminibu/bu -c -o "$1" "$2"
31}
32
33if [ ! -z "$1" ]; then
34 if [ "$1" == "clean" -o "$1" == "-c" ]; then
35 echo "Cleaning up, deleting all object code and downloaded source code..."
36 echo
37 rm -Rf minibu src/*.o
38 exit
39 else
40 echo "The only option supported is \"clean\", otherwise run $0"
41 echo "with no parameters to compile build."
42 echo
43 exit
44 fi
45fi
46
47mkdir -p minibu/src minibu/bu
48for F in $BUSRC; do
49 bld minibu/src/$F || cmd WGET minibu/src/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/src/$F
50done
51for F in $BUHDR; do
52 bld minibu/bu/$F || cmd WGET minibu/bu/$F wget -q http://svn.xagasoft.com/libbu++/trunk/src/$F -O minibu/bu/$F
53done
54
55bld src/build.tab.c src/build.y || cmd BISON src/build.tab.c bison -bsrc/build src/build.y
56bld src/build.yy.c src/build.l || cmd FLEX src/build.yy.c flex src/build.l
57
58for F in $BUSRC; do
59 OUTPUT=${F%.*}.o
60 bld minibu/src/$OUTPUT || gpp minibu/src/$OUTPUT minibu/src/$F
61done
62
63for F in src/*.c src/*.cpp; do
64 OUTPUT=${F%.*}.o
65 gpp "$OUTPUT" "$F"
66done
67bld build src/*.o minibu/src/*.o || cmd LINK build g++ -o build src/*.o minibu/src/*.o -ldl
68bld build~ build || cmd CP build~ cp build build~