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

github.setup            mulle-nat mulle-xcode-settings 1.2.5
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
categories              devel
maintainers             nomaintainer
license                 GPL-3+

description             Edit Xcode build settings from the command line
long_description        {*}${description}

checksums               rmd160  57799a10c12af472a3ee4b8eb88ae0b6900f67c2 \
                        sha256  a6eac4d3c665e8c33bfcfaaaa3e48a8792334ce978b8c0989364c807d1a00810

# the xcode project crashes on closing on Xcode less than 4.2
# so mulle-xcode-to-cmake was used to make it into a cmake build
# instead for this situation - just what it was designed for

if {[vercmp $xcodeversion 4.2] < 0} {
 
     PortGroup               cmake 1.0
     cmake.out_of_source     yes
 
     pre-configure {
         copy ${filespath}/CMakeLists.txt ${worksrcpath}
         copy ${filespath}/CMakeSourcesAndHeaders.txt ${worksrcpath}
     }
     
    configure.cflags-append -DCURRENT_PROJECT_VERSION=\\"${version}\\"
     
     set product             ${worksrcpath}/../build/${name}

} else {

    PortGroup               xcode 1.0

    xcode.project           mulle-xcode-settings.xcodeproj
    xcode.configuration     Release
    xcode.build.settings    SYMROOT=build
    xcode.target            mulle-xcode-settings
    
    set product             ${worksrcpath}/build/Release/${name}
}

destroot {
    copy ${product} ${destroot}${prefix}/bin
}

test.run                yes
test.cmd                ${product}
test.target
test.args               -v
