package Cpanel::Easy::PHP5::TTF;

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

use strict;

our $easyconfig = {
    'name'   => 'TTF (FreeType)',
    'url'    => 'http://www.php.net/manual/en/ref.image.php',
    'dryrun' => {
        '0' => {
            'name'    => 'Find freetype path for PHP 5',
            'command' => sub {
                my ($self) = @_;
                my @freetype_dir = ();
                if ( -e '/usr/local/include/freetype2' ) {
                    push @freetype_dir, '--with-freetype-dir', '/usr/local';
                }
                elsif ( -e '/usr/include/freetype2' ) {
                    push @freetype_dir, '--with-freetype-dir', '/usr';
                }

                $self->{'__'}{'freetype_dir'} = \@freetype_dir;
                return ( 1, 'Ok' );
            },
        },
    },
    'step' => {
        '0' => {
            'name'    => 'to config options',
            "command" => sub {
                my ($self) = @_;
                $self->add_to_configure(
                    {
                        '--enable-gd-native-ttf' => '',
                        @{ $self->{'__'}{'freetype_dir'} }
                    }
                );
                return ( 1, 'Ok' );
            },

        },
    },
};

1;
