Win32CompileFedora13

From VideoLAN Wiki
Jump to navigation Jump to search

Building VLC from source

Win32Compile on Fedora 13 (This document is based on Win32Compile)

Method Documentation Notes
Cross-compile with Mingw32 on Fedora 13

None: read this page

Preferred method (uses cross compilation)

Obtaining the build tools

The mingw32 cross-compile tools are available in the default repository. Install them (as root) with yum:

yum --verbose --noplugins install \
mingw32-gcc-c++-4.4.2 \
mingw32-gcc-4.4.2 \
mingw32-pthreads-2.8.0 \
mingw32-w32api-3.13 \
mingw32-binutils-2.19.51.0.14 \
mingw32-runtime-3.15.2 \
mingw32-filesystem-56 \
mingw32-cpp-4.4.2-2.fc13

You may also add the ndis tools and everything needed by the make package-win32* targets:

mingw32-nsiswrapper-5
mingw32-nsis-2.45
zip-3.0-1
p7zip-9.04 (For this one you need to create a link ''ln -s /usr/bin/7za /usr/win32/bin/7z'' and do not forget to add ''/usr/win32/bin'' to your 'PATH')
lua-5.1.4

You also need the Fedora qt-devel package, even if you are using Linux to cross-compile to a Windows exe (for moc and uic):

yum install qt-devel

Note: pre-built Windows Qt is 4.6.0 but the yum installed version for Linux is actually 4.6.2... If it is problematic try to downgrade the qt installed versions:

yum downgrade qt*-4.6.0

Be sure that you have pkg-config installed (check with yum -q pkgconfig) as the installed /usr/bin/i686-pc-mingw32-pkg-config is not working correctly.

Saving time by using pre-built libraries

If you want to save yourself time and energy by using the pre-built versions of these libraries, you may download them from http://people.videolan.org/~jb/Contribs/, the version you download must match that of the MINGW compiler.

For the installed mingw32 packages the available versions are: http://people.videolan.org/~jb/Contribs/contrib-xxxxxxx-win32-bin-gcc-4.4.2-runtime-3.15-only.tar.bz2, where xxxxx is a date

Install this (as root) with:

tar jxf contrib-xxxxxxx-win32-bin-gcc-4.4.2-runtime-3.15-only.tar.bz2 -C /

Note the -C /!

For QT4 you will need (to ease the compilation) to add some links in '/usr/win32/bin':

cd /usr/win32/bin
ln -s /usr/bin/moc-qt4 .
ln -s /usr/bin/uic-qt4 .
ln -s /usr/bin/rcc .

Note: for contrib-xxxxxxx-win32-bin-gcc-4.4.2-runtime-3.17-only.tar.bz2 you need to install mingw32-runtime-3.17 A pre-version is actually available here: http://rpmfarm.free.fr/13/i386/RPMS.farm/mingw32-runtime-3.17-1.EL.fc13.noarch.rpm

Note: previous contrib tarball is missing some files: /usr/win32/include/mpcdec/config_win32.h

A temporary version is available here: http://rpmfarm.free.fr/src/Patches/VLC/mpcdec_config_win32.h

Configuring the build

First prepare the build process in the vlc tree (fetched by git - See http://wiki.videolan.org/Git#Getting_VLC_or_x264_source_code_via_Git) by doing: cd vlc ./bootstrap

Once you've got all the files you need in place and the bootstap is done, you need to configure the build with the following configure script (created in 'extras/package/win32' and named 'configure-mingw-mine.sh'). In the following examples, assume that the third-party libraries are installed as above:

	+----------------------------------------------------------------------------------
	| #!/bin/sh
	| 
	| root=$(echo $0|sed 's#extras/package/win32/configure-mingw-mine.sh##')./
	| 
	| if [ -n "$1" ]
	| then
	|         CONTRIBS="$1"
	| else
	|         CONTRIBS="/usr/win32"
	| fi
	| export CONTRIBS
	| 
	| PATH="$CONTRIBS/bin:$PATH" \
	| PKG_CONFIG=/usr/bin/pkg-config \
	| PKG_CONFIG_LIBDIR=$CONTRIBS/lib/pkgconfig \
	| CPPFLAGS="-I$CONTRIBS/include -I$CONTRIBS/include/ebml" \
	| LDFLAGS="-L$CONTRIBS/lib" \
	| CC=i686-pc-mingw32-gcc CXX=i686-pc-mingw32-g++ \
	| CONFIG="${root}configure --host=i686-pc-mingw32 --build=i386-linux
 	| --enable-dirac --enable-mkv --enable-taglib --enable-nls --enable-projectm" \
	| sh ${root}extras/package/win32/configure-common.sh
	+----------------------------------------------------------------------------------

See ./configure --help for more information.

Building VLC

Once configured, to build VLC, just run make.

Note: you may need make MOC=/usr/bin/moc-qt4 UIC=/usr/bin/uic-qt4 in modules/gui/qt4) if you haven't done the links.

Once the compilation is done, you can either run VLC directly from the source tree or you can build self-contained VLC packages with the following make rules:

Command Description
make package-win32-base Creates a subdirectory named vlc-x.x.x with all the binaries 'stripped' (that is, smallest size, unusable with a debugger)
make package-win32-zip Same as above but will package the directory in a zip file.
make package-win32 Same as above but will also create an auto-installer package. You must have NSIS installed in its default location for this to work.


Notes: You'll need to add '/usr/win32/bin' to the path and as you used MinGW, you need to copy the mingw 'libgcc_s_sjlj-1.dll' into the installation folder near vlc.exe (you'll find the dll on your system as you installed the mingw packages): cp /usr/i686-pc-mingw32/sys-root/mingw/bin/libgcc_s_sjlj-1.dll vlc-<current_version>/

Well done—you're ready to use VLC!