Subversion Repositories DevTools

Rev

Blame | Last modification | View Log | RSS feed

########################################################################
# Copyright (C) 2010 Vix-ERG Limited, All rights reserved
#
# Module name   : ZendDirective.pm
# Module type   : Makefile system
# Compiler(s)   : Perl
# Environment(s): jats
#
# Description   : See: TECHGP-00254 Jats Integration of ZendGuard
#
#......................................................................#

require 5.008_002;
use strict;
use warnings;

use Pod::Usage;
use Getopt::Long;

use JatsError;

#
#   Globals
#
our $ScmPlatform;                       # Target Platform

#-------------------------------------------------------------------------------
# Function        : MakeZendGuard
#
# Description     : This directive supports the processing of a ZendGuard
#                   project file via the ZendGuard utility
#
# Inputs          : $platform   - Platform selector
#                   $script     - Name of the script
#                   @elements   - Options and arguments
#
#                   Valid Options and Arguments
#                       --Verbose           - Increase verbosity
#                       --Verbose=n         - Set verbosity
#                       --Src=Path          - Source Subdir
#                                             Default: '.'
#                       --Package=Name      - Package into pkg/Name within
#                                             the output package
#                                             Default is to place the encoded
#                                             directory tree within the BinDir
#                                             in a subdirectory called 'php'
#
#
sub MakeZendGuard
{
    my( $platforms, $script, @elements ) = @_;
    my $verbose = 0;
    my  @args;

    return if ( ! ActivePlatform($platforms) );

    #
    #   Directive is only supported on the PHP platform
    #
    Error ("'MakeZendGuard' directive is only supported on the PHP platform")
        unless( $ScmPlatform eq 'PHP' );

    #
    #   Parse the command line arguments
    #
    foreach ( @elements )
    {
        if ( m~^--Verbose~i ) {
            push @args, $_;

        } elsif ( m~^--Src=(.+)~ ) {
            push @args, $_;

        } elsif ( m~^--Package=(.+)~ ) {
            push @args, $_;
            

        } else {
            Error ("MakeZendGuard: Unknown option: $_");
        }
    }

    #
    #   Create build time recipe to perform the hard work
    #       Will be done during the 'generate' phase
    #       Will always be done
    #       Output will be packaged directly
    #
    GenerateFiles ('*', '--Tool=ZendGuard.pl',
                        '--Text=Processing PHP with ZenGuard',
                        '--UnknownPreq',
                        '--NoGenerate',
                        '--Clean',
                        '--Var(PackageDir)',
                        '--Var(Target)',                          # Underlying Target
                        '--Var(Type)',                            # Build Type
                        '--Var(ObjDir)',                          # Work directory
                        '--Var(BinDir)',                          # Possible output directory
                        "-script=--Prerequisite($script)",
                        @args,
                        );
}