From Fedora Project Wiki

Line 23: Line 23:
  
 
{|
 
{|
| <code>mingw-runtime</code> || Root filesystem and some base libraries
+
| <code>mingw-filesystem</code> || Core filesystem directory layout, and RPM macros for spec files. Equivalent to 'filesystem' RPM
 
|-
 
|-
| <code>mingw-binutils</code> || Binutils. Utilities like 'strip', 'ld', 'objdump' which work on Windows EXE and DLL files.
+
| <code>mingw-runtime</code> || Base libraries for core MinGW runtime & development environment. Equivalent to 'glibc' RPM
 
|-
 
|-
| <code>mingw-w32api</code> || Win32 API.  A [http://www.mingw.org/MinGWiki/index.php/w32api free (public domain) reimplementation] of the header files required to link to the Win32 API.
+
| <code>mingw-binutils</code> || Cross-compiled binutils (utilities like 'strip', 'as', 'ld') which
 +
understand Windows executables and DLLs. Equivalent to 'binutils' RPM
 
|-
 
|-
| <code>mingw-gcc</code> || GNU compiler collection.  Compilers for C and C++ which cross-compile to a Windows target
+
| <code>mingw-w32api</code> || Win32 API.  A [http://www.mingw.org/MinGWiki/index.php/w32api free (public domain) reimplementation] of the header files required to link to the Win32 API. No direct equivalent in base Fedora - 'glibc' is closest
 +
|-
 +
| <code>mingw-gcc</code> || GNU compiler collection.  Compilers for C and C++ which cross-compile to a Windows target. Equivalent to 'gcc' RPM
 
|}
 
|}
  

Revision as of 09:59, 6 September 2008

Packaging Guidelines for MinGW Windows cross-compiler

Please note this is a draft. "Rationale" sections are for discussion and will be deleted from the final document.

Naming

Packages should be named by prefixing the upstream package name with mingw-

Rationale Debian name their packages mingw32-*. However I can't see a reason for including '32' in the name, particularly since (a) the upstream package is just called mingw and (b) we may want to build 64 bit binaries.

Base packages

The base packages provide a root filesystem, base libraries, binutils (basic programs like 'strip', 'ld' etc), the compiler (gcc) and the Win32 API. Packages may need to depend on one or more of these. In particular, almost any conceivable package should depend on mingw-runtime.

mingw-filesystem Core filesystem directory layout, and RPM macros for spec files. Equivalent to 'filesystem' RPM
mingw-runtime Base libraries for core MinGW runtime & development environment. Equivalent to 'glibc' RPM
mingw-binutils Cross-compiled binutils (utilities like 'strip', 'as', 'ld') which

understand Windows executables and DLLs. Equivalent to 'binutils' RPM

mingw-w32api Win32 API. A free (public domain) reimplementation of the header files required to link to the Win32 API. No direct equivalent in base Fedora - 'glibc' is closest
mingw-gcc GNU compiler collection. Compilers for C and C++ which cross-compile to a Windows target. Equivalent to 'gcc' RPM

Rationale I've used the same names as the upstream packages, and also the same names as Debian (minus the unnecessary '32' which Debian has in the name).

Naming of the cross-compilers and binutils

The cross-compilers and binutils are Fedora binaries and are therefore placed in %{_bindir} (ie. /usr/bin) according to the FHS and Fedora guidelines.

The cross-compilers and binutils which generate i686 binaries for Windows are named:

%{_bindir}/i686-pc-mingw32-gcc
%{_bindir}/i686-pc-mingw32-g++
%{_bindir}/i686-pc-mingw32-ld
%{_bindir}/i686-pc-mingw32-as
%{_bindir}/i686-pc-mingw32-strip
etc.

The same binaries are present in %{_prefix}/i686-pc-mingw32/bin without any prefix in the name, ie:

%{_prefix}/i686-pc-mingw32/bin/gcc
%{_prefix}/i686-pc-mingw32/bin/g++
%{_prefix}/i686-pc-mingw32/bin/ld
%{_prefix}/i686-pc-mingw32/bin/as
%{_prefix}/i686-pc-mingw32/bin/strip
etc.

Note that we don't support generating x86-64 binaries (or any other architecture) at the moment, but when we do those will have a different prefix.

Rationale This is the name which autoconf configure scripts expect when they are invoked in cross-compiling mode. The /usr/i686-pc-mingw32/bin directory is required by GCC, otherwise it invokes the wrong assembler and linker.

Naming of the root filesystem

The root filesystem contains Windows executables and DLLs and any other Windows-only files. It is necessary both because we need to store Windows libraries in order to link further libraries which depend on them, and also because MinGW requires a root filesystem location. The location (for i686 target) is:

%{_prefix}/i686-pc-mingw32/sys-root/mingw

Rationale Hmmm. This is what the existing Fedora packages do, and very similar to what Debian is doing (they use a different and inconsistent name, but it is still a directory located directly under /usr), and is what MinGW expects.

Packaging DLLs

The Fedora MinGW SIG packages a range of common Linux libraries as Windows DLLs so that further libraries/programs can be compiled against them.

These libraries should be packaged in the directory:

%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib

Rationale Specified by MinGW. Putting them in %{_libdir} doesn't sound like a good idea because they are useless to ordinary Fedora programs.

Packaging EXEs

Any Windows binaries should be packaged in the directory:

%{_prefix}/i686-pc-mingw32/sys-root/mingw/bin

Rationale Specified by MinGW. No use to anyone if they are in /usr/bin.

Packaging header files and other auxiliary files

Any auxiliary Windows files should be placed in the standard subdirectories of the root filesystem, for example:

%{_prefix}/i686-pc-mingw32/sys-root/mingw/include
%{_prefix}/i686-pc-mingw32/sys-root/mingw/share
etc.