17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
19
########################################################
20
# Things to make the libcdio and libiso9660 libraries
21
########################################################
23
# From libtool documentation amended with guidance from N. Boullis:
25
# 1. Start with version information of `0:0:0' for each libtool library.
27
# 2. It is probably not a good idea to update the version information
28
# several times between public releases, but rather once per public
29
# release. (This seems to be more an aesthetic consideration than
30
# a hard technical one.)
32
# 3. If the library source code has changed at all since the last
33
# update, then increment REVISION (`C:R:A' becomes `C:R+1:A').
35
# 4. If any interfaces have been added, removed, or changed since the
36
# last update, increment CURRENT, and set REVISION to 0.
38
# 5. If any interfaces have been added since the last public release,
41
# 6. If any interfaces have been removed or changed since the last
42
# public release, then set AGE to 0. A changed interface means an
43
# incompatibility with previous versions..
45
libcdio_la_CURRENT := 3
46
libcdio_la_REVISION := 0
49
libiso9660_la_CURRENT := 3
50
libiso9660_la_REVISION := 0
51
libiso9660_la_AGE := 0
53
EXTRA_DIST = image/Makefile FreeBSD/Makefile MSWindows/Makefile \
54
libcdio.sym libiso9660.sym
56
noinst_HEADERS = cdio_assert.h cdio_private.h portable.h
75
FreeBSD/freebsd_cam.c \
76
FreeBSD/freebsd_ioctl.c \
86
MSWindows/win32_ioctl.c \
95
lib_LTLIBRARIES = libcdio.la libiso9660.la
97
libcdio_la_SOURCES = $(libcdio_sources)
98
libcdio_la_ldflags = -version-info $(libcdio_la_CURRENT):$(libcdio_la_REVISION):$(libcdio_la_AGE)
100
libiso9660_la_SOURCES = \
106
libiso9660_la_LIBADD = libcdio.la
107
libiso9660_la_ldflags = -version-info $(libiso9660_la_CURRENT):$(libiso9660_la_REVISION):$(libiso9660_la_AGE)
108
libiso9660_la_dependencies = libcdio.la
110
INCLUDES = $(LIBCDIO_CFLAGS)
112
########################################################
113
# Things to version the symbols in the libraries
114
########################################################
116
# An explanation of the versioning problem from Nicolas Boullis and
117
# the versioned symbol solution he uses below...
119
# Currently, libvcdinfo uses the cdio_open function from libcdio.
120
# Let's imagine a program foobar that uses both the vcdinfo_open
121
# function from libvcdinfo and the cdio_open function from libcdio.
123
# Currently, libcdio has SONAME libcdio.so.0, libvcdinfo has SONAME
124
# libvcdinfo.so.0 and requires libcdio.so.0, and foobar requires both
125
# libvcdinfo.so.0 and libcdio.so.0. Everything looks fine.
127
# Now, for some reason, you decide to change the cdio_open function.
128
# That's your right, but you have to bump the CURRENT version and (if I
129
# understand it correctly, athough this is not that clear in libtool's
130
# documentation) set the AGE to 0. Anyway, this bumps the SONAME, which is
131
# sane since the interface changes incompatibly.
133
# Now, you have a new libcdio with SONAME libcdio.so.1. But libvcdinfo and
134
# foobar still require libcdio.so.0. Everything is still fine.
136
# Now, after some minor changes, the author of foobar recompiles foobar.
137
# Then, foobar now requires libvcdinfo.so.0 and libcdio.so.1. And foobar
140
# What is happening? When you run foobar, if brings both libvcdinfo.so.0
141
# and libcdio.so.1, but libvcdinfo.so.0 also brings libcdio.so.0. So you
142
# have both libcdio.so.0 and libcdio.so.1 that bring their symbols to the
143
# global namespace. Hence, you have to incompatible versions of the
144
# cdio_open function in the name space. When foobar calls cdio_open, it
145
# may choose the wrong function, and segfaults...
147
# With versioned symbols, the cdio_open function from libcdio.so.0 may be
148
# known as (something that looks like) cdio_open@@CDIO_0. An the cdio_open
149
# function from libcdio.so.1 as cdio_open@@CDIO_1. Both versions of
150
# libcdio would still be brought in by the most recent foobar, but foobar
151
# (and libvcdinfo) know which versioned function to use and then use the
155
# This is some simple versioning where every symbol is versioned with
156
# something that looks like the SONAME of the library. More complex (and
157
# better) versioning is possible; it is for example what is used by glibc.
158
# But good complex versioning is something that requires much more
162
# The below is a impliments symbol versioning. First of all, I
163
# compute MAJOR as CURENT - AGE; that is what is used within libtool
164
# (at least on GNU/Linux systems) for the number in the SONAME. The
165
# nm command gives the list of symbols known in each of the object
166
# files that will be part of the shared library. And the sed command
167
# extracts from this list those symbols that will be shared. (This sed
168
# command comes from libtool.)
170
libcdio_la_MAJOR := $(shell expr $(libcdio_la_CURRENT) - $(libcdio_la_AGE))
171
if BUILD_VERSIONED_LIBS
172
libcdio_la_LDFLAGS = $(libcdio_la_ldflags) -Wl,--version-script=libcdio.la.ver
173
libcdio_la_DEPENDENCIES = libcdio.la.ver
175
libcdio.la.ver: $(libcdio_la_OBJECTS) $(srcdir)/libcdio.sym
176
echo 'CDIO_$(libcdio_la_MAJOR) { ' > $@
177
nm $(patsubst %.lo,%.o,$(libcdio_la_OBJECTS)) | 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.sym; then if test $$first = true; then echo " global:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@
178
nm $(patsubst %.lo,%.o,$(libcdio_la_OBJECTS)) | 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.sym; then :; else if test $$first = true; then echo " local:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@
181
libcdio_la_LDFLAGS = $(libcdio_la_ldflags)
184
libiso9660_la_MAJOR := $(shell expr $(libiso9660_la_CURRENT) - $(libiso9660_la_AGE))
185
if BUILD_VERSIONED_LIBS
186
libiso9660_la_LDFLAGS = $(libiso9660_la_ldflags) -Wl,--version-script=libiso9660.la.ver
187
libiso9660_la_DEPENDENCIES = $(libiso9660_la_dependencies) libiso9660.la.ver
189
libiso9660.la.ver: $(libiso9660_la_OBJECTS) $(srcdir)/libiso9660.sym
190
echo 'ISO9660_$(libiso9660_la_MAJOR) {' > $@
191
nm $(patsubst %.lo,%.o,$(libiso9660_la_OBJECTS)) | 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)/libiso9660.sym; then if test $$first = true; then echo " global:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@
192
nm $(patsubst %.lo,%.o,$(libiso9660_la_OBJECTS)) | 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)/libiso9660.sym; then :; else if test $$first = true; then echo " local:"; first=false; fi; echo " $${symbol};"; fi; done; } >> $@
195
MOSTLYCLEANFILES = libcdio.la.ver libiso9660.la.ver
197
libiso9660_la_LDFLAGS = $(libiso9660_la_ldflags)
198
libiso9660_la_DEPENDENCIES = $(libiso9660_la_dependencies)
21
########################################################
24
SUBDIRS = driver iso9660 cdda_interface paranoia
26
SUBDIRS = driver iso9660