Subversion Repositories DevTools

Rev

Rev 6114 | Blame | Compare with Previous | Last modification | View Log | RSS feed

########################################################################
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
#
# Module name   : wsdl-tools
# Module type   : JATS Plugin
# Compiler(s)   : Perl
# Environment(s): JATS
#
# Description   : This package extends the JATS toolset at build time
#                 It provides additional directives to the JATS makefiles
#                 to simplify the directives.
#
#                 The directive matches up with a run-time tool to
#                 do the bulk of the work.
#
# Operation     : This package adds the JATS directive ShellBuild
#                 When used the directive will use GenerateFiles to invoke
#                 a shell program at make-time to actually do the hard work.
#
# Directives    : ShellBuild (platform, script, ... )
#                 WindowsShellBuild(platform, script, ... )
#                 DebianShellBuild (platform, script, .... )
#                 DebianVariantShellBuild (platform, script, .... )
#
#......................................................................#

use strict;
use warnings;
use JatsError;
use FileUtils;

#
#   Jats Globals
#
our $ScmPlatform;

#-------------------------------------------------------------------------------
# Function        : ShellBuild
#
# Description     : Launches a shell build script that has had a set of 
#                   pre-invoke work performed already.
#
# Inputs          : platform          - Standard Platform Specifier
#                   script            - The shell build script to launch.
#                   uargs             - User options
#
#                     -DownloadPkg=   - Name of the package that has been 
#                                       downloaded.  If empty the download package
#                                       is generated automatically.
#                     -CopyModsDir    - Specifies that 'mods' directories should
#                                       be copied rather than symlink
#                     -WorkDir=       - Name of the package work dir
#                                       Will override untar'ed dirname
#                     -WorkDirSuffix= - An additional suffix to add to the working 
#                                       directory.
#                     -ConfigVarient= - Sets the name of the package build 
#                                       configuration varient.  This can then 
#                                       be used in the call-out script as 
#                                       ${CONFIG_VARIENT}.
#                     -PatchDir=      - Sets the directory where patches are located.
#                     -IgnorePatchErr= - Sets to ignore patch errors when there are 
#                                       mutiple tar files invloved in a single package
#
# Returns         : Nothing
#
sub ShellBuild
{
    my ($platforms, $script, @uargs) = @_;

    return if ( ! ActivePlatform($platforms) );
    
    #
    #   Generate the files
    #   Use standard JATS directive
    #
    Src('*', $script);
    GenerateFiles('*', '--Tool=shellbuild_linux.sh',# Tool to use
                  '-ShellBuild='.$script,           # User script
                  '--Var(BuildName)',               # Target Package
                  '--Var(BuildVersion)',            # Target Package Version
                  '--Var(Platform)',                # Target platform
                  '--Var(Type)',                    # Build Type
                  '--Var(Arch)',                    # Architecture
                  '--Var(MachType)',                # Machine Type
                  '--Var(BuildRoot)',               # Build Root
                  '--Var(InterfaceDir)',            # Interface dir
                  '--Var(LocalDir)',                # Local dirs
                  '--Var(LocalIncDir)',
                  '--Var(LocalLibDir)',
                  '--Var(LocalBinDir)',
                  '--Var(CompilerPath)',            # Path to compiler
                  '--Var(BinDir)',                  # Binary output directory
                  '--Var(ObjDir)',                  # Object output directory
                  '--Var(LibDir)',                  # Library output directory
                  '--Var(PackageBinDir)',           # Package Bin dir
                  '--Var(PackageIncDir)',           # Package Inc dir
                  '--Var(PackageLibDir)',           # Package Lib dir
                  '--Var(PackagePkgDir)',           # Package Pkg dir
                  '--Var(PackageDir)',              # Package dir
                  If('TOOLSET', '-Toolset'),        # Flag TOOLSET packaging
                  '--Var(PackageToolDir)',          # Tools dir
                  '--Var(PackageToolBin)',          # Tools binaries dir
                  '--Var(PackageToolScript)',       # Tools scripts dir
                  "--NoGenerate", "--Clean", @uargs );
}

#-------------------------------------------------------------------------------
# Function        : DebianShellBuild
#
# Description     : Launches a shell build script that has had a set of 
#                   pre-invoke work performed already.  Once the script
#                   Completes a Debian package builder is launched.
#
# Inputs          : platform          - Standard Platform Specifier
#                   script            - The shell build script to launch.
#                   uargs             - User options, as per ShellBuild().
#
# Returns         : Nothing
#
sub DebianShellBuild
{
    my ($platforms, $script, @uargs) = @_;

    return if ( ! ActivePlatform($platforms) );

    #
    #   The ShellBuild script will create the 'debbuild.pl' file
    #   Create a temp copy here in order to supress warnings
    #
    my $deb_dir = "$ScmPlatform.deb";
    my $deb_build = $deb_dir . '/debbuild.pl';
    mkdir ($deb_dir);
    TouchFile ( $deb_build );

    # Generate the files using ShellBuild()
    ShellBuild       ('*', $script, "-DebianPackage=$deb_dir", @uargs);
    MakeDebianPackage('*', "--Script=$deb_build"  );
}

#-------------------------------------------------------------------------------
# Function        : DebianVariantShellBuild
#
# Description     : Launches a shell build script that has had a set of 
#                   pre-invoke work performed already.  Once the script
#                   Completes a Debian package builder is launched.
#
# Inputs          : platform          - Standard Platform Specifier
#                   script            - The shell build script to launch.
#                   variant           - The Debian package name variant.
#                   uargs             - User options, as per ShellBuild().
#
# Returns         : Nothing
#
sub DebianVariantShellBuild
{
    my ($platforms, $script, $variant, @uargs) = @_;

    return if ( ! ActivePlatform($platforms) );

    #
    #   The ShellBuild script will create the 'debbuild.pl' file
    #   Create a temp copy here in order to supress warnings
    #
    my $deb_dir = "$ScmPlatform.deb";
    my $deb_build = $deb_dir . '/debbuild.pl';
    mkdir ($deb_dir);
    TouchFile ( $deb_build );

    # Generate the files using ShellBuild()
    ShellBuild       ('*', $script, "-DebianPackage=$deb_dir", @uargs);
    MakeDebianPackage('*', "--Script=$deb_build", "--Variant=$variant"  );
}

#-------------------------------------------------------------------------------
# Function        : WindowsShellBuild
#
# Description     : Runs a build script intended for Windows rather than Linux.
#
# Inputs          : platform          - Standard Platform Specifier
#                   script            - The shell build script to launch.
#                   uargs             - User options
#
#                     -DownloadPkg=   - Name of the package that has been 
#                                       downloaded.  If empty the download package
#                                       is generated automatically.
#                     -CopyModsDir    - Specifies that 'mods' directories should
#                                       be copied rather than symlink
#                     -WorkDir=       - Name of the package work dir
#                                       Will override untar'ed dirname
#                     -WorkDirSuffix= - An additional suffix to add to the working 
#                                       directory.
#                     -ConfigVarient= - Sets the name of the package build 
#                                       configuration varient.  This can then 
#                                       be used in the call-out script as 
#                                       ${CONFIG_VARIENT}.
#                     -PatchDir=      - Sets the directory where patches are located.
#
# Returns         : Nothing
#
sub WindowsShellBuild
{
    my ($platforms, $script, @uargs) = @_;

    return if ( ! ActivePlatform($platforms) );
    
    #
    #   Generate the files
    #   Use standard JATS directive
    #
    Src('*', $script);
    GenerateFiles('*', '--Tool=shellbuild_windows.pl',# Tool to use
                  '-ShellBuild='.$script,           # User script
                  '--Var(BuildName)',               # Target Package
                  '--Var(BuildVersion)',            # Target Package Version
                  '--Var(Platform)',                # Target platform
                  '--Var(Type)',                    # Build Type
                  '--Var(MachType)',                # Machine Type
                  '--Var(BuildRoot)',               # Build Root
                  '--Var(InterfaceDir)',            # Interface dir
                  '--Var(LocalDir)',                # Local dirs
                  '--Var(LocalIncDir)',
                  '--Var(LocalLibDir)',
                  '--Var(LocalBinDir)',
                  '--Var(BinDir)',                  # Binary output directory
                  '--Var(ObjDir)',                  # Object output directory
                  '--Var(LibDir)',                  # Library output directory
                  '--Var(PackageBinDir)',           # Package Bin dir
                  '--Var(PackageIncDir)',           # Package Inc dir
                  '--Var(PackageLibDir)',           # Package Lib dir
                  '--Var(PackagePkgDir)',           # Package Pkg dir
                  '--Var(PackageDir)',              # Package dir
                  If('TOOLSET', '-Toolset'),        # Flag TOOLSET packaging
                  '--Var(PackageToolDir)',          # Tools dir
                  '--Var(PackageToolBin)',          # Tools binaries dir
                  '--Var(PackageToolScript)',       # Tools scripts dir
                  "--NoGenerate", "--Clean", @uargs );
}

1;