mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-14 23:46:10 +00:00
135 lines
3.3 KiB
Plaintext
135 lines
3.3 KiB
Plaintext
|
--- util/makesharedlib.orig Wed Jul 1 13:56:20 1998
|
||
|
+++ util/makesharedlib Sat Oct 17 07:26:06 1998
|
||
|
@@ -10,6 +10,9 @@
|
||
|
;;
|
||
|
-kind=*) kind=`echo A$arg | sed -e 's/A-kind=//g'`
|
||
|
;;
|
||
|
+ -suffix=*) slsuffix=`echo A$arg | sed -e 's/A-suffix=//g'`
|
||
|
+ ;;
|
||
|
+ -echo) set -x ;;
|
||
|
*)
|
||
|
echo "Unrecognized option $arg"
|
||
|
exit 1
|
||
|
@@ -17,42 +20,70 @@
|
||
|
esac
|
||
|
done
|
||
|
|
||
|
+if [ "$SHELL_ECHO" = "on" ] ; then
|
||
|
+ set -x
|
||
|
+fi
|
||
|
#
|
||
|
# This is the default
|
||
|
-if test "$kind" = "ignore" ; then
|
||
|
+if [ "$kind" = "ignore" ] ; then
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
-if test -z "$slsuffix" ; then
|
||
|
+if [ -z "$slsuffix" ] ; then
|
||
|
slsuffix=so.1.0
|
||
|
+ req_slsuffix=so
|
||
|
+fi
|
||
|
+if [ -z "$req_slsuffix" ] ; then
|
||
|
+ req_slsuffix=$slsuffix
|
||
|
fi
|
||
|
-if test -z "$AR" ; then
|
||
|
+if [ -z "$AR" ] ; then
|
||
|
AR=ar
|
||
|
fi
|
||
|
-if test -z "$LD" ; then
|
||
|
+if [ -z "$LD" ] ; then
|
||
|
LD=ld
|
||
|
fi
|
||
|
-if test -z "$CLINKER" ; then
|
||
|
- if test -n "$CC" ; then
|
||
|
+if [ -z "$CLINKER" ] ; then
|
||
|
+ if [ -n "$CC" ] ; then
|
||
|
CLINKER=$CC
|
||
|
else
|
||
|
echo "No C linker or C compiler specified!"
|
||
|
exit 1
|
||
|
fi
|
||
|
fi
|
||
|
-if test -z "$SHLIBS" ; then
|
||
|
+if [ -z "$SHLIBS" ] ; then
|
||
|
echo "No libraries specified!"
|
||
|
exit 1
|
||
|
fi
|
||
|
+#
|
||
|
+# Check that there are libraries
|
||
|
+foundlib=0
|
||
|
+for libname in $SHLIBS ; do
|
||
|
+ libnamelocal=`basename $libname`
|
||
|
+ if [ -s $libnamelocal ] ; then
|
||
|
+ foundlib=1
|
||
|
+ break
|
||
|
+ fi
|
||
|
+done
|
||
|
+if [ $foundlib = 0 ] ; then
|
||
|
+ echo "Could not find $SHLIBS"
|
||
|
+ exit 1
|
||
|
+fi
|
||
|
+if [ ! -d shared ] ; then
|
||
|
+ mkdir shared
|
||
|
+fi
|
||
|
case $kind in
|
||
|
gcc)
|
||
|
for libname in $SHLIBS ; do
|
||
|
mkdir .tmp
|
||
|
cd .tmp
|
||
|
$AR x ../$libname
|
||
|
- $CLINKER -shared -Wl,-soname,$libname.$slsuffix \
|
||
|
- -o ../$libname.$slsuffix *.o
|
||
|
+ libbase=`basename $libname .a`
|
||
|
+ $CLINKER -shared -Wl,-soname,$libbase.$slsuffix \
|
||
|
+ -o ../shared/$libbase.$slsuffix *.o
|
||
|
cd ..
|
||
|
+ if [ $slsuffix != $req_slsuffix ] ; then
|
||
|
+ (cd shared ; ln -s $libbase.$slsuffix $libbase.$req_slsuffix )
|
||
|
+ fi
|
||
|
rm -rf .tmp
|
||
|
done
|
||
|
;;
|
||
|
@@ -61,8 +92,12 @@
|
||
|
mkdir .tmp
|
||
|
cd .tmp
|
||
|
$AR x ../$libname
|
||
|
- $LD -G -h $libname.$slsuffix -o ../$libname.$slsuffix *.o
|
||
|
+ libbase=`basename $libname .a`
|
||
|
+ $LD -G -h $libbase.$slsuffix -o ../shared/$libbase.$slsuffix *.o
|
||
|
cd ..
|
||
|
+ if [ $slsuffix != $req_slsuffix ] ; then
|
||
|
+ ( cd shared ; ln -s $libbase.$slsuffix $libbase.$req_slsuffix )
|
||
|
+ fi
|
||
|
rm -rf .tmp
|
||
|
done
|
||
|
;;
|
||
|
@@ -73,20 +108,22 @@
|
||
|
mkdir .tmp
|
||
|
cd .tmp
|
||
|
ar x ../$libname
|
||
|
+ libbase=`basename $libname .a`
|
||
|
nm -g -p *.o | awk '{ if ($2 == "T") { print $1 ; }}' | \
|
||
|
- sed -e 's/^\.//g' > $libname.exp
|
||
|
+ sed -e 's/^\.//g' > $libbase.exp
|
||
|
# xlC doesn't work with this!
|
||
|
# cc misses the iargc/getarg libraries
|
||
|
- xlf -o ../$libname.so *.o -bE:$libname.exp -bM:SRE -bnoentry
|
||
|
+ xlf -o ../shared/$libbase.so *.o -bE:$libbase.exp -bM:SRE -bnoentry
|
||
|
# create new shared file name
|
||
|
- newfile=`basename $libname`
|
||
|
- newfile="${newfile}shared.a"
|
||
|
+ newfile="${libbase}shared.a"
|
||
|
/bin/rm -f $newfile
|
||
|
- ar qv $newfile ../$libname.so
|
||
|
+ ar qv $newfile ../shared/$libbase.so
|
||
|
/bin/rm -f *.o
|
||
|
cd ..
|
||
|
/bin/rm -rf .tmp
|
||
|
done
|
||
|
+ ;;
|
||
|
+
|
||
|
*)
|
||
|
echo "Unknown shared library type $kind"
|
||
|
exit 1
|