openafs/regen.sh
Simon Wilkinson 69f26ece3c Add libtool support
Add support for using libtool to the Unix build system to build
both pthreaded and lwp libraries. For purely pthread libraries,
this just provides convenience macros to invoke the standard GNU
libtool from the OpenAFS build system. For libraries that have
lwp variants, we provide an initial wrapper script - lwptool,
which handles building a non-PIC LWP object before asking libtool
to build the pthread variants.

For a given source example.c, example.o is the non-PIC pthread
object, .libs/example.o is the PIC pthread object, and
.lwp/example.o is the LWP object.

To use libtool for a particular library directory, add the line
    include @TOP_OBJDIR@/src/config/Makefile.libtool
to the file's preamble. Makefile.pthread, or Makefile.lwp should be
included as normal to indicate whether the libraries in this Makefile
are pthread only, or should be built for both pthread and LWP objects.

The variables LT_current, LT_revision and LT_age may be used to control
the version of the shared objects produced. They have the same meaning
as that documented in the Versioning section of the libtool manual.

The LT_objs variable should be set to a space separated list of the .lo
objects included in the library. Note that there should _never_ be a
dependency on the .o form of these objects in the Makefile, as this
breaks parallel builds.

LT_deps is a list of the libtool dependencies of the library, and
LT_libs is a list of the external (non-OpenAFS) library dependencies.

A file called <libraryname>.sym should be created which contains a
newline seperated list of all of the symbols exported from this
library.

LWP library names remain the same as always. To distinguish the
pthreaded static and shared libraries these

LWP libraries should be linked using
    libexample.a: $(LT_objs)
	    $(LTLWP_LDLIB) $(LT_objs)

Shared libraries should be linked using
    libexample.la: $(LT_objs) $(LT_deps)

(note that the pattern rules in the included Makefile take care of the
 build rule here)

If necessary, static convenience libraries can be produced using:
    libconvenience.a: $(LT_objs)
	    $(LTLWP_LDLIB_static) $(LT_objs)

PIC convenience libaries can be linked using:
    libconvenience_pic.a: $(LT_objs)
	    $(LTLWP_LDLIB_pic) $(LT_objs)

Libtool libraries should be installed using the $(LT_INSTALL_DATA) macro

Binaries linking agains libtool libraries should be linked using the
$(LT_LDRULE) or $(LT_LRDULE_static) options, with library paths in the
built locations relative to the top of the tree. For example

example_test: example_test.o $(top_builddir)/src/example/libexample.la
	$(LT_LDRULE) example_test.o \
		     $(top_builddir)/src/example/libexample.la

Change-Id: I32b162e8443119e8115febc532c5b5a0ec8fed32
Reviewed-on: http://gerrit.openafs.org/8033
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
2012-09-04 06:55:51 -07:00

54 lines
1.2 KiB
Bash
Executable File

#!/bin/sh -e
while getopts "q" flag
do
case "$flag" in
q)
skipman=1;
;;
*)
echo "Usage ./regen.sh [-q]"
echo " -q skips man page generation"
exit
;;
esac
done
echo "Updating configuration..."
echo "Running aclocal"
if which aclocal > /dev/null 2>&1; then
aclocal -I src/cf -I src/external/rra-c-util/m4
elif which aclocal-1.10 > /dev/null 2>&1; then
aclocal-1.10 -I src/cf -I src/external/rra-c-util/m4
else
echo "No aclocal found on your system (looked for aclocal & aclocal-1.10)"
exit 1
fi
echo "Running libtoolize"
libtoolize -c -f
echo "Running autoconf"
autoconf
echo "Running autoconf for configure-libafs"
autoconf configure-libafs.ac > configure-libafs
chmod +x configure-libafs
echo "Running autoheader"
autoheader
#echo "Running automake"
#automake
echo "Deleting autom4te.cache directory"
rm -rf autom4te.cache
if [ $skipman ] ; then
echo "Skipping man page build"
else
# Rebuild the man pages, to not require those building from source to have
# pod2man available.
if test -d doc/man-pages ; then
echo "Building man pages"
perl doc/man-pages/merge-pod doc/man-pages/pod*/*.in
(cd doc/man-pages && ./generate-man)
fi
fi