Mercurial > hg > aboriginal
annotate native-compiler.sh @ 1083:cb4dbdb7f2cd
Make BUILD_STATIC take comma separated list of packages, or "all" or "none". Default behavior should remain the same.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 16 May 2010 02:26:03 -0500 |
parents | 27c38c82401d |
children | affef1edbdba |
rev | line source |
---|---|
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
1007
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
3 # Build a compiler for a given target, using one or more existing simple |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
4 # cross compilers. |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
5 |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
6 # This can be used to build a native compiler for an aribitrary target, or to |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
7 # build a more portable and capable cross compiler for an arbitrary host. |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 |
1083
cb4dbdb7f2cd
Make BUILD_STATIC take comma separated list of packages, or "all" or "none". Default behavior should remain the same.
Rob Landley <rob@landley.net>
parents:
1034
diff
changeset
|
9 # The new compiler is built --with-shared, with thread support, has uClibc++ |
cb4dbdb7f2cd
Make BUILD_STATIC take comma separated list of packages, or "all" or "none". Default behavior should remain the same.
Rob Landley <rob@landley.net>
parents:
1034
diff
changeset
|
10 # installed, and is linked against uClibc (see BUILD_STATIC in config). |
1007
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
11 |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
12 source sources/include.sh && read_arch_dir "$1" || exit 1 |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 check_for_base_arch || exit 0 |
1007
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
14 |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
15 # Building a cross compiler requires _two_ existing simple compilers: one for |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
16 # the host (to build the executables), and one for the target (to build |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
17 # the libraries). For native compilers both checks test for the same thing. |
48784ae8533e
Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents:
998
diff
changeset
|
18 |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 check_prerequisite "${ARCH}-cc" |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 check_prerequisite "${FROM_ARCH}-cc" |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 mkdir -p "$STAGE_DIR/bin" || dienow |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 # Build C Library |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 build_section linux-headers |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 build_section uClibc |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 # Build binutils, gcc, and ccwrap |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 build_section binutils |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 build_section gcc |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 build_section ccwrap |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 |
1034
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
35 # Tell future packages to link against the libraries in the new compiler, |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
36 # rather than the ones in the simple compiler. |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 export "$(echo $ARCH | sed 's/-/_/g')"_CCWRAP_TOPDIR="$STAGE_DIR" |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 build_section uClibc++ |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 |
1034
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
42 # For a native compiler, build make, bash, and distcc. (Yes, this is an old |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
43 # version of Bash. It's intentional.) |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
44 |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
45 if [ "$FROM_ARCH" == "$ARCH" ] |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
46 then |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
47 build_section make |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
48 build_section bash |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
49 build_section distcc |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
50 fi |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
51 |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 # Delete some unneeded files |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
53 |
1034
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
54 [ -z "$SKIP_STRIP" ] && |
27c38c82401d
Move make, bash, and distcc builds into native-compiler.sh. (Break 'em out into sources/sections/*.build.)
Rob Landley <rob@landley.net>
parents:
1007
diff
changeset
|
55 rm -rf "$STAGE_DIR"/{info,man,libexec/gcc/*/*/install-tools} |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
57 create_stage_tarball |