# $Id: Portfile 54753 2009-08-01 19:16:59Z jeremyhu@macports.org $

PortSystem              1.0

name                    wine-crossover-games
version                 7.2.0
categories              x11
maintainers             jeremyhu openmaintainer
homepage                http://www.codeweavers.com/
platforms               darwin
distname                crossover-games-wine-src-${version}
worksrcdir              wine

build.target            depend all
use_parallel_build      yes
universal_variant       no

description \
    Wine Is Not an Emulator (1.1.12 with CodeWeavers Modifications)

long_description \
    Wine is an implementation of the Windows APIs on top of X11.  This version contains the Codeweavers patches for Crossover Games

master_sites \
    http://media.codeweavers.com/pub/crossover/source/

checksums           md5     7b65ed80f08dc318485c5efb9b752d1b \
                    sha1    b7af9900b7ac5a109c8a16534fb111b83bf20436 \
                    rmd160  128775713960b36a9e2783ee4163a9b140ddab01


depends_lib \
    port:expat \
    port:fontconfig \
    port:freetype \
    port:jpeg \
    port:libiconv \
    port:libxml2 \
    port:libxslt \
    port:ncurses \
    port:openssl \
    port:zlib \
    port:xorg-libsm \
    port:xorg-libXcursor \
    port:xorg-libXi \
    port:xorg-libXinerama \
    port:xorg-libXrandr \
    port:xorg-libXxf86vm \
    port:mesa

depends_build \
    port:pkgconfig

configure.ldflags-append \
    -framework CoreServices \
    -lz

configure.args --x-include=${prefix}/include --x-lib=${prefix}/lib

platform darwin 10 {
    # _getdirentries_is_not_available_when_64_bit_inodes_are_in_effect dlls/ntdll/directory.o
    configure.cppflags-append -D_DARWIN_NO_64_BIT_INODE
}

pre-fetch {
    if { [string compare ${os.endian} "little"] != 0 } {
        return -code error "${name} only runs on little-endian computers, such as an Intel Mac."
    }
}

post-extract {
	system "cd ${workpath} && mv sources/wine ."
}

post-destroot {
    xinstall -d ${destroot}${prefix}/libexec/wine
    xinstall -m 755 ${filespath}/wine.in ${destroot}${prefix}/bin/wine
    reinplace s|@PREFIX@|${prefix}|g ${destroot}${prefix}/bin/wine
}

