## Notes for Building Audacious on Windows

John Lindgren
April 13, 2017

Several patch files should accompany this document.

### Set up MSYS2 environment

Download and run:
`http://repo.msys2.org/distrib/i686/msys2-i686-20161025.exe`

Accept the default options to install to `C:\msys32`.

Edit `C:\msys32\home\<user>\.bashrc` and add the following lines:

> `export PATH="$PATH:/C/cmake/bin:/C/GTK/bin:/C/libs/bin:/C/aud/bin"
> export PKG_CONFIG_PATH=/C/Qt/5.12.5/mingw73_32/lib/pkgconfig:/C/GTK/lib/pkgconfig:/C/libs/lib/pkgconfig:/C/aud/lib/pkgconfig
> export C_INCLUDE_PATH=/C/GTK/include:/C/libs/include
> export CPLUS_INCLUDE_PATH=/C/GTK/include:/C/libs/include
> export LIBRARY_PATH=/C/GTK/lib:/C/libs/lib`

In the MinGW shell (MSYS2 MinGW 32-bit, not MSYS2 MSYS):

> `pacman -Syu
> pacman -S autoconf automake bison gperf libtool mingw-w64-i686-gcc mingw-w64-i686-gettext make perl-XML-Parser pkg-config python2`

### Install CMake

Download and run:
`https://cmake.org/files/v3.8/cmake-3.8.2-win32-x86.msi`

Install to `C:\cmake`.

### Install Qt (for Qt builds)

Download and run (choose another mirror if desired):
`http://qt.mirror.constant.com/archive/online_installers/3.1/qt-unified-windows-x86-3.1.1-online.exe`

Choose the following install options:

- Skip the Qt account login page
- Use the default installation path (`C:\Qt`)
- Install Qt 5.12.5 for MinGW 7.3.0 32-bit

### Install libpng

Download and unzip to `C:\libpng`:
`https://sourceforge.net/projects/libpng/files/libpng16/1.6.29/libpng-1.6.29.tar.xz/download`

In the MinGW shell:

> `cd /C/libpng
> ./configure --prefix=/C/GTK
> make
> make install`

### Install libjpeg-turbo

Download and unzip to `C:\libjpeg`:
`https://sourceforge.net/projects/libjpeg-turbo/files/1.5.1/libjpeg-turbo-1.5.1.tar.gz/download`

In the MinGW shell:

> `cd /C/libjpeg
> ./configure --prefix=/C/GTK --without-simd --without-turbojpeg
> make
> make install`

### Install libffi

Download and unzip to `C:\libffi`:
`ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz`

In the MinGW shell:

> `cd /C/libffi
> ./configure --prefix=/C/GTK --with-gcc-arch=i686
> make
> make install`

### Install GLib

Download and unzip to `C:\glib`:
`http://ftp.gnome.org/pub/GNOME/sources/glib/2.52/glib-2.52.3.tar.xz`

Apply the recursive patches `glib-2-52.diff` and `glib-gettext-fix.diff`.

In the MinGW shell:

> `cd /C/glib
> CFLAGS="-O2 -march=i686" ./configure --prefix=/C/GTK --with-pcre=internal
> make
> make install`

### Install pixman

Download and unzip to `C:\pixman`:
`https://www.cairographics.org/releases/pixman-0.34.0.tar.gz`

In the MinGW shell:

> `cd /C/pixman
> ./configure --prefix=/C/GTK --disable-sse2 --disable-ssse3
> make
> make install`

### Install Cairo

Download and unzip to `C:\cairo`:
`https://www.cairographics.org/releases/cairo-1.14.8.tar.xz`

In the MinGW shell:

> `cd /C/cairo
> ./configure --prefix=/C/GTK --disable-interpreter
> make
> make install`

### Install FreeType

Download and unzip to `C:\freetype`:
`https://sourceforge.net/projects/freetype/files/freetype2/2.9/freetype-2.9.tar.bz2/download`

In the MinGW shell:

> `cd /C/freetype
> ./configure --prefix=/C/GTK
> make
> make install`

### Install HarfBuzz

Download and unzip to `C:\harfbuzz`:
`https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.7.4.tar.bz2`

In the MinGW shell:

> `cd /C/harfbuzz
> ./configure --prefix=/C/GTK
> make
> make install`

### Install Fontconfig

Download and unzip to `C:\fontconfig`:
`https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.6.tar.bz2`

In the MinGW shell:

> `cd /C/fontconfig
> ./configure --prefix=/C/GTK
> make
> make install`

### Install Pango

Download and unzip to `C:\pango`:
`http://ftp.gnome.org/pub/GNOME/sources/pango/1.40/pango-1.40.5.tar.xz`

In the MinGW shell:

> `cd /C/pango
> ./configure --prefix=/C/GTK
> make
> make install`

### Install gdk-pixbuf

Download and unzip to `C:\gdk-pixbuf`:
`http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36/gdk-pixbuf-2.36.6.tar.xz`

Apply the patch `gdk-pixbuf-util.c.diff` to `C:\gdk-pixbuf\gdk-pixbuf\gdk-pixbuf-util.c`.

In the MinGW shell:

> `cd /C/gdk-pixbuf
> ./configure --prefix=/C/GTK --enable-relocations --without-gdiplus --without-libtiff --with-included-loaders=bmp,jpeg,png
> make
> make install`

### Install libcroco

Download and unzip to `C:\libcroco`:
`http://ftp.gnome.org/pub/GNOME/sources/libcroco/0.6/libcroco-0.6.12.tar.xz`

In the MinGW shell:

> `cd /C/libcroco
> ./configure --prefix=/C/GTK
> make
> make install`

### Install librsvg

Download and unzip to `C:\librsvg`:
`http://ftp.gnome.org/pub/GNOME/sources/librsvg/2.40/librsvg-2.40.20.tar.xz`

In the MinGW shell:

> `cd /C/librsvg
> ./configure --prefix=/C/GTK --disable-introspection
> make
> make install`

### Install ATK

Download and unzip to `C:\atk`:
`http://ftp.gnome.org/pub/gnome/sources/atk/2.24/atk-2.24.0.tar.xz`

Apply the patch `atkprivate.c.diff` to `C:\atk\atk\atkprivate.c`.

In the MinGW shell:

> `cd /C/atk
> ./configure --prefix=/C/GTK
> make
> make install`

### Install GTK+

Download and unzip to `C:\gtksrc`:
`http://ftp.gnome.org/pub/GNOME/sources/gtk+/2.24/gtk+-2.24.31.tar.xz`

Apply the patch `gdkwindow-win32.c.diff` to `C:\gtksrc\gdk\win32\gdkwindow-win32.c`.
Apply the patch `gtkicontheme.c.diff` to `C:\gtksrc\gtk\gtkicontheme.c`.
Apply the patch `gtkmain.c.diff` to `C:\gtksrc\gtk\gtkmain.c`.
Apply the recursive patch `gtk-parentheses.diff`.

In the MinGW shell:

> `cd /C/gtksrc
> ./configure --prefix=/C/GTK
> make
> make install`

It may be necessary to run the MinGW shell with administrative privileges for GTK+ to build successfully.

### Install intltool

Download and unzip to `C:\intltool`:
`http://ftp.gnome.org/pub/GNOME/sources/intltool/0.40/intltool-0.40.6.tar.bz2`

In the MinGW shell:

> `cd /C/intltool
> ./configure --prefix=/C/GTK
> make
> make install`

### Install GNOME Icon Theme

Download and unzip to `C:\gnome-icon-theme`:
`http://ftp.gnome.org/pub/GNOME/sources/gnome-icon-theme/3.12/gnome-icon-theme-3.12.0.tar.xz`

In the MinGW shell:

> `cd /C/gnome-icon-theme
> ./configure --prefix=/C/GTK --disable-icon-mapping
> make
> make install`

It may be necessary to run the MinGW shell with administrative privileges for GNOME Icon Theme to install successfully.

### Install GNU regex

Download and unzip to `C:\libs`:
`http://sourceforge.net/projects/mingw/files/Other/UserContributed/regex/mingw-regex-2.5.1/mingw-libgnurx-2.5.1-bin.tar.gz/download`
`http://sourceforge.net/projects/mingw/files/Other/UserContributed/regex/mingw-regex-2.5.1/mingw-libgnurx-2.5.1-dev.tar.gz/download`

### Install libxml

Download and unzip to `C:\libxml`:
`ftp://xmlsoft.org/libxml2/libxml2-2.9.9.tar.gz`

In the MinGW shell:

> `cd /C/libxml
> ./configure --prefix=/C/libs --with-python=no
> make
> make install`

### Install mpg123

Download and unzip to `C:\mpg123`:
`http://mpg123.de/download/mpg123-1.25.13.tar.bz2`

In the MinGW shell:

> `cd /C/mpg123
> ./configure --prefix=/C/libs
> make
> make install`

### Install libfaad

Download and unzip to `C:\libfaad`:
`https://sourceforge.net/projects/faac/files/faad2-src/faad2-2.8.0/faad2-2.8.8.tar.gz/download`

Apply the patch `libfaad-decoder.c.diff` to `C:\libfaad\decoder.c`.

In the MinGW shell:

> `cd /C/libfaad
> ./configure --prefix=/C/libs
> make
> make install`

### Install libsndfile

Download and unzip to `C:\libsndfile`:
`http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz`

In the MinGW shell:

> `cd /C/libsndfile
> ./configure --prefix=/C/libs
> make
> make install`

### Install libbs2b

Download and unzip to `C:\libbs2b`:
`http://sourceforge.net/projects/bs2b/files/libbs2b/3.1.0/libbs2b-3.1.0.tar.bz2/download`

In the MinGW shell:

> `cd /C/libbs2b
> ./configure --prefix=/C/libs
> make
> make install`

### Install libcdio

Download and unzip to `C:\libcdio`:
`http://ftp.gnu.org/gnu/libcdio/libcdio-2.1.0.tar.bz2`

Download and unzip to `C:\libcdio-paranoia`:
`http://ftp.gnu.org/gnu/libcdio/libcdio-paranoia-10.2+2.0.0.tar.bz2`

In the MinGW shell:

> `cd /C/libcdio
> ./configure --prefix=/C/libs
> make
> make install
> cd /C/libcdio-paranoia
> ./configure --prefix=/C/libs
> make
> make install`

### Install libcddb

Download and unzip to `C:\libcddb`:
`http://sourceforge.net/projects/libcddb/files/libcddb/1.3.2/libcddb-1.3.2.tar.bz2/download`

Apply the recursive patch `libcddb-1.3.diff`.

In the MinGW shell:

> `cd /C/libcddb
> ./configure --prefix=/C/libs
> make
> make install`

### Install libcue

Download and unzip to `C:\libcue`:
`https://github.com/lipnitsk/libcue/archive/v2.2.1.tar.gz`

In the MinGW shell:

> `cd /C/libcue
> cmake -DCMAKE_INSTALL_PREFIX=/C/libs -DBUILD_SHARED_LIBS=1 -G"MSYS Makefiles"
> make
> make install`

### Install LAME

Download and unzip to `C:\lame`:
`https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz/download`

Apply the patch `libmp3lame.sym.diff` to `C:\lame\include\libmp3lame.sym`.

In the MinGW shell:

> `cd /C/lame
> ./configure --prefix=/C/libs --disable-frontend
> make
> make install`

### Install libflac

Download and unzip to `C:\libflac`:
`https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.3.3.tar.xz`

In the MinGW shell:

> `cd /C/libflac
> ./configure --prefix=/C/libs --disable-asm-optimizations --disable-sse --disable-ogg
> make
> make install`

### Install libogg

Download and unzip to `C:\libogg`:
`https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.4.tar.xz`

In the MinGW shell:

> `cd /C/libogg
> ./configure --prefix=/C/libs
> make
> make install`

### Install libvorbis

Download and unzip to `C:\libvorbis`:
`https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.6.tar.xz`

In the MinGW shell:

> `cd /C/libvorbis
> ./configure --prefix=/C/libs
> make
> make install`

### Install libneon

Download and unzip to `C:\libneon`:
`http://www.webdav.org/neon/neon-0.30.2.tar.gz`

Apply the recursive patch `neon-0.30.diff`.

In the MinGW shell:

> `cd /C/libneon
> ./autogen.sh
> ./configure --prefix=/C/libs --enable-shared
> make
> make install`

### Install libsamplerate

Download and unzip to `C:\libsamplerate`:
`http://www.mega-nerd.com/SRC/libsamplerate-0.1.9.tar.gz`

Apply the recursive patch `libsamplerate-0.1.diff`.

In the MinGW shell:

> `cd /C/libsamplerate
> ./configure --prefix=/C/libs
> make
> make install`

### Install libwavpack

Download and unzip to `C:\libwavpack`:
`http://www.wavpack.com/wavpack-5.1.0.tar.bz2`

Apply the recursive patch `wavpack-4.80.diff`.

In the MinGW shell:

> `cd /C/libwavpack
> ./configure --prefix=/C/libs
> make
> make install`

### Install FFmpeg

Download and unzip to `C:\ffmpeg`:
`http://ffmpeg.org/releases/ffmpeg-4.2.1.tar.xz`

In the MinGW shell:

> `cd /C/ffmpeg
> ./configure --prefix=/C/libs --enable-shared --disable-yasm --cpu=i686
> make
> make install`

### Install libmms

Download and unzip to `C:\libmms`:
`http://sourceforge.net/projects/libmms/files/libmms/0.6.4/libmms-0.6.4.tar.gz/download`

Apply the recursive patch `libmms-strndup.diff`.

In the MinGW shell:

> `cd /C/libmms
> cp /C/msys32/usr/share/libtool/build-aux/ltmain.sh .
> autoreconf
> ./configure --prefix=/C/libs
> make
> make install`

### Install libbinio

Download and unzip to `C:\libbinio`:
`https://github.com/adplug/libbinio/releases/download/libbinio-1.5/libbinio-1.5.tar.bz2`

In the MinGW shell:

> `cd /C/libbinio
> ./configure --prefix=/C/libs
> make
> make install`

### Install adplug

Download and unzip to `C:\adplug`:
`https://github.com/adplug/adplug/releases/download/adplug-2.3.1/adplug-2.3.1.tar.bz2`

In the MinGW shell:

> `cd /C/adplug
> ./configure --prefix=/C/libs
> make
> make install`

### Install libmodplug

Download and unzip to `C:\libmodplug`:
`https://sourceforge.net/projects/modplug-xmms/files/libmodplug/0.8.9.0/libmodplug-0.8.9.0.tar.gz/download`

In the MinGW shell:

> `cd /C/libmodplug
> ./configure --prefix=/C/libs
> make
> make install`

### Install libsidplayfp

Download and unzip to `C:\libsidplayfp`:
`https://sourceforge.net/projects/sidplay-residfp/files/libsidplayfp/2.0/libsidplayfp-2.0.1.tar.gz/download`

In the MinGW shell:

> `cd /C/libsidplayfp
> ./configure --prefix=/C/libs
> make
> make install`

### Install FluidSynth

Download and unzip to `C:\fluidsynth` (ignore "cannot create symlink" errors):
`http://sourceforge.net/projects/fluidsynth/files/fluidsynth-1.1.6/fluidsynth-1.1.6.tar.bz2/download`

Apply the recursive patch `fluidsynth.diff`.

In the MinGW shell:

> `cd /C/fluidsynth
> ./autogen.sh
> ./configure --prefix=/C/libs
> make
> make install`

### Install Audacious

Download and unzip to `C:\audacious`:
`https://distfiles.audacious-media-player.org/audacious-3.8.tar.bz2`

In the MinGW shell:

> `cd /C/audacious
> ./configure --prefix=/C/aud
> make
> make install`

### Install Audacious Plugins

Download and unzip to `C:\audacious-plugins`:
`https://distfiles.audacious-media-player.org/audacious-plugins-3.8.tar.bz2`

In the MinGW shell:

> `cd /C/audacious-plugins
> ./configure --prefix=/C/aud
> make
> make install`