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

PortSystem      1.0
PortGroup       github 1.0
PortGroup       xcode 1.0

github.setup    mdales osx2x 3cc708236898ab789bb99a5fba7420ff76ede9f7
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version         2.4.0
set my_version  2.4
revision        9
license         BSD
maintainers     nomaintainer
description     small Aqua application to control X11 servers from Mac OS X

long_description \
    osx2x is a small Mac OS X application that lets you \
    control other machines running either an X11 server \
    or a VNC server using your mac's mouse and keyboard. \
    So if you happen to have a mac and either an X \
    Windows machine or a machine running VNC on your \
    desk you only need to use a single keyboard and \
    mouse!

homepage        https://digitalflapjack.com/projects/osx2x/
master_sites    macports_distfiles
distname        ${name}-${my_version}
worksrcdir      ${github.author}-${github.project}-${git.branch}

checksums \
    md5     897cf872c4006d4173b3c6ff046b0c44 \
    sha1    1014e0ac22b0c00b47dde2b0f7f44eaa676acc7e \
    rmd160  cc2a63b9dbfd9485c039fc989bbab96e6cf919ac

patchfiles      patch-osx2x.xcodeproj.diff \
                patch-XXRemoteX11Daemon.m.diff \
                patch-XXRemoteVNC.m.diff \
                patch-offbyone.diff \
                XXView.m.diff

post-patch {
    reinplace s|@PREFIX@|${prefix}| ${worksrcpath}/osx2x.xcodeproj/project.pbxproj
    reinplace s|@X11_PREFIX@|${prefix}| ${worksrcpath}/osx2x.xcodeproj/project.pbxproj
}

depends_lib     port:xorg-libXtst \
                port:xorg-xorgproto \
                path:lib/libssl.dylib:openssl

xcode.configuration Release
xcode.build.settings-append HEADER_SEARCH_PATHS=${prefix}/include LIBRARY_SEARCH_PATHS=${prefix}/lib

destroot {
    copy ${worksrcpath}/build/${xcode.configuration}/osx2x.app ${destroot}${applications_dir}
}

livecheck.type      regexm
livecheck.version   ${my_version}
livecheck.url       ${github.raw}/${github.livecheck.branch}/Info.plist
livecheck.regex     {<key>CFBundleVersion</key>\s+<string>([0-9.]+)</string>}
