annotate sources/sections/ccwrap.sh @ 1839:c8293b3ab81f draft default tip

Teach chroot-splice to accept one or two arguments. (Control image now optional.)
author Rob Landley <rob@landley.net>
date Sun, 17 Jan 2016 21:18:52 -0600
parents d461b345c3c9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1210
a36e985f6198 Untangle static vs cross for ccwrap section.
Rob Landley <rob@landley.net>
parents: 1207
diff changeset
1 # build and install gcc wrapper
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
1085
2e03f846b21e Build ccwrap static unless BUILD_STATIC=none or we're doing the simple cross compiler.
Rob Landley <rob@landley.net>
parents: 981
diff changeset
3 # Which compiler do we build the wrapper with, and should it be static?
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
4
1210
a36e985f6198 Untangle static vs cross for ccwrap section.
Rob Landley <rob@landley.net>
parents: 1207
diff changeset
5 [ "$BUILD_STATIC" == none ] && STATIC_FLAGS= || STATIC_FLAGS=--static
a36e985f6198 Untangle static vs cross for ccwrap section.
Rob Landley <rob@landley.net>
parents: 1207
diff changeset
6 [ -z "$HOST_ARCH" ] && TEMP="$CC" || TEMP="${HOST_ARCH}-cc"
1677
c11a357ea92d Second attempt: make dynamic linker match libc in ccwrap.
Rob Landley <rob@landley.net>
parents: 1675
diff changeset
7 LIBC_TYPE=musl
c11a357ea92d Second attempt: make dynamic linker match libc in ccwrap.
Rob Landley <rob@landley.net>
parents: 1675
diff changeset
8 [ ! -z "$UCLIBC_CONFIG" ] && [ -z "$MUSL" ] && LIBC_TYPE=uClibc
905
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
9
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
10 # Build wrapper binary
023b577fb865 Break up sources/sections/binutils-gcc.sh into binutils, gcc, and ccwrap, plus more gcc->cc cleanup.
Rob Landley <rob@landley.net>
parents:
diff changeset
11
1664
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
12 mkdir -p "$STAGE_DIR/bin" &&
920
a69213462fbe If "$CCWRAP" is quoted it gets passed in as a blank argument when empty, confusing the compiler.
Rob Landley <rob@landley.net>
parents: 918
diff changeset
13 "$TEMP" "$SOURCES/toys/ccwrap.c" -Os $CFLAGS \
1677
c11a357ea92d Second attempt: make dynamic linker match libc in ccwrap.
Rob Landley <rob@landley.net>
parents: 1675
diff changeset
14 -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cc" $STATIC_FLAGS \
1776
398efd71a43e More fiddling with sh2 target and elf2flt.
Rob Landley <rob@landley.net>
parents: 1774
diff changeset
15 -DDYNAMIC_LINKER=\"/lib/ld-${LIBC_TYPE}.so.0\" \
1793
d461b345c3c9 Build sh2eb for the numato mimas v2. Still a lot of rough edges.
Rob Landley <rob@landley.net>
parents: 1776
diff changeset
16 ${ELF2FLT:+-DELF2FLT} &&
d461b345c3c9 Build sh2eb for the numato mimas v2. Still a lot of rough edges.
Rob Landley <rob@landley.net>
parents: 1776
diff changeset
17 # ${HOST_ARCH:+${ELF2FLT:+-DELF2FLT}} &&
1664
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
18 echo -e "#!/bin/bash\n\n${TOOLCHAIN_PREFIX}cc -E "'"$@"' \
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
19 > "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" &&
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
20 chmod +x "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" || dienow