# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=portfile:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0
PortGroup           xcode 1.0

if {${os.major} > 13} {
    # Pick fixes from upstream:
    github.setup    rentzsch mogenerator 2d7f9b452eaa951f84304caa196585992ff50acf
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    version         1.32
    revision        0
    checksums       rmd160  866725be8fbf14414cc142974414891c5b7e350e \
                    sha256  7fcec6884a9662a96f4cb65d7626f7423708aa1e6c56b16fc89d452c6be38a4c \
                    size    394278
} elseif {${os.major} > 11} {
    github.setup    rentzsch mogenerator 1.30.1
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    revision        0
    checksums       rmd160  ce8d2d6ce366e6d3d5ee2a8b1892a8147137655f \
                    sha256  d31461d750f24185531da5bd5595a4d3c0f06cec72cb46618fbe3e67ba84a319 \
                    size    312659
} else {
    # Peg for old systems:
    github.setup    rentzsch mogenerator 1.28
    # Change github.tarball_from to 'releases' or 'archive' next update
    github.tarball_from tarball
    revision        0
    checksums       rmd160  8a8a9ebe7d21509b1704d040bbe8e82a90ab0ef1 \
                    sha256  6f8429741f0acee0380eccdf426d81dbadab62d0aaa9f1b82c562ee727fe38a5 \
                    size    351443
    patchfiles-append \
                    0001-Unbreak-10.7.patch
}

epoch               1
categories          devel
platforms           macosx
maintainers         nomaintainer
license             MIT

description         Core Data code generation

long_description    mogenerator is a command-line tool that, given \
                    an .xcdatamodel file, will generate two classes per entity. \
                    The first class, _MyEntity, is intended solely for machine \
                    consumption and will be continuously overwritten to stay in \
                    sync with your data model. The second class, MyEntity, \
                    subclasses _MyEntity, won't ever be overwritten and is \
                    a great place to put your custom logic.

homepage            http://rentzsch.github.io/mogenerator/

xcode.configuration Release

destroot {
    xinstall ${worksrcpath}/build/Release/mogenerator ${destroot}${prefix}/bin
    
    set docdir ${prefix}/share/doc/${subport}
    if {${os.major} > 13} {
        set docs [list CONTRIBUTING.md README.md Version-History.md]
    } else {
        set docs [list CONTRIBUTING.md README.markdown]
    }
    xinstall -d ${destroot}${docdir}
    foreach doc ${docs} {
        xinstall -m 0644 -W ${worksrcpath} ${doc} ${destroot}${docdir}
    }
}