WebM/Updating libvpx

From MozillaWiki
Jump to: navigation, search

To update libvpx in Mozilla to the latest revision, you need to have access to a Mac, Linux and Windows machine. You must checkout and configure libvpx on each platform, copy the config files from every platform over to one machine, and prepare the update on that machine. This is because you can't configure builds for one platform on any other platform, and you need the config files for all platforms to prepare an update to libvpx.

On the Linux machine, checkout libvpx, and create directories for the x86-linux-gcc, x86_64-linux-gcc, and generic-gnu configurations. Configure and make these configurations.

$ git clone git://review.webmproject.org/libvpx.git
$ cd libvpx
$ mkdir objdir
$ cd objdir
$ mkdir x86-linux-gcc
$ cd x86-linux-gcc
$ ../../configure --target=x86-linux-gcc --disable-vp8-encoder --disable-examples --disable-install-docs
$ make
$ mkdir ../x86_64-linux-gcc
$ cd ../x86_64-linux-gcc
$ ../../configure --target=x86_64-linux-gcc --disable-vp8-encoder --disable-examples --disable-install-docs
$ make
$ mkdir ../generic-gnu
$ cd ../generic-gnu
$ ../../configure --target=generic-gnu --disable-vp8-encoder --disable-examples --disable-install-docs
$ make
$ cd ..

Currently, libvpx's configure will set the architecture flags wrong for x86-linux-gcc if run from a 64-bit machine (it mistakenly sets it as 64-bit). Either manually edit vpx_config.asm and vpx_config.h and toggle the ARCH_X86 and ARCH_X86_64 flags, or perform those steps on a 32-bit Linux machine.

On the Mac machine, checkout libvpx, and create directories for the x86_64-darwin9-gcc and x86-darwin9-gcc configurations. Configure and make these configurations. Note that this must be configured with --enable-pic.

$ git clone git://review.webmproject.org/libvpx.git
$ cd libvpx
$ mkdir objdir
$ cd objdir
$ mkdir x86_64-darwin9-gcc
$ cd x86_64-darwin9-gcc
$ ../../configure --target=x86_64-darwin9-gcc --disable-vp8-encoder --disable-examples --disable-install-docs --enable-pic
$ make
$ mkdir ../x86-darwin9-gcc
$ cd ../x86-darwin9-gcc
$ ../../configure --target=x86-darwin9-gcc --disable-vp8-encoder --disable-examples --disable-install-docs --enable-pic
$ make
$ cd ..

On the Win32 machine, checkout libvpx, and create a directory for the x86-win32-vs8 configuration. Configure and make this configuration.

$ git clone git://review.webmproject.org/libvpx.git
$ cd libvpx
$ mkdir objdir
$ cd objdir
$ mkdir x86-win32-vs8
$ cd x86-win32-vs8
$ ../../configure --target=x86-win32-vs8 --disable-vp8-encoder --disable-examples --disable-install-docs
$ make

Ignore the warning about devenv.com not found in path when building on Win32. You don't need the build to succeed, you just need the first few steps of the build process to generate the vpx_config* files.

On the Linux machine again, you need either a working Scratchbox environment or an Android NDK installed. These instructions are for the Scratchbox environment. You can find details on setting one up, along with all the pre-requisites to build Fennec for Maemo at Mobile/Build/cs2007q3/Fremantle. Make the libvpx checkout you did above available in the scratchbox environment (e.g., move it under ~/scratchbox/), and from that inside the checkout in Scratchbox execute:

$ cd objdir
$ mkdir armv7-linux-gcc
$ cd armv7-linux-gcc
$ CROSS=arm-linux-gnueabi- ../../configure --target=armv7-linux-gcc --disable-vp8-encoder --disable-examples --disable-install-docs --enable-pic --enable-runtime-cpu-detect --enable-arm-asm-detok

You don't need to run make, because you don't need vpx_config.asm for the ARM targets.

Once you've configured and built the targets specified above on their respective platforms, copy the objdirs of those targets onto the machine on which you want to prepare the update. For example, if you were going to prepare the update from the Linux machine, you'd do something like:

$ scp -r user@mac_machine:~/path/to/libvpx/objdir/ ~/path/to/local/libvpx/objdir/
$ scp -r user@win32_machine:~/path/to/libvpx/objdir/ ~/path/to/local/libvpx/objdir/

(In reality you'd likely need to have the scp "push" from the Windows machine to the Linux machine, unless you'e got an scp daemon running on your Windows machine...)

You should be left with a libvpx directory on one of your machines with an objdir with the following 6 configurations:

$ ls -1 objdir/
armv7-linux-gcc
generic-gnu
x86_64-darwin9-gcc
x86-darwin9-gcc
x86_64-linux-gcc
x86-linux-gcc
x86-win32-vs8

Once you have the objdir setup, change to the media/libvpx directory in your Mozilla tree:

$ cd /path/to/mozilla/media/libvpx

Run the update script, passing it the path to the libvpx directory which contains the objdir (not the path to the objdir, the path to the libvpx directory, which is the parent directory of objdir).

$ ./update.sh ~/path/to/libvpx/

This will copy the updated source files from the libvpx directory into the Mozilla source tree, and update the configuration files for each platform. Make sure to watch the script output to see if any files failed to copy. The update script also applies a number of patches for local fixes, you must check the update script output to ensure that the patches successfully applied as well, and update them if not.

Once you're satisfied that no errors occurred during the update, you can roll the bundle the changes up into a patch.