# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 97534 2012-09-08 05:54:36Z ryandesign@macports.org $

PortSystem      1.0
PortGroup       conflicts_build 1.0

name            scite
version         3.2.2
categories      editors
platforms       darwin
maintainers     nomaintainer
license         MIT

description     SciTE is a SCIntilla based Text Editor.

long_description \
    Originally built to demonstrate Scintilla, it has grown to be a generally \
    useful editor with facilities for building and running programs. It is best \
    used for jobs with simple configurations.

homepage        http://scintilla.sourceforge.net/SciTE.html
master_sites    sourceforge:project/scintilla/SciTE/${version}
distname        ${name}[strsed ${version} {g/\.//}]
extract.suffix  .tgz

depends_build   port:pkgconfig
depends_lib     port:gtk2

checksums       rmd160  0e0e79eee0dca1ee3f2d391f1a6e006763aa48ba \
                sha256  9f17fe2a5dc294bd1077bf64f713bb06733eec271bab770841e55474e6c781c8

worksrcdir      ${name}

patch.dir       ${workpath}

patchfiles      patch-scite-makefile.diff

# tidy's platform.h shadows scintilla's Platform.h on case-insensitive filesystems; see #28230
if {[file exists ${prefix}/include/Platform.h]} {
    conflicts_build tidy
}

use_configure   no

variant universal {}

set sysrootflags ""
if {${configure.sdkroot} != ""} {
    set sysrootflags "-isysroot ${configure.sdkroot}"
}

build.dir       ${worksrcpath}/gtk

build.args      CCOMP="${configure.cc} ${sysrootflags} [get_canonical_archflags cc]" \
                CC="${configure.cxx} ${sysrootflags} [get_canonical_archflags cxx]" \
                prefix=${prefix}

use_parallel_build  yes

pre-build {
    ui_debug "Building scintilla"
    set cmd "make [join ${build.args}] [portbuild::build_getjobsarg]"
    ui_debug "Assembled command: '${cmd}'"
    system -W ${workpath}/scintilla/gtk ${cmd}
}

destroot.destdir    prefix=${destroot}${prefix}

post-destroot {
    xinstall -m 444 ${worksrcpath}/doc/scite.1 ${destroot}${prefix}/share/man/man1
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${workpath}/scite License.txt README ${destroot}${docdir}
}

livecheck.distname  SciTE
