2007-03-26 08:48:00 +04:00
|
|
|
#!/bin/sh -f
|
|
|
|
|
2009-10-10 00:40:33 +04:00
|
|
|
LD=$1
|
2010-06-28 01:47:45 +04:00
|
|
|
PACKAGES=$2
|
|
|
|
LDFLAGS=$3; shift 3
|
|
|
|
|
2011-10-20 12:55:58 +04:00
|
|
|
[ -n "$PACKAGES" ] && LDFLAGS="$LDFLAGS $(pkg-config --libs $PACKAGES)"
|
2009-10-10 00:40:33 +04:00
|
|
|
|
2007-03-26 08:48:00 +04:00
|
|
|
outfile="$1"; shift
|
2007-07-01 15:08:30 +04:00
|
|
|
bin="$(echo $0 | sed 's,/[^/]*$,,')"
|
2007-03-26 08:48:00 +04:00
|
|
|
|
|
|
|
# Derived from Russ Cox's 9l in plan9port.
|
|
|
|
ofiles=""
|
|
|
|
args=""
|
|
|
|
for i
|
|
|
|
do
|
|
|
|
case "$i" in
|
2008-01-18 01:50:35 +03:00
|
|
|
*.[ao]|*.o_pic)
|
2007-03-26 08:48:00 +04:00
|
|
|
ofiles="$ofiles $i"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
args="$args $i"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
xtmp=/tmp/ld.$$.$USER.out
|
|
|
|
|
2007-07-01 15:08:30 +04:00
|
|
|
echo LD "$($bin/cleanname ${BASE}$outfile)"
|
2007-07-17 00:52:35 +04:00
|
|
|
[ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args
|
2007-03-26 08:48:00 +04:00
|
|
|
$LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1
|
|
|
|
status=$?
|
2010-06-17 02:32:09 +04:00
|
|
|
[ $status -eq 0 ] || echo $LD -o $outfile $ofiles $LDFLAGS $args >&2
|
2007-03-26 08:48:00 +04:00
|
|
|
|
2023-09-29 22:57:45 +03:00
|
|
|
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'
|
2007-03-26 08:48:00 +04:00
|
|
|
rm -f $xtmp
|
|
|
|
|
|
|
|
exit $status
|
|
|
|
|