# cpanel12 - Expat                          Copyright(c) 2006-2007 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

package Cpanel::Easy::PHP5::Expat;

our $easyconfig = {
    'name'      => 'Expat',
    'version'   => '$Rev: 3442 $',
    'ensurepkg' => [ 'expat', 'expat-devel' ],
    'note'      => 'You may need this to address http://bugs.php.net/bug.php?id=45996 for PHP 5.2.8 and older',
    'url'       => 'http://www.php.net/xml',
    'dryrun'    => {
        '0' => {
            'name'    => 'Find expat path for PHP 5 Expat',
            'command' => sub {
                my ($self) = @_;
                my @expat;
                for my $pth (qw(/usr /usr/local)) {
                    next if !-d $pth;
                    if ( -e "$pth/lib/libexpat.so" || -e "$pth/lib64/libexpat.so" ) {
                        push @expat, '--with-libexpat-dir', $pth;
                        last;
                    }
                }
                if ( @expat != 2 ) {
                    return ( 0, 'Could not find [_1] path', 'expat' );
                }
                else {
                    $self->{'__'}{'Expat'} = \@expat;

                    return ( 1, 'Ok' );
                }
            },
        },
    },
    'step' => {
        '0' => {
            'name'    => 'to config options',
            'command' => sub {
                my ($self) = @_;
                $self->add_to_configure( { @{ $self->{'__'}{'Expat'} } } );
                return ( 1, 'Ok' );
            },
        },
    },
};

1;
