# emerge layman
# mkdir /usr/local/portage
# echo 'PORTDIR_OVERLAY=”/usr/local/portage/”' >> /etc/make.conf
# echo 'source /var/lib/layman/make.conf' >> /etc/make.conf
# env-update
# emerge crossdev portage-utils
# crossdev -t i686-pc-mingw32
! Attention! This assembly for PREFIX = i686-pc-mingw32-, the name of the compiler and utilities on another system may differ. Accordingly, the root directory for this build is the / usr / i686-pc-mingw32 directory, and accordingly all include files and lib files are installed in / usr / i686-pc-mingw32 / usr / include, / usr / i686-pc-mingw32 / lib .
$ cd
$ wget www.zlib.net/zlib-1.2.6.tar.gz
$ tar -zxf zlib-1.2.6.tar.gz
$ cd zlib-1.2.6
$ CC=i686-pc-mingw32-gcc LDSHARED=i686-pc-mingw32-gcc CPP="i686-pc-mingw32-gcc -E" AR=i686-pc-mingw32-ar RANLIB=i686-pc-mingw32-ranlib ./configure --prefix=/usr/i686-pc-mingw32/
# make && make install
$ cd
$ wget ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
$ tar -zxf libiconv-1.14.tar.gz
$ cd libiconv-1.14
$ ./configure --enable-static --disable-shared --build=x86_64-pc-linux-gnu --host=i686-pc-mingw32 --prefix=/usr/i686-pc-mingw32/ LDFLAGS="-Wl,-elf2flt" CC="i686-pc-mingw32-gcc"
# make && make install
$ cd
$ wget download.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.8.0.tar.gz
$ tar -zxf qt-everywhere-opensource-src-4.8.0.tar.gz
$ cd qt-everywhere-opensource-src-4.8.0
$ wget pastebin.com/download.php?i=CAjgyASQ -O qapplication_win.cpp.patch
$ patch -p0 -i qapplication_win.cpp.patch
#ifndef QT_NO_TABLET
struct QTabletDeviceData
{
$ wget pastebin.com/raw.php?i=uPMXC6cD -O qmake.conf
$ cp qmake.conf mkspecs/win32-g++/qmake.conf
$ ./configure -prefix /usr/i686-pc-mingw32/usr -bindir /usr/i686-pc-mingw32/usr/bin -libdir /usr/i686-pc-mingw32/usr/lib/qt4 -docdir /usr/i686-pc-mingw32/usr/share/doc/qt-4.8.0 -headerdir /usr/i686-pc-mingw32/usr/include/qt4 -plugindir /usr/i686-pc-mingw32/usr/lib/qt4/plugins -importdir /usr/i686-pc-mingw32/usr/lib/qt4/imports -datadir /usr/share/qt4 -translationdir /usr/share/qt4/translations -sysconfdir /etc/qt4 -examplesdir /usr/share/qt4/examples -demosdir /usr/share/qt4/demos -opensource -confirm-license -shared -fast -largefile -stl -verbose -xplatform win32-g++ -nomake examples -nomake demos -release -no-separate-debug-info -exceptions -no-rpath -no-pch -reduce-relocations -arch windows -no-accessibility -no-xmlpatterns -no-multimedia -no-audio-backend -no-phonon -no-phonon-backend -no-svg -no-webkit -no-script -no-scripttools -no-declarative -system-zlib -no-gif -no-libtiff -no-libpng -no-libmng -no-libjpeg -no-cups -no-dbus -no-gtkstyle -no-nas-sound -no-opengl -no-sm -no-xshape -no-xvideo -no-xsync -no-xinerama -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-mitshm -no-fontconfig -no-freetype -no-xinput -no-xkb -no-glib -iconv -no-optimized-qmake -no-openssl -no-qt3support
$ make -j$((`cat /proc/cpuinfo | grep processor | wc -l`+1))
# make install
# cp bin/qmake /usr/i686-pc-mingw32/usr/bin/qmake
$ cd
$ cp -r qt-everywhere-opensource-src-4.8.0/examples/tutorials/addressbook addressbook
$ cd addressbook
$ /usr/i686-pc-mingw32/usr/bin/qmake -spec win32-g++
$ make
$ ls part7/release/part7.exe
part7/release/part7.exe
$ cp part7/release/part7.exe /var/samba/files/build/
$ cp `find / -name libstdc++-6.dll 2> /dev/null` /var/samba/files/build/libstc++-6.dll
$ cp `find / -name libgcc_s_sjlj-1.dll 2> /dev/null` /var/samba/files/build/libgcc_s_sjlj-1.dll
$ cp /usr/i686-pc-mingw32/usr/bin/*.dll /var/samba/files/build/
Source: https://habr.com/ru/post/139324/
All Articles