Built on Ubuntu 12.04 using the following extra tools:
GNU Binutils 2.27
GCC 5.4.0
YASM 1.3.0

export CFLAGS="-O2 -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
export CXXFLAGS="-std=gnu++11 -O2 -fno-strict-aliasing -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2"
export LDFLAGS="-s -Wl,-z,relro -Wl,--as-needed"

ICU 55.1-7.debian:
./configure --enable-release --with-data-packaging=library

Boost 1.63.0:
sudo ./b2 variant=release link=static threading=multi \
  cxxflags="$CXXFLAGS -Wno-unused-variable -Wno-unused-function" \
  cflags="$CFLAGS -Wno-unused-variable -Wno-unused-function" -j4 install

wxWidgets 3.0.2:
./configure --with-libxpm --with-opengl --with-sdl

FFmpeg 3.2.3:
./configure --disable-programs --disable-doc --disable-encoders --disable-muxers --enable-libpulse \
  --disable-libxcb --disable-debug --enable-pic --optflags=-O3

ffms2 2.23.1:
./configure --enable-shared --disable-static

freetype 2.7.1:
./configure --enable-shared --disable-static

libass: https://github.com/libass/libass/tree/cb985b51683dcbff5671cf9abc65b1b0825b2e75
fribidi: https://github.com/behdad/fribidi/tree/0ca97b7feb52a9bd1b03aa379bc77fc4fe05957e
harfbuzz: https://github.com/behdad/harfbuzz/tree/4ec19319ab195d852708661e12da2a6485fce544

Aegisub:
sed -i -e "s|\?data/locale/|/usr/share/locale/|g" src/aegisublocale.cpp
LUA="$PWD/vendor/luajit/src/host/minilua" \
CFLAGS="-std=gnu99 $CFLAGS -pthread" \
CXXFLAGS="$CXXFLAGS -pthread" \
LDFLAGS="$LDFLAGS -pthread -lpthread -lrt" \
LIBS="-lm -ldl -lrt" \
  ./configure --prefix=/usr --disable-compiler-flags --disable-debug --disable-rpath --disable-update-checker
make -j4 -C vendor/luajit/src/ amalg V=1
make -j4 LIBS_PTHREAD="-pthread -lpthread" V=1

For some reason I needed to relink the binaries with 'libaegisub/unix/*.o' put
in front of the static libraries.

g++ -o src/aegisub libaegisub/unix/*.o src/*.o src/libresrc/*.o src/command/*.o \
vendor/luajit/src/libluajit.a lib/libaegisub.a lib/libluabins.a lib/libresrc.a \
-s -Wl,-z,relro -Wl,--as-needed -pthread -lpthread -lrt \
-ldl -lm -lm -ldl -lrt -lGL   -pthread -lpthread -lrt -L/usr/local/lib -pthread \
-lwx_gtk2u_gl-3.0 -lwx_gtk2u_stc-3.0 -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 \
-lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0 \
-lz -L/usr/local/lib -lfreetype   -L/usr/local/lib -lass   -L/usr/local/lib -lfontconfig -lfreetype \
-lfftw3 -lm    -L/usr/local/lib -lboost_filesystem -lboost_locale -lboost_regex -lboost_system \
-lboost_thread -lboost_chrono -L/usr/local/lib -licuuc -licudata   -L/usr/local/lib -licui18n \
-licuuc -licudata   -lasound -lrt -lpulse   -lopenal   -L/usr/local/lib -lffms2   -lhunspell-1.3

g++ -o automation/aegisub-lua automation/tests/aegisub.o libaegisub/unix/*.o \
lib/libaegisub.a lib/libluabins.a vendor/luajit/src/libluajit.a \
-s -Wl,-z,relro -Wl,--as-needed -pthread -lpthread -lrt -ldl -lm -lm -ldl -lrt -L/usr/local/lib -pthread  \
-lwx_gtk2u_gl-3.0 -lwx_gtk2u_stc-3.0 -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 \
-lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0  -lz -L/usr/local/lib -lboost_filesystem \
-lboost_locale -lboost_regex -lboost_system -lboost_thread -lrt -lboost_chrono -L/usr/local/lib -licuuc -licudata  \
-L/usr/local/lib -licui18n -licuuc -licudata

g++ -o tools/repack-thes-dict tools/repack-thes-dict.o libaegisub/unix/*.o lib/libaegisub.a \
-s -Wl,-z,relro -Wl,--as-needed -pthread -lpthread -lrt -lm -ldl -L/usr/local/lib \
-lboost_filesystem -lboost_locale -lboost_regex -lboost_system -lboost_thread -lrt -lboost_chrono \
-L/usr/local/lib -licuuc -licudata   -L/usr/local/lib -licui18n -licuuc -licudata


https://github.com/probonopd/AppImages/blob/master/functions.sh

sed -i -e "s|/usr|././|g" aegisub-real

ldd aegisub-real | grep "=>" | awk '{print $3}' | xargs -I '{}' echo '{}' >> DEPSFILE
DEPS=$(cat DEPSFILE | sort | uniq)
for FILE in $DEPS ; do if [ -e $FILE ] ; then (cp -v --parents -rfL $FILE ./ || true); fi; done

BLACKLISTED_FILES=$(wget -q https://github.com/probonopd/AppImages/raw/master/excludelist -O - | sed '/^\s*$/d' | sed '/^#.*$/d')
echo $BLACKLISTED_FILES
rm -f $BLACKLISTED_FILES

rm -f libasyncns.so.0 libatk-1.0.so.0 libcairo.so.2 libffi.so.6 libglapi.so.0 libgmodule-2.0.so.0 \
libncursesw.so.5 libnsl.so.1 libpango-1.0.so.0 libpangocairo-1.0.so.0 libpangoft2-1.0.so.0 \
libpcre.so.3 libpixman-1.so.0 libslang.so.2 libtinfo.so.5 libwrap.so.0 libX11-xcb.so.1 libXau.so.6 \
libXcomposite.so.1 libXcursor.so.1 libXdamage.so.1 libXdmcp.so.6 libXext.so.6 libXfixes.so.3 \
libXinerama.so.1 libXi.so.6 libXrandr.so.2 libXrender.so.1

