TABLE OF CONTENTS
- mingw.cygclass
- MINGW32_SYSROOT
- MINGW32_PREFIX
- MINGW32_BINDIR
- MINGW32_INCLUDEDIR
- MINGW32_LIBDIR
- MINGW32_DATADIR
- MINGW64_SYSROOT
- MINGW64_PREFIX
- MINGW64_BINDIR
- MINGW64_INCLUDEDIR
- MINGW64_LIBDIR
- MINGW64_DATADIR
mingw.cygclass
[ Top ] [ Cygclasses ] [ Cygclasses ]
SYNOPSIS
inherit mingw
DESCRIPTION
Some architectures, particularly embedded systems, support multiple, incompatible ABIs in the same compiler triplet, with each ABI being distinguished by one or more complier flags. In such setups, each ABI has its own libdir, with only the "default" ABI in $prefix/lib.
In order to build libraries for such targets, a package must be compiled and installed once per ABI. This cygclass allows the packager to specify the compile and install steps only once, while handling the differences in libdir and compiler flags for each ABI iteration automatically.
NOTES
- Unlike other cygclasses, the src_compile and src_install functions provided herein are mandatory; the build may only be controlled via the functions documented below. Therefore, if other cygclasses are used as well, they must precede mingw in the inherit command.
- Do not attempt to use mingw with a PE architecture (such as Cygwin and MinGW), as the placement of DLLs in $libdir/../bin does not allow for mingw.
EXAMPLE
inherit mingw NAME="mingw64-zlib" VERSION=1.2.8 RELEASE=1 CATEGORY="Devel" SUMMARY="zlib for MinGW toolchain" HOMEPAGE="http://www.zlib.net/" SRC_URI="mirror://sourceforge/libpng/zlib-${VERSION}.tar.gz" SRC_DIR="zlib-${VERSION}" src_compile() { mkdir -p ${B}/build_win32 cd ${B}/build_win32 lndirs ${S} rm -f Makefile CC="${CC}" CFLAGS="${CFLAGS}" CHOST=${MINGW32_HOST} \ ./configure --prefix=${MINGW32_PREFIX} --libdir=${MINGW32_LIBDIR} cygmake mkdir -p ${B}/build_win64 cd ${B}/build_win64 lndirs ${S} rm -f Makefile CC="${CC}" CFLAGS="${CFLAGS}" CHOST=${MINGW64_HOST} \ ./configure --prefix=${MINGW64_PREFIX} --libdir=${MINGW64_LIBDIR} cygmake } src_install() { cd ${B}/build_win32 cyginstall cd ${B}/build_win64 cyginstall # already provided by native zlib rm -fr ${D}${MINGW32_DATADIR}/man rm -fr ${D}${MINGW64_DATADIR}/man }
MINGW32_SYSROOT
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
GCC cross-compilers provide the concept of a sysroot: a directory which acts as the virtual root of the target filesystem, resulting in MINGW32_SYSROOT/$prefix/include and MINGW32_SYSROOT/$prefix/lib being in the default search paths without requiring -I or -L flags.
This means that software natively compiled for the host system can be unpacked into the sysroot and used for cross-compiling. This is especially useful when bootstrapping a new toolchain; e.g. for Linux, one can just download glibc and kernel headers packages from a Linux distro, unpack them into the MINGW32_SYSROOT, and use those to build a cross-GCC for the first time.
If you do use natively-compiled host packages under the sysroot, you must fix paths in all *-config scripts, .la libtool libraries, and .pc pkg-config files so they do not erroneously point to Cygwin-native headers and libraries.
MINGW32_PREFIX
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW32_BINDIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/bin directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW32_INCLUDEDIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/include directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW32_LIBDIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/lib directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW32_DATADIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/share directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW64_SYSROOT
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
GCC cross-compilers provide the concept of a sysroot: a directory which acts as the virtual root of the target filesystem, resulting in MINGW64_SYSROOT/mingw/include and MINGW64_SYSROOT/mingw/lib being in the default search paths without requiring -I or -L flags.
This means that software natively compiled for the host system can be unpacked into the sysroot and used for cross-compiling. This is especially useful when bootstrapping a new toolchain; e.g. for Linux, one can just download glibc and kernel headers packages from a Linux distro, unpack them into the MINGW64_SYSROOT, and use those to build a cross-GCC for the first time.
If you do use natively-compiled host packages under the sysroot, you must fix paths in all *-config scripts, .la libtool libraries, and .pc pkg-config files so they do not erroneously point to Cygwin-native headers and libraries.
MINGW64_PREFIX
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW64_BINDIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/bin directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW64_INCLUDEDIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/include directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW64_LIBDIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/lib directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
MINGW64_DATADIR
[ Top ] [ cross.cygclass ] [ Definitions ]
DESCRIPTION
The $prefix/share directory under the sysroot. This definition is meant to be used in configure or cmake arguments to avoid dealing with different prefixes on various systems.
mingw_precompile
[ Top ] [ mingw.cygclass ] [ Compile Functions ]
SYNOPSIS
mingw_precompile() { PRECOMPILE_COMMAND; [PRECOMPILE_COMMAND ...] }
DESCRIPTION
This function, if defined, will be run once in total prior to the loop which calls mingw_compile. This function is intended to include cygautoreconf and similar commands. Directory traversal is completely within control of the function (e.g. cd ${S} must still be called before cygautoreconf).
mingw_compile
[ Top ] [ mingw.cygclass ] [ Compile Functions ]
SYNOPSIS
mingw_compile() { COMPILE_COMMAND; [COMPILE_COMMAND ...] }
DESCRIPTION
This function must include all compile commands, such as cygconf and cygmake. This function will be called once per ABI, during which the following variables will be altered to match the ABI:
- CC/CXX/etc. have the corresponding ABI flag(s) added;
- MINGW32_LIBDIR is adjusted to match the ABI-specific libdir;
- pkg-config's environment variables are adjusted to use MINGW32_LIBDIR.
The working directory of mingw_compile is unique for each ABI. Do not attempt to call cd ${B} or the like, but if you may traverse into a relative subdirectory with pushd/popd.
mingw_install
[ Top ] [ mingw.cygclass ] [ Compile Functions ]
SYNOPSIS
mingw_install() { INSTALL_COMMAND; [INSTALL_COMMAND ...] }
DESCRIPTION
This function must include all install commands, such as cyginstall. This function will be called once per ABI, during which the following variables will be altered to match the ABI:
- MINGW32_LIBDIR is adjusted to match the ABI-specific libdir;
- pkg-config's environment variables are adjusted to use MINGW32_LIBDIR.
The working directory of mingw_install is unique for each ABI. Do not attempt to call cd ${B} or the like, but if you may traverse into a relative subdirectory with pushd/popd.
mingw_postinstall
[ Top ] [ mingw.cygclass ] [ Compile Functions ]
SYNOPSIS
mingw_postinstall() { POSTINSTALL_COMMAND; [POSTINSTALL_COMMAND ...] }
DESCRIPTION
This function, if defined, will be run once in total after the loop which calls mingw_install is complete. This function is intended to include cleanup commands, such as removing superfluous documentation from the sysroot. Directory traversal is completely within control of the function.