shlib-build: Add -p option
authorAndrew Deason <adeason@sinenomine.net>
Thu, 17 Feb 2011 18:37:49 +0000 (12:37 -0600)
committerDerrick Brashear <shadow@dementia.org>
Thu, 17 Feb 2011 22:03:49 +0000 (14:03 -0800)
Add a -p option to shlib-build option to generate "plain" shared
objects. That is, shared objects that are intended to be e.g.
dlopen()'d, and are not intended to be libraries dynamically linked to
from other code. Such shared objects do not need a library name,
version numbers, export lists, etc.

Change-Id: I649c1b697a79936c1d580199291124398b05e56b
Reviewed-on: http://gerrit.openafs.org/3975
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/config/shlib-build.in

index b8f9223..bb4bc99 100644 (file)
@@ -24,6 +24,7 @@ major=
 minor=
 unused=
 srcdir=.
+plain=
 done=
 while [ -z "$done" ] && [ $# -gt 0 ] ; do
     case "$1" in
@@ -56,18 +57,23 @@ while [ -z "$done" ] && [ $# -gt 0 ] ; do
        ignore=yes
        shift
        ;;
+    -p)
+       plain=yes
+       shift
+       ;;
     --)
         shift
         done=yes
         ;;
     *)
-        echo 'Usage: shlib-build [-i] -l <lib> -M <major> -m <minor> -- ...' >&2
+        echo 'Usage: shlib-build (-p -f <file> | [-i] -l <lib> -M <major> -m <minor>) -- ...' >&2
         exit 1
         ;;
     esac
 done
-if [ -z "$library" ] ; then
-    echo 'Usage: shlib-build [-i] -l <lib> -M <major> -m <minor> -- ...' >&2
+if [ -z "$library" ] && [ -z "$plain" ] || \
+   [ -z "$filename" ] && [ "x$plain" != "x" ] ; then
+    echo 'Usage: shlib-build (-p -f <file> | [-i] -l <lib> -M <major> -m <minor>) -- ...' >&2
     exit 1
 fi
 
@@ -84,7 +90,7 @@ if [ -z "$filename" ] ; then
 fi
 case $sysname in
 rs_aix*)
-    if [ -f "$srcdir/$library.map" ] ; then
+    if [ -z "$plain" ] && [ -f "$srcdir/$library.map" ] ; then
        cat $srcdir/$library.map | \
        awk '/local:/ {inglobal=0};
             inglobal { sub(/;/,""); print };
@@ -96,7 +102,7 @@ rs_aix*)
     $linker $export -o "$filename" "$@"
     ;;
 sun*_5*)
-    if [ -f "$srcdir/$library.map" ] ; then
+    if [ -z "$plain" ] && [ -f "$srcdir/$library.map" ] ; then
         if [ -z "$ignore" ] ; then
             export="-Wl,-M$srcdir/$library.map"
         else
@@ -116,7 +122,7 @@ sun*_5*)
     fi
     ;;
 *_linux*)
-    if [ -f "$srcdir/$library.map" ] ; then
+    if [ -z "$plain" ] && [ -f "$srcdir/$library.map" ] ; then
         export="-Wl,--version-script=$srcdir/$library.map"
     fi
     if [ -z "$soname" ] ; then
@@ -128,14 +134,14 @@ sun*_5*)
     fi
     ;;
 hp_ux*)
-    if [ -f "$srcdir/$library.hp" ] ; then
+    if [ -z "$plain" ] && [ -f "$srcdir/$library.hp" ] ; then
         export="-c $srcdir/$library.hp"
     fi
     echo "$linker $export -o $filename $*"
     $linker $export -o "$filename" "$@"
     ;;
 *darwin*)
-    if [ -f "$srcdir/$library.map" ] ; then
+    if [ -z "$plain" ] && [ -f "$srcdir/$library.map" ] ; then
        # For 10.4 and later, the Mac exports list is a list of symbols,
        # prefixed with an '_'
        cat $srcdir/$library.map | \