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

github.setup        dkaluta icalBuddy64 62b911eb753c7c5c4921a92144e7716635221a68
github.tarball_from archive
name                icalbuddy64
version             20200908
revision            0

description         \
    Command-line utility for printing events and tasks from the macOS \
    calendar database.

long_description    {*}${description}

categories          office
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  66d1c107154165d28b7e9056fe71a5e3d45dfa7c \
                    sha256  b9019003fbdf0fcbb2ad5dc8b34325633c79c9d5e56e58c706bcd99d8214be0f \
                    size    204536

depends_build-append \
                    port:perl5

patchfiles-append   patch-Makefiles.diff

post-patch {
    reinplace -E \
        "s|^#!/usr/bin/perl|${prefix}/bin/perl5|" \
        ${worksrcpath}/utils/manserver.pl

    platform darwin powerpc {
        # With -Werror it unnecessarily fails on warnings:
        # warning: signed and unsigned type in conditional expression
        reinplace "s|-Werror||" ${worksrcpath}/Makefile
    }
}

compiler.c_standard 1999

build.target        icalBuddy \
                    icalBuddy.1 \
                    icalBuddyLocalization.1 \
                    icalBuddyConfig.1

use_parallel_build  no
use_xcode           yes

destroot {
    copy ${worksrcpath}/icalBuddy ${destroot}${prefix}/bin/

    xinstall -d ${destroot}${prefix}/share/man/man1
    copy {*}[glob ${worksrcpath}/*.1] ${destroot}${prefix}/share/man/man1/
}