MinGW64: Prebuilt Toolchain for Linux-32Bits Targetting Win32 (Posix Thread)

GCC 7.2.0 - MinGW-w64 5.0.3

Info:My Web Site: http://www.davidgis.fr ,
Author: David TECHER, <davidtecher@yahoo.fr>
Date: 2018-03-19
Revision: 078-012629

Note

info This document deals with collecting some notes about setting up a prebuil toochain. Info taken from the Web. This prebuilt toolchain has been built only for fun not for performance!!!
The main idea of this document is to backport some Arch packages for MinGW-w64 to any distribution based on Debian/Ubuntu for Linux32 (i686)

Table of contents

1   Prerequisites

export PREFIX=/opt/MinGW32
export PATH=$PREFIX/bin:$PATH
export target=i686-w64-mingw32

mkdir /build
cd /build

git clone --depth=1 --branch v5.0.3 git://git.code.sf.net/p/mingw-w64/mingw-w64

wget http://ftp.gnu.org/gnu/binutils/binutils-2.29.tar.bz2
wget ftp://ftp.uvsq.fr/pub/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.xz
wget https://ftp.gnu.org/gnu/mpfr/mpfr-3.1.6.tar.gz
wget https://gmplib.org/download/gmp/gmp-6.1.1.tar.xz
wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
wget http://isl.gforge.inria.fr/isl-0.18.tar.gz

tar -jxf binutils-2.29.tar.bz2
tar -xf gcc-7.2.0.tar.xz
tar xf mpc-1.0.3.tar.gz && tar xf mpfr-3.1.6.tar.gz && tar xf gmp-6.1.1.tar.xz && tar xf isl-0.18.tar.gz

ln -s /build/mpfr-3.1.6 /build/binutils-2.29/mpfr
ln -s /build/gmp-6.1.1/ /build/binutils-2.29/gmp
ln -s /build/mpc-1.0.3/ /build/binutils-2.29/mpc
ln -s /build/isl-0.18/ /build/binutils-2.29/isl

ln -s /build/gmp-6.1.1 /build/gcc-7.2.0/gmp
ln -s /build/isl-0.18 /build/gcc-7.2.0/isl
ln -s /build/mpc-1.0.3 /build/gcc-7.2.0/mpc
ln -s /build/mpfr-3.1.6 /build/gcc-7.2.0/mpfr

2   Build Toolchain

Note

info All commands provided in this section are done being ``root`` user

2.1   Binutils 2.29

cd /build/binutils-2.29
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
cd /build
mkdir binutils-2.29-build32/ && cd binutils-2.29-build32/
/build/binutils-2.29/configure --prefix=$PREFIX --target=$target  --enable-lto --disable-nls --infodir=$PREFIX/share/info/$target --enable-plugins \
        --disable-multilib --disable-nls --disable-werror --without-system-zlib
make -j$(nproc) && make install
ln -s $PREFIX/$target $PREFIX/mingw

2.2   MinGW-w64-Headers (ALL)

cd /build/mingw-w64/mingw-w64-headers
/build/mingw-w64/mingw-w64-headers/configure --host=$target --prefix=$PREFIX/$target/ --includedir=$PREFIX/$target/include --enable-sdk=all --enable-secure-api --enable-idl
make -j$(nproc)  && make install

2.3   GCC 7.2.0 - Pass #01

cd /build
mkdir gcc-7.2.0-mingw32 && cd gcc-7.2.0-mingw32
/build/gcc-7.2.0/configure --prefix=$PREFIX --target=$target  --enable-shared --enable-static --disable-multilib --enable-threads=posix \
        --enable-fully-dynamic-string --enable-libstdcxx-time=yes --enable-lto --enable-languages=c,c++,objc,obj-c++,fortran,lto \
        --without-system-zlib --enable-cloog-backend=isl --disable-dw2-exceptions --disable-nls --enable-libgomp --enable-checking=release \
        --with-as=$PREFIX/bin/i686-w64-mingw32-as --with-ld=$PREFIX/bin/i686-w64-mingw32-ld
make -j$(nproc) all-gcc && make install-gcc

2.4   MinGW-w64-Crt (ALL)

cd /build
mkdir mingw-w64-crt32 && cd mingw-w64-crt32
/build/mingw-w64/mingw-w64-crt/configure --host=$target --prefix=$PREFIX/$target/
make -j$(nproc)  && make install

2.5   MinGW-w64-Libraries: winpthreads

for library in winpthreads
do
        mkdir -pv /build/mingw-w64-$library
        cd /build/mingw-w64-$library
        /build/mingw-w64/mingw-w64-libraries/$library/configure --host=$target --prefix=$PREFIX/$target/
        make -j$(nproc)  && make install
done

2.6   GCC 7.2.0 - Pass #02

cd /build/gcc-7.2.0-mingw32/
make -j$(nproc) all && make install
strip -v $PREFIX/bin/$target-*
strip -v $PREFIX/libexec/gcc/i686-w64-mingw32/7.2.0/{cc1*,collect2,f951,lto*}
mv -vf  $PREFIX/$target/lib/*.dll $PREFIX/$target/bin/

2.7   MinGW-w64-Libraries: pseh, winstorecompat

for library in pseh winstorecompat
do
        mkdir -pv /build/mingw-w64-$library
        cd /build/mingw-w64-$library
        /build/mingw-w64/mingw-w64-libraries/$library/configure --host=$target --prefix=$PREFIX/$target/ > build.log 2>&1
        make -j$(nproc)  >> build.log 2>&1 && make install >> build.log 2>&1
done

2.8   MinGW-w64 Tools:

for tools in gendef genidl genlib genpeimg;
do
        mkdir -pv /build/mingw-w64-tools32/build-$tools
        cd /build/mingw-w64-tools32/build-$tools
        /build/mingw-w64/mingw-w64-tools/$tools/configure --prefix=$PREFIX
        make -j$(nproc) && make install;
done

cd /build
mkdir widl32 && cd widl32
/build/mingw-w64/mingw-w64-tools/widl/configure --prefix=$PREFIX --target=$target --includedir=$PREFIX/$target/include
make -j$(nproc)  && make install && strip $PREFIX/bin/$target-widl

3   Additional steps

3.1   Cmake 3.10.2 (optional)

Note

info If your cmake version -- provided by your package (apt, yum etc) -- is too old then you can use commands below

cd /build
wget https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
tar xvzf cmake-3.10.2.tar.gz
cd cmake-3.10.2
./configure --prefix=$PREFIX --parallel=$(nproc) --no-system-libs --no-system-curl --no-system-expat --no-system-jsoncpp \
        --no-system-zlib --no-system-bzip2 --no-system-liblzma --no-system-libarchive --no-system-librhash --no-qt-gui
make -j$(nproc) && make install
strip $PREFIX/bin/cmake
strip $PREFIX/bin/cmake
strip $PREFIX/bin/ccmake
strip $PREFIX/bin/cpack
strip $PREFIX/bin/ctest

3.2   Configure the environment

Note

info WINEPATH is filled in /opt/MinGW32/bin/i686-w64-mingw32-wine. Don't forget to modify its value to point to your local wine location.

export PREFIX=/opt/MinGW32
export target=i686-w64-mingw32
cat << _EOF_ > $PREFIX/README
##################################################################################################################
#
#            MinGW64: Prebuilt Toolchain for Linux-32Bits Targetting Win32 (Posix Thread)
#
##################################################################################################################
#
# You have to source this file to set up the environment. By default it should be installed at /opt/MinGW32
#
# Note: if wine is installed on your system then you have to modify the file /opt/MinGW32/bin/i686-w64-mingw32-wine
#
# - GCC 7.2.0:
#               Thread Posix,
#               Languages c,lto,c++,objc,obj-c++,fortran
# - MinGW-w64 5.0.3 (Headers, CRT,  Tools and Libraries)
#
export PREFIX=${PREFIX}
export target=${target}
export PATH=\$PREFIX/bin:\${PATH}
export CPPFLAGS=-I\$PREFIX/$target/include
export LDFLAGS=-L\$PREFIX/$target/lib
export mingw_c_flags="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"
export CFLAGS="\$mingw_c_flags \$CFLAGS"
export CXXFLAGS="\$mingw_c_flags \$CXXFLAGS"
export PKG_CONFIG=\$PREFIX/bin/\$target-pkg-config
export PKG_CONFIG_LIBDIR=\$PREFIX/\$target/lib/pkgconfig
export LD_LIBRARY_PATH=/opt/MinGW32/bin/:$LD_LIBRARY_PATH
_EOF_

cat << _EOF_ > $PREFIX/bin/$target-pkg-config
export PKG_CONFIG_LIBDIR=$PREFIX/$target/lib/pkgconfig:/usr/share/pkgconfig

exec pkg-config \$@
_EOF_

chmod 777 $PREFIX/bin/$target-pkg-config

mkdir -pv $PREFIX/share/cmake/Toochains;
wget "https://aur.archlinux.org/cgit/aur.git/plain/toolchain-mingw.cmake?h=mingw-w64-cmake" -O  - |sed -e "s:@PROCESSOR@:${target:0:4}:g;s:@TRIPLE@:${target}:g;s:/usr:${PREFIX}:g" > $PREFIX/share/cmake/Toochains/toolchain-MinGW32.cmake
wget "https://aur.archlinux.org/cgit/aur.git/plain/mingw-cmake.sh?h=mingw-w64-cmake" -O - | sed -e "s:@TRIPLE@:${target}:g;s:/usr:${PREFIX}:g;s:/opt/MinGW32/share/mingw/toolchain-i686-w64-mingw32.cmake:$PREFIX/share/cmake/Toochains/toolchain-MinGW32.cmake:g" > $PREFIX/bin/mingw-w64-cmake
wget "https://aur.archlinux.org/cgit/aur.git/plain/mingw-wine.sh?h=mingw-w64-cmake" -O - | sed -e "s:@TRIPLE@:${target}:g;s:/usr:${PREFIX}:g;s:export WINEPATH.*:export WINEPATH=/opt/wine/apps/MinGW32_Environment/bin/:g" > $PREFIX/bin/$target-wine
chmod 777 $PREFIX/bin/mingw-w64-cmake
chmod 777 $PREFIX/bin/$target-wine
wget http://techer.pascal.free.fr/mingw-w64-makeself-MinGW32-Distro -O $PREFIX/bin/mingw-w64-makeself-MinGW32-Distro
chmod 777 $PREFIX/bin/mingw-w64-makeself-MinGW32-Distro
wget http://techer.pascal.free.fr/mingw-w64-makeself -O $PREFIX/bin/mingw-w64-makeself
chmod 777 $PREFIX/bin/mingw-w64-makeself

chmod 777 -R $PREFIX

4   Packages

Note

info All packages will be built inside /tmp folder. A couple of packages are built using instruction from Arch.

4.1   Folders for Source

mkdir /tmp/sources

4.2   Zlib 1.2.11

URL https://aur.archlinux.org/packages/mingw-w64-zlib/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://zlib.net/zlib-1.2.11.tar.gz
tar xvzf zlib-1.2.11.tar.gz
cd zlib-1.2.11
sed -ie "s,dllwrap,${_arch}-dllwrap," win32/Makefile.gcc
CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" ./configure --prefix=$PREFIX/$target -shared -static
make -f win32/Makefile.gcc CC=$target-gcc AR=$target-ar RC=$target-windres STRIP=$target-strip IMPLIB=libz.dll.a CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4"

install -d $DESTDIR/$PREFIX/$target/{bin,include,lib}
install -m644 -t $DESTDIR/$PREFIX/$target/include zlib.h zconf.h
install -m644 -t $DESTDIR/$PREFIX/$target/lib libz.a libz.dll.a
install -m755 -t $DESTDIR/$PREFIX/$target/bin zlib1.dll
install -d $DESTDIR/$PREFIX/$target/lib/pkgconfig
sed "s,@prefix@,/${PREFIX}/${target},;s,@exec_prefix@,\${prefix},;s,@libdir@,\${exec_prefix}/lib,;s,@sharedlibdir@,\${libdir},;s,@includedir@,\${prefix}/include,;s,@VERSION@,$pkgver," < zlib.pc.in > $DESTDIR/$PREFIX/$target/lib/pkgconfig/zlib.pc
i686-w64-mingw32-strip -x $DESTDIR/$PREFIX/$target/bin/zlib1.dll
i686-w64-mingw32-strip -g $DESTDIR/$PREFIX/$target/lib/libz.a $PREFIX/$target/lib/libz.dll.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target
mingw-w64-makeself zlib 1.2.11 $DESTDIR/$PREFIX/$target delete

4.3   Bzip2 1.0.6

URL https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=mingw-w64-bzip2

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar xvzf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6/
git clone https://aur.archlinux.org/mingw-w64-bzip2.git
patch -p1 -i mingw-w64-bzip2/bzip2-1.0.5-autoconfiscated.patch
patch -p1 -i mingw-w64-bzip2/bzip2-use-cdecl-calling-convention.patch
patch -p1 -i mingw-w64-bzip2/mingw32-bzip2-1.0.5-slash.patch
sh autogen.sh
./configure --host=$target --prefix=$PREFIX/$target
make -j4

make DESTDIR=$DESTDIR install
rm -rf $DESTDIR/$PREFIX/$target/bin/*exe
rm -rf $DESTDIR/$PREFIX/$target/bin/bz*
rm -rf $DESTDIR//$PREFIX/$target/share
i686-w64-mingw32-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
i686-w64-mingw32-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR//$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself bzip2 1.0.6 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR/

4.4   Dlfcn (Win32) 1.1.1

URL https://aur.archlinux.org/packages/mingw-w64-dlfcn

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget https://github.com/dlfcn-win32/dlfcn-win32/archive/v1.1.1.tar.gz
tar xzf v1.1.1.tar.gz
cd dlfcn-win32-1.1.1/
./configure --prefix=$PREFIX/$target/ --libdir=$PREFIX/$target/lib --incdir=$PREFIX/$target/include --enable-shared --enable-static --cross-prefix=$target-
make -j$(nproc)

make DESTDIR=$DESTDIR install
i686-w64-mingw32-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
i686-w64-mingw32-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself dlfcn 1.1.1 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.5   Xz 5.2.3

URL https://aur.archlinux.org/packages/mingw-w64-xz/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build
wget --no-check-certificate http://tukaani.org/xz/xz-5.2.3.tar.gz
tar xzf xz-5.2.3.tar.gz
cd xz-5.2.3/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install-strip
find $DESTDIR/$PREFIX/$target -name '*.exe' | xargs -rtl1 rm
find $DESTDIR/$PREFIX/$target -name '*.dll' | xargs -rtl1 $target-strip -x
find $DESTDIR/$PREFIX/$target -name '*.a' -o -name '*.dll' | xargs -rtl1 $target-strip -g
rm -vf $DESTDIR/$PREFIX/$target/bin/{lz{cmp,diff,egrep,fgrep,grep,less,more},xz{cmp,diff,egrep,fgrep,grep,less,more}}
rm -rvf $DESTDIR/$PREFIX/$target/share

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself xz 5.2.3 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.6   Lzo 2.10

URL https://aur.archlinux.org/packages/mingw-w64-lzo

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build
wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
tar xzf lzo-2.10.tar.gz
cd lzo-2.10/
mkdir build && cd build
../configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared --enable-static
make -j$(nproc)
$target-gcc $CFLAGS -fpic -I../include/lzo -o minilzo/minilzo.o -c ../minilzo/minilzo.c
$target-ar rcs libminilzo.a minilzo/minilzo.o
$target-gcc -shared -o libminilzo-0.dll -Wl,--out-implib,libminilzo.dll.a minilzo/minilzo.o

make DESTDIR=$DESTDIR install

install -m644 libminilzo-0.dll $DESTDIR/$PREFIX/$target/bin
install -m644 libminilzo.dll.a  $DESTDIR/$PREFIX/$target/lib
install -m644 libminilzo.a $DESTDIR/$PREFIX/$target/lib
install -p -m644 ../minilzo/minilzo.h $DESTDIR/$PREFIX/$target/include
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec $target-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself lzo 2.10 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.7   Expat 2.2.5

URL https://aur.archlinux.org/packages/mingw-w64-expat

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget https://github.com/libexpat/libexpat/releases/download/R_2_2_5/expat-2.2.5.tar.bz2
tar xjf expat-2.2.5.tar.bz2
cd expat-2.2.5/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install-strip
rm -vf $DESTDIR/$PREFIX/$target/bin/*exe
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
rm -rf $DESTDIR/$PREFIX/$target/share

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself expat 2.2.5 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.8   Libpng 1.6.34

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://downloads.sourceforge.net/project/libpng/libpng16/1.6.34/libpng-1.6.34.tar.gz
tar xzf libpng-1.6.34.tar.gz
cd libpng-1.6.34/
wget http://downloads.sourceforge.net/project/apng/libpng/libpng16/libpng-1.6.34-apng.patch.gz
gunzip libpng-1.6.34-apng.patch.gz
patch -p0 -i libpng-1.6.34-apng.patch
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared --enable-static --enable-hardware-optimizations=yes --enable-intel-sse=yes
make -j$(nproc)

make DESTDIR=$DESTDIR install
rm -vf $DESTDIR/$PREFIX/$target/bin/*exe
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
rm -rf $DESTDIR/$PREFIX/$target/share
cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/libpng16-config $PREFIX/bin
ln -s $PREFIX/$target/bin/libpng-config $PREFIX/bin

mingw-w64-makeself libpng 1.6.34 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.9   Libiconv 1.15

URL https://aur.archlinux.org/packages/mingw-w64-libiconv/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build
wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz
tar xzf libiconv-1.15.tar.gz
cd libiconv-1.15/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes --enable-extra-encodings --enable-relocatable --disable-rpath --enable-silent-rules --enable-nls --docdir=$PREFIX/$target/share/doc/libiconv
make -j$(nproc)

make DESTDIR=$DESTDIR install
rm -vf $DESTDIR/$PREFIX/$target/bin/*exe
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
rm -rf $DESTDIR/$PREFIX/$target/share
rm -vf $DESTDIR/$PREFIX/$target/lib/charset.alias

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libiconv 1.15 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.10   Termcap 1.3.1

URL https://aur.archlinux.org/packages/mingw-w64-termcap/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz
tar xvzf termcap-1.3.1.tar.gz
cd termcap-1.3.1/
autoconf
./configure --host=$target  --prefix=$PREFIX/$target/
make -j$(nproc)
$target-gcc -shared -Wl,--out-implib,libtermcap.dll.a -o libtermcap-0.dll termcap.o tparam.o version.o

make install prefix=$DESTDIR/$PREFIX/$target exec_prefix=$DESTDIR/$PREFIX/$target oldincludedir=
mkdir -pv $DESTDIR/$PREFIX/$target/{bin,lib}
install -m 0755 libtermcap-0.dll $DESTDIR/$PREFIX/$target/bin
install -m 0644 libtermcap.dll.a $DESTDIR/$PREFIX/$target/lib
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself termcap 1.3.1 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.11   Libjpeg-turbo 1.5.3

URL: https://aur.archlinux.org/packages/mingw-w64-libjpeg-turbo/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-libjpeg-turbo.git
wget https://github.com/libjpeg-turbo/libjpeg-turbo/archive/1.5.3.tar.gz
tar xvzf 1.5.3.tar.gz
cd libjpeg-turbo-1.5.3/
patch -p1 -i ../mingw-w64-libjpeg-turbo/0001-header-compat.mingw.patch
patch -p1 -i ../mingw-w64-libjpeg-turbo/libjpeg-turbo-1.3.1-libmng-compatibility.patch
aclocal
autoheader
libtoolize --force
automake --force-missing --add-missing
autoconf
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes --with-jpeg8
make -j$(nproc)

make DESTDIR=$DESTDIR docdir=$DESTDIR/$PREFIX/$target/share/doc/libjpeg-turbo exampledir=$DESTDIR/$PREFIX/$target/share/doc/libjpeg-turbo install
cp -avf {jinclude,jpegint,transupp}.h $DESTDIR/$PREFIX/$target/include
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libjpeg-turbo 1.5.3 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.12   Libunistring 0.9.9

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://ftp.gnu.org/gnu/libunistring/libunistring-0.9.9.tar.gz
tar xvzf libunistring-0.9.9.tar.gz
cd libunistring-0.9.9/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared --enable-static --enable-threads=windows
make -j$(nproc)

make DESTDIR=$DESTDIR install
rm -rf $DESTDIR/$PREFIX/$target/share
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libunistring 0.9.9 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.13   Gettext 0.19.8.1

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-gettext.git
wget https://ftp.gnu.org/gnu/gettext/gettext-0.19.8.1.tar.gz
tar xzf gettext-0.19.8.1.tar.gz
cd gettext-0.19.8.1/
patch -p0 -i /tmp/sources/mingw-w64-gettext/05-always-use-libintl-vsnprintf.mingw.patch
patch -p0 -i /tmp/sources/mingw-w64-gettext/06-dont-include-ctype-after-gnulibs-wctype.mingw.patch
patch -p0 -i /tmp/sources/mingw-w64-gettext/07-fix-asprintf-conflict.mingw.patch
patch -p0 -i /tmp/sources/mingw-w64-gettext/08-vs-compatible.patch
patch -p0 -i /tmp/sources/mingw-w64-gettext/09-gnulib-fix-underscore-cond.patch

#export underscore_flag='-DUSER_LABEL_PREFIX_UNDERSCORE'
#export CFLAGS="$underscore_flag"
#export CXXFLAGS="$underscore_flag"
#unset LDFLAGS
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --disable-java --disable-native-java --disable-csharp --enable-threads=win32
make -j$(nproc)

make DESTDIR=$DESTDIR install
rm -vf $DESTDIR/$PREFIX/$target/bin/{autopoint,gettext.sh,gettextize}
rm -vf $DESTDIR/$PREFIX/$target/bin/*exe
rm -rf $DESTDIR/$PREFIX/$target/lib/gettext
rm -rf $DESTDIR/$PREFIX/$target/share
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
install -dm755 $DESTDIR/$PREFIX/$target/lib/pkgconfig
install -m644 /tmp/sources/mingw-w64-gettext/intl.pc $DESTDIR/$PREFIX/$target/lib/pkgconfig
sed -i "s:@PREFIX@:$PREFIX/$target:g;s:@VERSION@:0.19.8.1:g" $DESTDIR/$PREFIX/$target/lib/pkgconfig/intl.pc

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself gettext 0.19.8.1 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.14   Freetype 2.8 (wihtout Harfbuzz)

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget https://download-mirror.savannah.gnu.org/releases/freetype/freetype-2.8.tar.bz2
tar xvjf freetype-2.8.tar.bz2
cd freetype-2.8/
git clone https://aur.archlinux.org/mingw-w64-freetype2-minimal.git
patch -Np1 -i mingw-w64-freetype2-minimal/0001-Enable-table-validation-modules.patch
patch -Np1 -i mingw-w64-freetype2-minimal/0002-Enable-subpixel-rendering.patch
patch -Np1 -i mingw-w64-freetype2-minimal/0003-Enable-infinality-subpixel-hinting.patch
patch -Np1 -i mingw-w64-freetype2-minimal/0004-Enable-long-PCF-family-names.patch
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes --with-bzip2=yes --with-zlib=yes --with-png=yes --without-harfbuzz
make -j$(nproc)

make DESTDIR=$DESTDIR install
rm -rf $DESTDIR/$PREFIX/$target/share
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/freetype-config $PREFIX/bin/
mingw-w64-makeself freetype-noharfbuzz 2.8 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.15   Libzip 1.0.4

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget https://libzip.org/download/libzip-1.4.0.tar.xz
tar xvJf libzip-1.4.0.tar.xz
cd libzip-1.4.0/
sed -i "s|ADD_SUBDIRECTORY(regress)||g" CMakeLists.txt
sed -i "s|ADD_SUBDIRECTORY(examples)||g" CMakeLists.txt
mkdir build_shared && cd build_shared
mingw-w64-cmake ..
make -j$(nproc)
cd ..
mkdir build_static && cd build_static
mingw-w64-cmake -DBUILD_SHARED_LIBS=OFF ..
make -j$(nproc)

cd /tmp/sources/libzip-1.4.0/build_shared/ && make DESTDIR=$DESTDIR install
cd /tmp/sources/libzip-1.4.0/build_static/ && make DESTDIR=$DESTDIR install
rm -rf $DESTDIR/$PREFIX/$target/share
rm -vf $DESTDIR/$PREFIX/$target/bin/*exe
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libzip 1.0.4 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.16   Libffi 3.2.1

URL https://aur.archlinux.org/packages/mingw-w64-libffi/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-libffi.git
wget "https://github.com/libffi/libffi/archive/v3.2.1.tar.gz"
tar xvzf v3.2.1.tar.gz
cd libffi-3.2.1/
patch -p2 -i ../mingw-w64-libffi/fix_return_size.patch
sh autogen.sh;
./configure --host=$target --prefix=$PREFIX/$target --enable-shared --enable-static HOST=$target --enable-pax_emutramp
make -j$(nproc)

make DESTDIR=$DESTDIR install
rm -rf  $DESTDIR/$PREFIX/$target/share/info/dir
rm -rf  $DESTDIR/$PREFIX/$target/share/man
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libffi 3.2.1 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.17   PDcurses 4.0.2 - Win32a

URL https://aur.archlinux.org/packages/mingw-w64-pdcurses-win32a/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-pdcurses-win32a.git
wget https://github.com/Bill-Gray/PDCurses/archive/v4.0.2.tar.gz
tar xvzf v4.0.2.tar.gz
cd PDCurses-4.0.2/
patch -Np1 -i ../mingw-w64-pdcurses-win32a/pdcurses.diff
cp -a win32a build_shared
cd build_shared/
make -f mingwin32.mak PREFIX=$target- WIDE=Y UTF8=Y DLL=Y
cd ..
cp -a win32a build_static
cd build_static/
make -f mingwin32.mak PREFIX=$target- WIDE=Y UTF8=Y

cd ..
install -d $DESTDIR/$PREFIX/$target/{bin,lib,include}
install build_shared/pdcurses.dll $DESTDIR/$PREFIX/$target/bin
install build_static/pdcurses.a $DESTDIR/$PREFIX/$target/lib/libpdcurses.dll.a
install build_static/pdcurses.a $DESTDIR/$PREFIX/$target/lib/libpdcurses.a
install -m 0644 curses.h panel.h term.h acs_defs.h $DESTDIR/$PREFIX/$target/include/
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself pdcurses 4.02-win32a $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.18   Readline 7.0

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-readline.git
wget https://ftp.gnu.org/gnu/readline/readline-7.0.tar.gz
tar xvzf readline-7.0.tar.gz
cd readline-7.0/
for((i=1;i<=3;i++));do wget https://ftp.gnu.org/gnu/readline/readline-7.0-patches/readline70-00$i -O - | patch -Np0 ;done
patch -Np1 -i ../mingw-w64-readline/readline-1.patch
sed -i 's|-Wl,-rpath,$(libdir) ||g' support/shobj-conf
bash_cv_wcwidth_broken=no ./configure --host=$target --prefix=$PREFIX/$target --enable-shared --enable-static --enable-multibyte --with-curses
make -j$(nproc) SHLIB_LIBS="-mwindows -lpdcurses"

make install DESTDIR=$DESTDIR SHLIB_LIBS="-mwindows -lpdcurses" # First time
make install DESTDIR=$DESTDIR SHLIB_LIBS="-mwindows -lpdcurses" # Second time
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself readline 7.0 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.19   Wineditline 2.201 (optional)

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources
export DESTDIR=/tmp/build

wget https://github.com/winlibs/wineditline/archive/WinEditLine-2.201.tar.gz
tar xvzf WinEditLine-2.201.tar.gz
cd wineditline-WinEditLine-2.201/
mkdir build && cd build
mingw-w64-cmake  ..
make -j$(nproc)

make PREFIX=$DESTDIR install
$target-strip $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/bin32/*exe
$target-strip --strip-unneeded $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/bin32/edit.dll
$target-strip -g $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/bin32/libedit.dll.a
$target-strip -g $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/lib32/libedit_a.a
cp -vf $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/bin32/*exe $PREFIX/$target/bin/
cp -vf $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/bin32/edit.dll $PREFIX/$target/bin/
cp -vf $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/bin32/libedit.dll.a $PREFIX/$target/lib
cp -vf $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/lib32/libedit_a.a $PREFIX/$target/lib
cp -avf $DESTDIR/tmp/sources/wineditline-WinEditLine-2.201/include/* $PREFIX/$target/include

# Some fixes in order to build the package
rm -rf $DESTDIR
mkdir -p $DESTDIR/$PREFIX/$target/{bin,lib,include}
cp -vf $PREFIX/$target/bin/{edit_test.exe,edit_test_dll.exe} $DESTDIR/$PREFIX/$target/bin/
cp -vf $PREFIX/$target/bin/edit.dll $DESTDIR/$PREFIX/$target/bin/
cp -vf $PREFIX/$target/lib/libedit.dll.a $DESTDIR/$PREFIX/$target/lib/
cp -vf $PREFIX/$target/lib/libedit_a.a $DESTDIR/$PREFIX/$target/lib/
cp -r $PREFIX/$target/include/editline/ $DESTDIR/$PREFIX/$target/include/
mingw-w64-makeself wineditline 2.201 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.20   Pcre 8.41

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.bz2"
tar xvjf pcre-8.41.tar.bz2
cd pcre-8.41/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes --enable-unicode-properties --enable-jit --enable-pcre16 --enable-pcre32 --enable-pcregrep-libz --enable-pcregrep-libbz2 --enable-pcretest-libreadline
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/pcre-config $PREFIX/bin
mingw-w64-makeself pcre 8.41 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.21   Fontconfig 2.12.6

URL https://aur.archlinux.org/packages/mingw-w64-fontconfig

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

git clone https://aur.archlinux.org/mingw-w64-fontconfig.git
wget "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.6.tar.bz2"
tar xjf fontconfig-2.12.6.tar.bz2
cd fontconfig-2.12.6/
#patch -p1 -i ../mingw-w64-fontconfig/0007-pkgconfig.mingw.patch
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes --disable-docs --with-arch=i686
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself fontconfig 2.12.6 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.22   Pixman 0.34.0

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget https://www.cairographics.org/releases/pixman-0.34.0.tar.gz
tar xzf pixman-0.34.0.tar.gz
cd pixman-0.34.0/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself pixman 0.34.0 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.23   Glib 2.54.3

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://ftp.gnome.org/pub/gnome/sources/glib/2.54/glib-2.54.3.tar.xz
tar xvJf glib-2.54.3.tar.xz
cd glib-2.54.3
patch -p1 -i  /opt/Sources/MINGW-packages/mingw-w64-glib2/0001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch
patch -p1 -i  /opt/Sources/MINGW-packages/mingw-w64-glib2/0004-glib-prefer-constructors-over-DllMain.patch
patch -p1 -i  /opt/Sources/MINGW-packages/mingw-w64-glib2/0017-glib-use-gnu-print-scanf.patch
patch -p1 -i  /opt/Sources/MINGW-packages/mingw-w64-glib2/0023-print-in-binary-more-for-testing.all.patch
patch -p1 -i  /opt/Sources/MINGW-packages/mingw-w64-glib2/0027-no_sys_if_nametoindex.patch
patch -p1 -i  /opt/Sources/MINGW-packages/mingw-w64-glib2/0028-inode_directory.patch
NOCONFIGURE=1 ./autogen.sh
mkdir build_shared && cd build_shared/
../configure --host=$target --prefix=$PREFIX/$target  --disable-static --enable-shared --disable-libelf  -with-threads=posix HOST=$target
make -j$(nproc)
cd ..
mkdir build_static && cd build_static
../configure --host=$target --prefix=$PREFIX/$target  --enable-static --disable-shared --disable-libelf  -with-threads=posix HOST=$target
make -j$(nproc)

make DESTDIR=$DESTDIR install
cd ../build_shared/
make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself glib 2.54.3 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.24   Cairo 1.14.12 (minimal)

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget "https://cairographics.org/releases/cairo-1.14.12.tar.xz"
tar xJf cairo-1.14.12.tar.xz
cd cairo-1.14.12/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself cairo-minimal 1.14.12 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.25   Libogg 1.3.3

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.3.tar.gz
tar xvzf libogg-1.3.3.tar.gz
cd libogg-1.3.3/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libogg 1.3.3 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.26   Libvorbis 1.3.5

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.5.tar.xz
tar xvJf libvorbis-1.3.5.tar.xz
cd libvorbis-1.3.5/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libvorbis 1.3.5 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.27   Mpg123 1.25.8

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget --no-check-certificate "https://sourceforge.net/projects/mpg123/files/mpg123/1.25.8/mpg123-1.25.8.tar.bz2/download" -O mpg123-1.25.8.tar.bz2
tar xvjf mpg123-1.25.8.tar.bz2
cd mpg123-1.25.8/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself mpg123 1.25.8 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.28   Flac 1.3.2

  • Depends: libogg
[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget https://ftp.osuosl.org/pub/xiph/releases/flac/flac-1.3.2.tar.xz
tar xvJf flac-1.3.2.tar.xz
cd flac-1.3.2/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static  --disable-xmms-plugin
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself flac 1.3.2 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.29   Libmodplug 0.8.8.5

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget --no-check-certificate  "https://sourceforge.net/projects/modplug-xmms/files/libmodplug/0.8.8.5/libmodplug-0.8.8.5.tar.gz/download" -O libmodplug-0.8.8.5.tar.gz
tar xvzf libmodplug-0.8.8.5.tar.gz
cd libmodplug-0.8.8.5/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libmodplug 0.8.8.5 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.30   SpeedxDSP 1.2RC3

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://downloads.xiph.org/releases/speex/speexdsp-1.2rc3.tar.gz
tar xvzf speexdsp-1.2rc3.tar.gz
cd speexdsp-1.2rc3/
./configure --host=$target --prefix=$PREFIX/$target/  --enable-static --enable-shared
make -j$(nproc)

 make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself speedxDSP 1.2rc3 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.31   Speex 1.2.0

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget "http://downloads.us.xiph.org/releases/speex/speex-1.2.0.tar.gz"
tar xvzf speex-1.2.0.tar.gz
cd speex-1.2.0/
./configure --host=$target --prefix=$PREFIX/$target/  --enable-static --enable-shared
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself speex 1.2.0 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.32   Libsndfile 1.0.28

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28.tar.gz
tar xvzf libsndfile-1.0.28.tar.gz
cd libsndfile-1.0.28/
./configure --host=$target --prefix=$PREFIX/$target/  --enable-static --enable-shared --disable-sqlite --disable-test-coverage --enable-external-libs --enable-experimental
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself libsndfile 1.0.28 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.33   Boost 1.66.0

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-boost.git
wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2
tar xvjf boost_1_66_0.tar.bz2
cd boost_1_66_0/
patch -Np0 -i ../mingw-w64-boost/boost-mingw.patch
cd ..
cp -r boost_1_66_0 build-i686-w64-mingw32
cd build-i686-w64-mingw32/
cat > user-config.jam << _EOF_
using gcc : mingw64 : i686-w64-mingw32-g++
        :
        <rc>i686-w64-mingw32-windres
        <archiver>i686-w64-mingw32-ar
;
_EOF_
./bootstrap.sh --with-toolset=gcc --with-python=/usr/bin/python2
./b2 -d+2 -q target-os=windows variant=release threading=multi threadapi=win32 link=shared,static runtime-link=shared --prefix=$DESTDIR/$PREFIX/$target \
        --user-config=user-config.jam --without-python --without-mpi --without-graph_parallel \
        cxxflags="-std=c++11 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions --param=ssp-buffer-size=4" \
        address-model=32 architecture=x86 binary-format=pe --layout=tagged install > build.log 2>&1

mkdir $DESTDIR/$PREFIX/$target/bin
mv $DESTDIR/$PREFIX/$target/lib/*dll $DESTDIR/$PREFIX/$target/bin/
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
mingw-w64-makeself boost 1.66.0 $DESTDIR/$PREFIX/$target delete
#rm -rf $DESTDIR

4.34   Asio 1.10.8

wget http://downloads.sourceforge.net/asio/asio-1.10.8.tar.bz2
tar xvjf asio-1.10.8.tar.bz2
cd asio-1.10.8/
./configure --host=$target --prefix=$PREFIX/$target/
make -j$(nproc) && make install

4.35   Portaudio v190600_20161030

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://www.steinberg.net/sdk_downloads/asiosdk2.3.zip
unzip  asiosdk2.3.zip
wget http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz
tar xvzf pa_stable_v190600_20161030.tgz
cd portaudio/
#wget "https://aur.archlinux.org/cgit/aur.git/plain/fix_static_linking.patch?h=mingw-w64-portaudio" -O - |patch -p1
patch -p0 -i /opt/Sources/MINGW-packages/mingw-w64-portaudio/fix-build.patch
patch -p0 -i /opt/Sources/MINGW-packages/mingw-w64-portaudio/wdmks-wasapi-dsound.patch
autoconf
./configure --host=$target --prefix=$PREFIX/$target/  --enable-static --disable-shared --with-winapi=wmme,directx,wasapi,wdmks,asio --with-dxdir=$PREFIX/$target/ --with-asiodir=/tmp/sources/ASIOSDK2.3/ ac_cv_path_AR=$target-ar
make -j$(nproc)
$target-gcc -O2 -shared -o libportaudio32.dll -Wl,--whole-archive lib/.libs/libportaudio.a -Wl,--no-whole-archive -lstdc++ -lwinmm -lole32 -lsetupapi

make DESTDIR=$DESTDIR install
mkdir $DESTDIR/$PREFIX/$target/bin
cp libportaudio32.dll $DESTDIR/$PREFIX/$target/bin
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.36   FluidSynthh 1.1.9

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget "https://github.com/FluidSynth/fluidsynth/archive/v1.1.9.tar.gz"
tar xvzf v1.1.9.tar.gz
cd fluidsynth-1.1.9/
mkdir build && cd build/
mingw-w64-cmake -Denable-portaudio=ON  -Denable-dbus=OFF ..
# Dirty hack to fix build for 'libfluidsynth-1.dll'
sed -i "s:$: -lstdc++:g" ./src/CMakeFiles/libfluidsynth.dir/linklibs.rsp
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.37   Libtool 2.4.6

URL https://aur.archlinux.org/packages/mingw-w64-libtool/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget ftp://ftp.gnu.org/pub/gnu/libtool/libtool-2.4.6.tar.xz
tar xvJf libtool-2.4.6.tar.xz
cd libtool-2.4.6/
./configure --host=$target --prefix=$PREFIX/$target/  --enable-static --enable-shared lt_cv_sys_lib_dlsearch_path_spec=$PREFIX/$target/lib

make DESTDIR=$DESTDIR install
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.38   SDL2 2.0.7

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget https://www.libsdl.org/release/SDL2-2.0.7.tar.gz
tar xvzf SDL2-2.0.7.tar.gz
cd SDL2-2.0.7
mkdir build_sdl  && cd build_sdl
../configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc) LDFLAGS=-no-undefined

make DESTDIR=$DESTDIR install
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/sdl2-config $PREFIX/bin/
rm -rf $DESTDIR

4.39   Smpeg 2.0.0

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

svn co svn://svn.icculus.org/smpeg/tags/release_2_0_0
cd release_2_0_0
CFLAGS="--std=gnu++98" ./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/smpeg2-config $PREFIX/bin/
rm -rf $DESTDIR

4.40   SDL2_mixer 2.0.2

  • Dependancies: fluidsynth, libmodplug, flac, mpg123, vorbis
[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.2.tar.gz
tar xvzf SDL2_mixer-2.0.2.tar.gz
cd SDL2_mixer-2.0.2
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.41   Libao 1.2.0

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://downloads.xiph.org/releases/ao/libao-1.2.0.tar.gz
tar xvzf libao-1.2.0.tar.gz
cd libao-1.2.0/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.42   LibTimidity 0.2.5

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget https://github.com/sezero/libtimidity/archive/libtimidity-0.2.5.tar.gz
tar xvzf libtimidity-0.2.5.tar.gz
cd libtimidity-libtimidity-0.2.5/
aclocal
autoheader
libtoolize --force
automake --force-missing --add-missing
autoconf
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.43   SDL 1.2.15

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget https://www.libsdl.org/release/SDL-1.2.15.tar.gz
tar xvzf SDL-1.2.15.tar.gz
cd SDL-1.2.15/
./configure --host=$target --target=$target --build=i686-pc-linux-gnu --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
#sed -e "s|-mwindows||g" -i  $DESTDIR/$PREFIX/$target/lib/pkgconfig/sdl.pc

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/sdl-config $PREFIX/bin/
rm -rf $DESTDIR

4.44   Libjpeg v9

URL https://aur.archlinux.org/packages/mingw-w64-libjpeg/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz
tar xvzf jpegsrc.v9c.tar.gz
cd jpeg-9c/
./configure --host=$target --target=$target --build=i686-pc-linux-gnu --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g
cp jpegint.h $DESTDIR/$PREFIX/$target/include

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.45   LibTiff 4.0.9

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget "http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz"
tar xvzf tiff-4.0.9.tar.gz
cd tiff-4.0.9/
export CFLAGS+=" -fno-strict-aliasing"
export CXXFLAGS+=" -fno-strict-aliasing"
./configure --host=$target --target=$target --build=i686-pc-linux-gnu --prefix=$PREFIX/$target/ --enable-shared --enable-static -disable-jbig --without-x
make -j$(nproc)

make DESTDIR=$DESTDIR install
cp -vf libtiff/{tiffiop,tif_dir}.h $DESTDIR/$PREFIX/$target/include
cp libtiff/tif_config.h $DESTDIR/$PREFIX/$target/include
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.46   GibLib 5.1.4

URL https://aur.archlinux.org/packages/mingw-w64-giflib/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

git clone https://aur.archlinux.org/mingw-w64-giflib.git
wget http://downloads.sourceforge.net/sourceforge/giflib/giflib-5.1.4.tar.bz2
patch -Np1 -i ../mingw-w64-giflib/giflib-5.0.4-include-stddef.patch
./configure --host=$target --target=$target --build=i686-pc-linux-gnu --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc) bin_PROGRAMS=''

make DESTDIR=$DESTDIR bin_PROGRAMS='' install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.47   LibWebp 0.6.1

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-0.6.1.tar.gz"
tar xvzf libwebp-0.6.1.tar.gz
cd libwebp-0.6.1/
./configure --host=$target --target=$target --build=i686-pc-linux-gnu --prefix=$PREFIX/$target/ --enable-shared --enable-static --enable-swap-16bit-csp -enable-experimental --enable-libwebp{mux,demux,decoder,extras}
make -j$(nproc) SDL_LIBS="-lmingw32 -lSDLmain -lSDL -mwindows -liconv -lm -luser32 -lgdi32 -lwinmm -ldxguid"

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.48   SDL_image 1.2.12

  • Dependancies: libwebp, libtiff, libjpeg, libpng, SDL
[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources/

wget https://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.12.tar.gz
tar xvzf SDL_image-1.2.12.tar.gz
cd SDL_image-1.2.12/
./configure --host=$target --target=$target --build=i686-pc-linux-gnu --prefix=$PREFIX/$target/ --enable-shared --enable-static --disable-sdltest
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.49   LibMikmod 3.3.11

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://downloads.sourceforge.net/mikmod/libmikmod-3.3.11.tar.gz
tar xvzf libmikmod-3.3.11.tar.gz
cd libmikmod-3.3.11/
sed -i "s,#define HAVE_SSE2,,g" "include/mikmod_internals.h"
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --enable-threads=win32
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/libmikmod-config $PREFIX/bin/
rm -rf $DESTDIR

4.50   Smpeg 0.4.5

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

svn co svn://svn.icculus.org/smpeg/tags/release_0_4_5
# Patch for GCC 6
cd release_0_4_5
wget "https://bugs.archlinux.org/task/51926?getfile=14765" -O - |patch -p1
./autogen.sh
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static -disable-sdltest --disable-gtk-player --disable-gtktest --without-x --with-sdl-prefix=$PREFIX/$target/ --enable-opengl-player=no
 make -j$(nproc) LDFLAGS+="-lstdc++"
i686-w64-mingw32-gcc -shared .libs/*.o -lSDL -lstdc++ -o smpeg.dll -Xlinker --out-implib -Xlinker libsmpeg.dll.a

make DESTDIR=$DESTDIR install
cp smpeg.dll $DESTDIR/$PREFIX/$target/bin/
cp -vf libsmpeg.dll.a $DESTDIR/$PREFIX/$target/lib/
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s  $PREFIX/$target/bin/smpeg-config $PREFIX/bin/
rm -rf $DESTDIR

4.51   SDL_mixer 1.2.12

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-1.2.12.tar.gz
tar xvzf SDL_mixer-1.2.12.tar.gz
cd SDL_mixer-1.2.12/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
sed -e "s:^SDL_LIB.* :SDL_LIBS = $PREFIX/$target/lib/libmingw32.a $PREFIX/$target/lib/libSDLmain.a $PREFIX/$target/lib/libSDL.a:g" -i Makefile
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.52   Icu 0.57.1 (static)

Old way (OpenTTD recommendations) - NOT TESTED

cd /tmp/sources
wget wget http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz
tar xvzf icu4c-57_1-src.tgz
cd icu

unset CPPFLAGS
unset LDFLAGS

# Create folders
mkdir -pv {native,cross}

# Build natively. DON'T INSTALL
cd native/
../source/configure --enable-static --disable-shared
# JUST RUN MAKE! DON'T INSTALL!!! THIS IS JUST NEEDED FOR CROSSCOMPILATION
make -j$(nproc)

# Build for Win32 and INSTALL
cd ../cross
../source/runConfigureICU MinGW --host=$target --prefix=$PREFIX/$target/ --enable-static --disable-shared --disable-strict --with-cross-build=/tmp/sources/icu/native
make -j$(nproc) && make install

mv $PREFIX/$target/lib/libsicudt.a $PREFIX/$target/lib/libsicudt.a.old
cp lib/libsicudt.a $PREFIX/$target/lib/libsicudt.a

Arch way

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-icu.git
wget http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz
tar xvzf icu4c-57_1-src.tgz
cd icu/
patch -p1 -i /tmp/sources/mingw-w64-icu/0004-move-to-bin.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0007-actually-move-to-bin.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0008-data-install-dir.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0009-fix-bindir-in-config.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0010-msys-rules-for-makefiles.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0011-sbin-dir.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0012-libprefix.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0014-mingwize-pkgdata.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0015-debug.mingw.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0016-icu-pkgconfig.patch
patch -p1 -i /tmp/sources/mingw-w64-icu/0017-icu-config-versioning.patch
cd source
autoreconf -fi
#
# Phase 1: Build natively on Linux
#
mkdir -p nativebuild && pushd nativebuild
CFLAGS=-fno-stack-protector
unset CPPFLAGS
unset LDFLAGS
CC=gcc CXX=g++ ../configure --enable-static --disable-shared
make -j$(nproc)
popd
#
# Phase 2: Cross-Compil
#
mkdir build-$target
cd build-$target
export CPPFLAGS=-I$PREFIX/$target//include
export LDFLAGS=-L$PREFIX/$target/lib
../configure --host=$target  --prefix=$PREFIX/$target/ --with-cross-build=$PWD/../nativebuild --with-data-packaging=library --disable-rpath --enable-release --disable-tests --disable-samples --enable-static --enable-shared
make -j$(nproc)

make install DESTDIR=$DESTDIR
mv -vf $DESTDIR/$PREFIX/$target/lib/*dll $DESTDIR/$PREFIX/$target/bin/
find $DESTDIR/$PREFIX/$target -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/icu-config $PREFIX/bin/
# Fix for OpenTTD
mv $PREFIX/$target/lib/libsicudt.a $PREFIX/$target/lib/libsicudt.a.old
cp lib/libsicudt.a $PREFIX/$target/lib/libsicudt.a

rm -rf $DESTDIR

4.53   OpenAL Soft 1.18.2

URL https://aur.archlinux.org/packages/mingw-w64-openal/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://kcat.strangesoft.net/openal-releases/openal-soft-1.18.2.tar.bz2
tar xjf openal-soft-1.18.2.tar.bz2
cd openal-soft-1.18.2/
mkdir build-$target && cd build-$target
mingw-w64-cmake  -DALSOFT_EXAMPLES=OFF -DALSOFT_TESTS=OFF -DALSOFT_UTILS=OFF ..

make DESTDIR=$DESTDIR install
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.54   Libtheora 1.1.1

URL https://aur.archlinux.org/packages/mingw-w64-libtheora/

Note

While compiling, a exe file has to be executed. Just run

sudo echo ':DOSWin:M::MZ::/opt/wine/apps/MinGW32_Environment/bin//wine:' > /proc/sys/fs/binfmt_misc/register
[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-libtheora.git
cd mingw-w64-libtheora/
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar xjf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1/
patch -p1 -i ../libtheora-1.1.1-fix-pp_sharp_mod-calc.patch
patch -p0 -i ../libtheora-1.1.1-libpng16.patch
patch -p1 -i ../libtheora-1.1.1-libm.patch
patch -p1 -i ../libtheora-1.1.1-libadd.patch
patch -p1 -i  ../mingw-libtheora-1.1.1-rint.patch
sed -i 's/CFLAGS="$CFLAGS $cflags_save"/CFLAGS="$cflags_save"/g' configure.ac
sed -i 's/^EXPORTS//' win32/xmingw32/*.def
autoreconf -fi -I m4
./configure --host=$target --target=$target  --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.55   Lame 3.100

URL https://aur.archlinux.org/packages/mingw-w64-lame/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-lame.git
wget http://downloads.sourceforge.net/lame/lame-3.100.tar.gz
tar xvzf lame-3.100.tar.gz
cd lame-3.100/
unset LDFLAGS CPPFLAGS
patch -Np1 -i ../mingw-w64-lame/mingw.patch
patch -p1 -i /opt/Sources/MINGW-packages/mingw-w64-lame/0007-revert-posix-code.patch
CFLAGS="-msse" CPPFLAGS="-msse" ./configure --host=$target  --prefix=$PREFIX/$target/ --enable-shared --enable-static --enable-nasm

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.56   LibreSSL 2.6.4

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources
export DESTDIR=/tmp/build

wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.6.4.tar.gz
tar xzf libressl-2.6.4.tar.gz
cd libressl-2.6.4/
CC=$target-gcc ./configure --host=$target --prefix=$PREFIX/$target/  CPPFLAGS="-I/$PREFIX/$target/include -D__MINGW_USE_VC2005_COMPAT" --enable-shared=yes --enable-static=yes
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.57   Opus 1.2.1

URL https://aur.archlinux.org/packages/mingw-w64-opus/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget https://ftp.osuosl.org/pub/xiph/releases/opus/opus-1.2.1.tar.gz
tar xvzf opus-1.2.1.tar.gz
cd opus-1.2.1/
./configure --host=$target  --prefix=$PREFIX/$target/ --enable-shared --enable-static --enable-custom-modes --disable-doc  --disable-extra-programs --enable-check-asm --enable-ambisonics --enable-fuzzing
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.58   Opusfile 0.10

  • Dependancies: ogg, opus, libressl (with patch)
[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget https://ftp.osuosl.org/pub/xiph/releases/opus/opusfile-0.10.tar.gz
tar xzf opusfile-0.10.tar.gz
cd opusfile-0.10/
# Patch for LibreSSL support
wget "https://patchwork.ozlabs.org/patch/827411/raw/" -O - |patch -p1
patch -p1 -i package/opusfile/0001-fix-libressl-support.patch
./configure --host=$target  --prefix=$PREFIX/$target/ --enable-shared --enable-static --disable-doc
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.59   Fftw 3.3.7

URL https://aur.archlinux.org/packages/mingw-w64-fftw/

Note

info Options were used following recommendations from http://www.fftw.org/install/windows.html

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://www.fftw.org/fftw-3.3.7.tar.gz
tar xvzf fftw-3.3.7.tar.gz
cd fftw-3.3.7/
export confflags="--host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --with-windows-f77-mangling --disable-dependency-tracking  --enable-threads --with-combined-threads --with-our-malloc --with-incoming-stack-boundary=2"
# Run 1
mkdir build-$target--double && cd build-$target--double
../configure $confflags --enable-sse2 --enable-avx
make -j$(nproc)
# Run 2
cd ..
mkdir build-$target--long-double && cd build-$target--long-double
../configure $confflags --enable-long-double
make -j$(nproc)
# Run 3
cd ..
mkdir build-$target-single && cd build-$target-single
../configure $confflags --enable-sse --enable-avx --enable-float
make -j$(nproc)
# Run 4
mkdir build-$target-quad-precision && cd build-$target-quad-precision
../configure $confflags --enable-quad-precision
# Run check using wine
cd ..
sed -i "s|\$program=\$arglist\[0\]|\$program=\"wine \$arglist[0]\"|g" tests/check.pl
cd build-$target--double
make check

for dir in build-i686-w64-mingw32--double/ build-i686-w64-mingw32--long-double/ build-i686-w64-mingw32-quad-precision/ build-i686-w64-mingw32-single/;
do
        cd $dir;
        make DESTDIR=$DESTDIR install;
        cd /tmp/sources/fftw-3.3.7;
done
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.60   Libaacplus 2.0.2

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
export DESTDIR=/tmp/build
cd /tmp/sources

wget http://tipok.org.ua/downloads/media/aacplus/libaacplus/libaacplus-2.0.2.tar.gz
tar xvzf libaacplus-2.0.2.tar.gz
cd libaacplus-2.0.2
wget "https://aur.archlinux.org/cgit/aur.git/plain/au.patch?h=libaacplus" -O - | patch -p1
./autogen.sh --fail-early
# Note: we use 'ac_cv_file__bin_bash=true' so we can cross-compil :)
./configure --host=$target --target=$target  --prefix=$PREFIX/$target/ --enable-shared --enable-static --with-fftw3 --with-fftw3-prefix=$PREFIX/$target ac_cv_file__bin_bash=true
make # THERE IS NO ERROR HERE just run 'make' else it will fail

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.61   Libsamplerate 0.1.9

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://www.mega-nerd.com/SRC/libsamplerate-0.1.9.tar.gz
tar xvzf libsamplerate-0.1.9.tar.gz
cd libsamplerate-0.1.9/
wget "https://aur.archlinux.org/cgit/aur.git/plain/no-examples-or-tests.patch?h=mingw-w64-libsamplerate" -O - |patch -p1
autoreconf -fi
./configure --host=$target --target=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --enable-sndfile
make -j$(nproc)

make DESTDIR=$DESTDIR install
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip -g $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
rm -rf $DESTDIR

4.62   Libxml2 2.9.8

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

wget http://xmlsoft.org/sources/libxml2-2.9.8.tar.gz
tar xvzf libxml2-2.9.8.tar.gz
cd libxml2-2.9.8/
sed -i "s| doc example | |g" Makefile.am
autoreconf -vfi
./configure --host=$target --target=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --with-icu --without-python
make -j$(nproc)
$target-ar x $PREFIX/$target/lib/libiconv.a
$target-ar x $PREFIX/$target/lib/liblzma.a
$target-ar x $PREFIX/$target/lib/libz.a
$target-ar x $PREFIX/$target/lib/libws2_32.a
$target-ar x $PREFIX/$target/lib/libicuin.dll.a # I don't know if it is needed since I added '--with-icu'
$target-ar x $PREFIX/$target/lib/libicuuc.dll.a # I don't know if is it needed since I added '--with-icu'
$target-ar x $PREFIX/$target/lib/libicudt.dll.a # I don't know  i it is needed since I added '--with-icu'
$target-ar cru .libs/libxml2.a *.o
$target-ranlib .libs/libxml2.a

make DESTDIR=$DESTDIR install
$target-strip --strip-unneeded $DESTDIR/$PREFIX/$target/bin/*dll
$target-strip --strip-debug $DESTDIR/$PREFIX/$target/lib/*.a

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/xml2-config $PREFIX/bin
rm -rf $DESTDIR

4.63   Libgpg-error 1.28

URL https://aur.archlinux.org/packages/mingw-w64-libgpg-error/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-libgpg-error.git
wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.28.tar.bz2
tar xvjf libgpg-error-1.28.tar.bz2
cd libgpg-error-1.28/
patch -p1 -i ../mingw-w64-libgpg-error/01-mingw32-fix-potomo.mingw.patch
patch -p1 -i ../mingw-w64-libgpg-error/02-fix-symbollist-on.mingw.patch
patch -p1 -i ../mingw-w64-libgpg-error/05-w32-gen.all.patch
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/gpgrt-config $PREFIX/bin/
ln -s $PREFIX/$target/bin/gpg-error-config $PREFIX/bin/
rm -rf $DESTDIR

4.64   Libgcrypt 1.8.2

URL https://aur.archlinux.org/packages/mingw-w64-libgcrypt/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-libgcrypt.git
wget https://gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.2.tar.bz2
tar xvjf libgcrypt-1.8.2.tar.bz2
cd libgcrypt-1.8.2/
wget "http://techer.pascal.free.fr/libgcrypt/configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch" -O - |patch -Np1
patch -p0 -i ../mingw-w64-libgcrypt/libgcrypt-use-correct-def-file.patch
patch -p1 -i ../mingw-w64-libgcrypt/Smarter-fig2dev-detection.all.patch
autoreconf -fi
./configure --host=$target --target=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static
make -j$(nproc)

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/libgcrypt-config $PREFIX/bin
rm -rf $DESTDIR

4.65   Libxslt 1.1.32

URL https://aur.archlinux.org/packages/mingw-w64-libxslt/

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-libxslt.git
wget http://xmlsoft.org/sources/libxslt-1.1.32.tar.gz
tar xvzf libxslt-1.1.32.tar.gz
cd libxslt-1.1.32/
for file in libxslt-1.1.32-w64.patch libxslt-1.1.27-disable_static_modules.patch libxslt-1.1.32-win32-shared.patch \
        libxslt.m4-libxslt-1.1.26.patch 0002-python-linking-on.mingw.patch 0003-fix-concurrent-directory-creation.all.patch \
        0004-add-missing-include-for-python.all.patch 0007-use-mingw-C99-compatible-functions-{v}snprintf.patch 0008-fix-warnings.patch;
do
        patch -Nbp1 -i /opt/Sources/MINGW-packages/mingw-w64-libxslt/$file;
done
autoreconf -fi
./configure --host=$target --target=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --without-python --with-crypto --with-plugins LIBS="-lxml2"

make DESTDIR=$DESTDIR install
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a' -o -name '*.dll' | xargs ${target}-strip -g

cp -avf $DESTDIR/$PREFIX/$target/* $PREFIX/$target/
ln -s $PREFIX/$target/bin/xslt-config $PREFIX/bin/
rm -rf $DESTDIR

4.66   PostgreSQL 10.3

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
export DESTDIR=/tmp/build

git clone https://aur.archlinux.org/mingw-w64-postgresql.git
wget https://ftp.postgresql.org/pub/source/v10.3/postgresql-10.3.tar.bz2
tar xvjf postgresql-10.3.tar.bz2
cd postgresql-10.3/
patch -p1 -i ../mingw-w64-postgresql/postgresql-9.4.1-mingw-link.patch
#mkdir build-$target && cd build-$target
./configure --host=$target --target=$target --prefix=$PREFIX/$target/  --with-openssl --with-libxml --with-libxslt --with-icu --enable-nls --enable-thread-safety
#ln -s /tmp/sources/postgresql-10.3/src/interfaces/libpq/libpqdll.def src/interfaces/libpq/
#ln -s /tmp/sources/postgresql-10.3/src/cinterfaces/ecpg/ecpglib/libecpgdll.def src/interfaces/ecpg/ecpglib/
#ln -s /tmp/sources/postgresql-10.3/src/interfaces/ecpg/pgtypeslib/libpgtypesdll.def src/interfaces/ecpg/pgtypeslib/
#ln -s /tmp/sources/postgresql-10.3/src/interfaces/ecpg/compatlib/libecpg_compatdll.def src/interfaces/ecpg/compatlib/
make -j$(nproc)
$target-ar rvs -o libpq.a src/interfaces/libpq/*.o

make DESTDIR=$DESTDIR install
mv -vf libpq.a $DESTDIR/$PREFIX/$target/lib
mv -vf $DESTDIR/$PREFIX/$target/lib/*.dll $DESTDIR/$PREFIX/$target/bin/
find $DESTDIR/$PREFIX/$target/ -name '*.exe' -exec ${target}-strip --strip-all {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.dll' -exec ${target}-strip --strip-unneeded {} \;
find $DESTDIR/$PREFIX/$target/ -name '*.a'   -exec ${target}-strip -g {} \;

4.67   Physfs

cd /tmp/sources/
hg clone -b default http://hg.icculus.org/icculus/physfs physfs
unset LDFLAGS
export CFLAGS="$CFLAGS -fno-strict-aliasing"
export CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
cd physfs
sed -i 's/-Werror//g' CMakeLists.txt
mkdir build && cd build
wget "https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw32.cmake" -O - |sed -e "s:/usr:/opt/mingw32:g" > /tmp/Toolchain-Ubuntu-mingw32.cmake
/opt/cmake/3.9.3/bin/cmake  -DCMAKE_TOOLCHAIN_FILE=/tmp/Toolchain-Ubuntu-mingw32.cmake -DCMAKE_BUILD_TYPE=Release -DPHYSFS_BUILD_TEST=OFF -DPHYSFS_BUILD_WX_TEST=OFF -DCMAKE_INSTALL_PREFIX=$PREFIX/$target/ ..
make -j$(nproc)  && make install

4.68   Allegro 5.2.3.0

cd /tmp/sources
wget https://github.com/liballeg/allegro5/releases/download/5.2.3.0/allegro-5.2.3.0.tar.gz
tar xvzf allegro-5.2.3.0.tar.gz
cd allegro-5.2.3.0/
mkdir build && cd build/
wget "https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw32.cmake" -O - |sed -e "s:/usr:/opt/mingw32:g" > /tmp/Toolchain-Ubuntu-mingw32.cmake
/opt/cmake/3.9.3/bin/cmake  -DCMAKE_TOOLCHAIN_FILE=/tmp/Toolchain-Ubuntu-mingw32.cmake \
-DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$PREFIX/$target/ \
-DCMAKE_BUILD_TYPE=Release -DPHYSFS_LIBRARY=$PREFIX/$target/lib/libphysfs.dll.a \
-DWANT_ACODEC_DYNAMIC_LOAD=ON -DWANT_DEMO=OFF -DWANT_DOCS_HTML=OFF -DWANT_DOCS_MAN=OFF -DWANT_EXAMPLES=OFF \
-DWANT_TESTS=OFF -DOPENAL_LIBRARY=$PREFIX/$target/lib/libOpenAL32.dll.a ..
make -j$(nproc)  && make install

#ln -s /opt/mingw32/i686-w64-mingw32/lib/pkgconfig/allegro-5.pc /opt/mingw32/i686-w64-mingw32/lib/pkgconfig/allegro.pc

4.69   Allegro 4.4.

cd /tmp/sources
wget https://github.com/liballeg/allegro5/releases/download/4.4.2/allegro-4.4.2.tar.gz
tar xvzf allegro-4.4.2.tar.gz
cd allegro-4.4.2/
wget http://techer.pascal.free.fr/0001-allegro-4.4.2_mingw32.patch -O - |patch -p1
mkdir build && cd build
wget "https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw32.cmake" -O - |sed -e "s:/usr:/opt/mingw32:g" > /tmp/Toolchain-Ubuntu-mingw32.cmake
MINGDIR=$PREFIX/$target \
/opt/cmake/3.9.3/bin/cmake  \
        -DCMAKE_TOOLCHAIN_FILE=/tmp/Toolchain-Ubuntu-mingw32.cmake \
        -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="/opt/mingw32/i686-w64-mingw32" \
        -DCMAKE_BUILD_TYPE=Release -DWANT_EXAMPLES=OFF -DWANT_TESTS=OFF   ..
make -j$(nproc)
sed -i "s:suffix=:suffix=44:g" lib/pkgconfig/allegro.pc
make install
ln -s /opt/mingw32/i686-w64-mingw32/lib/liballeg44.dll.a /opt/mingw32/i686-w64-mingw32/lib/liballeg44.a

4.70   Game-music-emu 0.6.2

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget https://bitbucket.org/mpyne/game-music-emu/downloads/game-music-emu-0.6.2.tar.xz
tar xvJf game-music-emu-0.6.2.tar.xz
cd game-music-emu-0.6.2/
mkdir build && cd build
wget "https://raw.githubusercontent.com/zyga/cmake-toolchains/master/Toolchain-Ubuntu-mingw32.cmake" -O - |sed -e "s:/usr:/opt/mingw32:g" > /tmp/Toolchain-Ubuntu-mingw32.cmake
/opt/cmake/3.9.3/bin/cmake  -DCMAKE_TOOLCHAIN_FILE=/tmp/Toolchain-Ubuntu-mingw32.cmake -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=$PREFIX/$target/  -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc) && make install

4.71   GUILib 1.2.1

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget https://www.libsdl.org/projects/GUIlib/src/GUIlib-1.2.1.tar.gz
tar xvzf GUIlib-1.2.1.tar.gz
cd GUIlib-1.2.1/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared --enable-static --disable-sdltest
make -j$(nproc) && make install

4.72   SDL2_net 2.0.1

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz
tar xvzf SDL2_net-2.0.1.tar.gz
cd SDL2_net-2.0.1/
sed -i "s|#include <winsock.h>|#include <winsock2.h>|g" SDLnetsys.h
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --disable-sdltest --disable-gui
make -j$(nproc) && make install

4.73   SDL_net 1.2.8

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget https://www.libsdl.org/projects/SDL_net/release/SDL_net-1.2.8.tar.gz
tar xvzf SDL_net-1.2.8.tar.gz
cd SDL_net-1.2.8/
sed -i "s|#include <winsock.h>|#include <winsock2.h>|g" SDLnetsys.h
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --disable-sdltest --disable-gui
make -j$(nproc) && make install

4.74   SDL2_image 2.0.2

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.2.tar.gz
tar xvzf SDL2_image-2.0.2.tar.gz
cd SDL2_image-2.0.2/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-shared --enable-static --disable-sdltest
make -j$(nproc) && make install

4.75   SDL_gfx 2.0.26

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-2.0.26.tar.gz
tar xvzf SDL_gfx-2.0.26.tar.gz
cd SDL_gfx-2.0.26/
./configure --host=$target --prefix=$PREFIX/$target/ --enable-static --enable-shared
make -j$(nproc) && make install-strip

4.76   SDL2_ttf 2.0.14 (for SDL 2)

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-2.0.14.tar.gz
tar xzf SDL2_ttf-2.0.14.tar.gz
cd SDL2_ttf-2.0.14/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes --disable-sdltest --with-freetype-prefix=$PREFIX/$target
make -j$(nproc) && make install-strip

4.77   SDL_ttf 2.0.11 (for SDL 1.2)

[ ! -d /tmp/sources ] && mkdir -p /tmp/sources
cd /tmp/sources/
wget http://libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.11.tar.gz
tar xvzf SDL_ttf-2.0.11.tar.gz
cd SDL_ttf-2.0.11/
./configure --host=$target  --prefix=$PREFIX/$target/  --enable-shared=yes --enable-static=yes --disable-sdltest --with-freetype-prefix=$PREFIX/$target
make -j$(nproc) && make install-strip

4.78   Gzdoom 3.2.5

Help from https://zdoom.org/wiki/Compile_ZDoom_on_Mac_OS_X

wget https://zdoom.org/files/gzdoom/src/gzdoom-g3.2.5.zip
unzip gzdoom-g3.2.5.zip
cd gzdoom-g3.2.5/
mkdir {build-native,build-cross}
cd build-native
#
# SDL2 is not part of my base system but install at /opt/wine/apps/koku-xinput/. Prefix is used here to point to its installation
#
SDL2DIR=/opt/wine/apps/koku-xinput/  /opt/cmake/3.9.3/bin/cmake -DCMAKE_BUILD_TYPE=Release ..
#
# CrossCompiling
#
cd ../build-cross
/opt/cmake/3.9.3/bin/cmake  -DCMAKE_TOOLCHAIN_FILE=/tmp/Toolchain-Ubuntu-mingw32.cmake -DBUILD_SHARED_LIBS=OFF \
        -DCMAKE_INSTALL_PREFIX=$PREFIX/$target/  \
        -DCMAKE_BUILD_TYPE=Release \
        -DFORCE_CROSSCOMPILE=ON -DIMPORT_EXECUTABLES=/tmp/sources/gzdoom-g3.2.5/build-native/ImportExecutables.cmake ..

5   Make the Toolchain portable

5.1   Download

Download the compressed toolchain i686-w64-mingw32-gcc-7.2.0-posix_Linux-32Bit_binaries_20180227_v001.tar.xz

  • Required space: 940MB

TODO

5.2   Install on Linux Debian 9.3 64 Bits

  • Option #1: Enough free space on /

    sudo tar xvJf i686-w64-mingw32-gcc-7.2.0-posix_Linux-32Bit_binaries_20180227_v001.tar.xz  -C /
    
  • Option #2: Using symbolic link

    sudo tar xvJf i686-w64-mingw32-gcc-7.2.0-posix_Linux-32Bit_binaries_20180227_v001.tar.xz -C /some/path/to/extract
    sudo ln -s /some/path/to/extract/opt/mingw32 /opt/
    

5.3   Prerequisites for 32 bits binaries

  • Install missing packages

    apt-get install libc6-i386
    
  • Check that it works running /opt/mingw32/bin/i686-w64-mingw32-gcc -v

    david@kvm-ReactOS:~$ /opt/mingw32/bin/i686-w64-mingw32-gcc -v
    Using built-in specs.
    COLLECT_GCC=/opt/mingw32/bin/i686-w64-mingw32-gcc
    COLLECT_LTO_WRAPPER=/home/david/opt/mingw32/bin/../libexec/gcc/i686-w64-mingw32/7.2.0/lto-wrapper
    Target: i686-w64-mingw32
    Configured with: /build/gcc-7.2.0/configure --prefix=/opt/mingw32 --target=i686-w64-mingw32 --disable-multilib --enable-threads=posix --enable-lto --enable-languages=c,c++ --disable-nls --with-gnu-ld --with-gnu-as --enable-libgomp
    Thread model: posix
    gcc version 7.2.0 (GCC)
    

5.4   Set up environment

export PREFIX=/opt/mingw32
export target=i686-w64-mingw32
export PATH=/opt/mingw32/bin:${PATH}
export CPPFLAGS=-I/opt/mingw32/i686-w64-mingw32/include
export LDFLAGS=-L/opt/mingw32/i686-w64-mingw32/lib
export PKG_CONFIG=/opt/mingw32/bin/i686-w64-mingw32-pkg-config
export PKG_CONFIG_LIBDIR=$PREFIX/$target/lib/pkgconfig

6   Test 1 - Chocolate Doom 3.0.0

URL https://www.chocolate-doom.org/wiki/index.php/Chocolate_Doom

6.1   Ahout dependancies for this game

  • SDL2
  • SDL2_{Mixer,Net}
  • Libsamplerate (optional)
  • Libpng

6.2   Build the game

export CHOCOLATE_PREFIX=/tmp/chocolate
wget https://github.com/chocolate-doom/chocolate-doom/releases/download/chocolate-doom-3.0.0/chocolate-doom-3.0.0.tar.gz
tar xzf chocolate-doom-3.0.0.tar.gz
cd chocolate-doom-3.0.0/
./configure --host=$target --prefix=$CHOCOLATE_PREFIX --datadir=$CHOCOLATE_PREFIX --with-bashcompletiondir=$CHOCOLATE_PREFIX/completions
make -j$(nproc) && make install

6.3   Add DLLs to make it portable

cp -vf /opt/mingw32/i686-w64-mingw32/bin/SDL2{_mixer,_net,}.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libpng16-16.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libsamplerate-0.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/zlib1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/lib/libgcc_s_sjlj-1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libwinpthread-1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libglib-2.0-0.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libportaudio-2.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libsndfile-1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libintl-8.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libpcre-1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libglib-2.0-0.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libFLAC-8.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libogg-0.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libspeex-1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libvorbis-0.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libvorbisenc-2.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libsndfile-1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libfluidsynth-1.dll $CHOCOLATE_PREFIX/bin/
cp -vf /opt/mingw32/i686-w64-mingw32/bin/libiconv-2.dll $CHOCOLATE_PREFIX/bin/

i686-w64-mingw32-strip $CHOCOLATE_PREFIX/bin/*exe
i686-w64-mingw32-strip $CHOCOLATE_PREFIX/bin/*dll

That's it! Now you can copy the prefix folder and test it on any Window machine. I tried it on my own Windows XP and it worked.

7   Test 2 - OpenTTD 1.7.2

URL https://www.openttd.org/

7.1   About dependancies for this game

Quoted from https://svn.openttd.org/trunk/readme.txt

The following libraries are used by OpenTTD for:

  • libSDL/liballegro: hardware access (video, sound, mouse)
  • zlib: (de)compressing of old (0.3.0-1.0.5) savegames, content downloads, heightmaps
  • liblzo2: (de)compressing of old (pre 0.3.0) savegames
  • liblzma: (de)compressing of savegames (1.1.0 and later)
  • libpng: making screenshots and loading heightmaps
  • libfreetype: loading generic fonts and rendering them
  • libfontconfig: searching for fonts, resolving font names to actual fonts
  • libicu: handling of right-to-left scripts (e.g. Arabic and Persian) and natural sorting of strings.

OpenTTD does not require any of the libraries to be present, but without liblzma you cannot open most recent savegames and without zlib you cannot open most older savegames or use the content downloading system. Without libSDL/liballegro on non-Windows and non-MacOS X machines you have no graphical user interface; you would be building a dedicated server

Depends on

  • ZLib
  • Lzo2
  • Icu
  • Freetype
  • SDL

7.3   Build game from sources

cd /tmp/sources
wget http://binaries.openttd.org/releases/1.7.2/openttd-1.7.2-source.tar.gz -O- | tar xfz -
cd openttd-1.7.2/
# Patch for src/video/allegro_v.cpp, dirty patch but it works
wget http://techer.pascal.free.fr/0001-openttd-1.7.2_mingw32.patch -O - |patch -p1
# Patch: Allegro dependancies are not taken into account for pkg-config for MinGW environment
wget http://techer.pascal.free.fr/0002-openttd-1.7.2_mingw32.patch -O - | patch -p1
./configure --host=$target --prefix=/tmp/openttd_build  --with-lzo2=$PREFIX/$target/lib/liblzo2.a --enable-static --static-icu
make -j$(nproc)

7.4   Make the game portable

cp /opt/mingw32/i686-w64-mingw32/bin/alleg44.dll bin/
cp /opt/mingw32/i686-w64-mingw32/bin/SDL.dll bin/
cp /opt/mingw32/i686-w64-mingw32/lib/libgcc_s_sjlj-1.dll bin/
cp /opt/mingw32/i686-w64-mingw32/bin/libwinpthread-1.dll bin/
i686-w64-mingw32-strip bin/*dll

7.5   Add Modules (OpenGFX, OpenSFX, OpenMSX)

# OpenGFX
wget http://uk.binaries.openttd.org/binaries/extra/opengfx/0.5.2/opengfx-0.5.2-all.zip -O /tmp/opengfx.zip
unzip /tmp/opengfx.zip -d bin/baseset
# OpenSFX
wget http://bundles.openttdcoop.org/opensfx/releases/opensfx-0.2.3.zip -O /tmp/opensfx-0.2.3.zip
unzip /tmp/opensfx-0.2.3.zip -d bin/baseset
# OpenMSX
wget http://bundles.openttdcoop.org/openmsx/releases/0.3.1/openmsx-0.3.1.zip -O /tmp/openmsx-0.3.1.zip
unzip /tmp/openmsx-0.3.1.zip -d bin/baseset
# Zbase
wget http://binaries.openttd.org/bananas/basegraphic/zBase-v5588.tar.gz
gunzip zBase-v5588.tar.gz
mv zBase-v5588.tar bin/baseset/

7.6   MIDI on Linux (Music in Game)

apt install fluidsynth fluid-soundfont-gm timidity

Open a terminal and launch -- let the terminal opened --

timidity -iA -B2,8 -Os -EFreverb=0

7.7   Launch the game

  • Help for the game

    wine bin/openttd.exe -h
    
  • With some options

    wine bin/openttd.exe  -r 1400x900 -s win32 -m win32 -v win32 -b 32bpp-sse4-anim
    
  • With SDL options

    wine openttd.exe  -r 1920x1080 -s sdl -m win32 -v sdl -b 32bpp-sse4-anim