Mercurial > hg > aboriginal
annotate native-compiler.sh @ 1187:878dbfe76341
Move $BUILD/logs creation from record-commands.sh to include.sh so it gets reliably recreated when a user blanks the logs and re-runs.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 01 Aug 2010 15:19:00 -0500 |
parents | c222ae88733a |
children | 4021fb1183d7 |
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 |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 check_prerequisite "${ARCH}-cc" |
1090
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
16 if [ -z "$HOST_ARCH" ] |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
17 then |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
18 # Build unprefixed native compiler |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
19 HOST_ARCH="$ARCH" |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
20 else |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
21 # Build prefixed cross compiler via canadian cross. Needs a host compiler |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
22 # to build the executables and a target compiler to build the libraries. |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
23 PROGRAM_PREFIX="$ARCH-" |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
24 check_prerequisite "${HOST_ARCH}-cc" |
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
25 fi |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 mkdir -p "$STAGE_DIR/bin" || dienow |
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 C Library |
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 linux-headers |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 build_section uClibc |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 # Build binutils, gcc, and ccwrap |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 build_section binutils |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 build_section gcc |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 build_section ccwrap |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 |
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
|
40 # 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
|
41 # 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
|
42 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
43 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
|
44 |
1130
c222ae88733a
Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents:
1090
diff
changeset
|
45 # Add C++ standard library |
c222ae88733a
Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents:
1090
diff
changeset
|
46 |
c222ae88733a
Add NO_CPLUSPLUS config option, to skip c++ support entirely.
Rob Landley <rob@landley.net>
parents:
1090
diff
changeset
|
47 [ -z "$NO_CPLUSPLUS" ] && build_section uClibc++ |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 |
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
|
49 # 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
|
50 # 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
|
51 |
1090
affef1edbdba
Cleanup "FROM_ARCH" mess. Rename FROM_ARCH->HOST_ARCH, make stage script responsible for setting HOST_ARCH (not includes.sh). Also, remove HOST_UTILS variable, only build uClibc utils for non-simple compilers and bypass uClibc's (weird) makefile for the utils directory.
Rob Landley <rob@landley.net>
parents:
1083
diff
changeset
|
52 if [ "$HOST_ARCH" == "$ARCH" ] |
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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 |
946
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
59 # Delete some unneeded files |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
60 |
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
|
61 [ -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
|
62 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
|
63 |
b2cb36998d54
Helps to actually remember to add the new file.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
64 create_stage_tarball |