2019-02-09 10:32:31 +00:00
|
|
|
Building MKVToolNix 31.0.0 for Windows
|
2015-05-08 10:34:37 +00:00
|
|
|
=====================================
|
2003-05-09 06:27:26 +00:00
|
|
|
|
2012-03-29 19:10:49 +00:00
|
|
|
There is currently only one supported way to build MKVToolNix for
|
2017-04-24 15:00:47 +00:00
|
|
|
Windows: on Linux using a MinGW cross compiler. It is known that you
|
|
|
|
can also build it on Windows itself with the MinGW gcc compiler, but
|
2012-03-29 19:10:49 +00:00
|
|
|
that's not supported officially as I don't have such a setup myself.
|
2004-01-12 20:02:13 +00:00
|
|
|
|
2012-03-29 19:10:49 +00:00
|
|
|
Earlier versions could still be built with Microsoft's Visual Studio /
|
|
|
|
Visual C++ programs, and those steps were described here as
|
|
|
|
well. However, current MKVToolNix versions require many features of
|
2016-12-13 21:37:14 +00:00
|
|
|
the C++11 and C++14 standards which Microsoft's compilers have had
|
|
|
|
spotty support for for a long time. Additionally the author doesn't
|
|
|
|
use Visual C++ himself and couldn't provide project files for it.
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2017-04-24 15:00:47 +00:00
|
|
|
# 1. Building with a MinGW cross compiler
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
## 1.1. Preparations
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2011-10-23 19:06:28 +00:00
|
|
|
You will need:
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2017-04-24 15:00:47 +00:00
|
|
|
- a MinGW cross compiler
|
2015-05-08 20:28:13 +00:00
|
|
|
- roughly 4 GB of free space available
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2017-04-23 16:27:47 +00:00
|
|
|
Luckily there's the [M cross environment project](http://mxe.cc/)
|
|
|
|
that provides an easy-to-use way of setting up the cross-compiler
|
|
|
|
and all required libraries.
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2017-04-24 15:00:47 +00:00
|
|
|
MXE is a fast-changing project. In order to provide a stable basis for
|
2016-12-27 19:21:11 +00:00
|
|
|
compilation, the author maintains his own fork. That fork also includes
|
2016-12-18 13:12:22 +00:00
|
|
|
a couple of changes that cause libraries to be compiled only with the
|
2015-05-08 20:26:58 +00:00
|
|
|
features required by MKVToolNix saving compilation time and deployment
|
2017-04-24 15:00:47 +00:00
|
|
|
space. In order to retrieve that fork, you need `git`. Then do the
|
2015-05-08 20:26:58 +00:00
|
|
|
following:
|
2012-05-31 11:39:43 +00:00
|
|
|
|
2017-08-22 19:08:24 +00:00
|
|
|
git clone https://gitlab.com/mbunkus/mxe $HOME/mxe
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2017-04-24 15:00:47 +00:00
|
|
|
The rest of this guide assumes that you've unpacked MXE
|
2016-03-23 10:25:29 +00:00
|
|
|
into the directory `$HOME/mxe`.
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
## 1.2. Automatic build script
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2015-05-08 20:26:58 +00:00
|
|
|
MKVToolNix contains a script that can download, compile and install
|
2016-03-23 10:25:29 +00:00
|
|
|
all required libraries into the directory `$HOME/mxe`.
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2016-12-27 19:21:11 +00:00
|
|
|
If the script does not work or you want to do everything yourself,
|
2012-05-21 15:54:58 +00:00
|
|
|
you'll find instructions for manual compilation in section 1.3.
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
### 1.2.1. Script configuration
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2018-06-25 15:59:11 +00:00
|
|
|
The script is called `packaging/windows/setup_cross_compilation_env.sh`.
|
|
|
|
It contains the following variables that can be adjusted to fit your
|
2010-03-06 13:40:50 +00:00
|
|
|
needs:
|
|
|
|
|
2015-05-08 20:26:58 +00:00
|
|
|
ARCHITECTURE=64
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2017-04-24 15:00:47 +00:00
|
|
|
The architecture (64-bit vs 32-bit) that the binaries will be built
|
|
|
|
for. The majority of users today run a 64-bit Windows, therefore 64 is
|
|
|
|
the default. If you run a 32-bit version of Windows, change this to 32.
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2016-03-23 10:25:29 +00:00
|
|
|
INSTALL_DIR=$HOME/mxe
|
2010-03-06 13:40:50 +00:00
|
|
|
|
|
|
|
Base installation directory
|
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
PARALLEL=
|
2010-03-06 18:08:13 +00:00
|
|
|
|
2011-10-23 19:06:28 +00:00
|
|
|
Number of processes to execute in parallel. Will be set to the number
|
|
|
|
of cores available if left empty.
|
2010-03-06 18:08:13 +00:00
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
### 1.2.2. Execution
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2015-05-08 20:26:58 +00:00
|
|
|
From the MKVToolNix source directory run:
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2018-06-25 15:59:11 +00:00
|
|
|
./packaging/windows/setup_cross_compilation_env.sh
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2016-12-27 19:21:11 +00:00
|
|
|
If everything works fine, you'll end up with a configured MKVToolNix
|
2017-01-08 20:04:51 +00:00
|
|
|
source tree. You just have to run `rake` afterwards.
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
## 1.3. Manual installation
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2017-04-24 15:00:47 +00:00
|
|
|
First you will need the MXE build scripts. Get them by
|
2015-05-08 20:26:58 +00:00
|
|
|
downloading them (see section 1.1. above) and unpacking them into
|
2016-03-23 10:25:29 +00:00
|
|
|
`$HOME/mxe`.
|
2011-10-23 19:06:28 +00:00
|
|
|
|
2015-05-08 20:26:58 +00:00
|
|
|
Next, build the required libraries (change `MXE_TARGETS` to
|
2017-04-24 15:00:47 +00:00
|
|
|
`i686-w64-mingw32.static` if you need a 32-bit build instead of a 64-bit
|
2015-05-08 20:26:58 +00:00
|
|
|
one, and increase `JOBS` if you have more than one core):
|
2011-10-23 19:06:28 +00:00
|
|
|
|
2016-03-23 10:25:29 +00:00
|
|
|
cd $HOME/mxe
|
2016-12-20 18:52:06 +00:00
|
|
|
make MXE_TARGETS=x86_64-w64-mingw32.static MXE_PLUGIN_DIRS=plugins/gcc6 \
|
|
|
|
JOBS=2 \
|
2016-12-30 14:01:30 +00:00
|
|
|
gettext libiconv zlib boost file flac lzo ogg pthreads vorbis \
|
2016-12-20 18:52:06 +00:00
|
|
|
qtbase qttranslations qtwinextras
|
2010-03-06 13:40:50 +00:00
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
Append the installation directory to your `PATH` variable:
|
2011-10-23 19:06:28 +00:00
|
|
|
|
2016-03-23 10:25:29 +00:00
|
|
|
export PATH=$PATH:$HOME/mxe/usr/bin
|
2015-05-08 10:36:38 +00:00
|
|
|
hash -r
|
2011-10-23 19:06:28 +00:00
|
|
|
|
2015-05-08 20:26:58 +00:00
|
|
|
Finally, configure MKVToolNix (the `host=…` spec must match the
|
|
|
|
`MXE_TARGETS` spec from above):
|
2011-10-23 19:06:28 +00:00
|
|
|
|
2015-05-08 10:36:38 +00:00
|
|
|
cd $HOME/path/to/mkvtoolnix-source
|
2015-05-08 20:26:58 +00:00
|
|
|
host=x86_64-w64-mingw32.static
|
2016-03-23 10:25:29 +00:00
|
|
|
qtbin=$HOME/mxe/usr/${host}/qt5/bin
|
2015-05-08 10:36:38 +00:00
|
|
|
./configure \
|
2015-05-08 20:26:58 +00:00
|
|
|
--host=${host} \
|
2015-10-25 08:29:10 +00:00
|
|
|
--enable-static-qt \
|
2015-05-08 20:26:58 +00:00
|
|
|
--with-moc=${qtbin}/moc --with-uic=${qtbin}/uic --with-rcc=${qtbin}/rcc \
|
2016-03-23 10:25:29 +00:00
|
|
|
--with-boost=$HOME/mxe/usr/${host}
|
2011-10-23 19:06:28 +00:00
|
|
|
|
2016-12-27 19:29:54 +00:00
|
|
|
If everything works, build it:
|
2011-10-23 19:06:28 +00:00
|
|
|
|
2017-01-08 20:04:51 +00:00
|
|
|
rake
|
2010-03-06 13:40:50 +00:00
|
|
|
|
|
|
|
You're done.
|