2014-02-06 00:17:29 +00:00
|
|
|
Cross Compiling to Windows
|
|
|
|
==========================
|
|
|
|
|
2013-01-08 16:11:59 +00:00
|
|
|
Cross compiling mpv to Windows is supported with MinGW-w64. This can be used to
|
|
|
|
produce both 32 bit and 64 bit executables. MinGW-w64 is available from
|
|
|
|
http://mingw-w64.sourceforge.net.
|
|
|
|
|
|
|
|
You have to run mpv's configure with these arguments:
|
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
```bash
|
|
|
|
DEST_OS=win32 TARGET=i686-w64-mingw32 ./waf configure
|
|
|
|
```
|
2013-09-08 10:25:20 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
While building a complete MinGW-w64 toolchain yourself is possible, people have
|
2014-12-12 00:08:51 +00:00
|
|
|
created scripts to help ease the process. In particular, [MXE](http://mxe.cc)
|
|
|
|
makes it very easy to bootstrap a complete MingGW-w64 environment from scratch.
|
|
|
|
See a working example below.
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-12-12 00:08:51 +00:00
|
|
|
Alternatively, you can try [mingw-w64-cmake](https://github.com/lachs0r/mingw-w64-cmake),
|
|
|
|
which bootstraps a MinGW-w64 environment and builds mpv and dependencies.
|
2014-02-15 18:12:58 +00:00
|
|
|
|
|
|
|
**Warning**: the original MinGW (http://www.mingw.org) is unsupported.
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2013-07-30 14:07:42 +00:00
|
|
|
Note that MinGW environments included in Linux distributions are often broken,
|
2013-01-08 16:11:59 +00:00
|
|
|
outdated and useless, and usually don't use MinGW-w64.
|
|
|
|
|
2014-09-14 14:21:04 +00:00
|
|
|
Additional dependencies
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
You need a pthread wrapper. It must be interoperable with native Windows
|
|
|
|
threads. pthreads-win32 or MinGW pthreads might work.
|
|
|
|
|
|
|
|
If you want ``--input-file=...`` to work, you need libwaio. It's available
|
|
|
|
from: git://midipix.org/waio
|
|
|
|
|
2013-01-08 16:11:59 +00:00
|
|
|
Example with MXE
|
2014-02-06 00:17:29 +00:00
|
|
|
----------------
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-06 00:17:29 +00:00
|
|
|
```bash
|
2014-12-12 00:08:51 +00:00
|
|
|
# Before starting, make sure you install MXE prerequisites. MXE will download
|
|
|
|
# and build all target dependencies, but no host dependencies. For example,
|
|
|
|
# you need a working compiler, or MXE can't build the crosscompiler.
|
|
|
|
#
|
|
|
|
# Refer to
|
|
|
|
#
|
|
|
|
# http://mxe.cc/#requirements
|
|
|
|
#
|
|
|
|
# Scroll down for disto/OS-specific instructions to install them.
|
|
|
|
|
2014-02-15 18:17:56 +00:00
|
|
|
# Download MXE. Note that compiling the required packages requires about 1.4 GB
|
2013-09-08 10:25:20 +00:00
|
|
|
# or more!
|
2013-01-08 16:11:59 +00:00
|
|
|
|
|
|
|
cd /opt
|
2014-11-26 05:31:44 +00:00
|
|
|
git clone https://github.com/mxe/mxe mxe
|
|
|
|
cd mxe
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-16 02:15:56 +00:00
|
|
|
# Set build options.
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
# The JOBS environment variable controls threads to use when building. DO NOT
|
2014-02-16 02:15:56 +00:00
|
|
|
# use the regular `make -j4` option with MXE as it will slow down the build.
|
|
|
|
# Alternatively, you can set this in the make command by appending "JOBS=4"
|
|
|
|
# to the end of command:
|
|
|
|
echo "JOBS := 4" >> settings.mk
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
# The MXE_TARGET environment variable builds MinGW-w64 for 32 bit targets.
|
2014-02-16 02:15:56 +00:00
|
|
|
# Alternatively, you can specify this in the make command by appending
|
|
|
|
# "MXE_TARGETS=i686-w64-mingw32" to the end of command:
|
2014-11-26 05:31:44 +00:00
|
|
|
echo "MXE_TARGETS := i686-w64-mingw32.static" >> settings.mk
|
2014-02-16 02:15:56 +00:00
|
|
|
|
|
|
|
# If you want to build 64 bit version, use this:
|
2014-11-26 05:31:44 +00:00
|
|
|
# echo "MXE_TARGETS := x86_64-w64-mingw32.static" >> settings.mk
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-16 02:15:56 +00:00
|
|
|
# Build required packages. The following provide a minimum required to build
|
|
|
|
# mpv.
|
|
|
|
|
|
|
|
make gcc ffmpeg libass jpeg pthreads
|
|
|
|
|
|
|
|
# Add MXE binaries to $PATH
|
2014-11-26 05:31:44 +00:00
|
|
|
export PATH=/opt/mxe/usr/bin/:$PATH
|
2013-01-08 16:11:59 +00:00
|
|
|
|
|
|
|
# Build mpv. The target will be used to automatically select the name of the
|
2014-11-26 05:31:44 +00:00
|
|
|
# build tools involved (e.g. it will use i686-w64-mingw32.static-gcc).
|
2013-01-08 16:11:59 +00:00
|
|
|
|
2014-02-15 18:12:58 +00:00
|
|
|
cd ..
|
2013-01-08 16:11:59 +00:00
|
|
|
git clone https://github.com/mpv-player/mpv.git
|
|
|
|
cd mpv
|
2014-11-26 05:31:44 +00:00
|
|
|
DEST_OS=win32 TARGET=i686-w64-mingw32.static ./waf configure
|
2014-02-16 02:15:56 +00:00
|
|
|
# Or, if 64 bit version,
|
2014-11-26 05:31:44 +00:00
|
|
|
# DEST_OS=win32 TARGET=x86_64-w64-mingw32.static ./waf configure
|
2013-07-16 11:28:28 +00:00
|
|
|
./waf build
|
2014-02-06 00:17:29 +00:00
|
|
|
```
|