void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

cross-cc (1002B)


      1#!/bin/bash
      2
      3# compiler wrapper to get rid of -I/usr/include and -L/usr/lib, that fucks up
      4# cross compilation badly.
      5declare -a MYARGS
      6
      7ARGS=("$@")
      8i=0
      9while [ $i -lt ${#ARGS[@]} ]; do
     10	arg="${ARGS[$i]}"
     11	if [ "$incpath" ]; then
     12		if [ "$arg" = "/usr/include" ]; then
     13			echo "[cc-wrapper] ignoring -I $arg"
     14		else
     15			MYARGS+=("-I${arg}")
     16		fi
     17		unset incpath
     18	elif [ "$libpath" ]; then
     19		# XXX: avoid so much repetition
     20		if [ "$arg" = "/usr/lib" -o "$arg" = "/usr/lib32" -o "$arg" = "/usr/lib64" -o "$arg" = "/lib" ]; then
     21			echo "[cc-wrapper] ignoring -L $arg"
     22		else
     23			MYARGS+=("-L${arg}")
     24		fi
     25		unset libpath
     26	elif [ "$arg" = "-I" ]; then
     27		incpath=1
     28	elif [ "$arg" = "-L" ]; then
     29		libpath=1
     30	elif [ "$arg" = "-I/usr/include" -o "$arg" = "-L/usr/lib" \
     31		-o "$arg" = "-L/usr/lib32" -o "$arg" = "-L/usr/lib64" \
     32		-o "$arg" = "-L/lib" ]; then
     33		echo "[cc-wrapper] ignoring $arg"
     34	else
     35		MYARGS+=("${arg}")
     36	fi
     37	i=$((i+1))
     38done
     39#echo "[cc-wrapper] @BIN@ ${MYARGS[@]}"
     40exec @BIN@ "${MYARGS[@]}"