Document build system changes

This commit is contained in:
Moritz Bunkus 2011-10-23 21:06:28 +02:00
parent f9da63dd49
commit 44e7c8c56d
3 changed files with 72 additions and 319 deletions

View File

@ -1,3 +1,17 @@
2011-10-23 Moritz Bunkus <moritz@bunkus.org>
* build system: Boost's "Range" library is now required.
* build system: Boost v1.46.0 or newer is now required. As a
consequence included copies of some of Boost's libraries have been
removed (foreach, property tree).
* build system: The C++ compiler must now support several features
of the C++11 standard: initializer lists, range-based 'for' loops,
right angle brackets, the 'auto' keyword and lambda
functions. configure checks for each of these. For GCC this means
at least v4.6.0.
2011-10-22 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: bug fix: Fixed reading MPEG transport streams on big

27
README
View File

@ -55,19 +55,29 @@ the Subversion repository version might not even compile.
In order to compile MKVToolNix you need a couple of libraries. Most of
them should be available pre-compiled for your distribution. The
libraries you absolutely need are:
programs and libraries you absolutely need are:
- A C++ compiler that supports several features of the C++11 standard:
initializer lists, range-based 'for' loops, right angle brackets,
the 'auto' keyword and lambda functions. For GCC this means at least
v4.6.0.
- libebml and libmatroska for low-level access to Matroska files.
Instructions on how to compile them are a bit further down in this
file.
- expat ( http://expat.sourceforge.net/ ) -- a light-weight XML
parser library
- libOgg ( http://downloads.xiph.org/releases/ogg/ ) and libVorbis
( http://downloads.xiph.org/releases/vorbis/ ) for access to Ogg/OGM
files and Vorbis support
- zlib ( http://www.zlib.net/ ) -- a compression library
- Several of Boost's libraries: "format", "RegEx", "filesystem",
"system", "foreach" ( http://www.boost.org/ )
- Boost ( http://www.boost.org/ ) -- Several of Boost's libraries are
used: "format", "RegEx", "filesystem", "system", "foreach",
"Range". At least v1.46.0 is required.
You also need the "rake" or "drake" build program or at least the
programming language Ruby and the "rubygems" package. MKVToolNix comes
@ -88,21 +98,28 @@ built. These include:
- wxWidgets ( http://www.wxwidgets.org/ ) -- a cross-platform GUI
toolkit. You need this if you want to use mmg (the mkvmerge GUI) or
mkvinfo's GUI.
- libFLAC ( http://downloads.xiph.org/releases/flac/ ) for FLAC
support (Free Lossless Audio Codec)
- lzo ( http://www.oberhumer.com/opensource/lzo/ ) and bzip2 (
http://www.bzip.org/ ) are compression libraries. These are the
least important libraries as almost no application supports Matroska
content that is compressed with either of these libs. The
aforementioned zlib is what every program supports.
- libMagic from the "file" package ( http://www.darwinsys.com/file/ )
for automatic content type detection
- libcurl ( http://curl.haxx.se/ ) for online update checks
2.3. Building libmatroska and libebml
Start with the two libraries. Either get libebml 1.0.0 from
http://dl.matroska.org/downloads/libebml/ and libmatroska 1.0.0 from
This is optional as MKVToolNix comes with its own set of the
libraries. It will use them if no version is found on the system.
Start with the two libraries. Either get libebml 1.2.2 from
http://dl.matroska.org/downloads/libebml/ and libmatroska 1.3.0 from
http://dl.matroska.org/downloads/libmatroska/ or a fresh copy from the
Subversion repository:

View File

@ -59,57 +59,27 @@ Section 2 -- Building with a mingw cross compiler
2.1. Preparations
2.1.1. Prerequisites
You need:
You will need:
- a mingw cross compiler
- roughly 2 GB of free space available
- the "bjam" build utility for the Boost library (see 2.1.3.)
You usually don't need root access unless you have to install mingw
packages (see 2.1.2.). The mkvtoolnix build process itself can be run
as any user.
Earlier versions of this document described in painful details how to
build each library. Luckily there's the "mingw-cross-env" project at
http://mingw-cross-env.nongnu.org/ that provides an easy-to-use way of
setting up everything we need.
2.1.2. Installing mingw itself
First, download a release or the current development version; see
http://mingw-cross-env.nongnu.org/#latest-release to to retrieve
them. Then unpack the release.
You need a mingw cross compiler with Unicode support enabled in its
Standard Template Library. If your Linux distribution comes with such
a compiler then you should use this. Otherwise you'll have to get or
compile one yourself. How to do the latter is beyond the scope of this
document.
Note that "Unicode enabled STL" means that you have to use mingw v4.0
or newer. The v3.x series does not contain support for wide
characters.
If you're using a Debian or Ubuntu based distribution then all you
need to do is install three packages:
sudo apt-get install mingw32 mingw32-runtime mingw32-binutils
The rest of the document assumes that the mingw gcc executable is
called "i586-mingw32msvc-gcc" and can be found in the PATH.
2.1.3. Obtaining the "bjam" utility
Boost comes with its own build tool called "bjam". This binary must be
run on your build host, meaning that it must be a Linux executable and
not the "bjam.exe" for Windows.
Most Linux distributions come with the Boost development tools. For
Debian and Ubuntu based distributions "bjam" is located in its own
package that you can install easily:
sudo apt-get install bjam
Other distributions might package it in packages named "boost-dev" or
"boost-devel" or similar.
The rest of this guide assumes that you've unpacked mingw-cross-env
into the directory $HOME/mingw-cross-env.
2.2. Automatic build script
mkvtoolnix contains a script that can download, compile and install
all required libraries into the directory $HOME/mingw.
all required libraries into the directory $HOME/mingw-cross-env.
If the script does not work or you want to do everything yourself
you'll find instructions for manual compilation in section 2.3.
@ -120,30 +90,18 @@ The script is called winbuild/setup_cross_compilation_env.sh. It
contains the following variables that can be adjusted to fit your
needs:
BJAM=bjam
TARGET=i686-pc-mingw32
Path and name of the "bjam" Boost.Build system tool (see section
2.1.3.)
The target specification for the standard configure scripts.
HOST=i586-mingw32msvc
The 'host' specification for the standard configure scripts.
MINGW_PREFIX=${HOST}-
Path and prefix of the cross compiler executables. Defaults to the
'host' specification followed by '-'. These settings are correct if
your cross compiler has a standard name, e.g. i586-mingw32msvc-gcc.
INSTALL_DIR=$HOME/mingw
INSTALL_DIR=$HOME/mingw-cross-env
Base installation directory
PARALLEL=1
PARALLEL=
Number of processes to execute in parallel. If you have a multi-core
CPU or multiple CPUs installed set this value to the total number of
cores you want to use, e.g. for a dual-core CPU use PARALLEL=2.
Number of processes to execute in parallel. Will be set to the number
of cores available if left empty.
2.2.2. Execution
@ -152,270 +110,34 @@ From the mkvtoolnix source directory run:
./winbuild/setup_cross_compilation_env.sh
If everything works fine you'll end up with a configured mkvtoolnix
source tree. You just have to run 'make' afterwards. Log files of
everything can be found in $INSTALL_DIR/logs.
source tree. You just have to run 'drake' afterwards.
2.3. Manual installation
This section mentions libraries with certain version numbers. Unless
stated otherwise newer (or slightly older) versions will work just as
well -- just alter the commands to match your actual library version
numbers.
First you will need the mingw-cross-env build scripts. Get them by
downloading them (see above) and unpacking them into
$HOME/mingw-cross-env.
This guide assumes that all libraries are downloaded to the
$HOME/mingw/src directory.
Next, build the required libraries:
2.3.1. Preparing the directory tree
cd $HOME/mingw-cross-env
make gcc w32api mingwrt gettext boost bzip2 curl flac expat libiconv \
ogg pthreads vorbis wxwidgets zlib
This guide assumes a certain directory structure. It consists of the
following directories:
Append the installation directory to your PATH variable:
$HOME/mingw -- base directory for everything else
$HOME/mingw/src -- contains source code during the build process
$HOME/mingw/include -- contains include files for installed libraries
$HOME/mingw/lib -- contains libraries for installed libraries
export PATH=$PATH:$HOME/mingw-cross-env/usr/i686-pc-mingw32/bin
Some libraries will not be installed into the .../include and .../lib
directories but into their own subdirectory, e.g. $HOME/mingw/boost.
Create the directories:
mkdir $HOME/mingw $HOME/mingw/src $HOME/mingw/include $HOME/mingw/lib
2.3.2. libebml and libmatroska
Get the source code libraries from
http://dl.matroska.org/downloads/libebml/ and
http://dl.matroska.org/downloads/libmatroska/
cd $HOME/mingw/src
wget http://dl.matroska.org/downloads/libebml/libebml-1.0.0.tar.bz2 \
http://dl.matroska.org/downloads/libmatroska/libmatroska-1.0.0.tar.bz2
bunzip2 < libebml-1.0.0.tar.bz2 | tar xf -
bunzip2 < libmatroska-1.0.0.tar.bz2 | tar xf -
cd libebml-1.0.0/make/linux
perl -pi -e 's/error/info/' Makefile
make CXX=i586-mingw32msvc-g++ AR="i586-mingw32msvc-ar rcvu" RANLIB=i586-mingw32msvc-ranlib SHARED=no staticlib
cp libebml.a $HOME/mingw/lib/
cp -R ../../ebml $HOME/mingw/include/ebml
cd ../../../libmatroska-1.0.0/make/linux
perl -pi -e 's/error/info/' Makefile
export CXXFLAGS=-I$HOME/mingw/include
export LDFLAGS=-L$HOME/mingw/lib
make CXX=i586-mingw32msvc-g++ AR="i586-mingw32msvc-ar rcvu" RANLIB=i586-mingw32msvc-ranlib SHARED=no staticlib
cp libmatroska.a $HOME/mingw/lib/
cp -R ../../matroska $HOME/mingw/include/matroska
2.3.3. expat
Get precompiled expat binaries for mingw from
http://sourceforge.net/projects/mingw/files/ You need both the
"libexpat...-dll-..." and the "libexpat...-dev-..." packages.
cd $HOME/mingw/src
wget 'http://downloads.sourceforge.net/project/mingw/MinGW%20expat/expat-2.0.1-1/libexpat-2.0.1-1-mingw32-dll-1.tar.gz?use_mirror=heanet' \
'http://downloads.sourceforge.net/project/mingw/MinGW%20expat/expat-2.0.1-1/libexpat-2.0.1-1-mingw32-dev.tar.gz?use_mirror=heanet'
mkdir expat
cd expat
tar xzf ../libexpat-2.0.1-1-mingw32-dll-1.tar.gz
tar xzf ../libexpat-2.0.1-1-mingw32-dev.tar.gz
cp -R . $HOME/mingw
2.3.4. zlib
Get precompiled zlib binaries for mingw from
http://sourceforge.net/projects/mingw/files/ You need both the
"libz...-dll-..." and the "libz...-dev-..." packages.
cd $HOME/mingw/src
wget 'http://downloads.sourceforge.net/project/mingw/MinGW%20zlib/zlib-1.2.3-1-mingw32/libz-1.2.3-1-mingw32-dll-1.tar.gz?use_mirror=heanet' \
'http://downloads.sourceforge.net/project/mingw/MinGW%20zlib/zlib-1.2.3-1-mingw32/libz-1.2.3-1-mingw32-dev.tar.gz?use_mirror=heanet'
mkdir zlib
cd zlib
tar xzf ../libz-1.2.3-1-mingw32-dll-1.tar.gz
tar xzf ../libz-1.2.3-1-mingw32-dev.tar.gz
cp -R . $HOME/mingw
2.3.5. iconv
Get precompiled iconv binaries for mingw from
http://sourceforge.net/projects/mingw/files/ You need the
"libiconv...-dll-...", the "libiconv...-dev-..." and the
"libcharset...-dll-..." packages.
cd $HOME/mingw/src
wget 'http://downloads.sourceforge.net/project/mingw/MinGW%20libiconv/libiconv-1.13.1-1/libiconv-1.13.1-1-mingw32-dll-2.tar.lzma?use_mirror=heanet' \
'http://downloads.sourceforge.net/project/mingw/MinGW%20libiconv/libiconv-1.13.1-1/libcharset-1.13.1-1-mingw32-dll-1.tar.lzma?use_mirror=heanet' \
'http://downloads.sourceforge.net/project/mingw/MinGW%20libiconv/libiconv-1.13.1-1/libiconv-1.13.1-1-mingw32-dev.tar.lzma?use_mirror=heanet'
mkdir iconv
cd iconv
lzma -d < ../libiconv-1.13.1-1-mingw32-dll-2.tar.lzma | tar xf -
lzma -d < ../libcharset-1.13.1-1-mingw32-dll-1.tar.lzma | tar xf -
lzma -d < ../libiconv-1.13.1-1-mingw32-dev.tar.lzma | tar xf -
cp -R . $HOME/mingw
2.3.6. libogg, libvorbis and libFLAC
Get the source code archives from
http://downloads.xiph.org/releases/ogg/
http://downloads.xiph.org/releases/vorbis/
http://downloads.xiph.org/releases/flac/
cd $HOME/mingw/src
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz \
http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.bz2 \
http://downloads.xiph.org/releases/flac/flac-1.2.1.tar.gz
tar xzf libogg-1.1.4.tar.gz
bunzip2 < libvorbis-1.2.3.tar.bz2 | tar xf -
tar xzf flac-1.2.1.tar.gz
export CFLAGS=-I$HOME/mingw/include
export CXXFLAGS=-I$HOME/mingw/include
export LDFLAGS=-L$HOME/mingw/lib
cd libogg-1.1.4
./configure --host=i586-mingw32msvc --prefix=$HOME/mingw
make
make install
cd ../libvorbis-1.2.3
./configure --host=i586-mingw32msvc --prefix=$HOME/mingw
make
make install
cd ../flac-1.2.1
export CFLAGS="-I$HOME/mingw -DSIZE_T_MAX=UINT_MAX"
export CXXFLAGS="-I$HOME/mingw -DSIZE_T_MAX=UINT_MAX"
./configure --host=i586-mingw32msvc --prefix=$HOME/mingw
make
make install
2.3.7. boost
Get the Boost source code archive from http://www.boost.org/
Building Boost requires tht you tell the "bjam" build utility which
gcc to use. Note that you also need a working "bjam" binary before
building this library. See section 2.1.3 for details.
cd $HOME/mingw/src
wget -O boost_1_46_1.tar.bz2 http://sourceforge.net/projects/boost/files/boost/1.46.1/boost_1_46_1.tar.bz2/download
bunzip2 < boost_1_46_1.tar.bz2 | tar xf -
cd boost_1_46_1
./bootstrap.sh --with-bjam=/usr/bin/bjam --without-libraries=python,mpi \
--without-icu --prefix=$HOME/mingw/boost
echo "using gcc : : i586-mingw32msvc-g++ ;" > user-config.jam
bjam \
target-os=windows threadapi=win32 \
link=static runtime-link=static variant=release \
include=$HOME/mingw/include \
--user-config=user-config.jam --prefix=$HOME/mingw/boost \
install
Check if $HOME/prog/mingw/lib contains the filesystem, system and
regex libraries:
ls $HOME/mingw/boost/lib/libboost_{filesystem,system,regex}*
2.3.8. wxWidgets
Get the full wxWidgets source archive from http://www.wxwidgets.org/
cd $HOME/mingw/src
wget 'http://downloads.sourceforge.net/project/wxwindows/wxAll/2.8.10/wxWidgets-2.8.10.tar.bz2?use_mirror=ovh'
bunzip2 < wxWidgets-2.8.10.tar.bz2 | tar xf -
cd wxWidgets-2.8.10
export CFLAGS=-I$HOME/mingw/include
export CXXFLAGS=-I$HOME/mingw/include
export LDFLAGS=-L$HOME/mingw/lib
./configure --enable-gif --enable-unicode --disable-compat24 --disable-compat26 \
--host=i586-mingw32msvc --prefix=$HOME/mingw
make
make install
2.3.9. gettext (optional)
Get precompiled gettext binaries for mingw from
http://sourceforge.net/projects/mingw/files/ You need both the
"libintl...-dll-..." and the "gettext...-dev-..." packages.
cd $HOME/mingw/src
wget 'http://downloads.sourceforge.net/project/mingw/MinGW%20gettext/gettext-0.17-1/libintl-0.17-1-mingw32-dll-8.tar.lzma?use_mirror=heanet' \
'http://downloads.sourceforge.net/project/mingw/MinGW%20gettext/gettext-0.17-1/gettext-0.17-1-mingw32-dev.tar.lzma?use_mirror=heanet'
mkdir gettext
cd gettext
lzma -d < ../libintl-0.17-1-mingw32-dll-8.tar.lzma | tar xf -
lzma -d < ../gettext-0.17-1-mingw32-dev.tar.lzma | tar xf -
cp -R . $HOME/mingw
2.3.10. file/libmagic (optional)
Get precompiled binaries for 'regex' and 'file' for mingw from
http://gnuwin32.sourceforge.net/packages.html You need both the
"...-bin.zip" and the "...-lib.zip" packages.
cd $HOME/mingw/src
wget 'http://downloads.sourceforge.net/project/gnuwin32/regex/2.7/regex-2.7-bin.zip' \
'http://downloads.sourceforge.net/project/gnuwin32/regex/2.7/regex-2.7-lib.zip' \
'http://downloads.sourceforge.net/project/gnuwin32/file/5.03/file-5.03-bin.zip' \
'http://downloads.sourceforge.net/project/gnuwin32/file/5.03/file-5.03-lib.zip'
mkdir file
cd file
unzip -o ../regex-2.7-bin.zip
unzip -o ../regex-2.7-lib.zip
unzip -o ../file-5.03-bin.zip
unzip -o ../file-5.03-lib.zip
cp -R . $HOME/mingw
2.3.11. bzip2 (optional)
Get precompiled bzip2 binaries for mingw from
http://sourceforge.net/projects/mingw/files/ You need both the
"libbz2...-dll-..." and the "libbz2...-dev-..." packages.
cd $HOME/mingw/src
wget 'http://downloads.sourceforge.net/project/mingw/MinGW%20bzip2/release%201.0.5-2/libbz2-1.0.5-2-mingw32-dll-2.tar.gz' \
'http://downloads.sourceforge.net/project/mingw/MinGW%20bzip2/release%201.0.5-2/bzip2-1.0.5-2-mingw32-dev.tar.gz'
mkdir libbz2
cd libbz2
tar xzf ../libbz2-1.0.5-2-mingw32-dll-2.tar.gz
tar xzf ../bzip2-1.0.5-2-mingw32-dev.tar.gz
perl -pi -e 'if (m/Core.*low.*level.*library.*functions/) {
$_ .= qq|
#undef BZ_API
#undef BZ_EXTERN
#define BZ_API(func) func
#define BZ_EXTERN extern
|;
}
$_' include/bzlib.h
cp -R . $HOME/mingw
2.3.12. libcurl (optional)
Get the source code from http://curl.haxx.se/latest.cgi?curl=tar.bz2
cd $HOME/mingw/src
wget http://curl.linux-mirror.org/download/curl-7.21.3.tar.bz2
tar xjf curl-7.21.3.tar.bz2
cd curl-7.21.3
./configure \
--host=i586-mingw32msvc \
--prefix=$HOME/mingw \
--with-zlib=$HOME/mingw \
--enable-ipv6
make
make install
2.3.13. mkvtoolnix itself
Change back into the mkvtoolnix source code directory and execute the
following commands:
Finally, configure mkvtoolnix:
cd $HOME/path/to/mkvtoolnix-source
./configure \
--host=i586-mingw32msvc \
--with-extra-includes=$HOME/mingw/include \
--with-extra-libs=$HOME/mingw/lib \
--with-boost=$HOME/mingw/boost \
--with-wx-config=$HOME/mingw/bin/wx-config
make
--host=i686-pc-mingw32 \
--with-boost=$HOME/mingw-cross-env/usr/i686-pc-mingw32 \
--with-wx-config=$HOME/mingw-cross-env/usr/i686-pc-mingw32/bin/i686-pc-mingw32-wx-config
If everything works then build it:
./drake
You're done.