# -*- 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

PortSystem              1.0
PortGroup               github 1.0
PortGroup               cmake 1.0

github.setup            IoLanguage io 2017.09.06
revision                1
name                    Io
categories              lang
# mostly BSD, but some LGPL and GPL files
license                 GPL-2
platforms               macosx
maintainers             {mark @markemer} openmaintainer

description             Io is small prototype-based programming language

long_description        ${description}. The ideas in Io are mostly inspired \
                        by Smalltalk (all values are objects), Self, \
                        NewtonScript and Act1 (prototype-based differential \
                        inheritance, actors and futures for concurrency), \
                        LISP (code is a runtime inspectable / modifiable \
                        tree) and Lua (small, embeddable).

homepage                http://www.iolanguage.com/

checksums               rmd160  ebf5d206b115329456df169aaaad33f431a92bfc \
                        sha256  febf9b6f4174e3d9fee179b5d41a81dba8b9660ece7a1cecee7452f5e9e460ea \
                        size    9154022

depends_lib             path:lib/pkgconfig/cairo.pc:cairo \
                        port:freetype \
                        path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        port:gmp \
                        port:jpeg \
                        port:libedit \
                        port:libevent \
                        port:libffi \
                        port:libiconv \
                        port:libidn \
                        port:libmemcached \
                        port:libogg \
                        port:libpng \
                        port:libsndfile \
                        port:libtheora \
                        port:libvorbis \
                        port:libxml2 \
                        port:loudmouth \
                        port:lzo2 \
                        port:ncurses \
                        path:lib/libssl.dylib:openssl \
                        port:ossp-uuid \
                        path:lib/pkgconfig/pango.pc:pango \
                        port:pcre \
                        port:python37 \
                        port:readline \
                        port:sqlite3 \
                        port:tiff \
                        port:yajl \
                        port:zlib

configure.python        ${prefix}/bin/python3.7

# ../../_build/binaries/io_static: No such file or directory
use_parallel_build      no

post-destroot {
    set libstofix \
        [list libIoObjcBridge.dylib \
              libIoOpenGL.dylib \
              libIoRegex.dylib \
              libIoTheora.dylib \
              libIoVorbis.dylib]
    fs-traverse destlib ${destroot}${prefix}/lib {
        if {[file isfile ${destlib}] && [file extension ${destlib}] == ".dylib"} {
            set lib [strsed ${destlib} "s|^${destroot}||"]
            set cmd "install_name_tool -id '${lib}'"
            if {[lsearch ${libstofix} [file tail ${destlib}]] > -1} {
                foreach linkedlibname {Blowfish Box MD5 Ogg Range Socket SystemCall Yajl} {
                    set linkedlib "libIo${linkedlibname}.dylib"
                    append cmd " -change '${prefix}/lib/${linkedlib}' '${prefix}/lib/io/addons/${linkedlibname}/_build/dll/${linkedlib}'"
                }
            }
            append cmd " '${destlib}'"
            ui_debug "Assembled command: '${cmd}'"
            system "${cmd}"
        }
    }
}

test.run                yes
test.cmd                ${worksrcpath}/_build/binaries/io_static ${worksrcpath}/libs/iovm/tests/correctness/run.io
test.target