#!/usr/bin/perl
# Copyright 2007, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Textbender Software"), to deal in the Textbender Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Textbender Software, and to permit persons to whom the Textbender Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Textbender Software. THE TEXTBENDER SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE TEXTBENDER SOFTWARE OR THE USE OR OTHER DEALINGS IN THE TEXTBENDER SOFTWARE.
use strict; use warnings;
=pod

=head1 DESCRIPTION

Basic build of Rhinohide.

=head1 SYNOPSIS

build clean

build [I<argument>]

build --help | --man

=head1 ARGUMENTS

=over 8

=item B<rhinohide>

Builds the whole of Rhinohide. This is the default argument.

=item B<clean>

Deletes all build files.

=item B<jar>

Builds the Rhinohide jar. Returns the jar file name.

=back

=cut

{
    use textbender::a::b::Config qw( do_fail );
    my $config_path = 'textbender/a/b/rhinohide/build_config.pl';
    do $config_path or do_fail $config_path;
}

    sub _shift_options();
      #
      # Shifts command line options into %textbender::a::b::Build::option.
      #


{
    _shift_options;
    my $argument = shift; defined $argument or $argument = 'rhinohide';
    my $sub_name = 'textbender::a::b::rhinohide::Rhinohide::build_' . $argument;
    {
        no strict 'refs';
        use textbender::a::b::rhinohide::Rhinohide();
        &$sub_name();
    }
}


=pod

=head1 OPTIONS

=over 8

=cut

sub _shift_options()
{
    use Getopt::Long qw( GetOptions );
    use Pod::Usage qw( pod2usage );
    use textbender::a::b::Build qw( %option );
    use textbender::a::b::Console qw( $verbosity );

    my @specification;
    push @specification, 'help|?';
=pod

=item --B<help>

Outputs a brief help message and exits.

=cut

    push @specification, 'man';
=pod

=item --B<man>

Outputs the full manual page and exits.

=cut

    push @specification, 'sign!';
    $option{'sign'} = 0; # default
=pod

=item --B<sign> | --B<no-sign>

Specifies whether or not to sign the jars.
By default, jars are not signed.
NEVER TESTED WITH THIS BUILD. FIX or remove.

=cut

    push @specification, 'verbose';
=pod

=item --B<verbose>

Increases the level of console output.

=cut

    Getopt::Long::GetOptions( \%option, @specification )
        or pod2usage( -verbose => 0 ); # and exits

    defined $option{'help'} and pod2usage( -verbose => 1 ); # and exits
    defined $option{'man'} and pod2usage( -verbose => 2 ); # and exits

    defined $option{'verbose'} and $verbosity = 1;
}

=pod

=back

=cut