# $Id: Portfile 67634 2010-05-15 09:56:12Z ryandesign@macports.org $

PortSystem 1.0
PortGroup archcheck 1.0

name             mono
version          2.6.4
categories       devel lang mono
platforms        darwin
license          GPLv2 LGPLv2 MIT
maintainers      mww openmaintainer
description      Implementation of the .NET Development Framework
long_description Mono is an effort to create an open source \
                 implementation of the .NET Development Framework \
                 including a C# compiler.

homepage         http://www.go-mono.com/
master_sites     ${homepage}sources/${name}/
use_bzip2        yes
universal_variant no

if {[info exists supported_archs]} {
    supported_archs i386 ppc
}
if {${build_arch} == "x86_64"} {
    configure.build_arch i386
} elseif {${build_arch} == "ppc64"} {
    configure.build_arch ppc
}

checksums        md5     342a7ca3bea3cbec0c8ac48b9322fcb4 \
                 sha1    c3b556e63cfa635687a40372a83e4a1b8fd10103 \
                 rmd160  c5c12bd0226ff3b45bb8951bfb5c74415e81d6b1

depends_build    port:pkgconfig port:gawk
depends_lib      port:gettext path:lib/pkgconfig/glib-2.0.pc:glib2 \
                 port:libiconv port:zlib port:libgdiplus port:xorg-libX11

archcheck.files  lib/libintl.dylib \
                 lib/libglib-2.0.dylib \
                 lib/libiconv.dylib \
                 lib/libz.dylib \
                 lib/libgdiplus.dylib \
                 lib/libX11.dylib

patchfiles       patch-configure.diff \
                 patch-data-config.in.diff \
                 patch-mono-utils-mono-sigcontext.h.diff \
                 patch-libgc-darwin_stop_world.c.diff

# Do NOT pick up external boehmgc (prefixing CPPFLAGS or CFLAGS does not suffice -- ugly++)
configure.cc-append	"-I${worksrcpath}/libgc/include"

configure.args   --with-gc=included \
                 --with-preview=yes \
                 --without-sigaltstack \
                 --with-libgdiplus=${prefix} \
                 --disable-dtrace

test.run         yes
test.target      check

post-patch {
    reinplace "s/-pthread/-lpthread/g" ${worksrcpath}/configure
    reinplace s|@PREFIX@|$prefix|g $worksrcpath/data/config.in
}

post-destroot {
    set docdir ${prefix}/share/doc/${name}-${version}

    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING.LIB ChangeLog NEWS README \
        ${destroot}${docdir}

    xinstall -m 0644 -W ${worksrcpath}/docs assembly-bundle embedded-api exceptions \
        gc-issues jit-thoughts jit-trampolines object-layout stack-alignment unmanaged-calls \
        ${destroot}${docdir}

    move ${destroot}${prefix}/share/jay ${destroot}${docdir}

    set libgc_docdir ${prefix}/share/doc/ligbc-mono-6.6

    eval move ${destroot}${prefix}/share/libgc-mono \
        ${destroot}${libgc_docdir}

    xinstall -d ${destroot}${libgc_docdir}/html

    eval move [glob ${destroot}${libgc_docdir}/*.html] \
        ${destroot}${libgc_docdir}/html
}

platform darwin 9 {
    # is this still valid for 2.6.3+ ?
    configure.cflags-append    -D_NONSTD_SOURCE
    configure.cxxflags-append    -D_NONSTD_SOURCE
    patchfiles-append patch-interp.h.diff patch-sys-mman.c.diff
}

livecheck.type  regex
livecheck.url   ${homepage}sources-stable/
livecheck.regex mono/mono-(\\d+(?:\\.\\d+)*)

