Blame lib/paranoia/Makefile.am

Packit cb6d3d
#   Copyright (C) 2004, 2006, 2008, 2011, 2017 Rocky Bernstein <rocky@gnu.org>
Packit cb6d3d
#
Packit cb6d3d
#   This program is free software: you can redistribute it and/or modify
Packit cb6d3d
#   it under the terms of the GNU General Public License as published by
Packit cb6d3d
#   the Free Software Foundation, either version 3 of the License, or
Packit cb6d3d
#   (at your option) any later version.
Packit cb6d3d
#
Packit cb6d3d
#   This program is distributed in the hope that it will be useful,
Packit cb6d3d
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit cb6d3d
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit cb6d3d
#   GNU General Public License for more details.
Packit cb6d3d
#
Packit cb6d3d
#   You should have received a copy of the GNU General Public License
Packit cb6d3d
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit cb6d3d
Packit cb6d3d
########################################################
Packit cb6d3d
# Things to make the libcdio_paranoia 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_paranoia.sym
Packit cb6d3d
Packit cb6d3d
libcdio_paranoia_la_CURRENT = 2
Packit cb6d3d
libcdio_paranoia_la_REVISION = 0
Packit cb6d3d
libcdio_paranoia_la_AGE = 0
Packit cb6d3d
Packit cb6d3d
noinst_HEADERS  = gap.h isort.h overlap.h p_block.h
Packit cb6d3d
Packit cb6d3d
libcdio_paranoia_sources = gap.c isort.c overlap.c overlap.h \
Packit cb6d3d
	p_block.c paranoia.c
Packit cb6d3d
Packit cb6d3d
lib_LTLIBRARIES = libcdio_paranoia.la
Packit cb6d3d
Packit cb6d3d
libcdio_paranoia_la_SOURCES = $(libcdio_paranoia_sources)
Packit cb6d3d
libcdio_paranoia_la_ldflags = -version-info $(libcdio_paranoia_la_CURRENT):$(libcdio_paranoia_la_REVISION):$(libcdio_paranoia_la_AGE) @LT_NO_UNDEFINED@
Packit cb6d3d
Packit cb6d3d
AM_CPPFLAGS = $(LIBCDIO_PARANOIA_CFLAGS) $(LIBCDIO_CFLAGS)
Packit cb6d3d
Packit cb6d3d
FLAGS=@LIBCDIO_PARANOIA_CFLAGS@ @TYPESIZES@ @CFLAGS@ -I.. -I../..
Packit cb6d3d
OPT=$(FLAGS)
Packit cb6d3d
DEBUG=$(FLAGS)
Packit cb6d3d
Packit cb6d3d
## SUFFIXES = .t
Packit cb6d3d
## TFILES = isort.t gap.t p_block.t paranoia.t
Packit cb6d3d
##test:	$(TFILES)
Packit cb6d3d
##.c.t:
Packit cb6d3d
##	$(CC) -g -DTEST $(DEBUG) -o $@ $< $(LIBS)
Packit cb6d3d
##	$@
Packit cb6d3d
##debug:
Packit cb6d3d
##	$(MAKE) libcdio_paranoia.a CFLAGS="$(DEBUG)"
Packit cb6d3d
Packit cb6d3d
LIBS = $(LIBCDIO_LIBS) $(LIBCDIO_CDDA_LIBS)
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_paranoia_la_MAJOR = $(shell expr $(libcdio_paranoia_la_CURRENT) - $(libcdio_paranoia_la_AGE))
Packit cb6d3d
if VERSION_SCRIPT
Packit cb6d3d
if BUILD_VERSIONED_LIBS
Packit cb6d3d
libcdio_paranoia_la_LDFLAGS = $(libcdio_paranoia_la_ldflags) -Wl,--version-script=libcdio_paranoia.la.ver
Packit cb6d3d
libcdio_paranoia_la_DEPENDENCIES = libcdio_paranoia.la.ver
Packit cb6d3d
Packit cb6d3d
libcdio_paranoia.la.ver: $(libcdio_paranoia_la_OBJECTS) $(srcdir)/libcdio_paranoia.sym
Packit cb6d3d
	echo 'CDIO_PARANOIA_$(libcdio_paranoia_la_MAJOR) { ' > $@
Packit cb6d3d
	objs=`for obj in $(libcdio_paranoia_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_paranoia.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_paranoia.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
Packit cb6d3d
libcdio_paranoia_la_LDFLAGS = $(libcdio_paranoia_la_ldflags)
Packit cb6d3d
endif !BUILD_VERSIONED_LIBS
Packit cb6d3d
else !VERSION_SCRIPT
Packit cb6d3d
libcdio_paranoia_la_LDFLAGS = $(libcdio_paranoia_la_ldflags)
Packit cb6d3d
endif !VERSION_SCRIPT
Packit cb6d3d
Packit cb6d3d
MOSTLYCLEANFILES = libcdio_paranoia.la.ver