预先编译

The following packages are required for the development of all WebM projects:

  • Git version 1.5.4 or newer

VP8 Codec SDK (libvpx)

The VP8 SDK supports a large variety of targets and build
environments. These are generally identified by a isa-os-compiler
triplet. This is the instruction set architecture, the operating
system, and compiler used to compile for the target. A full list of
these targets can be seen by running ./configure --help in the root
of your source tree. (Windows users will need to set up MSYS
before being able to run this command.) Certain targets require special
setup be completed. Please see if one of the sections on this page
applies to you before trying to build the codec library.

Building For x86 (32- and 64-bit)

The Yasm assembler is required
to build optimized libraries for x86 platforms. Version 0.8.0 is
recommended, as there is a
known issue that
may affect later versions. For Unix-like platforms, binary
distributions are likely to be included in your package manager
already, or you can easily build from source. Windows users are
advised to download the pre-built binary.

Building For Windows

There are two methods of building for Windows.

Using Visual Studio

Visual Studio project files are available in each release
snapshot
, but are not
present in code checked out from the Git repository. To build a
release snapshot on Windows, you only need to install Yasm, as
described above. The project files are located in the build/
subdirectory.

These files are generated using our Makefile build system, so if you
wish to work on the latest code from Git on Windows, you’ll have to
install a Unix-workalike environment like MSYS or Cygwin. Instructions
for installing MSYS can be found below. When creating the Visual Studio
projects from source, you’ll have to do some additional setup:

Decide on “in-tree” or “out-of-tree” build method.

The “build root” is not necessarily the same directory as the “source
root” with this build system. This allows you to keep your source tree
pristine and not clutter it with object files, temporary files, output
runs, etc. You can wipe out your whole build root at any time without
worrying too much about it. We first must choose the build root we
want to use:

  • In-Tree Build Root means that your build root is a subdirectory
    of the source root. The advantage of this approach is that the Git
    Extensions plug-in for Visual Studio can be used. Create the following
    directory (use vs7 for VS 2003): libvpx/build/x86-win32-vs8 Note that
    git has been configured to ignore this directory — we don’t want the
    generated files to be checked in.

  • Out-Of-Tree Build Root means that the build root is not a child
    of the source root. This is the most common configuration used.
    Typically you create a build directory in the same location that the
    libvpx tree is checked out.

Configure The Build Root

The first thing that must be done to a new build root is to configure
it for the configuration of the SDK that you want to build. Start a
Cygwin or MSYS shell, and navigate to your build directory. Then issue
the configure command below to enable an encoder/decoder build of a
single codec:

$ cd /cygdrive/c/on2/build
$ ../on2_codec_sdk/configure --target=x86-win32-vs8 --enable-static-msvcrt
  • --disable-install-docs is not necessary if you have installed
    the doxygen program in your cygwin setup
  • --enable-static-msvcrt to switch all vs8 projects to use
    static for Runtime library option, i.e. /MT and /MTd,
    instead of /MD and /MDd by default.

  • ../on2_codec_sdk/configure --help has interesting output.

  • vs8 is for Visual Studio 2005, vs7 is for Visual Studio .NET 2003

Build The VS Projects

If configuration succeeded (it should) you can now execute the scripts
that create the visual studio solutions and projects:

$ make

That’s It!

You typically will not need to rerun the configuration scripts, but it
doesn’t hurt to do so. You will need to rerun them if you pull in
changes to any file named configure or .mk, or if any files are
added, removed, or renamed (even by others). You should be aware that
your changes will be overwritten any time you modify the project
settings through the properties page. The Makefiles and associated
scripts are the authoritative location for all build related
information.
This means if you add, remove, or rename a file, you
must do so in the Makefiles first, and then regenerate the project
files from them.

Using MSYS

If you’re already familiar with MSYS, there’s likely nothing here that
will surprise you. If this is your first time installing MSYS, read
on …

Download depot_tools

The depot_tools are used to download the tools and patches needed to
build the VP8 library on Windows. They facilitate a one-step
dependencies download, and allow you to avoid the hassle of
downloading individual MSYS archives.

Get the Chromium MinGW dependencies

Now we use the depot_tools installation to grab MSYS, and a subset of
MSYS tools needed for building VP8.

  1. Create a very simple .gclient in an empty directory, and insert
    the following text:

    solutions = [
     {  "name" : "mingw",
    "url"  : "http://src.chromium.org/svn/trunk/deps/third_party/mingw"
     }
    ]

    • Tip: A text editor like Notepad++ will be useful here since
      Windows doesn’t want to allow you to name a file .gclient. Note
      that any text editor will do, provided that it will allow you to
      name a file .gclient — Notepad++ is not required.
  2. Open a cmd.exe window, cd to the directory where you saved
    your .gclient, and execute the command:

    D:srcchromium_mingw_deps>gclient sync

    It will return output similar to the following.

    __ running 'svn checkout
    http://src.chromium.org/svn/trunk/deps/third_party/mingw
    D:srcchromium_mingw_depsmingw
       ' in 'D:srcchromium_mingw_deps'
       A    D:srcchromium_mingw_depsmingwREADME.chromium
       A    D:srcchromium_mingw_depsmingwmingwrt-3.15.2-mingw32-dev.tar.gz
       A    D:srcchromium_mingw_depsmingwpthreads-w32.patch.txt
       A    D:srcchromium_mingw_depsmingwmsysCORE-1.0.11-20080826-src.tar.gz
       A    D:srcchromium_mingw_depsmingwcoreutils-5.97-MSYS-1.0.11-snapshot-src.tar.bz2
       A    D:srcchromium_mingw_depsmingwgcc-4.2.1-2-src.tar.gz
       A    D:srcchromium_mingw_depsmingww32api-3.13-mingw32-src.tar.gz
       A    D:srcchromium_mingw_depsmingwgcc-core-4.2.1-sjlj-2.tar.gz
       A    D:srcchromium_mingw_depsmingwbinutils-2.17.50-20060824-1.tar.gz
       A    D:srcchromium_mingw_depsmingwpthreads-w32-2-8-0-release.tar.gz
       A    D:srcchromium_mingw_depsmingwMSYS-1.0.11.exe
       A    D:srcchromium_mingw_depsmingwmingwrt-3.15.2-mingw32-src.tar.gz
       A    D:srcchromium_mingw_depsmingwbinutils-2.17.50-20060824-1-src.tar.gz
       A    D:srcchromium_mingw_depsmingww32api-3.13-mingw32-dev.tar.gz
       A    D:srcchromium_mingw_depsmingwcoreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2

    • Tip: If subversion is not installed, depot_tools will
      install it for you! No need to stop here to install it yourself.

发表评论

电子邮件地址不会被公开。 必填项已用*标注