[FFmpeg-devel] [PATCH 5/5] build: rename version.h to libavutil/ffversion.h

James Almer jamrial at gmail.com
Sat Nov 30 21:38:14 CET 2013


On 30/11/13 5:33 PM, Timothy Gu wrote:
> On Nov 30, 2013 12:24 PM, "Michael Niedermayer" <michaelni at gmx.at> wrote:
>>
>> On Sat, Nov 30, 2013 at 10:31:48AM -0800, Timothy Gu wrote:
>>> Updated.
>>>
>>> Can someone review this?
>>>
>>> Timothy
>>
>>>  version.sh |   12 ++++++++++--
>>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>> 4526aa35d1bb744288a11d3f4de99dc81b536b83
>  0002-version.sh-add-preprocessing-guards.patch
>>> From d82aec2015740f58919cb545eb4ac049fde4ddf1 Mon Sep 17 00:00:00 2001
>>> From: Timothy Gu <timothygu99 at gmail.com>
>>> Date: Fri, 29 Nov 2013 09:57:30 -0800
>>> Subject: [PATCH 2/3] version.sh: add preprocessing guards
>>>
>>> Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
>>> ---
>>>  version.sh | 12 ++++++++++--
>>>  1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/version.sh b/version.sh
>>> index c28ffe7..92edcb9 100755
>>> --- a/version.sh
>>> +++ b/version.sh
>>> @@ -42,9 +42,17 @@ if [ -z "$2" ]; then
>>>  fi
>>>
>>>  NEW_REVISION="#define FFMPEG_VERSION \"$version\""
>>> -OLD_REVISION=$(cat "$2" 2> /dev/null)
>>> +OLD_REVISION=$(cat "$2" 2> /dev/null | head -3 | tail -1)
>>> +
>>> +# String used for preprocessor guard
>>> +GUARD=$(echo "$2" | sed 's/\//_/' | sed 's/\./_/' | tr '[:lower:]'
> '[:upper:]' | sed 's/LIB//')
>>>
>>>  # Update version header only on revision changes to avoid spurious
> rebuilds
>>>  if test "$NEW_REVISION" != "$OLD_REVISION"; then
>>> -    echo "$NEW_REVISION" > "$2"
>>> +    cat << EOF > "$2"
>>> +#ifndef $GUARD
>>> +#define $GUARD
>>> +$NEW_REVISION
>>> +#endif /* $GUARD */
>>> +EOF
>>>  fi
>>
>> "#ifndef VERSION_H"
>>
>> missing prefix to avoid name clashes
> 
> This is supposed to be combined with the second patch which gives
> AVUTIL_FFVERSION_H. But if you still want me to change it, what would you
> suggest?
> 
> Timothy

Since the script lets you choose any name for the generated header, a hardcoded 
prefix when it's not part of a library would be a good idea.
For example FFMPEG_, since that's the usual name for the root folder.


More information about the ffmpeg-devel mailing list