Build System Component Module


Overview

The Build System Component Module provides the build system with the ability to import and export shared components from the common component repository (currently, this repository resides on a NFS directory on the engineering network).

Most build system modules and targets deal within the context of the current directory, however the Component module deals with components as a whole, so many of the targets produced by this module are stored in a location known to all subdirectories within a component build at the COMPONENT_ROOT level.


Component Repository / Dist Area

XXX Say something here.

Component Descriptors

XXX Say something here.

Global Macros and Controls

COMPONENT_DISTROOT
This macro specifies the location of the component repository. The component repository is also know as the "dist area".

COMPONENT_DEFAULT_PLATFORM_LIST
This macro includes an ordered list of platforms that will be considered when importing or exporting ("pushing to the component repository") components. The first entry in this list should be the most precise platform name, with platforms furter down the list considered for fallback or compatibility. The default for this is derived from the default tool chain in use by the native code Mentok module.

COMPONENT_DIST_COMPATIBILITY_PLATFORMS
This macro includes a list of platform link targets that is suitable for maintaining backwards compatibility with older component make code. This macro is provided as a convenience for assigning to the _PLATFORMLINKS controls for individual DIST_TARGETS (see below). The variant tag is not appended to this list of platform names.

COMPONENT_DIST_COMPATIBILITY_PLATFORMS_AND_VTAG
This macro includes a list of platform link targets that is suitable for maintaining backwards compatibility with older component make code. This macro is provided as a convenience for assigning to the _PLATFORMLINKS controls for individual DIST_TARGETS (see below). The variant tag is appended to this lit of platform names.

COMPONENT_IMPORT_TARGET_ROOT
This macro indicates the root location that all import targets are copied to for use in the component build. Individual import targets may override this with target specific options and controls, but this not reccomended.

COMPONENT_DISTTAG
An additional tag that will be appended to the revision of a component that is pushed to the DISTROOT as the result of the building of the DIST_TARGETS pattern targets. The primary purpose of this macro is to provide Release Engineering a way to add tags to the "Natural" version of a component when it is pushed to the component repository (a.k.a. the dist area).


Targets


IMPORT_TARGETS

IMPORT_TARGETS Overview

IMPORT_TARGETS is the pattern target used to import components into a component build tree. This target can be used to import components from the any architecture, not just the architecture of the current build machine. Import components are taken from the COMPONENT_DISTROOT directory and copied into the COMPONENT_IMPORT_TARGET_ROOT directory.

Since the rules governing how a component from the component repository will be placed in COMPONENT_IMPORT_TARGET_ROOT, the function COMPONENT_FUNC_IMPORT_COMPUTE_TARGETDIR should be used by point make files that need to access imported files. This function takes the name of the import target as it appears in the IMPORT_TARGETS list as its only argument, and returns the directory into which that component was imported. Note: this behavior is changed considerably from previous versions of this build system. While Mentok imported all components into one flat dir, version 3.5 and upward changed to importing each component into its own directory. This chage was done to better accomodate cross compiling, multi-platform comiling, importing more than one revision of a component, etc. without the problems of colbbering files and other conflicts that plagued the old system.

IMPORT_TARGETS will be built during the "target" phase of a build. IMPORT_TARGETS may be built in isolation by requesting the "component_import" target.

IMPORT_TARGETS Options

<import target>_REV
Specify the revision of the <import target> to import into the current build. This will default to "-UNSPECIFIED-" if this option is not set. This should normally be set and is the primary control for individual import pattern targets.

<import target>_DISTROOT
Override the value of the COMPONENT_DISTROOT for the current <import target> only.

<import target>_DISTNAME
Override the default name to search for in the component repositry for the current <import target>. The default name is the target name <import target>.

<import target>_PLATFORM
Override the list of acceptable platforms to consider when importing the current <import target> from the component repository. The default platform list is controlled by the COMPONENT_DEFAULT_PLATFORM_LIST macro.

<import target>_VTAG
Override the value of the BS_VTAG for the current <import target> only.

<import target>_TO
Override the default location of the imported component. The default location will vary accroding to other target options, and may be obtained with the COMPONENT_FUNC_IMPORT_COMPUTE_TARGETDIR function. USE OF THIS OPTION IS STRONGLY DISCURAGED.

<import target>_FROM
Override the full path from which the imported target will be imported from. Normally this path is a construction of the <import target> name COMPONENT_DISTROOT, <import target>_REV, and the platform. USE OF THIS OPTION IS STRONGLY DISCURAGED.


DIST_TARGETS

DIST_TARGETS Overview

DIST_TARGETS is the pattern target used to push components to the component repository used for sharing components across development teams and time. These targets are are "phony" make targets so they will always be build when requested, even if the the requested component and revision appears to have already been pushed to the component repository. This is done because the full dependency of every file that could be pushed to the repository as a result of one of these targets is not tracked.

In addition to pushing the contents of a component to the component repository, DIST_TARGETS pattern targets also cause a XML component descriptor file to be generated and pushed to the repository. The component descriptor for components pushed to the repository will chain the component descriptors of all imported components found in the current IMPORT_TARGETS before being pushed to the component repository. This is done to track the full dependency tree of a component even if components used in its construction are not re-packaged in its dist or hidden by static linking.

DIST_TARGETS Options

<dist target>_FROM
Specifies the directory to push to dist. If left unspecified, the current working directory will be pushed, which is probably not what you want. In most cases it is expected that a directory created by targets from the Packaging build system module will be specified as the _FROM for a given <dist target>

<dist target>_REEXPORT
Specifies a list of components from the IMPORT_[ARCH|NOARCH]_TARGETS pattern target that should be re-exported when creating the the current <dist target>. ONLY components that have been imported via a IMPORT_[ARCH|NOARCH]_TARGETS operation may be re-exported.

<package target>_SCRUB
Specifies a list of files or directories to remove from the target once it has been copied to the component repository. This option is useful for cleaning out CVS directories or other ancillary files.

<dist target>_REV
Specify the revision of the component to push to the component repository. The default revision is the date expressed in YYYY-MM-DD format. COMPONENT_DISTTAG will be appended to this revision if specified by release engineering (see above).

<dist target>_DISTROOT
Override the value of the COMPONENT_DISTROOT for the current <dist target> only.

<dist target>_PLATFORM
Specify the intended runtime platform for the component. This information will be used to control how the <dist target> will be placed in the component repository, which in turn affects how other projects see and use it. The default platform will be the platform at the head of the list in the COMPONENT_DEFAULT_PLATFORM_LIST macro.

<dist target>_PLATFORMLINKS
Specify a list of compatibility platforms for the given component that will be used when publishing the current <dist target> to the component repository. The default value for this will be empty.

<dist target>_TO
Specify an override location for the constructed path under the component repository (Specified by COMPONENT_DISTROOT or <dist target>_DISTROOT) to push the component to. The default location to push a <dist target> to is <Component Repository>/<dist target>/<dist target>_REV)/<Platform> USE OF THIS OPTION IS STRONGLY DISCURAGED.

<dist target>_COMMENT
Specify a text comment that will be included in the component descriptor XML file.


EXPORT_DESC_TARGETS

EXPORT_DESC_TARGETS Overview

EXPORT_DESC_TARGETS is the pattern target used to create component descriptor XML files without pushing a component to the component repository. The target options availible for EXPORT_DESC_TARGETS pattern targets are identical to those for DIST_TARGETS. The generated descriptor will be placed in $(BS_ARCH_TARGET_DIR)/export desc target.xml

component_import

component_import Overview

Simple target to trigger the building of IMPORT_ARCH_TARGETS and IMPORT_NOARCH_TARGETS pattern targets independent of the main build "target" phase.

component_dist

component_dist Overview

Simple target to trigger the building of DIST_TARGETS pattern targets independent of the main build "posttarget" phase.

component_desc

component_desc Overview

Simple target to trigger the building of EXPORT_DESC_TARGETS pattern targets independent of the main build "posttarget" phase.

component_shadow

component_shadow Overview

Simple target that archives the areas of the component repository that are used during IMPORT_ARCH_TARGETS and IMPORT_NOARCH_TARGETS importing. The purpose of this rule is to facilitate the construction of offline build environments. The shadow archives of the repository are built as $(ARCH_TARGET_DIR)/imported_components_arch.tar.gz and $(NOARCH_TARGET_DIR)/imported_components_noarch.tar.gz component_shadow is only built if specificly requested; it is not part of any "pretarget", "target", or "posttarget" phase.

component_info

component_info Overview

Simple target to display information about the macro settings of all global macros used by the component module of the build system. The component_info target will be built during the "info" phase of a build, and can be built in isolation by requesting the component_info target.

component_man

component_man Overview

Simple targets to display usage information and help pertaining to the component module of the build system. The component_man target will be built during the "man" phase of a build, and can be built in isolation by requesting the component_man target.

Functions


COMPONENT_FUNC_IMPORT_COMPUTE_TARGETDIR(<import target>)

This function is provided to obtain the actual directory into which an imported component was copied. This fuction should be used by point makefiles that need to reference the contents of imported components. This function takes as its only argument the name of an import target as it appears in the IMPORT_TARGETS list, and returns the relative path to the directory into which the component in question was imported.

Example Makefile


COMPONENT_ROOT=../..
BS_ROOT=$(COMPONENT_ROOT)/../build3

include $(BS_ROOT)/defines.mk

IMPORT_TARGETS=mhnet mhnet-crossplatform blackbird-mh # this_component_doesnt_exist


this_component_doesnt_exist_REV=2003-07-18

blackbird-mh_REV=4.0.4-2005-03-28_blackbird-404-endc-204-branch

mhnet_REV=2003-04-03
#mhnet_DISTROOT=foo
#mhnet_FROM=foobar

mhnet-crossplatform_REV=2003-04-03
mhnet-crossplatform_PLATFORM=SunOS-5.9-sparcv9
mhnet-crossplatform_DISTNAME=mhnet
#mhnet_DISTROOT=foo
#mhnet_FROM=foobar


SUBDIR_TARGETS=

EXPORT_DESC_TARGETS=test_descriptor

DIST_TARGETS=foo

# DISTROOT//COMPONENT_DISTTAG//

foo_FROM=/home/carlalex/eng-home/src/blackbird-trunk/src/bbi/cmi/stdio
#foo_TO=/tmp/foo/bar/some-other-path
foo_DISTROOT=/tmp/testdist
foo_DISTNAME=moof
foo_SCRUB=CVS BUILDTARGETS\*
foo_PLATFORM=$(BS_PLATFORM_NOARCH)
foo_PLATFORMLINKS=fake-platform
foo_REV=3.1
foo_COMMENT=Mentok build system test component
# Note: this is probably a dumb thing to do in a real make file...
# the two platforms of the one component would clobber
# each other. If you wanted to roll up a multi-platform component
# to dist, you should stage the merge of plarforms with package rules,
# then dist your package dir.
foo_REEXPORT=mhnet mhnet-crossplatform


#COMPONENT_DISTTAG=test_dist_tag



include $(BS_ROOT)/rules.mk


Example Component Descriptor XML File


<?xml version="1.0"?>
<ComponentDesc>
    <Name>foo</Name>
    <Revision>3.1</Revision>
    <Comment>foo component DIST created at 2003-06-13 14:28:42 on firsttime.int.recourse.net</Comment>
    <Platform>Linux-2.4.20-13-i686-libc-2.3.2</Platform>
    <ReferenceDist>/usr/local/test-dist/foo/3.1/Linux-2.4.20-13-i686-libc-2.3.2</ReferenceDist>
    <CompatibilityPlatform>Linux</CompatibilityPlatform>
    <CompatibilityPlatform>Linux-2.4-i686</CompatibilityPlatform>
    <CompatibilityPlatform>Linux-2.4-i686-libc-2.3.2</CompatibilityPlatform>
    <CompatibilityPlatform>Linux-2.4.20-13-i686</CompatibilityPlatform>
    <CompatibilityPlatform>Linux-i686</CompatibilityPlatform>
    <Import>
        <ComponentDesc>
            <Name>mhnet</Name>
            <Revision>2003-04-03</Revision>
            <Comment>Imported Component did not provide a component.xml file; This stub was auto generated by the importing rules.</Comment>
            <Platform>Linux-2.4.20-13-i686-libc-2.3.2</Platform>
            <ImportDist>/usr/local/test-dist/mhnet/2003-04-03/Linux-2.4-i686</ImportDist>
        </ComponentDesc>
        <ComponentDesc>
            <Name>mhjava</Name>
            <Revision>2003-04-07</Revision>
            <Comment>MH java component descriptor.</Comment>
            <Platform>noarch</Platform>
            <Import>
                <ComponentDesc>
                    <Name>Test sub component</Name>
                    <Revision>1.0</Revision>
                </ComponentDesc>
            </Import>
            <ImportDist>/usr/local/test-dist/mhjava/2003-04-07/Linux-2.4-i686</ImportDist>
        </ComponentDesc>
    </Import>
</ComponentDesc>