# -*- 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    newzealandpaul webarchiver 0.13
github.tarball_from archive
revision        0
epoch           1
categories      www
maintainers     {khindenburg @kurthindenburg} openmaintainer
license         GPL-3

description     Command-line tool to create Safari-style webarchives
long_description \
    webarchiver is a simply utility that allows you to create Safari\
    webarchives (.webarchive) from the command line.\
    webarchiver is compatible with Mac OS X 10.4 (Safari 2.0).

checksums           rmd160  d71ec11b3d7d4395bfcefe571226130e835885a7 \
                    sha256  bbb81adb809a2817e6febdcf801af805b9f4d3080127411e544ac00ee4575242 \
                    size    26997

xcode.scheme            ${name}
xcode.configuration     "Release"

# See root6 portfile
if {${os.platform} eq "darwin" && ${os.major} >= 20} {
    configure.sdk_version
}

if {${os.major} >= 21} {
    xcode.build.settings-append \
        CODE_SIGN_IDENTITY=-
} else {
    xcode.build.settings-append \
        CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO
}

# This should be removed if/when dealt with in the xcode portgroup; see:
# https://trac.macports.org/ticket/57137
if {[vercmp ${xcodeversion} 12.0] >= 0} {
    build.pre_args  -derivedDataPath ./DerivedData
}

destroot {
    xinstall ${worksrcpath}/build/Release/webarchiver ${destroot}${prefix}/bin

    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 ${worksrcpath}/README.md ${destroot}${docdir}
}
