comparison sources/sections/ccwrap.sh @ 1677:c11a357ea92d

Second attempt: make dynamic linker match libc in ccwrap. Building uClibc requires the wrapper, so we can't have the wrapper look for and _existing_ dynamic linker, so the wrapper script has to check the config.
author Rob Landley <rob@landley.net>
date Sun, 24 Aug 2014 22:23:05 -0500
parents a87931846137
children 117f1c93212a
comparison
equal deleted inserted replaced
1676:0f4499211cfa 1677:c11a357ea92d
2 2
3 # Which compiler do we build the wrapper with, and should it be static? 3 # Which compiler do we build the wrapper with, and should it be static?
4 4
5 [ "$BUILD_STATIC" == none ] && STATIC_FLAGS= || STATIC_FLAGS=--static 5 [ "$BUILD_STATIC" == none ] && STATIC_FLAGS= || STATIC_FLAGS=--static
6 [ -z "$HOST_ARCH" ] && TEMP="$CC" || TEMP="${HOST_ARCH}-cc" 6 [ -z "$HOST_ARCH" ] && TEMP="$CC" || TEMP="${HOST_ARCH}-cc"
7 LIBC_TYPE=musl
8 [ ! -z "$UCLIBC_CONFIG" ] && [ -z "$MUSL" ] && LIBC_TYPE=uClibc
7 9
8 # Build wrapper binary 10 # Build wrapper binary
9 11
10 mkdir -p "$STAGE_DIR/bin" && 12 mkdir -p "$STAGE_DIR/bin" &&
11 "$TEMP" "$SOURCES/toys/ccwrap.c" -Os $CFLAGS \ 13 "$TEMP" "$SOURCES/toys/ccwrap.c" -Os $CFLAGS \
12 -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cc" $STATIC_FLAGS -DDYNAMIC_LINKER=\"/lib/$(cd $STAGE_DIR/lib; ls ld-*.so.0)\" && 14 -o "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cc" $STATIC_FLAGS \
15 -DDYNAMIC_LINKER=\"/lib/ld-${LIBC_TYPE}.so.0\" &&
13 echo -e "#!/bin/bash\n\n${TOOLCHAIN_PREFIX}cc -E "'"$@"' \ 16 echo -e "#!/bin/bash\n\n${TOOLCHAIN_PREFIX}cc -E "'"$@"' \
14 > "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" && 17 > "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" &&
15 chmod +x "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" || dienow 18 chmod +x "$STAGE_DIR/bin/${TOOLCHAIN_PREFIX}cpp" || dienow