# $Id: Portfile 58210 2009-09-24 06:56:08Z ryandesign@macports.org $

PortSystem 1.0
PortGroup perl5 1.0

perl5.setup	    SDL_Perl 2.1.3
revision            1
maintainers	    meowfishies.com:sethk
categories-append   devel
description	    Perl bindings for the Simple DirectMedia Layer
long_description    ${description}
homepage	    http://sdl.perl.org/
master_sites	    http://search.cpan.org/CPAN/authors/id/D/DG/DGOEHRIG/
checksums	    md5 6ce26e1b710ce52def4ec22637cd5176 \
		    sha1 9c11cd7e4356f9b254cd9e3a2f993b1751a21552 \
		    rmd160 26a4d317d9a5761fc893b732f2236eaad8d12b88
platforms	    darwin
patchfiles	    patch-make-lib-SDL-Build-Darwin.pm patch-src-SDL.xs \
		    patch-test-testgfxprim.pl

depends_lib-append  port:p5-module-build \
		    path:lib/pkgconfig/sdl.pc:libsdl

variant image {
    depends_lib-append	port:libsdl_image
}

variant mixer {
    depends_lib-append	port:libsdl_mixer
}

variant net {
    depends_lib-append	port:libsdl_net
}

variant ttf {
    depends_lib-append	port:libsdl_ttf
}

variant gfx {
    depends_lib-append	port:libsdl_gfx
}

default_variants    +image +mixer +net +ttf +gfx

configure.cmd	    ${perl5.bin}
configure.pre_args  Build.PL
configure.env-append PREFIX=${prefix}
configure.args	    'Build Build' installdirs=vendor

build.cmd	    ${perl5.bin}
build.pre_args	    Build
build.args	    build

# Work around build system problem:
post-build {
    file rename ${worksrcpath}/blib/arch/auto/src/SDL \
	    ${worksrcpath}/blib/arch/auto/
    file rename ${worksrcpath}/blib/arch/auto/src/SDL_perl \
	    ${worksrcpath}/blib/arch/auto/
    system "rmdir ${worksrcpath}/blib/arch/auto/src"
}

test.pre_args	    Build

destroot.cmd	    ${perl5.bin}
destroot.pre_args   Build
destroot.args	    install
destroot.destdir    destdir=${destroot}
