cygport/cygclass/toolchain.cygclass

Cygport Reference Manual

### TABLE OF CONTENTS

- toolchain.cygclass

- TOOLCHAIN_TARGET
- TOOLCHAIN_SYSROOT
- TOOLCHAIN_PREFIX
- TOOLCHAIN_BINDIR
- TOOLCHAIN_INCLUDEDIR
- TOOLCHAIN_LIBDIR
- TOOLCHAIN_DATADIR
- toolchain_compile
- src_compile (toolchain)

## toolchain.cygclass

[ Top ] [ Cygclasses ] [ Cygclasses ]

SYNOPSIS

      TOOLCHAIN_TARGET="..."
      inherit toolchain

DESCRIPTION

The GNU toolchain, consisting of Binutils, the GCC compilers, and the GDB debugger, are used to build code in C and related languages into an executable or library, either for the system on which it runs (a "native" compiler) or for another system (a "cross" compiler).

This cygclass assists in building both native- and cross-compilers which will run on Cygwin.

INHERITS

autotools.cygclass

SEE ALSO

cross.cygclass

## TOOLCHAIN_TARGET

[ Top ] [ toolchain.cygclass ] [ Variables ]

DESCRIPTION

The CPU-VENDOR-OS triplet, or customary abbreviation thereof, describing the compiler's "target" system; for example:

- i686-pc-linux-gnu: i686 GNU/Linux
- x86_64-w64-mingw32: Win64
- arm-eabi [arm-unknown-eabi]: Embedded ARM ELF system (e.g. with Newlib)
- avr [avr-unknown-none]: Atmel AVR bare metal (e.g. Arduino)

Note that while the 'unknown' vendor tag is usually omitted from embedded systems, particularly in conjunction with a 'none' OS tag, as above, this does not apply to e.g. 'x86_64-unknown-linux-gnu' and other systems.

The keyword "native" is also accepted, which will cause a host-native Cygwin compiler to be built, and TOOLCHAIN_TARGET to be redefined accordingly.

NOTES

- TOOLCHAIN_TARGET must be defined before inherit()ing toolchain.cygclass.

## TOOLCHAIN_SYSROOT

[ Top ] [ toolchain.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 TOOLCHAIN_SYSROOT/$prefix/include and TOOLCHAIN_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 without needing to mangle paths. 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 TOOLCHAIN_SYSROOT, and use those to build a cross-GCC for the first time.

## TOOLCHAIN_PREFIX

[ Top ] [ toolchain.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.

## TOOLCHAIN_BINDIR

[ Top ] [ toolchain.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.

## TOOLCHAIN_INCLUDEDIR

[ Top ] [ toolchain.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.

## TOOLCHAIN_LIBDIR

[ Top ] [ toolchain.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.

## TOOLCHAIN_DATADIR

[ Top ] [ toolchain.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.

## toolchain_compile

[ Top ] [ toolchain.cygclass ] [ Compile Functions ]

SYNOPSIS

      toolchain_compile [CONFIGURE_ARGS]

DESCRIPTION

Configures the toolchain package with the necessary options for the given TOOLCHAIN_TARGET, then runs cygmake to build.

## src_compile (toolchain)

[ Top ] [ toolchain.cygclass ] [ Overloads ]

NOTE

An autoreconf stage is not run by default, because GNU toolchain packages require specific versions of the autotools which do not match the latest versions in the distribution. They also do not recurse with AC_CONFIG_SUBDIRS.

DEFINITION

    src_compile() {
            cd ${B}
            toolchain_compile
    }