[MPlayer-cvslog] r34203 - in trunk: Changelog DOCS/tech/crosscompile.txt DOCS/tech/mingw-crosscompile.txt Makefile configure gui/win32/interface.c loader/com.h mplayer.c osdep/priority.c stream/tvi_dshow.c

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Oct 15 21:45:41 CEST 2011


On Sat, Oct 15, 2011 at 03:20:52PM +0200, ib wrote:
> Author: ib
> Date: Sat Oct 15 15:20:52 2011
> New Revision: 34203
> 
> Log:
> Port to Wine.
> 
> This makes MPlayer and the GUI compile and run as a Wine executable,
> which is mainly to allow Windows code checking in a Linux environment.
> 
> In Makefile: Generalize the windres call by specifying option "-o" for
> the output file.
> 
> In gui/win32/interface.c: Use the same function to create a thread as
> Cygwin, and convert Windows style file names so that they are accessible
> in the Linux environment.
> 
> In osdep/priority.c: Include windows.h.
> 
> In configure: Add system "Wine" which shall be considered (mostly) a
> win32 system. Since winegcc by default compiles all files with the
> "-fpic" flag, remove it, and remove all MinGW compatibility WIN32
> defines, because we're not compiling for real Windows. Define to not use
> Windows sockets (Wine uses different ones) and replace Windows' stricmp
> by strcasecmp. Ensure that yasm's object format isn't win32 and that
> HAVE_LINUX_DVD_STRUCT will be defined.
> 
> In stream/tvi_dshow.c: Define MP_DEFINE_LOCAL_GUID, because Wine's
> DEFINE_GUID macro isn't compatible using "static" with it.
> 
> In loader/com.h: Rename the IIDs to become local ones, because Wine's
> unknwn.h not only declares but defines them.
> 
> In mplayer.c: Don't define a SIGSEGV signal handler, or the Wine
> executable will crash.

I am not really happy about having all these wildly different things in
one single commit, particularly since I do not see any reason for them
to be.
The osdep/priority.c seems like a code correctness change that can be
motivated without any need for wine to come in.
The loader/com.h change makes sense anyway, since it is consistent with
what is done in tvi_dshow to reduce the chance of symbol collisions
(and anyone using -luuid - I think that's the one it was - would have
issues with that code as it was before in Windows, too).

> +  ./configure --target=$(uname -m)-wine --cc=winegcc --windres=wrc

That doesn't work on 64 bit Linux. I have not finished compiling yet,
but I think the only sensible command to suggest is
./configure --target=i686-wine --cc="winegcc -m32" --windres=wrc

> +#ifdef __WINE__
> +/**
> + * @brief Convert a Windows style file name into an Unix style one.
> + *
> + * @param filename pointer to the file name to be converted
> + *
> + * @return pointer to the converted file name

You should say what the point of that code is.

> Modified: trunk/loader/com.h
> ==============================================================================
> --- trunk/loader/com.h	Sat Oct 15 13:07:29 2011	(r34202)
> +++ trunk/loader/com.h	Sat Oct 15 15:20:52 2011	(r34203)
> @@ -29,6 +29,9 @@ typedef struct
>  } GUID;
>  #endif
>  
> +// hack: use copies of the IIDs
> +#define IID_IUnknown MP_IID_IUnknown
> +#define IID_IClassFactory MP_IID_IClassFactory
>  extern const GUID IID_IUnknown;
>  extern const GUID IID_IClassFactory;

As said, I disagree that this is a hack. Well, maybe using a define
instead of renaming all is kind of, but it's at least border line.

> Modified: trunk/mplayer.c
> ==============================================================================
> --- trunk/mplayer.c	Sat Oct 15 13:07:29 2011	(r34202)
> +++ trunk/mplayer.c	Sat Oct 15 15:20:52 2011	(r34203)
> @@ -3002,7 +3002,9 @@ int main(int argc, char *argv[])
>  #ifdef CONFIG_SIGHANDLER
>      // fatal errors:
>      signal(SIGBUS, exit_sighandler); // bus error
> +#ifndef __WINE__
>      signal(SIGSEGV, exit_sighandler); // segfault
> +#endif

This however is a huge ugly hack and should have a comment at least.
When adding such hacks you should always dump in any sensible
information, in particularly if someone wants to remove it because
for some reason it works fine on their system you should not leave
them scratching their head how much it might break.


More information about the MPlayer-cvslog mailing list