This is an attempt at keeping a log of what needs to be done to build KStars from source on Windows using the emerge tool.
Some quick explanations of GNU on Windows projects
Cygwin: Cygwin provides a kind of emulation layer for UNIX APIs on Windows. It has almost everything of GNU/Linux distros (X11/GNOME/KDE/whatever), including the Qt libraries and KDE Frameworks 5 libraries in its distribution. However, compiling and linking against these libraries means that you are essentially running a binary that uses X and UNIX APIs on Windows. The end result is a KStars binary that needs a running X-server, is very slow, and does not work very well.
MinGW + MSYS: Provides a native GNU build toolchain and native GNU accessories that (if my understand is right) still use libstdc++ and such GNU/Linuxy things, but does not need an implementation of the UNIX API on Windows.
Moral of the story: Avoid Cygwin.
This article: https://techbase.kde.org/Getting_Started/Build/Windows/emerge is great for almost all things.
If you are using Windows 10, please see the notes at the very bottom of the page
Also, do not try to use Cygwin to get python and git. The entire process does not want you to have the standard GNU tools in path etc. Instead, get them from the standard installers at python.org and git-scm.com
When installing git using the installer from git-scm.com, make sure you choose the option where git is accessible from command line, but the MinGW tools are not added to the path (Second option out of the three as of this writing). Adding the MinGW32 tools to the path ends up causing trouble while building with the MinGW compiler.
Please note that emerge has a verbose mode (emerge --verbose) which is very helpful for diagnosing any problems.
Building Qt packages
First build Qt Base by emerging it
For some strange reason, emerge may get stuck half way in powershell. It looks like hitting enter periodically ensures that the process goes on (why????). Of course this could just be coincidence but it seems unlikely. (This could be due to a virtualbox feature -- the author of this blurb is running the Windows OS in virtualbox)
This is a very long process. emerge will download 7zip, other developer utils, cmake and then download MSYS (binaries), and then build a few packages like OpenSSL. Then actually getting to building the Qt libraries.