mirror of https://git.ffmpeg.org/ffmpeg.git
build: Store library version numbers in .version files
This moves work from the configure to the Make stage where it can be parallelized and ensures that shared libraries are built with the right version number in the filename.
This commit is contained in:
parent
11a9320de5
commit
edb4348732
2
Makefile
2
Makefile
|
@ -67,7 +67,7 @@ COMPILE_HOSTC = $(call COMPILE,HOSTCC)
|
|||
%.h.c:
|
||||
$(Q)echo '#include "$*.h"' >$@
|
||||
|
||||
%.c %.h %.ver: TAG = GEN
|
||||
%.c %.h %.ver %.version: TAG = GEN
|
||||
|
||||
AVPROGS-$(CONFIG_AVCONV) += avconv
|
||||
AVPROGS-$(CONFIG_AVPLAY) += avplay
|
||||
|
|
|
@ -49,7 +49,7 @@ $(TOOLOBJS): | tools
|
|||
|
||||
OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS))
|
||||
|
||||
CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver
|
||||
CLEANSUFFIXES = *.d *.o *~ *.h.c *.gcda *.gcno *.map *.ver *.version
|
||||
DISTCLEANSUFFIXES = *.pc
|
||||
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
include $(SRC_PATH)/avbuild/common.mak
|
||||
|
||||
-include $(SUBDIR)lib$(NAME).version
|
||||
|
||||
LIBVERSION := $(lib$(NAME)_VERSION)
|
||||
LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
|
||||
LIBMINOR := $(lib$(NAME)_VERSION_MINOR)
|
||||
|
@ -30,6 +32,9 @@ $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME)
|
|||
$(TESTPROGS) $(TOOLS): %$(EXESUF): %.o
|
||||
$$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS)
|
||||
|
||||
$(SUBDIR)lib$(NAME).version: $(SUBDIR)version.h | $(SUBDIR)
|
||||
$$(M) $$(SRC_PATH)/avbuild/libversion.sh $(NAME) $$< > $$@
|
||||
|
||||
$(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS)
|
||||
$$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
toupper(){
|
||||
echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
}
|
||||
|
||||
name=lib$1
|
||||
ucname=$(toupper ${name})
|
||||
file=$2
|
||||
|
||||
eval $(awk "/#define ${ucname}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
|
||||
eval ${ucname}_VERSION=\$${ucname}_VERSION_MAJOR.\$${ucname}_VERSION_MINOR.\$${ucname}_VERSION_MICRO
|
||||
eval echo "${name}_VERSION=\$${ucname}_VERSION"
|
||||
eval echo "${name}_VERSION_MAJOR=\$${ucname}_VERSION_MAJOR"
|
||||
eval echo "${name}_VERSION_MINOR=\$${ucname}_VERSION_MINOR"
|
|
@ -5318,19 +5318,6 @@ VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
|
|||
SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
|
||||
EOF
|
||||
|
||||
get_version(){
|
||||
lcname=lib${1}
|
||||
name=$(toupper $lcname)
|
||||
file=$source_path/$lcname/version.h
|
||||
eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
|
||||
eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
|
||||
eval echo "${lcname}_VERSION=\$${name}_VERSION" >> avbuild/config.mak
|
||||
eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> avbuild/config.mak
|
||||
eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> avbuild/config.mak
|
||||
}
|
||||
|
||||
map 'get_version $v' $LIBRARY_LIST
|
||||
|
||||
map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> avbuild/config.mak' $LIBRARY_LIST
|
||||
|
||||
print_program_extralibs(){
|
||||
|
|
Loading…
Reference in New Issue