view 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
line wrap: on
line source

# build and install gcc wrapper

# Which compiler do we build the wrapper with, and should it be static?

[ "$BUILD_STATIC" == none ] && STATIC_FLAGS= || STATIC_FLAGS=--static
[ -z "$HOST_ARCH" ] && TEMP="$CC" || TEMP="${HOST_ARCH}-cc"

# Build wrapper binary

mkdir -p "$STAGE_DIR/bin" &&
"$TEMP" "$SOURCES/toys/ccwrap.c" -Os $CFLAGS \
  -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cc" $STATIC_FLAGS -DDYNAMIC_LINKER=\"/lib/$(cd $STAGE_DIR/lib; ls ld-*.so.0)\" &&
echo -e "#!/bin/bash\n\n${TOOLCHAIN_PREFIX}cc -E "'"$@"' \
  > "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" &&
chmod +x "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" || dienow