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

github.setup        vslavik poedit 3.4.1 v -oss
revision            0
categories          editors
# bundles gettext
license             MIT GPL-3+
maintainers         {l2dy @l2dy} openmaintainer
description         Gettext translations editor
long_description    This program is GUI frontend to GNU gettext utilities \
                    and catalogs editor/source code parser.
homepage            https://poedit.net/

depends_build       port:bison \
                    port:curl \
                    port:gsed \
                    port:ninja

fetch.type          git

if {${os.platform} eq "darwin" && ${os.major} < 18} {
    known_fail      yes
    pre-fetch {
        ui_error "${name} @${version} requires OS X 10.14 or later."
        return -code error "incompatible OS X version"
    }
}

post-fetch {
    system -W ${worksrcpath} "git submodule update --init"
}

patchfiles          patch-deps-tool-path.diff \
                    patch-remove-sparkle.diff

if {${configure.sdkroot} eq ""} {
    patchfiles-append   patch-deps-sdkroot.diff
}

post-patch {
    reinplace -W "${worksrcpath}" "s|@@PREFIX@@|${prefix}|g" \
        deps/build_deps.sh
}

xcode.configuration     "Release"
xcode.scheme            "Poedit"

build.pre_args          -workspace Poedit.xcworkspace \
                        -derivedDataPath ./DerivedData

destroot {
    copy ${worksrcpath}/build/Release/Poedit.app ${destroot}${applications_dir}
}