[FFmpeg-cvslog] build: Simplify postprocessing of linker version script files

Diego Biurrun git at videolan.org
Mon Jun 27 19:40:46 CEST 2016


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Fri May 27 11:38:38 2016 +0200| [c5fd4b50610f62cbb3baa4f4108139363128dea1] | committer: Diego Biurrun

build: Simplify postprocessing of linker version script files

Generate the files in a single postprocessing step w/o intermediate files.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c5fd4b50610f62cbb3baa4f4108139363128dea1
---

 Makefile    |    3 ---
 common.mak  |    2 +-
 configure   |   17 +++++++++--------
 library.mak |    3 +++
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index d90d9be..4e026b0 100644
--- a/Makefile
+++ b/Makefile
@@ -62,9 +62,6 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
 %.h.c:
 	$(Q)echo '#include "$*.h"' >$@
 
-%.ver: %.v
-	$(M)sed 's/MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
-
 %.c %.h %.ver: TAG = GEN
 
 AVPROGS-$(CONFIG_AVCONV)   += avconv
diff --git a/common.mak b/common.mak
index d62f899..8f6a61f 100644
--- a/common.mak
+++ b/common.mak
@@ -52,7 +52,7 @@ $(TOOLOBJS): | tools
 
 OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))
 
-CLEANSUFFIXES     = *.d *.o *~ *.h.c *.map *.ver *.ver-sol2 *.gcno *.gcda
+CLEANSUFFIXES     = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver
 DISTCLEANSUFFIXES = *.pc
 LIBSUFFIXES       = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
 
diff --git a/configure b/configure
index 261200d..1b5e017 100755
--- a/configure
+++ b/configure
@@ -2465,6 +2465,7 @@ objformat="elf"
 pkg_config_default=pkg-config
 ranlib="ranlib"
 strip="strip"
+version_script='--version-script'
 yasmexe="yasm"
 
 # machine
@@ -2506,6 +2507,7 @@ SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
+VERSION_SCRIPT_POSTPROCESS_CMD="cat"
 
 asflags_filter=echo
 cflags_filter=echo
@@ -3748,7 +3750,8 @@ case $target_os in
             echo "hwcap_1 = OVERRIDE;" > mapfile &&
             add_ldflags -Wl,-M,mapfile
         nm_default='nm -P -g'
-        SLIB_CREATE_DEF_CMD='$(Q)perl $(SRC_PATH)/compat/solaris/make_sunver.pl $$(filter %.ver,$$^) $(OBJS) | grep -v @ > $(SUBDIR)lib$(NAME).ver-sol2'
+        version_script='-M'
+        VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
         ;;
     netbsd)
         disable symver
@@ -4829,13 +4832,9 @@ enabled xmm_clobber_test &&
     disable xmm_clobber_test
 
 echo "X { local: *; };" > $TMPV
-if test_ldflags -Wl,--version-script,$TMPV; then
-    append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
-elif test_ldflags -Wl,-M,$TMPV; then
-    append SHFLAGS '-Wl,-M,\$(SUBDIR)lib\$(NAME).ver-sol2'
-fi
-
-check_cc <<EOF && enable symver_asm_label
+if test_ldflags -Wl,${version_script},$TMPV; then
+    append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
+    check_cc <<EOF && enable symver_asm_label
 void ff_foo(void) __asm__ ("av_foo at VERSION");
 void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
 EOF
@@ -4843,6 +4842,7 @@ EOF
 __asm__(".symver ff_foo,av_foo at VERSION");
 void ff_foo(void) {}
 EOF
+fi
 
 if [ -z "$optflags" ]; then
     if enabled small; then
@@ -5243,6 +5243,7 @@ SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
 SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
 SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
+VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
 SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
 EOF
 
diff --git a/library.mak b/library.mak
index 712b7e1..44087aa 100644
--- a/library.mak
+++ b/library.mak
@@ -35,6 +35,9 @@ $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
 $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o $(EXEOBJS)
 	$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
 
+$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
+	$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
+
 $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
 	$(Q)cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
 



More information about the ffmpeg-cvslog mailing list