[Ffmpeg-devel] [PATCH] Build Darwin dynamic/shared libraries

Dan Villiom Podlaski Christiansen danchr
Thu Jul 14 12:27:32 CEST 2005

Michael Niedermayer wrote:
> Hi
> On Wednesday 13 July 2005 14:06, Dan Villiom Podlaski Christiansen wrote:
> [...]
>> 3) initialise 3 common variables in libavcodec/msmpeg4.c, to not make
>> ld(1) complain about common storage. I discussed this with a GCC hacker
>> on IRC, and there was a reason why this was necessary, but I didn't
>> quite understand what it was ;)
> thats a bit unprecisse, is it needed by gcc? a specific version? the c 
> standard? is it a warning or an error?
> if its needed by the c standard its ok obviously, if its not and just a 
> warning its rejected, ...

It was about the semantics of Mach-O binaries. If the variables weren't 
initialised, they would be put in a section of the binary which couldn't 
be referenced by other modules in the library. There were two possible 
solutions to this: Either the library could be built as a single module, 
which IIRC he said was a bit risky, or the variables could be 
initialised. Initialising the variables struck me as the cleanest 
solution as it's merely stating explicitly what would happen anyway.

>> 4) make the vhooks Mach-O bundles rather than libraries.
>> 5) add support for a ${DESTDIR} environment variable to force
>> installation into another path than the root. I found it quite useful.
> we have bindir, libdir, mandir and prefix isnt that enough?

I'm afraid not, since $libdir gets hard-coded into the libraries. The 
specific need for this was in DarwinPorts where the installation happens 
into another path than $prefix, for later actual installation. Other 
ports management systems might find this useful as well.

When building libraries, you can't specify the other path as $prefix, so 
the need for $DESTDIR arises. Also, I found it useful for ensuring that 
the proper files where built and installed without touching /usr/local.

> iam also not too happy about all the ifeq ($(CONFIG_DARWIN),) in the 
> makefiles, this should be in configure IMHO

For many of these, there is no other simple solution. The Mach-O linker 
is very different from the ELF linker, and the library naming 
conventions also differ. Some of the statements could perhaps be moved 
to configure, but I mainly tried to follow the convention used in the 
libpostproc Makefile where e.g. soname/install_name is specified in the 
Makefile, and where the ELF conventions are followed rather strictly.

>> @@ -5,6 +5,7 @@
>>  #
>>  #set -x
>>  # Even in the 21st century some diffs are not supporting -u.
>> +
>>  diff -u "$0" "$0" > /dev/null 2>&1
>>  if [ $? -eq 0 ]; then
>>    diff_cmd="diff -u"
> cosmetical change

That one wasn't intentional.

- Dan Christiansen

More information about the ffmpeg-devel mailing list