Contributors: DmitrijsLedkovs, StephenKitt
Packages affected: mingw32 mingw-w64
See also: multiarch Multiarch/Spec
This specification describes the way we would like to package i686-w64-mingw32 and x86_64-w64-mingw32 toolchains.
While Multiarch/Spec provides starting ideas it is not clear, what is the correct procedure to package mingw cross-compilation environment. Currently such environments are implemented in Fedora by Mingw SIG, openSUSE derives from that effort in OBS project. Additionally there is documentation created by mingw.org.
Multiarch/Spec covers installation of shared libraries, but doesn't discuss -dev packages.
Fedora MinGW SIG packaging guidelines deal with installing any cross-compiled packages, but it is not x86_64 aware.
Futher discussion of multiarch in debian is also of interest.
Relocation HOWTO is also of interest. A guide how to create relocatable MinGW toolchain.
Linaro CrossBuilding wiki page sheds a lot of light into current state of cross-compiling.
- Bob is a maintainer of an upstream project. He gets a lot of request to create native Windows install files. Bob uses the mingw-w64 toolchain in Debian to cross-compile his app and create an nsis installer for it.
- Wine packaging uses the mingw-w64 toolchain in Debian to compile wine-gecko and eventually wine-mono.
LibreOffice packaging uses the mingw-w64 toolchain to build a Windows DLL for its SDK.
- A number of Debian packages use the mingw-w64 toolchain to build Windows tools for the Windows-based installer.
The scope of this spec covers:
- cross-compilers to x86 and x86_64 Windows platforms, i.e. binutils, gcc, mingw-w64 runtime and headers
- Packaging and cross-compilation guidelines to x86 and x86_64 Windows platforms
- Biarch is not ready - two single-arch toolchains
- Co-installable multiple gcc versions
- No sysroot, because single mingw include dir is not x86_64 aware
- Where to install cross-compiled packages
- Naming scheme for the packages.
Diagram below is a modified version from Fedora MinGW SIG under license Attribution-Share Alike 3.0 Unported.
This is the current (non Multiarch) layout:
[root] | +- usr | +- bin | | | +- i686-w64-mingw32-cpp | +- i686-w64-mingw32-gcc | +- i686-w64-mingw32-g++ | +- i686-w64-mingw32-strip | +- i686-w64-mingw32-ld | +- ... etc.. | +- x86_64-w64-mingw32-cpp | +- x86_64-w64-mingw32-gcc | +- x86_64-w64-mingw32-g++ | +- x86_64-w64-mingw32-strip | +- x86_64-w64-mingw32-ld | +- ... etc.. | +- lib | | | +- gcc - (cross-compiler) | | | +-i686-w64-mingw32 | +-x86_64-w64-mingw32 | +- i686-w64-mingw32 - root of x86 toolchain and binaries | | | +- lib - Cross compiler toolchain support libraries / files | | | +- include - Cross compiler toolchain support headers / files | +- x86_64-w64-mingw32 - root of x86_64 toolchain and binaries (same layout as for x86)
This is the future layout once dpkg knows about the architecture:
[root] | +- usr | +- bin | | | +- i686-w64-mingw32-cpp | +- i686-w64-mingw32-gcc | +- i686-w64-mingw32-g++ | +- i686-w64-mingw32-strip | +- i686-w64-mingw32-ld | +- ... etc.. | +- x86_64-w64-mingw32-cpp | +- x86_64-w64-mingw32-gcc | +- x86_64-w64-mingw32-g++ | +- x86_64-w64-mingw32-strip | +- x86_64-w64-mingw32-ld | +- ... etc.. | +- include | | | +- i686-w64-mingw32 - x86-specific headers | +- x86_64-w64-mingw32 - x64-specific headers | +- lib | | | +- gcc - (cross-compiler) | | | | | +-i686-w64-mingw32 | | +-x86_64-w64-mingw32 | | | +- i686-w64-mingw32 - x86 libraries | +- x86_64-w64-mingw32 - x64 libraries
This should be the description of why this spec is being defined.
Scope and Use Cases
While not always required, but in many cases they bring much better clarity to the scope and scale of the specification than could be obtained by talking in abstract terms.
This section is usually broken down into subsections, such as the packages being affected, data and system migration where necessary, user interface requirements and pictures (photographs of drawings on paper work well).
Targets in dpkg
MinGW-w64 targets need to be added to dpkg for Multiarch and cross-building using sbuild to work. This is tracked in #606825.
Once the architectures exist, cross-build-essential can be used to tell sbuild what to do; this requires
- changing gcc-mingw-w64 to provide gcc-i486-w64-mingw32 and g++-i486-w64-mingw32 (and likewise for x86_64)
- changing mingw-w64 to build libc6-dev:mingw64-i386 and libc6-dev:mingw64-amd64
- providing pkg-config-i486-w64-mingw32 and pkg-config-x86_64-w64-mingw32
- enabling mingw64-i386 and mingw64-amd64 in cross-build-essential
To implement a specification, the developer should observe the use cases carefully, and follow the design specified. He should make note of places in which he has strayed from the design section, adding rationale describing why this happened. This is important so that next iterations of this specification (and new specifications that touch upon this subject) can use the specification as a reference.
The implementation is very dependent on the type of feature to be implemented. Refer to the team leader for further suggestions and guidance on this topic.
The specification process requires experienced people to drive it. More documentation on the process should be produced.
The drafting of a specification requires english skills and a very good understanding of the problem. It must also describe things to an extent that someone else could implement. This is a difficult set of conditions to ensure throughout all the specifications added.
There is a lot of difficulty in gardening obsolete, unwanted and abandoned specifications in the Wiki.
BoF agenda and discussion
Possible meetins where this specification will be discussed.