Cygport Reference Manual

### TABLE OF CONTENTS

- multilib.cygclass

- multilib_precompile
- multilib_compile
- multilib_install
- multilib_postinstall

## multilib.cygclass

[ Top ] [ Cygclasses ] [ Cygclasses ]

SYNOPSIS

      CROSS_HOST="..."
      inherit cross multilib

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 multilib in the inherit command.
- Do not attempt to use multilib with a PE architecture (such as Cygwin and MinGW), as the placement of DLLs in $libdir/../bin does not allow for multilib.

EXAMPLE

      CROSS_HOST="x86_64-pc-linux-gnu" # supports x86-64 and x32
      inherit cross multilib

      NAME="linux-x86_64-zlib"
      VERSION=1.2.8
      RELEASE=1
      CATEGORY="Devel"
      SUMMARY="zlib for Linux x86-64/x32 toolchain"
      HOMEPAGE="https://www.zlib.net/"
      SRC_URI="mirror://sourceforge/libpng/zlib-${VERSION}.tar.gz"
      SRC_DIR="zlib-${VERSION}"

      multilib_compile() {
        lndirs ${S}
        rm -f Makefile
        CC="${CC}" CFLAGS="${CFLAGS}" CHOST=${CROSS_HOST} \
        ./configure --prefix=${CROSS_PREFIX} --libdir=${CROSS_LIBDIR}
        cygmake
      }

      multilib_install() {
        cyginstall
      }

      multilib_postinstall() {
        # already provided by native zlib
        rm -fr ${D}${CROSS_DATADIR}/man
      }

## multilib_precompile

[ Top ] [ multilib.cygclass ] [ Compile Functions ]

SYNOPSIS

      multilib_precompile() {
        PRECOMPILE_COMMAND; [PRECOMPILE_COMMAND ...]
      }

DESCRIPTION

This function, if defined, will be run once in total prior to the loop which calls multilib_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).

## multilib_compile

[ Top ] [ multilib.cygclass ] [ Compile Functions ]

SYNOPSIS

      multilib_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;
- CROSS_LIBDIR is adjusted to match the ABI-specific libdir;
- pkg-config's environment variables are adjusted to use CROSS_LIBDIR.

The working directory of multilib_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.

## multilib_install

[ Top ] [ multilib.cygclass ] [ Install Functions ]

SYNOPSIS

      multilib_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:

- CROSS_LIBDIR is adjusted to match the ABI-specific libdir;
- pkg-config's environment variables are adjusted to use CROSS_LIBDIR.

The working directory of multilib_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.

## multilib_postinstall

[ Top ] [ multilib.cygclass ] [ Install Functions ]

SYNOPSIS

      multilib_postinstall() {
        POSTINSTALL_COMMAND; [POSTINSTALL_COMMAND ...]
      }

DESCRIPTION

This function, if defined, will be run once in total after the loop which calls multilib_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.