# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 82577 2011-08-15 22:15:27Z ciserlohn@macports.org $

PortSystem          1.0

name                factor
version             0.94
categories          lang devel
platforms           darwin
license             BSD
maintainers         ciserlohn

description         A practical stack language

long_description    The Factor programming language combines powerful language \
                    features with a full-featured library. The implementation \
                    is fully compiled for performance, while still supporting \
                    interactive development. Factor applications are portable \
                    between all common platforms. Factor can deploy stand- \
                    alone applications on all platforms.

homepage            http://www.factorcode.org/

master_sites        http://downloads.factorcode.org/releases/${version}/
distname            ${name}-src-${version}
worksrcdir          ${name}

checksums           sha1    9982a2f431cc9ca279bbcc0b69dfec5fdfd1466b \
                    rmd160  2f8451c4dfddf8d6b5a1dd59f897fa2e83ca17a1

use_zip             yes

patchfiles          patch-GNUmakefile

universal_variant   no
supported_archs	    i386 x86_64

use_configure       no

if {${build_arch} == "x86_64"} {
    build.target    macosx-x86-64
    set boot_image  boot.unix-x86.64.image 

} elseif {${build_arch} == "i386"} {
    build.target    macosx-x86-32
    set boot_image  boot.unix-x86.32.image 
}

build.args-append   CC=${configure.cc} \
                    CXX=${configure.cxx} \
                    SITE_CFLAGS="${configure.cflags} ${configure.cc_archflags}"

post-build {
    system "cd ${worksrcpath} && ./factor -i=./${boot_image}"
}

destroot {
    set factor_dir ${destroot}${applications_dir}/Factor-${version}
    xinstall -d ${factor_dir}
    foreach f {Factor.app factor.image basis core \
               extra misc readme.html license.txt} {
        copy ${worksrcpath}/$f ${factor_dir}
    }
    copy ${worksrcpath}/libfactor.dylib ${destroot}${prefix}/lib
}


livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     ${name}-src-(\\d+\\.\\d+)${extract.suffix}
