9c: ignore autolib symbols
9l: use autolib symbols
This commit is contained in:
parent
e9a569a96a
commit
ead3e31153
2 changed files with 127 additions and 5 deletions
16
bin/9c
16
bin/9c
|
|
@ -27,7 +27,7 @@ case "$tag" in
|
||||||
cflags="$ngflags -g3 -no-cpp-precomp" ;;
|
cflags="$ngflags -g3 -no-cpp-precomp" ;;
|
||||||
*HP-UX*) cc=cc; cflags="-g -O -c -Ae" ;;
|
*HP-UX*) cc=cc; cflags="-g -O -c -Ae" ;;
|
||||||
*Linux*) usegcc
|
*Linux*) usegcc
|
||||||
case "`uname -r`" in
|
case "${SYSVERSION:-`uname -r`}" in
|
||||||
2.6.*)
|
2.6.*)
|
||||||
cflags="$cflags -D__Linux26__"
|
cflags="$cflags -D__Linux26__"
|
||||||
;;
|
;;
|
||||||
|
|
@ -53,12 +53,20 @@ case "$tag" in
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# N.B. Must use temp file to avoid pipe; pipe loses status.
|
||||||
|
xtmp=/tmp/9c.$$.$USER.out
|
||||||
|
status=x
|
||||||
case "$tag" in
|
case "$tag" in
|
||||||
*SunOS*-cc)
|
*SunOS*-cc)
|
||||||
exec $cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>&1 |
|
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@" 2>&1 |
|
||||||
/bin/sed 's/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' 1>&2
|
/bin/sed 's/\"\([^\"][^\"]*\)\", line \([0-9][0-9]*\)/\1:\2/g' 1>&2
|
||||||
|
status=$?
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
exec $cc -DPLAN9PORT -I$PLAN9/include $cflags "$@"
|
$cc -DPLAN9PORT -I$PLAN9/include $cflags "$@"
|
||||||
|
status=$?
|
||||||
;;
|
;;
|
||||||
esac
|
esac >$xtmp 2>&1
|
||||||
|
grep -v '__p9l_autolib_' $xtmp
|
||||||
|
rm -f $xtmp
|
||||||
|
exit $status
|
||||||
|
|
|
||||||
116
bin/9l
116
bin/9l
|
|
@ -1,5 +1,115 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
libsl=""
|
||||||
|
|
||||||
|
doautolib=1
|
||||||
|
verbose=0
|
||||||
|
|
||||||
|
if [ "x$1" = "x-l" ]
|
||||||
|
then
|
||||||
|
shift
|
||||||
|
doautolib=0
|
||||||
|
elif [ "x$1" = "x-v" ]
|
||||||
|
then
|
||||||
|
shift
|
||||||
|
verbose=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $doautolib = 1 ]
|
||||||
|
then
|
||||||
|
ofiles=""
|
||||||
|
for i
|
||||||
|
do
|
||||||
|
case "$i" in
|
||||||
|
[^-]*.o)
|
||||||
|
ofiles="$ofiles $i"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# echo "ofiles $ofiles"
|
||||||
|
autolibs=""
|
||||||
|
if [ "x$ofiles" != "x" ]
|
||||||
|
then
|
||||||
|
autolibs=`
|
||||||
|
nm $ofiles |
|
||||||
|
grep '__p9l_autolib_[a-zA-Z0-9+-]*$' |
|
||||||
|
sed 's/.* __p9l_autolib_//' |
|
||||||
|
sort -u
|
||||||
|
`
|
||||||
|
fi
|
||||||
|
# echo "autolibs $autolibs"
|
||||||
|
|
||||||
|
libsl=""
|
||||||
|
special="mp draw 9pclient mux thread bio" # order matters
|
||||||
|
for i in $special
|
||||||
|
do
|
||||||
|
eval "need$i=0"
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $autolibs
|
||||||
|
do
|
||||||
|
case "$i" in
|
||||||
|
9pclient)
|
||||||
|
need9pclient=1
|
||||||
|
needmux=1
|
||||||
|
needthread=1
|
||||||
|
;;
|
||||||
|
bio)
|
||||||
|
needbio=1
|
||||||
|
;;
|
||||||
|
draw)
|
||||||
|
needdraw=1
|
||||||
|
;;
|
||||||
|
mp)
|
||||||
|
needmp=1
|
||||||
|
;;
|
||||||
|
mux)
|
||||||
|
needmux=1
|
||||||
|
needthread=1
|
||||||
|
;;
|
||||||
|
plumb)
|
||||||
|
need9pclient=1
|
||||||
|
needmux=1
|
||||||
|
needthread=1
|
||||||
|
libsl="$libsl -lplumb"
|
||||||
|
;;
|
||||||
|
sec)
|
||||||
|
needmp=1
|
||||||
|
libsl="$libsl -lsec"
|
||||||
|
;;
|
||||||
|
thread)
|
||||||
|
needthread=1
|
||||||
|
;;
|
||||||
|
venti)
|
||||||
|
libsl="$libsl -lventi"
|
||||||
|
needthread=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
libsl="$libsl -l$i"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in $special
|
||||||
|
do
|
||||||
|
if eval "[ \$need$i = 1 ]"
|
||||||
|
then
|
||||||
|
libsl="$libsl -l$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
libsl="$libsl -l9"
|
||||||
|
|
||||||
|
if [ $needdraw = 1 ]
|
||||||
|
then
|
||||||
|
if [ "x$X11" = "x" ]
|
||||||
|
then
|
||||||
|
X11=/usr/X11R6
|
||||||
|
fi
|
||||||
|
libsl="$libsl -L$X11/lib -lX11"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
extralibs="-lm"
|
extralibs="-lm"
|
||||||
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
|
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
|
||||||
case "$tag" in
|
case "$tag" in
|
||||||
|
|
@ -36,4 +146,8 @@ case "$tag" in
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exec $ld -L$PLAN9/lib "$@" $extralibs
|
if [ $verbose = 1 ]
|
||||||
|
then
|
||||||
|
echo $ld -L$PLAN9/lib "$@" $libsl $extralibs
|
||||||
|
fi
|
||||||
|
exec $ld -L$PLAN9/lib "$@" $libsl $extralibs
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue