|
Packit |
cb6d3d |
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011, 2012
|
|
Packit |
cb6d3d |
# Rocky Bernstein <rocky@gnu.org>
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
########################################################
|
|
Packit |
cb6d3d |
# Things to make the cdda_interface library
|
|
Packit |
cb6d3d |
########################################################
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# From libtool documentation amended with guidance from N. Boullis:
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# 1. Start with version information of `0:0:0' for each libtool library.
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# 2. It is probably not a good idea to update the version information
|
|
Packit |
cb6d3d |
# several times between public releases, but rather once per public
|
|
Packit |
cb6d3d |
# release. (This seems to be more an aesthetic consideration than
|
|
Packit |
cb6d3d |
# a hard technical one.)
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# 3. If the library source code has changed at all since the last
|
|
Packit |
cb6d3d |
# update, then increment REVISION (`C:R:A' becomes `C:R+1:A').
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# 4. If any interfaces have been added, removed, or changed since the
|
|
Packit |
cb6d3d |
# last update, increment CURRENT, and set REVISION to 0.
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# 5. If any interfaces have been added since the last public release,
|
|
Packit |
cb6d3d |
# then increment AGE.
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# 6. If any interfaces have been removed or changed since the last
|
|
Packit |
cb6d3d |
# public release, then set AGE to 0. A changed interface means an
|
|
Packit |
cb6d3d |
# incompatibility with previous versions.
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
EXTRA_DIST = libcdio_cdda.sym
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
libcdio_cdda_la_CURRENT = 2
|
|
Packit |
cb6d3d |
libcdio_cdda_la_REVISION = 0
|
|
Packit |
cb6d3d |
libcdio_cdda_la_AGE = 0
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
noinst_HEADERS = common_interface.h drive_exceptions.h low_interface.h \
|
|
Packit |
cb6d3d |
smallft.h utils.h
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
libcdio_cdda_sources = common_interface.c cddap_interface.c interface.c \
|
|
Packit |
cb6d3d |
scan_devices.c smallft.c toc.c utils.c drive_exceptions.c
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
lib_LTLIBRARIES = libcdio_cdda.la
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
libcdio_cdda_la_SOURCES = $(libcdio_cdda_sources)
|
|
Packit |
cb6d3d |
libcdio_cdda_la_ldflags = -version-info $(libcdio_cdda_la_CURRENT):$(libcdio_cdda_la_REVISION):$(libcdio_cdda_la_AGE) @LT_NO_UNDEFINED@
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
AM_CPPFLAGS = $(LIBCDIO_PARANOIA_CFLAGS) $(LIBCDIO_CFLAGS)
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
FLAGS=@LIBCDIO_CFLAGS@ @UCDROM_H@ @TYPESIZES@ @CFLAGS@
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
OPT=$(FLAGS)
|
|
Packit |
cb6d3d |
DEBUG=$(FLAGS) -DCDDA_TEST
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
## test:
|
|
Packit |
cb6d3d |
## $(MAKE) libcdio_cdda.a CFLAGS="$(DEBUG)"
|
|
Packit |
cb6d3d |
## $(CC) $(DEBUG) -c test_interface.c
|
|
Packit |
cb6d3d |
## $(LD) $(DEBUG) test_interface.o $(LDFLAGS) -o cdda_test $(LIBS) libcdio_cdda.a
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
LIBS = $(LIBCDIO_LIBS) @LIBS@ @COS_LIB@
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
########################################################
|
|
Packit |
cb6d3d |
# Things to version the symbols in the libraries
|
|
Packit |
cb6d3d |
########################################################
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# An explanation of the versioning problem from Nicolas Boullis and
|
|
Packit |
cb6d3d |
# the versioned symbol solution he uses below...
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# Currently, libvcdinfo uses the cdio_open function from libcdio.
|
|
Packit |
cb6d3d |
# Let's imagine a program foobar that uses both the vcdinfo_open
|
|
Packit |
cb6d3d |
# function from libvcdinfo and the cdio_open function from libcdio.
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# Currently, libcdio has SONAME libcdio.so.0, libvcdinfo has SONAME
|
|
Packit |
cb6d3d |
# libvcdinfo.so.0 and requires libcdio.so.0, and foobar requires both
|
|
Packit |
cb6d3d |
# libvcdinfo.so.0 and libcdio.so.0. Everything looks fine.
|
|
Packit |
cb6d3d |
#
|
|
Packit |
cb6d3d |
# Now, for some reason, you decide to change the cdio_open function.
|
|
Packit |
cb6d3d |
# That's your right, but you have to bump the CURRENT version and (if I
|
|
Packit |
cb6d3d |
# understand it correctly, athough this is not that clear in libtool's
|
|
Packit |
cb6d3d |
# documentation) set the AGE to 0. Anyway, this bumps the SONAME, which is
|
|
Packit |
cb6d3d |
# sane since the interface changes incompatibly.
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# Now, you have a new libcdio with SONAME libcdio.so.1. But libvcdinfo and
|
|
Packit |
cb6d3d |
# foobar still require libcdio.so.0. Everything is still fine.
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# Now, after some minor changes, the author of foobar recompiles foobar.
|
|
Packit |
cb6d3d |
# Then, foobar now requires libvcdinfo.so.0 and libcdio.so.1. And foobar
|
|
Packit |
cb6d3d |
# now segfaults...
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# What is happening? When you run foobar, if brings both libvcdinfo.so.0
|
|
Packit |
cb6d3d |
# and libcdio.so.1, but libvcdinfo.so.0 also brings libcdio.so.0. So you
|
|
Packit |
cb6d3d |
# have both libcdio.so.0 and libcdio.so.1 that bring their symbols to the
|
|
Packit |
cb6d3d |
# global namespace. Hence, you have to incompatible versions of the
|
|
Packit |
cb6d3d |
# cdio_open function in the name space. When foobar calls cdio_open, it
|
|
Packit |
cb6d3d |
# may choose the wrong function, and segfaults...
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# With versioned symbols, the cdio_open function from libcdio.so.0 may be
|
|
Packit |
cb6d3d |
# known as (something that looks like) cdio_open@@CDIO_0. An the cdio_open
|
|
Packit |
cb6d3d |
# function from libcdio.so.1 as cdio_open@@CDIO_1. Both versions of
|
|
Packit |
cb6d3d |
# libcdio would still be brought in by the most recent foobar, but foobar
|
|
Packit |
cb6d3d |
# (and libvcdinfo) know which versioned function to use and then use the
|
|
Packit |
cb6d3d |
# good one.
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# This is some simple versioning where every symbol is versioned with
|
|
Packit |
cb6d3d |
# something that looks like the SONAME of the library. More complex (and
|
|
Packit |
cb6d3d |
# better) versioning is possible; it is for example what is used by glibc.
|
|
Packit |
cb6d3d |
# But good complex versioning is something that requires much more
|
|
Packit |
cb6d3d |
# work...
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
# The below is a impliments symbol versioning. First of all, I
|
|
Packit |
cb6d3d |
# compute MAJOR as CURENT - AGE; that is what is used within libtool
|
|
Packit |
cb6d3d |
# (at least on GNU/Linux systems) for the number in the SONAME. The
|
|
Packit |
cb6d3d |
# nm command gives the list of symbols known in each of the object
|
|
Packit |
cb6d3d |
# files that will be part of the shared library. And the sed command
|
|
Packit |
cb6d3d |
# extracts from this list those symbols that will be shared. (This sed
|
|
Packit |
cb6d3d |
# command comes from libtool.)
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
libcdio_cdda_la_MAJOR = $(shell expr $(libcdio_cdda_la_CURRENT) - $(libcdio_cdda_la_AGE))
|
|
Packit |
cb6d3d |
if VERSION_SCRIPT
|
|
Packit |
cb6d3d |
if BUILD_VERSIONED_LIBS
|
|
Packit |
cb6d3d |
libcdio_cdda_la_LDFLAGS = $(libcdio_cdda_la_ldflags) -Wl,--version-script=libcdio_cdda.la.ver
|
|
Packit |
cb6d3d |
libcdio_cdda_la_DEPENDENCIES = libcdio_cdda.la.ver
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
libcdio_cdda.la.ver: $(libcdio_cdda_la_OBJECTS) $(srcdir)/libcdio_cdda.sym
|
|
Packit |
cb6d3d |
echo 'CDIO_CDDA_$(libcdio_cdda_la_MAJOR) { ' > $@
|
|
Packit |
cb6d3d |
objs=`for obj in $(libcdio_cdda_la_OBJECTS); do sed -ne "s/^pic_object='\(.*\)'$$/\1/p" $$obj; done`; \
|
|
Packit |
cb6d3d |
if test -n "$$objs" ; then \
|
|
Packit |
cb6d3d |
nm $${objs} | sed -n -e 's/^.*[ ][ABCDGIRSTW][ABCDGIRSTW]*[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$$/\1/p' | sort -u | { first=true; while read symbol; do if grep -q "^$${symbol}\$$" $(srcdir)/libcdio_cdda.sym; then if test $$first = true; then echo " global:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@; \
|
|
Packit |
cb6d3d |
nm $${objs} | sed -n -e 's/^.*[ ][ABCDGIRSTW][ABCDGIRSTW]*[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$$/\1/p' | sort -u | { first=true; while read symbol; do if grep -q "^$${symbol}\$$" $(srcdir)/libcdio_cdda.sym; then :; else if test $$first = true; then echo " local:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@; \
|
|
Packit |
cb6d3d |
fi
|
|
Packit |
cb6d3d |
echo '};' >> $@
|
|
Packit |
cb6d3d |
else !BUILD_VERSIONED_LIBS
|
|
Packit |
cb6d3d |
libcdio_cdda_la_LDFLAGS = $(libcdio_cdda_la_ldflags)
|
|
Packit |
cb6d3d |
endif !BUILD_VERSIONED_LIBS
|
|
Packit |
cb6d3d |
else !VERSION_SCRIPT
|
|
Packit |
cb6d3d |
libcdio_cdda_la_LDFLAGS = $(libcdio_cdda_la_ldflags)
|
|
Packit |
cb6d3d |
endif !VERSION_SCRIPT
|
|
Packit |
cb6d3d |
|
|
Packit |
cb6d3d |
MOSTLYCLEANFILES = libcdio_cdda.la.ver
|