# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 128009 2014-11-10 20:35:29Z ionic@macports.org $

PortSystem 1.0

name         imake
version      1.0.7
categories   x11 devel
license      X11
installs_libs no
platforms    darwin
maintainers  mcalhoun openmaintainer

description       Discontinued imake build system.
long_description  ${description}

homepage http://xorg.freedesktop.org/
master_sites xorg:individual/util/

use_bzip2 yes

checksums           rmd160  7a8d7b830463c1c429a8ad8349324e607ea255fb \
                    sha256  690c2c4ac1fad2470a5ea73156cf930b8040dc821a0da4e322014a42c045f37e

depends_run    port:xorg-cf-files path:bin/perl:perl5
depends_build  port:pkgconfig port:xorg-xproto

if {${os.platform} eq "darwin" && ${os.major} >= 12} {
    depends_lib-append port:tradcpp
    set cppcmd ${prefix}/bin/tradcpp
} else {
    set cppcmd /usr/bin/cpp
}

configure.env-append RAWCPP=${cppcmd}

patchfiles     patch-imakemdep.h.diff
post-patch {
    reinplace "s|::CPPCMD::|${cppcmd}|" ${worksrcpath}/imakemdep.h
}

configure.env-append  HAS_PERL=yes

post-configure {
    # Ensure that the MacPorts perl is used
    reinplace \
        "s|#!/usr/bin/perl|#!${prefix}/bin/perl|" \
        ${worksrcpath}/mkhtmlindex.pl
}

livecheck.type   regex
livecheck.url    "http://xorg.freedesktop.org/releases/individual/util/?C=M;O=D"
livecheck.regex  ${name}-(\\d+(?:\\.\\d+)*)
