[FFmpeg-devel] [PATCH] Add versioning information to dlls

Jeremy Kolb jkolb
Thu May 22 16:16:40 CEST 2008


Ramiro Polla wrote:
>>>> This patch adds support for generating .rc files and then linking 
>>>> them with the dlls created by ffmpeg.  This information can be used 
>>>> to identify the product version by the user and is also available to 
>>>> installer programs for ease of updating etc.
>>>>     
>>>>         
>>> Diego, Mans, ping?
>>>       
>
> [...]
>
>   
>> +# build dll configuration for windows.
>> +
>> +dllinfo_generate() {
>> +    name=$1
>> +    description=$2
>> +    version=$3
>> +    major=${version%%.*}
>> +    version_commas=`echo $version | tr . ,`,0
>> +    dllname=`echo $name | sed s/lib//`
>> +    
>> +    case "$license" in
>> +        'GPL' | 'LGPL')
>> +            license_str="This FFmpeg build is distributed under the terms of the GNU $license.\r\n"
>> +            ;;
>> +        'unredistributable')
>> +            license_str="This FFmpeg build may not be distributed publicly.\r\n"
>> +            ;;
>> +    esac
>>     
>
> I'm pretty sure this can be simplified. Something like:
>
> license_str="This FFmpeg build is distributed under the terms of the GNU 
> $license.\r\n"
> test "$license" = "unredistributable" &&
>      license_str="This FFmpeg build may not be distributed publicly.\r\n"
>
>   

Ah that is cleaner.  My bash skills leave something to be desired.

>> +
>> +    cat <<EOF >$TMPRC
>> +#include <WinVer.h>
>> +#include "version.h"
>> +VS_VERSION_INFO VERSIONINFO
>> + FILEVERSION $version_commas
>> + PRODUCTVERSION $version_commas
>> + FILEFLAGSMASK 0x17L
>> + FILEFLAGS 0x0L
>> + FILEOS VOS__WINDOWS32
>> + FILETYPE VFT_DLL
>> + FILESUBTYPE 0x0L
>> +BEGIN
>> +    BLOCK "StringFileInfo"
>> +    BEGIN
>> +        BLOCK "040904b0"
>> +        BEGIN
>> +            VALUE "Comments",            "$license_str"
>> +                                         "Source code is available at http://ffmpeg.org"
>> +            VALUE "CompanyName",         "FFmpeg"
>> +            VALUE "FileDescription",     "$description"
>> +            VALUE "FileVersion",         "$version"
>> +            VALUE "InternalName",        "$name"
>> +            VALUE "LegalCopyright",      "(C) 2000-2008 Fabrice Bellard, et al."
>> +            VALUE "LegalTrademarks",     "FFmpeg"
>> +            VALUE "OriginalFilename",    "$dllname-$major.dll"
>>     
>
> Get the version information from av*.h
>
>   

that would be for $version, $major and $version_commas correct?

> [...]
>   
>> Index: subdir.mak
>> ===================================================================
>> --- subdir.mak	(revision 13216)
>> +++ subdir.mak	(working copy)
>> @@ -27,7 +27,9 @@
>>  $(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
>>  	cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
>>  
>> -$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
>> +$(SUBDIR)$(SLIB_EXTRA_OBJS): $(SLIB_EXTRA_DEP) 
>>     
>                                                   ^
>   
>> +
>> +$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)$(SLIB_EXTRA_OBJS)
>>  	$(SLIB_CREATE_DEF_CMD)
>>  	$(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS) $(EXTRAOBJS)
>>  	$(SLIB_EXTRA_CMD)
>> Index: common.mak
>> ===================================================================
>> --- common.mak	(revision 13216)
>> +++ common.mak	(working copy)
>> @@ -32,6 +32,9 @@
>>  %.d: %.cpp
>>  	$(DEPEND_CMD) > $@
>>  
>> +%.rco: %.rc
>> +	windres -I$(BUILD_ROOT) $< $@
>> +
>>  %$(EXESUF): %.c
>>  
>>  install: install-libs install-headers
>> @@ -66,9 +69,9 @@
>>  DEPS := $(OBJS:.o=.d)
>>  depend dep: $(DEPS)
>>  
>> -CLEANSUFFIXES = *.o *~ *.ho
>> +CLEANSUFFIXES = *.o *~ *.ho *.rco
>>  LIBSUFFIXES   = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp *.map
>> -DISTCLEANSUFFIXES = *.d
>> +DISTCLEANSUFFIXES = *.d *.rc 
>>     
>                                 ^
>
> There are a few trailing whitespaces in your patch. It's an item on the 
> patch submission checklist Diego pointed out.
>
>   

Thought I had got all of those.  Good catch.

> You can also let the dependency files (.d) check for version.h and 
> av*.h. Just add a rule for %.d: %.rc, add the extra objs to DEPS, and 
> make a DEPEND_CMD for .rc files that treats them as C files (-xc flag 
> for gcc). That way you can avoid SLIB_EXTRA_DEP.
>
> Ramiro Polla
>
>   
Can you elaborate?

Jeremy





More information about the ffmpeg-devel mailing list