[FFmpeg-devel] Symbol versioning, Round 3

Reinhard Tartler siretart
Tue Dec 29 22:59:34 CET 2009


Hi,

Changes for this time:

 - implemented a templated based approach for version files
 - .v is the input, .ver is the generated version script

M?ns already mentioned that this change needs to consider non gnu ld
implementations as well and offered to integrate this as well. Does this
offer still stand?


diff --git a/common.mak b/common.mak
index b629cb4..06ff8f5 100644
--- a/common.mak
+++ b/common.mak
@@ -79,7 +79,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
 
diff --git a/libavcodec/libavcodec.v b/libavcodec/libavcodec.v
new file mode 100644
index 0000000..33aa50a
--- /dev/null
+++ b/libavcodec/libavcodec.v
@@ -0,0 +1,3 @@
+LIBAVCODEC_%MAJOR% {
+	global: *;
+};
diff --git a/libavdevice/libavdevice.v b/libavdevice/libavdevice.v
new file mode 100644
index 0000000..15ad08a
--- /dev/null
+++ b/libavdevice/libavdevice.v
@@ -0,0 +1,4 @@
+LIBAVDEVICE_%MAJOR% {
+	global: avdevice_*;
+	local: *;
+};
diff --git a/libavfilter/libavfilter.v b/libavfilter/libavfilter.v
new file mode 100644
index 0000000..ce8de29
--- /dev/null
+++ b/libavfilter/libavfilter.v
@@ -0,0 +1,4 @@
+LIBAVFILTER_%MAJOR% {
+	global: avfilter_*; av_*;
+	local: *;
+};
diff --git a/libavformat/libavformat.v b/libavformat/libavformat.v
new file mode 100644
index 0000000..a5e7197
--- /dev/null
+++ b/libavformat/libavformat.v
@@ -0,0 +1,3 @@
+LIBAVFORMAT_%MAJOR% {
+	global: *;
+};
diff --git a/libavutil/libavutil.v b/libavutil/libavutil.v
new file mode 100644
index 0000000..535bc86
--- /dev/null
+++ b/libavutil/libavutil.v
@@ -0,0 +1,4 @@
+LIBAVUTIL_%MAJOR% {
+	global: av_*; ff_*; avutil_*;
+	local: *;
+};
diff --git a/libpostproc/libpostproc.v b/libpostproc/libpostproc.v
new file mode 100644
index 0000000..12da19b
--- /dev/null
+++ b/libpostproc/libpostproc.v
@@ -0,0 +1,4 @@
+LIBPOSTPROC_%MAJOR% {
+	global: postproc_*; pp_*;
+	local: *;
+};
diff --git a/libswscale/libswscale.v b/libswscale/libswscale.v
new file mode 100644
index 0000000..1b3f0ab
--- /dev/null
+++ b/libswscale/libswscale.v
@@ -0,0 +1,4 @@
+LIBSWSCALE_%MAJOR% {
+	global: swscale_*; sws_*; ff_*;
+	local: *;
+};
diff --git a/subdir.mak b/subdir.mak
index 1a5158a..2f1e5f8 100644
--- a/subdir.mak
+++ b/subdir.mak
@@ -51,9 +51,14 @@ 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)lib$(NAME).ver: $(SRC_PATH_BARE)/$(SUBDIR)lib$(NAME).v
+	sed 's/%MAJOR%/$(lib$(NAME)_VERSION_MAJOR)/' $$^ > $$@
+
+$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(SUBDIR)lib$(NAME).ver $(OBJS)
 	$(SLIB_CREATE_DEF_CMD)
-	$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
+	$(LD) $(SHFLAGS) $(FFLDFLAGS) \
+		-Wl,--version-script,$(SUBDIR)lib$(NAME).ver \
+		-o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
 	$(SLIB_EXTRA_CMD)
 
 ifdef SUBDIR

-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4




More information about the ffmpeg-devel mailing list