Command Wrapper

For generic program argument transformations in T2 Linux, wrapper applications got introduced allowing on-the-fly modification of program arguments. The wrapper binary is automatically compiled by the build system and placed inside a tool directory put as first search location into the PATH environment variable. Thus any invocation of the to-be-wrapped application will cause the wrapper to be executed.

Available Wrappers

The currently existing wrappers are:

  • cmd (CMD): a generic command wrapper

  • cc (CC): C compiler wrapper

  • c++ (CXX): C++ compiler wrapper

  • kcc (KCC): Kernel C compiler wrapper

  • f77 (F77): Fortran 77 compiler wrapper

  • strip (STRIP): configuration for strip wrapper

  • install, cp, ln, move (INSTALL): file installation wrapper

Wrapper Configuration

Each of this wrappers has a set of associated environment variables to configure the wrapper at runtime. Each of the variables is prefixed with the wrapper name in capital letters (see the list above for details):

  • prefix_WRAPPER_DEBUG: If set to a non-zero value the wrapper will log actions to the standard output.

  • prefix_WRAPPER_BYPASS: If set to a non-zero value the wrapper will be deactivated and thus no transformations applied.

  • prefix_WRAPPER_INSERT: Arguments to be inserted at the beginning of the argument string.

  • prefix_WRAPPER_REMOVE: Arguments to be removed from the argument string.

  • prefix_WRAPPER_APPEND: Arguments to be appended at the end of the argument list.

  • prefix_WRAPPER_FILTER: A colon (':') separated list of commands used to transform the arguments (for example: "sed '...' | awk '...' | foobar").

  • prefix_WRAPPER_OTHERS: A colon (':') separated list of other wrappers to be run first.

  • prefix_WRAPPER_APPEND_PO: 'PO' stands for 'PreOthers' - the content will be added when others wrappers are executed first.

Environment Variables

All scripts, including the package .conf files, get run with certain environment variables set. This section does provide a full list, including the usage and meaning.

Basic build characterization:

  • config: Name of the active configuration (e.g. default).

  • extraver: Version text after the first whitespace, or $sdever if no extra version is present.

  • sdever: T2 Linux Version (including release date for snapshots).

  • arch: Architecture name (subdir in architecture).

  • target: Target distribution name (subdir in targets).

  • base: T2 Linux sources base directory.

Architecture build characterization:

  • crossnative: Either contains the value 'cross' or 'native' reflecting the build mode.

  • archprefix: Program prefix for binutils and compiler binaries (for cross-building).

  • arch_sizeof_long_long: Size of 'long long' - arch setting from architecture/*/archtest.out.

  • arch_sizeof_int: Size of 'int' - arch setting from architecture/*/archtest.out.

  • arch_machine: Machine name - arch setting from architecture/*/archtest.out.

  • arch_sizeof_char_p: Size of 'char*' - arch setting from architecture/*/archtest.out.

  • arch_sizeof_long: Size of 'long' - arch setting from architecture/*/archtest.out.

  • arch_bigendian: Indicates whether the architecture is big-endian - arch setting from architecture/*/archtest.out.

  • arch_sizeof_short: Size of 'short' - arch setting from architecture/*/archtest.out.

  • arch_target: Target name - arch setting from architecture/*/archtest.out.

  • arch_build: Build name - like 'arch_target' - but for the build host.

Build directories:

  • root: Root directory (usually '/').

  • xroot: Real root directory (/R.work/build/... when in chroot mode).

  • build_log: Build log file ... (Build-Target only).

  • build_pkgs: Package files go here .. (Build-Target only).

  • build_root: Change-root dir name ...... (Build-Target only).

  • targetdir: Directory containing the target config (target/...).

Package build characterization:

  • pkg: Name of the package to be built.

  • ver: Package version (from *.desc - until first whitespace).

  • desc_[A-Z]: Tag data from the *.desc file.

  • id: Unique ID for this Build-Pkg invocation.

  • stagelevel: Active build stage (0-1 = crossbuild, 2-8 = native, 9 = rebuild).

Package build directories:

  • archdir: Directory containing the package vanilla archive files (download/...).

  • confdir: Directory containing the package build config (package/...).

  • builddir: Directory in which the package is build (src.$id).

Package install directories:

  • prefix: Install prefix (usually '/usr' or '/opt/...').

  • prefix_auto: Set to '1' if the value was not supplied by the user and thus can be redetected in the package .conf file.

  • bindir: Location where the binaries (programs) should be installed.

  • sbindir: Location where the system binaries should be installed.

  • libdir: Location where the library files should be installed.

  • sysconfdir: Location where the configuration should be installed (i.e. etc).

  • localstatedir: Location where the variable data should be installed (i.e. var).

  • datadir: Location where the architecture independent data should be installed (i.e. share).

  • docdir: Location where the documentation should be installed.

  • mandir: Location where the info man pages should be installed.

  • infodir: Location where the info files should be installed.

  • includedir: Location where the header files should be installed.

Package's automated build system configuration:

  • autoextract: When set to '0' automatic untar will be skipped.

  • autopatch: When set to '0' automatic patching will be skipped.

  • chownsrcdir: When set to '0' the run of chown-ing the root after extracting the $srctar will be skipped.

  • nocvsinsrcdir: When set '0' CVS and .svn directories in $srcdir will not be removed.

  • srctar: Filename of the source tar file ('auto' = autodetect).

  • srcdir: Directory in the source tar file ('auto' = autodetect).

  • xsrctar: Filename of the source tar file after 'auto' has been processed.

  • xsrcdir: Directory in source tar file after 'auto' has been processed.

  • taropt: Options for extraction via tar.

  • patchfiles: List of patchfiles found in $confdir.

  • patchopt: Options passed to the patch program.

  • createprefix: If set to '0' to skip creation for directory skeleton for $prefix.

  • createdocs: If set to '0' to skip automatic copying of documentation files.

Build flow modifications (deprecated by the new hooks - see the section called “Build System Hooks”)

  • prepare: Command to be executed before the main build-block.

  • prepatch: Command to be executed before the automatic patching.

  • postpatch: Command to be executed after the automatic patching.

  • postdoc: Command to be executed after the automatic document copy process.

  • preconf: Command to be executed before running configure.

  • premake: Command to be execute before running 'make'.

  • inmake: Command to be execute between 'make' and 'make install'.

  • postmake: Command to be execute after running 'make install'.

  • postflist: Command to be execute after creating the flist.

  • postinstall: Command to be execute after finishing all the standard stuff.

  • finish: Command to be execute after everything else outside build-block.

  • custmain: Command to execute instead of 'configure, make, make install'.

  • mainfunction: Alternate main function instead of build_this_package().

Build type flow configuration

  • runconf: When set to '0' running configure will be disabled.

  • runxmkmf: When set to '0' running 'xmkmf' will be disabled.

  • runmkpl: When set to '0' running 'perl Makefile.PL' will be disabled.

  • runpysetup: When set to '0' running 'python setup.py' will be disabled

  • autogen: When set to '1' running the autogen script will be enabled.

Configuration parameters

  • confopt: Options used for GNU autoconf './configure'.

  • extraconfopt: Options which should be appended to $confopt by set_confopt().

  • configprefix: Prefix to the GNU autoconf './configure' script.

  • configscript: Specify the name used instead of './configure' for GNU autoconf.

  • pyconfopt: Options used for setup.py - the Python setup scripts.

  • makeopt: Options used for 'make' (defaults to useful CC, CXX, HOSTCC, prefix ... settings).

  • makeinstopt: Options used for 'make install' (defaults to '$makeopt install').

File list modifications:

  • flistdel: Regex describing files which shouldn't go into the package file list.

  • flistrfilter: Regex describing which lines to ignore in flist rlog.

  • flistroot: List of top-level directories which should be used for the file list.

Post build sanity checks:

  • check_shared: Check for files which are shared with other packages.

  • check_usrlocal: Check for files which are installed in usr/local.

  • check_badfiles: Check for files which are registered 'bad files'.

Program invocation:

  • BUILDCC: C compiler for helper apps (usually that's just 'cc').

  • BUILD_CC: C compiler for helper apps (must be the same as $BUILDCC).

  • HOSTCC: C compiler for helper apps (must be the same as $BUILDCC).

  • HOST_CC: C compiler for helper apps (must be the same as $BUILDCC).

  • MAKE: Make executable name.

  • CC: C compiler executable name for target architecture.

  • CXX: C++ compiler executable name for target architecture.

  • STRIP: Strip executable name for target architecture.

  • LD: Ld executable name for target architecture.

  • AR: Ar executable name for target architecture.

  • RANLIB: Ranlib executable name for target architecture.

  • AS: As executable name for target architecture.

  • GASP: Gasp executable name for target architecture.

  • NM: Nm executable name for target architecture.

Wrapper configuration (see the section called “Command Wrapper” for a detailed description):

  • CMD_WRAPPER_*: configuration for the generic command wrapper

  • CC_WRAPPER_*: configuration for C compiler wrapper

  • CXX_WRAPPER_*: configuration for C++ compiler wrapper

  • KCC_WRAPPER_*: configuration for Kernel C compiler wrapper

  • F77_WRAPPER_*: configuration for Fortran 77 compiler wrapper

  • STRIP_WRAPPER_*: configuration for strip wrapper

  • INSTALL_WRAPPER_*: configuration for the install wrapper

Modular supplied configuration:

  • SDECFG_*: configuration from 'Config' file

Build scripts are executed from $base/src.