[MPlayer-cygwin] compile the libs on mingw

Sascha Sommer saschasommer at freenet.de
Sun Jan 2 17:34:57 CET 2005


On Sunday 02 January 2005 12:46, Stefan Gürtler wrote:
> Yesterday i have tryed my best to once again compile some libs needed
> for Mplayer under MinGW, and I want to share my findings and sumerize
>
> them for Sacha, who once stated:
> >I should write some build howto that explains the various tweaks
> >
>  >needed to compile the libs on mingw. Hopefully I find a bit of
>  >time for this during the christmas holidays.

Ok, ok, here is a first draft. Not spellchecked not even read again.
Feedback greatly appreciated.

>
> Maybe you can help me finding solutions for the problems i have
> encountered.
>
> So we start with Lame mp3 - encoder. Decoder is not to be build, as
> lames decoder is not used by mplayer and building it leads to conflicts
> with mplayers mp3lib while compiling mplayer!
> Homepage: http://lame.sourceforge.net/
> Download: http://sourceforge.net/project/showfiles.php?group_id=290
>
> Download lame source from sourceforge.
> Latest is lame v3.96.1 (as of january 2005) but i have used v3.96
> $ tar xfz lame-3.96.tar.gz
> $ cd lame-3.96
> $ ./configure --prefix=/mingw --disable-gtktest --disable-decoder
> Building lame with nasm
> (./configure --prefix=/mingw --enable-nasm --disable-gtktest
> -disable-decoder)
> failed for me. Anybody succeeded in this?

No, looks like a autoconf/make/libtool issue searching objects in i386 dir 
while they are in i386/.libs etc...

> I failed to compile internal tremor under MinGW (as of january 1st.
> 2005), i had to disable it.

Fixed. Current cvs still won't compile due to an undefined reference in 
ao_pcm.c
Replacing strndup with strdup should work, though.
Not sure if this one occurens of strndup is worth a new file in osdep/

> Compiling x264 (rev80), xvid, tremor and lame workes just fine with
> cygwin, but
> x264 is not found by ./configure. Looking at the configure.log showed
> some errors because of undefined variables, and therefore building the
> test object fails and x264 is not enabled.
>

Didn't try to compile x264 yet.

Sascha
-------------- next part --------------
Once finished this should become a howto that will explain the steps necessary to setup the toolchain to compile your own versions of MPlayer on MinGW 
similar to the one in the packages found at http://www.mplayerhq.hu/MPlayer/releases/win32-beta

Step 1 Mingw and msys 
Download the latest versions of MinGW and msys from
http://www.mingw.org/download.shtml

The versions used in this document are
MinGW-3.1.0-1.exe
MSYS-1.0.10.exe

Then install MinGW and afterwards msys. 

Answer
"Do you wish to continue with the post install? [yn ]"
and
"Do you have MinGW installed? [yn ]" 
with y and give the path to your mingw dir in the next question. (c:/mingw if you did not alter the path during the mingw setup)

After the installation is finished, open a msys shell (you can find an icon for it on your desktop).

The following steps assume that you download the packages to your msys home dir, for me that is in c:\msys\home\useranme
where username is my windows username.

Step 2 directx headers
Get the directx header package at
http://www.mplayerhq.hu/MPlayer/releases/win32-beta/contrib/dx7headers.tgz

As alternative you can also use the modified wine headers reimar posted to the cygwin list.

Extract the headers and move them to your mingw inlucde dir (c:\mingw\include)
To do this use the following commands in your msys shell
tar -xvvzf dx7headers.tgz
mv *.h c:/mingw/include

Note: In this tutorial I install all packages into the mingw tree, it might probably be better to put all extra libraries and headers
into a seperate directory and pass this directory with the --with-extraincdir and --with-extralibdir switches to configure
Furthermore I'm using static linking to prevent problems caused by different dll versions. 
Omitting the --disable-shared from the configure commands will help you to build smaller exes that require the various dlls to be installed. 

Step 2 ogg and vorbis
Go to http://www.vorbis.com/download.psp
Select "Unix / Linux" as operating system
Then download the libvorbis and libogg .tar.gz sources
from the Libraries section
Also get the patch http://mplayerhq.hu/MPlayer/releases/win32-beta/contrib/libogg-mingw32.diff

extract the archive:

tar -xvvzf libogg-1.1.tar.gz

change to the dir containing the sources:
cd libogg-1.1

Apply the mingw build patch:
patch -p0 <../libogg-mingw32.diff

Then call configure with your mingw install dir as prefix:

./configure --prefix=c:/mingw --disable-shared

compile the sources:

make

and install them:

make install

afterwards go back to your msys home dir:

cd

now install libvorbis in a similar way
tar -xvvzf libvorbis-1.0.1.tar.gz
cd libvorbis-1.0.1
./configure --prefix=c:/mingw --disable-shared
make
make install
cd

Step 3 freetype (for osd font rendering)
First install libiconv from 
http://www.gnu.org/software/libiconv/

Get the sources then
tar -xvvzf libiconv-1.9.1.tar.gz
cd libiconv-1.9.1
./configure --prefix=c:/mingw --disable-shared
make
make install
cd

Then get the latest freetype2 source package from
http://sourceforge.net/project/showfiles.php?group_id=3157

tar -xvvjf freetype-2.1.9.tar.bz2
cd freetype-2.1.9
make
make install
cd

Step 4 zlib, libregif, libpng, libjpeg
zlib is needed for some mov files with compressed headers the others to play/encode png/jpeg/gif files

Sources are available from:
http://www.gzip.org/zlib/
http://armory.nicewarrior.org/projects/libregif/
http://sourceforge.net/project/showfiles.php?group_id=5624
http://www.ijg.org/

tar -xvvzf zlib-1.2.1.tar.gz
cd zlib-1.2.1.tar
./configure --prefix=c:/mingw
make
make install
cd

tar -xvvzf libpng-1.2.8-config.tar.gz
cd libpng-1.2.8-config
./configure --prefix=c:/mingw --disable-shared
make
make install
cd

tar -xvvzf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/mingw/ --enable-static
make
cp .libs/libjpeg.a c:/mingw/lib/
cp jpeglib.h jconfig.h jmorecfg.h c:/mingw/include/
cd

tar -xvvzf libregif-4.1.5.tar.gz
cd libregif-4.1.5
./configure --prefix=c:/mingw
make
make install
cd

Step 5 lame and xvid

Get the nasm sources from http://sourceforge.net/project/showfiles.php?group_id=6208

tar -xvvzf nasm-0.98.38.tar.gz
cd nasm-0.98.38
./configure --prefix=c:/mingw
make
make install
cd

Install lame from http://lame.sourceforge.net/download/download.html
tar -xvvzf lame-3.96.1.tar.gz
cd lame-3.96.1
./configure --prefix=c:/mingw --disable-shared --disable-decoder
make
make install
cd

Now get http://www.xvid.org/downloads.html
tar -xvvzf xvidcore-1.0.3.tar.gz
cd xvidcore-1.0.3/build/generic
./configure --prefix=c:/mingw --disable-shared
make
make install
mv c:/mingw/lib/xvidcore.a c:/mingw/lib/libxvidcore.a

Step 6 live.com rtsp streaming support
Get the sources
http://www.live.com/liveMedia/public/

tar -xvvzf live.2004.12.29.tar.gz       (got some errors from tar here but the build worked nevertheless)
cd live
genMakefiles mingw
make


Step 7 MPlayer
For my build I'm using a cvs checkout using cygwin, but cvs snapshots, wincvs or release tarballs should work, too.

In the cygwin shell
cd to your msys home dir

cvs -d:pserver:anonymous at mplayerhq.hu:/cvsroot/mplayer login
cvs -z3 -d:pserver:anonymous at mplayerhq.hu:/cvsroot/mplayer co -P main

When asked for a password, just hit enter. A directory named main will be created.

Now checkout ffmpeg
cvs -d:pserver:anonymous at mplayerhq.hu:/cvsroot/ffmpeg login
cvs -z3 -d:pserver:anonymous at mplayerhq.hu:/cvsroot/ffmpeg co -P main

and copy the libavcodec and libavformat dirs from it to the main dir
cp -R ffmpeg/libavcodec/ ffmpeg/libavformat/ main/

All the sources should be there now.

cd main
./configure --enable-runtime-cpudetection --with-codecsdir=codecs --enable-static --with-livelibdir=/home/username/live
(make sure you use the right path for the --with-livelibdir option)
make

If everything went well your first mplayer.exe can be found in the main dir now.


02.01.2005 Sascha Sommer



More information about the MPlayer-cygwin mailing list