}
+wrap_bin_cc() {
+ local out="$1"
+ local bin="$2"
+
+ echo '#!/bin/sh' > "$out"
+ echo 'for arg in "$@"; do' >> "$out"
+ echo ' case "$arg" in -l*|-L*|-shared|-static)' >> "$out"
+ echo -n ' exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
+ echo -n '-idirafter "$STAGING_DIR/usr/include" ' >> "$out"
+ echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
+ echo '-Wl,-rpath-link,"$STAGING_DIR/usr/lib"} "$@" ;;' >> "$out"
+ echo ' esac' >> "$out"
+ echo 'done' >> "$out"
+ echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
+ echo '-idirafter "$STAGING_DIR/usr/include"} "$@"' >> "$out"
+
+ chmod +x "$out"
+}
+
+wrap_bin_ld() {
+ local out="$1"
+ local bin="$2"
+
+ echo '#!/bin/sh' > "$out"
+ echo -n 'exec "'"$bin"'" '"$CFLAGS"' ${STAGING_DIR:+' >> "$out"
+ echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
+ echo '-rpath-link "$STAGING_DIR/usr/lib"} "$@"' >> "$out"
+
+ chmod +x "$out"
+}
+
+wrap_bin_other() {
+ local out="$1"
+ local bin="$2"
+
+ echo '#!/bin/sh' > "$out"
+ echo 'exec "'"$bin"'" "$@"' >> "$out"
+
+ chmod +x "$out"
+}
+
wrap_bins() {
if probe_cc; then
mkdir -p "$1" || return 1
for cmd in "${CC%-*}-"*; do
if [ -x "$cmd" ]; then
local out="$1/${cmd##*/}"
+ local bin="$cmd"
+
+ if [ -x "$out" ] && ! grep -q STAGING_DIR "$out"; then
+ mv "$out" "$out.bin"
+ bin='$(dirname "$0")/'"${out##*/}"'.bin'
+ fi
- echo '#!/bin/sh' > "$out"
case "${cmd##*/}" in
*-*cc|*-*cc-*|*-*++|*-*++-*|*-cpp)
- echo -n 'exec "'"$cmd"'" '"$CFLAGS"' ' >> "$out"
- echo -n '${STAGING_DIR:+-idirafter ' >> "$out"
- echo -n '"$STAGING_DIR/usr/include" ' >> "$out"
- echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
- echo -n '-Wl,-rpath-link,' >> "$out"
- echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out"
+ wrap_bin_cc "$out" "$bin"
;;
*-ld)
- echo -n 'exec "'"$cmd"'" ${STAGING_DIR:+' >> "$out"
- echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
- echo -n '-rpath-link ' >> "$out"
- echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out"
+ wrap_bin_ld "$out" "$bin"
;;
*)
- echo "exec '$cmd' \"\$@\"" >> "$out"
+ wrap_bin_other "$out" "$bin"
;;
esac
- chmod +x "$out"
fi
done
fi
if test_feature "locale"; then
- echo "CONFIG_NLS=y" >> "$config"
+ echo "CONFIG_BUILD_NLS=y" >> "$config"
else
- echo "# CONFIG_NLS is not set" >> "$config"
+ echo "# CONFIG_BUILD_NLS is not set" >> "$config"
fi
echo "CONFIG_DEVEL=y" >> "$config"
echo -e " $me --toolchain {directory} --config {target}" >&2
echo -e " Analyze the given toolchain and print a suitable" >&2
echo -e " .config for the given target. Omit target " >&2
- echo -e " argument to get a list of names." >&2
- echo -e " suitable to prime .config with.\n" >&2
+ echo -e " argument to get a list of names.\n" >&2
echo -e " $me --help" >&2
echo -e " Display this help text and exit.\n\n" >&2
echo -e " Most commands also take a --cflags parameter which " >&2