Commit a482e61b authored by Måns Rullgård's avatar Måns Rullgård

Add symbol versioning for shared libraries

Based on patch by Reinhard Tartler <siretart tauware de>

Originally committed as revision 21236 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 2ed46eea
......@@ -9,6 +9,7 @@ vpath %.c $(SRC_DIR)
vpath %.h $(SRC_DIR)
vpath %.S $(SRC_DIR)
vpath %.asm $(SRC_DIR)
vpath %.v $(SRC_DIR)
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
BUILD_ROOT_REL = .
......@@ -33,6 +34,9 @@ CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
%$(EXESUF): %.c
%.ver: %.v
sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
......@@ -77,7 +81,7 @@ $(HOSTPROGS): %$(HOSTEXESUF): %.o
DEPS := $(OBJS:.o=.d)
depend dep: $(DEPS)
CLEANSUFFIXES = *.d *.o *~ *.ho *.map
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
......
......@@ -1561,6 +1561,7 @@ tmpfile TMPE $EXESUF
tmpfile TMPH .h
tmpfile TMPO .o
tmpfile TMPS .S
tmpfile TMPV .ver
tmpfile TMPSH .sh
unset -f mktemp
......@@ -2568,6 +2569,10 @@ check_ldflags -Wl,--as-needed
check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
check_ldflags -Wl,-Bsymbolic
echo "X{};" > $TMPV
test_ldflags -Wl,--version-script,$TMPV &&
append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
if enabled small; then
check_cflags -Os # not all compilers support -Os
optimizations="small"
......
LIBAVCODEC_$MAJOR {
global: *;
};
LIBAVDEVICE_$MAJOR {
global: avdevice_*;
local: *;
};
LIBAVFILTER_$MAJOR {
global: avfilter_*; av_*;
local: *;
};
LIBAVFORMAT_$MAJOR {
global: *;
};
LIBAVUTIL_$MAJOR {
global: av_*; ff_*; avutil_*;
local: *;
};
LIBPOSTPROC_$MAJOR {
global: postproc_*; pp_*;
local: *;
};
......@@ -51,7 +51,7 @@ install-libs: install-lib$(NAME)-shared
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver
$(SLIB_CREATE_DEF_CMD)
$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
$(SLIB_EXTRA_CMD)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment