package Cpanel::Easy::PHP5::Enchant;

# cpanel - Cpanel/Easy/PHP5/Enchant.pm            Copyright(c) 2011 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

our $easyconfig = {
    'name'      => 'Enchant',
    'ensurepkg' => [qw{enchant enchant-devel enchant-dev libenchant libenchant-devel libenchant-dev}],
    'url'       => 'http://www.php.net/manual/en/ref.enchant.php',
    'skip'      => 1,
    'dryrun'    => {
        '0' => {
            'name'    => 'Find enchant path for PHP 5',
            'command' => sub {
                my ($self) = @_;
                my @jpeg = ();
                for my $pth (qw( /usr/local /usr )) {
                    next if !-d $pth;
                    if ( -e "$pth/lib/libenchant.so" || -e "$pth/lib64/libenchant.so" ) {
                        $self->{'__'}{'enchant'} = $pth;
                        return ( 1, 'Ok' );
                    }
                }
                return ( 0, 'Could not find [1] path', 'enchant' );
            },
        },
    },
    'step' => {
        '0' => {
            'name'    => 'to config options',
            'command' => sub {
                my ($self) = @_;
                $self->add_to_configure( { '--with-enchant' => $self->{'__'}{'enchant'} } );
                return ( 1, 'Ok' );
            },
        },
    },
};

1;
