mirror of https://github.com/0intro/wmii
41 lines
818 B
Bash
Executable File
41 lines
818 B
Bash
Executable File
#!/bin/sh -f
|
|
|
|
LD=$1
|
|
PACKAGES=$2
|
|
LDFLAGS=$3; shift 3
|
|
|
|
[ -n "$PACKAGES" ] && LDFLAGS="$LDFLAGS $(pkg-config --libs $PACKAGES)"
|
|
|
|
outfile="$1"; shift
|
|
bin="$(echo $0 | sed 's,/[^/]*$,,')"
|
|
|
|
# Derived from Russ Cox's 9l in plan9port.
|
|
ofiles=""
|
|
args=""
|
|
for i
|
|
do
|
|
case "$i" in
|
|
*.[ao]|*.o_pic)
|
|
ofiles="$ofiles $i"
|
|
;;
|
|
*)
|
|
args="$args $i"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
xtmp=/tmp/ld.$$.$USER.out
|
|
|
|
echo LD "$($bin/cleanname ${BASE}$outfile)"
|
|
[ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args
|
|
$LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1
|
|
status=$?
|
|
[ $status -eq 0 ] || echo $LD -o $outfile $ofiles $LDFLAGS $args >&2
|
|
|
|
sed 's/.*: In function `[^:]*: *//' $xtmp | grep -E . |
|
|
grep -E -v 'is almost always misused|is dangerous, better use|in statically linked applications requires at runtime'
|
|
rm -f $xtmp
|
|
|
|
exit $status
|
|
|