Build Instructions

From Aegisub Wiki

Jump to: navigation, search

This page contains instructions on how to compile Aegisub by yourself for the Windows operating system. For Linux, FreeBSD and other UNIX-based systems, please see Unix Instructions.

This is a fairly complex process, but required if you plan to stay ahead of SVN snapshots or contribute to the project by sending patches. The repository is located at http://svn.aegisub.net/trunk/.

If you have any issues build Aegisub, please drop us a line in the official IRC channel.

Contents

[edit] Requirements

Aegisub requires the following to compile on Windows:

  1. Microsoft Visual C++:
    • 2008 is the recommended version, and is known to work. It's uncertain whether Express works.
    • 2005 also works fine, and used to be the recommended version. Express works.
    • 2003 hasn't been tested in a while, but might work.
    • mingw32 has never been tested, and will probably not work.
  2. wxWidgets 2.8.x built with OpenGL support (recommended: 2.8.9)
  3. wxSTC (included with wxWidgets in contrib/ directory)
  4. Some features might require additional libraries
  5. If you're using Visual C++ Express, you will also need the Platform SDK (Windows 2003 or Windows 2008 one, former seems to work better).

[edit] Obtaining the source

You will have to use the TortoiseSVN client. Even if you don't want to use it, you'll need it installed, as Aegisub uses one of its tools for building.

  1. Download TortoiseSVN at http://tortoisesvn.tigris.org/ and install it.
  2. Create an empty folder somewhere for the Aegisub project and binaries.
  3. On that folder, create an empty "src" folder.
  4. Right click that "src" folder, choose "SVN Checkout", and check out the url "http://svn.aegisub.net/trunk/".

If everything goes well, you'll see a list of files being downloaded. After it finishes, you're done getting the source.

[edit] Building wxWidgets

First of all, you need to build wxWidgets:

  1. Get the latest release of wxWidgets 2.8.x
    • wxWidgets 2.8.9 has no known issues
    • wxWidgets 2.8.8 has a bug in wxSpinCtrl that will only allow you to use the arrow controls to change the value. To fix this you will either have to use a newer snapshot or hack the source.
      1. Open "src\msw\spinctrl.cpp
      2. Go to line 180
      3. Change return DLGC_WANTARROWS; to return DLGC_WANTALLKEYS;
  2. Open the solution file located under the "build\msw" folder
  3. Enable OpenGL support:
    1. Open "include\wx\msw\setup.h"
    2. Go to line 994
    3. Set wxUSE_GLCANVAS to 1
  4. Build both "Unicode Release" and "Unicode Debug" versions
  5. Open "contrib\build\stc\stc.sln" and build that as well (on both Unicode Release and Unicode Debug)

[edit] Setting up MSVC folders

Before building Aegisub, you will need to set up MSVC's folders. Go to the "Tools" menu, then "Options", "Projects and Solutions", "VC++ Directories".

On the following lines, replace "C:\wxWidgets-2.8.7" with the folder where you installed wxWidgets and "C:\Program Files\TortoiseSVN" with the folder where you installed TortoiseSVN (this is necessary even if you use another SVN client).

  • Add to MSVC include folders:
    • C:\wxWidgets-2.8.7\include
    • C:\wxWidgets-2.8.7\include\msvc
    • C:\wxWidgets-2.8.7\contrib\include
    • C:\wxWidgets-2.8.7\src\zlib
  • Add to MSVC lib folders:
    • C:\wxWidgets-2.8.7\lib\vc_lib
  • Add to MSVC executable folders:
    • C:\Program Files\TortoiseSVN\bin

[edit] Building minimal Aegisub

  1. From the SVN trunk, open the appropriate project file:
    1. Visual Studio 2005: build\aegisub_vs2005\aegisub_vs2005.vcproj
    2. Visual Studio 2008: build\aegisub_vs2008\aegisub_vs2008.vcproj
  2. Build it

[edit] Building Aegisub's additional features

After you have a minimal build of Aegisub working, open "aegisub\win32\config.h" and uncomment any features that you might want to enable.

For CSRI, Automation, Auto3, Hunspell and Universal Charset Detection, the projects are already on the repository: just add them to the solution and set the project "aegisub_vs2005" to depend on them (right click on Aegisub and click "Project Dependencies..."). Since those are very important features, and are easy to build, we highly recommend that you build them. The projects are:

  • csri\csri.vcproj - For styles preview and some subtitle rendering
  • lua51\lua51_vc8.vcproj - For automation and auto3 support
  • hunspell\src\win_api\libhunspell.vcproj - For spellchecking support
  • universalchardet\universalcharset.vcproj - For autodetection support

For Visual Studio 2008, please use the "_2008" (or "_vc9") projects instead.

For the other dependencies, you will need to manually compile the libraries and put them somewhere that Visual Studio can find them. Also, for FreeType2, you will need to set the #define to the appropriate library name.

[edit] DirectSound

For DirectSound support, you'll need the DirectX SDK. If you intend to compile VSFilter as well, it's recommended that you use the April 2007 SDK.

[edit] DirectShow

For DirectShow support, you'll need baseclasses, which is included in the Platform SDK for Windows 2003.

[edit] ffmpeg

On Windows, compiling Aegisub with ffmpeg is is only useful for testing and development purposes. Nevertheless, it is possible. The recommended way of doing it is to compile it as a static library (building it as shared is rumored to work but I haven't tested it) using MinGW and MSYS (make sure you update the MSYS packages from the "technology preview" branch since the current stable is from 2004 or so and will not work), using gcc 4.2.x or newer (important!).

First install MinGW and MSYS, then either compile or otherwise obtain gcc 4.2.x. Check out ffmpeg from SVN, then run configure, like so:

./configure --enable-memalign-hack --enable-gpl --enable-swscale

Additional recommended options are:

--prefix=/mingw --disable-encoders --disable-muxers --enable-small --disable-debug

If you're feeling adventurous, you can also try building with some of the external libraries like libfaad and liba52, but I wouldn't recommend it.

Next step, actually compile it:

make

Then install it into your MinGW folders (you did use --prefix=/mingw right?)

make install

And with that you're done with MSYS.

Now go to wherever you installed MinGW and check the include folder. You will see a bunch of folders named libavcodec, libavformat, libavutil etc etc. Create a new folder called ffmpeg and copy all the .h files from the libav* folders into that folder. In the MinGW/lib folder, look in the subfolders until you find the libgcc.a belonging to whatever version of gcc you built ffmpeg with (i.e. 4.2.x). Copy that from the subfolder it's in to mingw/lib.

Since MSVC doesn't like MinGW's inttypes.h and stdint.h, you need to find compatible versions and replace the ones in MinGW/include with those (it might be a good idea to back up the original ones). To spare you some googling, here they are: inttypes.h, stdint.h

In MSVC, go to the options and add X:/mingw/include to the include paths (important: make sure you move it to the very bottom so it gets included last, or your usual projects will end up with the wrong math.h etc etc) and X:/mingw/lib to the library paths. Then rightclick the Aegisub project, go to properties -> linker -> input. Add the following lines to "additional dependencies" (you can do this for only release, only debug, or both; do what suits you):

libgcc.a
libmingwex.a
libwsock32.a
libavutil.a
libavcodec.a
libavformat.a
libswscale.a

plus any external libraries you might have compiled (i.e. liba52.a).

Finally, go to config.h and uncomment

#define WITH_FFMPEG
#define WITH_STATIC_FFMPEG

and you're ready to build.

Personal tools