# $Id: Portfile 47107 2009-02-22 03:52:07Z raimue@macports.org $

PortSystem      1.0
PortGroup       xcode 1.0

name            libsdl-framework
set my_name     SDL
version         1.2.13
revision        1
categories      devel multimedia
maintainers     nox openmaintainer
description     Cross-platform multi-media development API

long_description \
    Simple DirectMedia Layer is a cross-platform multimedia library designed to provide \
    fast access to the graphics framebuffer and audio device. It is used by MPEG playback \
    software, emulators, and many popular games, including the award winning Linux port of \
    \"Civilization: Call To Power.\" Simple DirectMedia Layer supports Linux, Win32, BeOS, \
    Mac OS, Solaris, IRIX, and FreeBSD.

if {[variant_isset universal]} {
    eval xcode.build.settings-append        "ARCHS='${configure.universal_archs}'"
    eval xcode.destroot.settings-append     "ARCHS='${configure.universal_archs}'"
} else {
    set arch ${os.arch}
    if {! [string compare ${os.arch} powerpc]} {
        set arch ppc
    }

    xcode.build.settings-append         ARCHS=${arch}
    xcode.destroot.settings-append      ARCHS=${arch}
}

homepage        http://www.libsdl.org/
master_sites    ${homepage}release/
distname        ${my_name}-${version}
dist_subdir     libsdl

checksums       md5 c6660feea2a6834de10bc71b2f8e4d88 \
                sha1 51fcaa3e1d5c01fd813ea08688780f86b19cf539 \
                rmd160 ed8825fc98f4b3759cf9e5cf8357d71c50df9925

xcode.project       Xcode/SDL/SDL.xcodeproj
xcode.target        "Framework Without X11 Stuff (for those who didn't install the X11 headers with Xcode)"
xcode.destroot.type framework

post-extract {
    system "cd ${worksrcpath} && tar -xvzf Xcode.tar.gz Xcode/SDL/{Info-Framework{,NoX11}.plist,SDL.xcodeproj}"
}

post-patch {
    reinplace -E "/(MACOSX_DEPLOYMENT_TARGET|GCC_VERSION|SDKROOT)_ppc =/d" \
        ${worksrcpath}/${xcode.project}/project.pbxproj
}

variant x11 {
    xcode.target    Framework
}

variant universal {}

livecheck.check regex
livecheck.url   ${homepage}download.php
livecheck.regex ${my_name}-(\\d+(?:\\.\\d+)*)
