#!/bin/env perl
# $Id$
require 5.008;
use strict;
use Data::Dumper;
use inc::Installer {
    'buildtools'  => [
        'bzip2', 'curl', 'wget', 'tar', 'unzip', 'ftp'
    ],
    'configfiles' => {
        'bashrc'  => 'perlvars.bashrc',
        'winbat'  => 'perlvars.bat',
        'jprops'  => 'perlvars.properties',
        'confpm'  => 'Cipres/Config.pm',
    },
    'loglevel' => 2,
};

my $TARGETS;
{
    local $/ = undef;
    $TARGETS = inc::Installer::TargetHandler->new( eval <main::DATA> );
}

WriteMakefile(
    'NAME'    => 'Cipres::Everything',
    'VERSION' => '0.01',
    'AUTHOR'  => 'Rutger Vos <rvosa@sfu.ca>',
);

if ( $^O ne 'MSWin32' ) {
    my $outpaths = inc::Installer::OutPaths->new;
    my $prefix = $outpaths->Installsitelib . '/ext';
    chdir 'expat-2.0.0';
    system './configure', '--prefix', $prefix;
    system $Config::Config{'make'};
    system $Config::Config{'make'}, 'install';
    chdir '../';
    PREREQ: for my $prereq ( $TARGETS->GetPrereqsForTarget( 'base' ) ) {
            $prereq->MakeplArg( " EXPATLIBPATH=$prefix/lib EXPATINCPATH=$prefix/include " );
        #    last PREREQ;
    }
}

InstallPrereqs();


__DATA__
(
    'base'       => { 
        'enable' => 1,
        'prereq' => [
            inc::Installer::Prerequisite->new(
                'name'     => 'Log::Dispatch::Screen',
                'cpanid'   => 'DROLSKY/Log-Dispatch-2.12.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/Log-Dispatch.ppd',  
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'Exception::Class',
                'cpanid'   => 'DROLSKY/Exception-Class-1.23.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/Exception-Class.ppd',
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'Exception::Class::TCF',
                'cpanid'   => 'RVOSA/Exception-Class-TCF-0.03.tar.gz',
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'Math::Random',
                'cpanid'   => 'GROMMEL/Math-Random-0.69.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/Math-Random.ppd',
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'Math-BigInt',
                'cpanid'   => 'TELS/Math-BigInt-1.77.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/Math-BigInt.ppd', 
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'List::Util',
                'cpanid'   => 'GBARR/Scalar-List-Utils-1.14.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/List-Utils.ppd',  
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'Module::Build::Base',
                'cpanid'   => 'KWILLIAMS/Module-Build-0.2805.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/Module-Build.ppd',  
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'Log::Dispatch::Screen',
                'cpanid'   => 'DROLSKY/Log-Dispatch-2.12.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/Log-Dispatch.ppd',  
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'SVG',
                'cpanid'   => 'RONAN/SVG-2.33.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/SVG.ppd',
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'Class::Inspector',
                'cpanid'   => 'ADAMK/Class-Inspector-1.16.tar.gz',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/Class-Inspector.ppd',
            ),    
            inc::Installer::Prerequisite->new(
                'name'     => 'Log::Log4perl',
                'cpanid'   => 'MSCHILLI/Log-Log4perl-1.06.tar.gz',
                'ppduri'   => 'http://theoryx5.uwinnipeg.ca/ppms/Log-Log4perl.ppd',  
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'XML::Parser',
                'cpanid'   => 'MSERGEANT/XML-Parser-2.34.tar.gz',
                'ppduri'   => 'http://ppm.tcool.org/archives/XML-Parser.ppd',
                'makepl_arg' => 'ARGS GO HERE',
            ),
            inc::Installer::Prerequisite->new(
                'name'     => 'XUL::Node',
                'cpanid'   => 'EILARA/XUL-Node-0.05.tar.gz',
                'ppduri'   => 'http://trouchelle.com/ppm/XUL-Node.ppd',  
            ),
        ],
    },
    'wx'         => {
        'enable' => 0,
        'prereq' => [
            inc::Installer::Prerequisite->new(
                'name'     => 'Alien::wxWidgets',
                'cpanid'   => 'MBARBON/Alien-wxWidgets-0.21.tar.gz',
                'ppduri'   => 'Wx-0.26.ppd',
                'uri'      => 'http://wxperl.sourceforge.net/',
            ),
            inc::Installer::Prerequisite->new(            
                'name'     => 'Wx',
                'cpanid'   => 'MBARBON/Wx-0.57.tar.gz', 
                'ppduri'   => 'Wx-0.26.ppd',                
                'uri'      => 'http://wxperl.sourceforge.net/',
            ),            
            inc::Installer::Prerequisite->new(
                'name'     => 'Wx::Perl::VirtualTreeCtrl',
                'cpanid'   => 'BBC/Wx-Perl-VirtualTreeCtrl-1.015.tar.gz',
                'uri'      => 'http://search.cpan.org/~bbc/Wx-Perl-VirtualTreeCtrl-1.015/',
            ),            
        ],        
    },
    'cpan'       => {
        'enable' => 0,
        'prereq' => [
            inc::Installer::Prerequisite->new(        
                'name'     => 'Bundle::CPAN',
                'cpanid'   => 'ANDK/Bundle-CPAN-1.852.tar.gz',
                'uri'      => 'http://search.cpan.org/~andk/Bundle-CPAN-1.852/',
            ), 
            inc::Installer::Prerequisite->new(                          
                'name'     => 'CPAN',
                'cpanid'   => 'ANDK/CPAN-1.87.tar.gz',
                'uri'      => 'http://search.cpan.org/~andk/CPAN-1.87/',
                'ppduri'   => 'http://ppm.activestate.com/PPMPackages/5.8-windows/CPAN.ppd',
            ),            
        ],        
    },
    'bioperl'    => {
        'enable' => 0,
        'prereq' => [
            inc::Installer::Prerequisite->new(        
                'name'     => 'Bio',
                'cpanid'   => 'BIRNEY/bioperl-1.4.tar.gz',
                'ppduri'   => 'http://bioperl.org/DIST/Bioperl-1.4.ppd',
            ),          
        ],        
    },    
    'testsuite'  => {
        'enable' => 0,
        'prereq' => [
            inc::Installer::Prerequisite->new(                          
                'name'     => 'Test::Pod',
                'cpanid'   => 'PETDANCE/Test-Pod-1.26.tar.gz',
                'ppduri'   => 'http://www.bribes.org/perl/ppm/Test-Pod.ppd',  
            ),
            inc::Installer::Prerequisite->new(                          
                'name'     => 'Test::Pod::Coverage',
                'cpanid'   => 'PETDANCE/Test-Pod-Coverage-1.08.tar.gz',
                'ppduri'   => 'http://www.bribes.org/perl/ppm/Test-Pod-Coverage.ppd',
            ),
            inc::Installer::Prerequisite->new(                          
                'name'     => 'Test::Distribution',
                'cpanid'   => 'SRSHAH/Test-Distribution-1.26.tar.gz', 
            ),         
        ],        
    },
)