Diego Biurrun <[email protected]> writes:

> On Mon, Oct 15, 2012 at 04:11:28AM +0100, Mans Rullgard wrote:
>> --- /dev/null
>> +++ b/compat/plan9/main.c
>> @@ -0,0 +1,16 @@
>> +int plan9_main(int argc, char **argv);
>> +
>> +#undef main
>> +int main(int argc, char **argv)
>> +{
>> +    /* The setfcr() function in lib9 is broken, must use asm. */
>> +#ifdef __i386
>> +    short fcr;
>> +    __asm__ volatile ("fstcw        %0 \n"
>> +                      "or      $63, %0 \n"
>> +                      "fldcw        %0 \n"
>> +                      : "=m"(fcr));
>> +#endif
>> +
>> +    return plan9_main(argc, argv);
>> +}
>
> This should have a license boilerplate of some sort.
>
>> --- /dev/null
>> +++ b/compat/plan9/sys/select.h
>> @@ -0,0 +1,2 @@
>> +#include_next <sys/select.h>
>> +#define FD_SETSIZE 96
>
> Wouldn't it be simpler to just add another -D flag? 

That's also a possibility.

> Or is sys/select.h completely missing?
>
>> --- a/configure
>> +++ b/configure
>> @@ -2898,6 +2899,19 @@ case $target_os in
>>          ;;
>>      minix)
>>          ;;
>> +    plan9)
>> +        add_host_cflags -I${source_path}/compat/plan9
>> +        add_cppflags -I${source_path}/compat/plan9 \
>> +                     -D_C99_SNPRINTF_EXTENSION     \
>> +                     -D_REENTRANT_SOURCE           \
>> +                     -D_RESEARCH_SOURCE
>> +        add_compat strtod.o strtod=avpriv_strtod
>> +        network_extralibs='-lbsd'
>> +        exeobjs=compat/plan9/main.o
>> +        disable avserver
>> +        ln_s='ln -s -f'
>> +        cp_f='cp'
>> +        ;;
>>      none)
>>          ;;
>>      *)
>> @@ -3571,6 +3585,12 @@ elif enabled msvc; then
>>      enabled x86_32 && disable aligned_stack
>>  fi
>>  
>> +case $target_os in
>> +    plan9)
>> +        add_cppflags -Dmain=plan9_main
>> +    ;;
>> +esac
>> +
>>  enabled_any $THREADS_LIST      && enable threads
>>  
>>  enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
>
> Why is this not part of the plan9 section above?

Because then all the link tests would fail with missing main().

>> --- a/doc/platform.texi
>> +++ b/doc/platform.texi
>> @@ -292,4 +292,66 @@ and for a build with shared libraries
>> +
>> +@item Missing/broken @code{head} and @code{printf} commands
>> +
>> +Replacements adequate for building Libav can be found in the
>> +@code{compat/plan9} directory.  Place these somewhere they will be
>> +found by the shell.  These are not full implementations of the
>> +commands and are @emph{not} suitable for general use.
>
> We fiddle with the PATH for Solaris, we could do the same for Plan 9.

That's not so easy.  On Solaris it's a simple matter of adding a
directory if it exists at all since that particular directory is
extremely unlikely to be used for anything else.  For these files, we
need them before we've figured out what OS we're running.

>> +@item Missing C99 @code{stdint.h} and @code{inttypes.h}
>> +
>> +Any standard headers appropriate for the CPU architecture will work.
>
> People will probably appreciate a link to a drop-in replacement header.

I used the FreeBSD ones with some minor changes.  What do you suggest I
link to?

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to