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
release/0.6
Måns Rullgård 15 years ago
parent 2ed46eeab3
commit a482e61bd6
  1. 6
      common.mak
  2. 5
      configure
  3. 3
      libavcodec/libavcodec.v
  4. 4
      libavdevice/libavdevice.v
  5. 4
      libavfilter/libavfilter.v
  6. 3
      libavformat/libavformat.v
  7. 4
      libavutil/libavutil.v
  8. 4
      libpostproc/libpostproc.v
  9. 2
      subdir.mak

@ -9,6 +9,7 @@ vpath %.c $(SRC_DIR)
vpath %.h $(SRC_DIR) vpath %.h $(SRC_DIR)
vpath %.S $(SRC_DIR) vpath %.S $(SRC_DIR)
vpath %.asm $(SRC_DIR) vpath %.asm $(SRC_DIR)
vpath %.v $(SRC_DIR)
ifeq ($(SRC_DIR),$(SRC_PATH_BARE)) ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
BUILD_ROOT_REL = . BUILD_ROOT_REL = .
@ -33,6 +34,9 @@ CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
%$(EXESUF): %.c %$(EXESUF): %.c
%.ver: %.v
sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES)) ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES) $(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
@ -77,7 +81,7 @@ $(HOSTPROGS): %$(HOSTEXESUF): %.o
DEPS := $(OBJS:.o=.d) DEPS := $(OBJS:.o=.d)
depend dep: $(DEPS) depend dep: $(DEPS)
CLEANSUFFIXES = *.d *.o *~ *.ho *.map CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver
DISTCLEANSUFFIXES = *.pc DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp

5
configure vendored

@ -1561,6 +1561,7 @@ tmpfile TMPE $EXESUF
tmpfile TMPH .h tmpfile TMPH .h
tmpfile TMPO .o tmpfile TMPO .o
tmpfile TMPS .S tmpfile TMPS .S
tmpfile TMPV .ver
tmpfile TMPSH .sh tmpfile TMPSH .sh
unset -f mktemp 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,-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 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 if enabled small; then
check_cflags -Os # not all compilers support -Os check_cflags -Os # not all compilers support -Os
optimizations="small" optimizations="small"

@ -0,0 +1,3 @@
LIBAVCODEC_$MAJOR {
global: *;
};

@ -0,0 +1,4 @@
LIBAVDEVICE_$MAJOR {
global: avdevice_*;
local: *;
};

@ -0,0 +1,4 @@
LIBAVFILTER_$MAJOR {
global: avfilter_*; av_*;
local: *;
};

@ -0,0 +1,3 @@
LIBAVFORMAT_$MAJOR {
global: *;
};

@ -0,0 +1,4 @@
LIBAVUTIL_$MAJOR {
global: av_*; ff_*; avutil_*;
local: *;
};

@ -0,0 +1,4 @@
LIBPOSTPROC_$MAJOR {
global: postproc_*; pp_*;
local: *;
};

@ -51,7 +51,7 @@ install-libs: install-lib$(NAME)-shared
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME) 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) $(SLIB_CREATE_DEF_CMD)
$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS) $(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
$(SLIB_EXTRA_CMD) $(SLIB_EXTRA_CMD)

Loading…
Cancel
Save