Apache2-API

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

    },
    TEST_REQUIRES =>
    {
        'lib'                   => 0,
        'File::Find'            => 0,
        'File::Spec'            => 0,
        'File::Which'           => 0,
		'Test::Mock::Apache2'	=> '0.05',
		'Test::MockObject'		=> '1.20180705',
		'Test::More'            => 0,
		'Test::Pod'             => 0,
		'Test::Time'            => 0,
        'Test2::V0'             => '0.000145',
		'utf8'                  => 0,
    },
    LICENSE             => 'perl_5',
    MIN_PERL_VERSION    => 'v5.26.1',
    (MM->can('signature_target') ? (SIGN => 1) : ()),
    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', DIST_CP => 'cp' },
    clean               => { FILES => 'Apache2-API-*' },
    ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( META_MERGE => {
        'meta-spec' => { version => 2 },
        dynamic_config => 1,
        resources => {
        #    homepage    => undef,
            repository  => {
                url         => 'git@gitlab.com:deguest/Apache2-API.git',
                web         => 'https://gitlab.com/deguest/Apache2-API',
                type        => 'git',
            },
            bugtracker => {
                web         => 'https://gitlab.com/deguest/Apache2-API/issues',
            },
        },
    }) : ()),
);

# NOTE: Apache2 test units preparation
# The rest below is for tests under Apache/modperl2
eval
{
    require Apache::TestMM;
};

my @scripts = ();

my $MY_DEBUG = $ENV{API_DEBUG};
if( !$@ && !$ENV{NO_MOD_PERL} )
{
    print( STDERR "Generating Makefile including modperl\n" ) if( $MY_DEBUG );
    Apache::TestMM->import( qw(test clean) ); #enable 'make test'
    $WriteMakefileArgs{PREREQ_PM}->{ 'Apache::Test' } = 0;

    @scripts = qw( t/TEST );
    # accept the configs from command line
    Apache::TestMM::filter_args();
    my $ref = {@Apache::TestMM::Argv};
    $ref->{_HAS_APACHE_TEST} = 1;
    
    my $config = Apache::TestConfig->thaw->httpd_config;
    my( $has_ssl, $has_perl_ssl, $has_error ) = ( 0, '', 0 );
    $ref->{_HAS_SSL} = 0;
    # require Data::Dump;
    if( $MY_DEBUG > 2 )
    {
        require Data::Dump;
        print( STDERR "Apache::TestConfig->thaw->httpd_config yields: ", Data::Dump::dump( $config ), "\n" );
    }
    if( ref( $config ) eq 'Apache::TestConfig' )
    {
        $has_ssl = $config->{modules}->{ $config->{vars}->{ssl_module} } ? 1 : 0;
        my $apache_bin = $config->{vars}->{httpd};
        if( !$apache_bin )
        {
            eval
            {
                require File::Which;
            };
            if( !$@ )
            {
                for( qw( apache2 httpd ) )
                {
                    if( $apache_bin = File::Which::which( $_ ) )
                    {
                        print( STDERR "Found Apache binary at $apache_bin" ) if( $MY_DEBUG );
                        last;
                    }
                }
            }
        }
        
        my $cmd = '';
        if( $apache_bin )
        {
            print( STDERR "Checking Apache2 configuration with binary $apache_bin\n" ) if( $MY_DEBUG );
            $cmd .= ". $config->{vars}->{conf_dir}/envvars; " if( $config->{vars}->{conf_dir} && -e( "$config->{vars}->{conf_dir}/envvars" ) );
            $cmd .= $apache_bin;
            open( my $io, "${cmd} -M 2>&1|" );
            while( <$io> )
            {
                print( STDERR $_ ) if( $MY_DEBUG );
                $has_ssl++, last if( /ssl/i );
                if( /Syntax[[:blank:]]+error[[:blank:]]+(?:on|at)[[:blank:]]+line[[:blank:]]+(\d+)/i )
                {
                    $has_error = $1;
                }
            }
            close( $io );
            print( STDERR "# Done\n" ) if( $MY_DEBUG );
        }
        warn( "[warning] You have syntax error in your Apache configuration file at line $has_error. You might want to do an apache2ctl configtest or (${cmd} -t)\n" ) if( $has_error );
        
        print( STDERR "Checking for SSL modules IO::Socket::SSL or Net::SSL\n" ) if( $MY_DEBUG );
        # IO::Socket::SSL or Net::SSL
        eval( 'require IO::Socket::SSL' );
        if( $@ )
        {
            my $io_ssl_err = $@;
            eval( 'require Net::SSL' );
            unless( $@ )
            {
                $has_perl_ssl = 'Net::SSL';
            }
        }
        else
        {
            $has_perl_ssl = 'IO::Socket::SSL';
        }
        
        if( $has_ssl && $has_perl_ssl )
        {
            print( STDERR "Found Apache module mod_ssl enabled and $has_perl_ssl module installed. Ok\n" ) if( $MY_DEBUG );
            $ref->{_HAS_SSL} = 1;
        }
        elsif( $has_ssl && !$has_perl_ssl )
        {
            print( STDERR "Found Apache module mod_ssl enabled, but missing perl modules (either IO::Socket::SSL or Net::SSL)\n" ) if( $MY_DEBUG );
        }
        elsif( !$has_ssl && $has_perl_ssl )
        {
            print( STDERR "Apache module mod_ssl is not enabled, but found $has_perl_ssl\n" ) if( $MY_DEBUG );
        }
        else
        {
            print( STDERR "Apache module mod_ssl is not enabled and could not find either IO::Socket::SSL nor Net::SSL, deactivating the use of SSL for our tests.\n" ) if( $MY_DEBUG );
        }
    }
    
    print( STDERR "apxs specified? ", ( $ref->{apxs} ? "yes at $ref->{apxs}" : 'no' ), "\n" ) if( $MY_DEBUG );
    if( !$ref->{apxs} )
    {
        my $apxs;
        eval
        {
            require Apache2::BuildConfig;
            require File::Spec;
            require File::Which;
        };
        # perl -MApache2::BuildConfig -MData::Dump -lE 'my $c=Apache2::BuildConfig->new; say Data::Dump::dump($c)'
        if( !$@ )
        {
            my $build = Apache2::BuildConfig->new;
            $apxs = File::Spec->catfile( $build->{APXS_BINDIR}, 'apxs' ) if( $build->{APXS_BINDIR} );
            undef( $apxs ) unless( -e( $apxs ) );
            print( STDERR "Found apxs at $apxs\n" ) if( $MY_DEBUG );
        }
        
        if( !$apxs )
        {
            eval
            {
                require File::Which;
            };
            if( !$@ && ( $apxs = File::Which::which( 'apxs' ) ) )
            {
                $ref->{apxs} = $apxs;
                print( STDERR "Found apxs at $apxs" ) if( $MY_DEBUG );
            }
        }
        
        if( $apxs )
        {
            print( STDERR "apxs found and set to $apxs\n" ) if( $MY_DEBUG );
            $ref->{apxs} = $apxs;
        }
        else
        {
            die( "You have not provided the arguement -apxs and the apxs binary could not be found. Maybe you need to install apache2-dev?\n" );
        }
    }
    
    if( !$ref->{httpd_conf} )
    {
        DEFAULT_APACHE_CONF_CHECK:
        {
            eval
            {
                require File::Spec;
                require IO::File;
            };
            print( STDERR "Error trying to load File::Spec and IO::File: $@\n" ) if( $@ && $MY_DEBUG );
            last DEFAULT_APACHE_CONF_CHECK if( $@ );
            my $base;
            # http://httpd.apache.org/docs/2.0/platform/windows.xml
            my @possible_bases = ();

Makefile.PL  view on Meta::CPAN

=head2 -bindir

Apache bin/ dir (default is C<apxs -q BINDIR>)

=head2 -cgi_module_name

cgi module name

=head2 -defines

values to add as C<-D> defines (for example, C<"VAR1 VAR2">)

=head2 -documentroot

DocumentRoot (default is C<$ServerRoot/htdocs>

=head2 -group

Group to run test server as (default is C<$GROUP>)

=head2 -httpd

server to use for testing (default is C<$bindir/httpd>)

=head2 -httpd_conf

inherit config from this file (default is apxs derived)

=head2 -httpd_conf_extra

inherit additional config from this file

=head2 -libmodperl

path to mod_perl's .so (full or relative to LIBEXECDIR)

=head2 -limitrequestline

global LimitRequestLine setting (default is C<128>)

=head2 -maxclients

maximum number of concurrent clients (default is C<minclients+1>)

=head2 -minclients

minimum number of concurrent clients (default is C<1>)

=head2 -perlpod

location of perl pod documents (for testing downloads)

=head2 -php_module_name

php module name

=head2 -port

Port [port_number|select] (default C<8529>)

=head2 -proxyssl_url

url for testing ProxyPass / https (default is localhost)

=head2 -sbindir

Apache sbin/ dir (default is C<apxs -q SBINDIR>)

=head2 -servername

ServerName (default is localhost)

=head2 -serverroot

ServerRoot (default is C<$t_dir>)

=head2 -src_dir

source directory to look for C<mod_foos.so>

=head2 -ssl_module_name

ssl module name

=head2 -sslca

location of SSL CA (default is C<$t_conf/ssl/ca>)

=head2 -sslcaorg

SSL CA organization to use for tests (default is asf)

=head2 -sslproto

SSL/TLS protocol version(s) to test

=head2 -startup_timeout

seconds to wait for the server to start (default is 60)

=head2 -t_conf

the conf/ test directory (default is C<$t_dir/conf>)

=head2 -t_conf_file

test httpd.conf file (default is C<$t_conf/httpd.conf>)

=head2 -t_dir

the t/ test directory (default is C<$top_dir/t>)

=head2 -t_logs

the logs/ test directory (default is C<$t_dir/logs>)

=head2 -t_pid_file

location of the pid file (default is C<$t_logs/httpd.pid>)

=head2 -t_state

the state/ test directory (default is C<$t_dir/state>)

=head2 -target

name of server binary (default is C<apxs -q TARGET>)

=head2 -thread_module_name

thread module name

=head2 -threadsperchild

number of threads per child when using threaded MPMs (default is C<10>)

=head2 -top_dir

top-level directory (default is C<$PWD>)

=head2 -user

User to run test server as (default is C<$USER>)

=cut



( run in 1.097 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )