annotate sources/sections/ccwrap.sh @ 1675:a87931846137

Have ccwrap autodetect which dynamic linker to use, musl's or uClibc's. Give musl a ld-musl.so.0 symlink so we can tell which libc we're using.
author Rob Landley <rob@landley.net>
date Sun, 17 Aug 2014 13:03:48 -0500
parents 35b8949e9d9c
children c11a357ea92d
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"
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
7
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
8 # 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
9
1664
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
10 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
11 "$TEMP" "$SOURCES/toys/ccwrap.c" -Os $CFLAGS \
1675
a87931846137 Have ccwrap autodetect which dynamic linker to use, musl's or uClibc's.
Rob Landley <rob@landley.net>
parents: 1664
diff changeset
12 -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cc" $STATIC_FLAGS -DDYNAMIC_LINKER=\"/lib/$(cd $STAGE_DIR/lib; ls ld-*.so.0)\" &&
1664
35b8949e9d9c Very basic musl support. Still needs debugging and to be enabled per-target.
Rob Landley <rob@landley.net>
parents: 1489
diff changeset
13 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
14 > "$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
15 chmod +x "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" || dienow