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

# when updating subsurface, it's probably a good idea to update libdivecomputer, too
github.setup            torvalds subsurface 3.1.1 v
epoch                   1
revision                3
categories              x11
platforms               darwin
license                 GPL-2
maintainers             nomaintainer

description             Subsurface is an open source dive log program written in C.
long_description        ${description}

homepage                http://subsurface.hohndel.org/
checksums               rmd160  049ce041fa50be02752e8b097c3d5adca2e9ff6f \
                        sha256  d9db76238435fc0dcb24e4957a33aed6aa8e50496b121009327ab48abfa14954

patchfiles              Makefile.patch

depends_build           port:pkgconfig
depends_lib             path:lib/pkgconfig/glib-2.0.pc:glib2 \
                        port:libxml2 \
                        port:gtk2 \
                        port:hicolor-icon-theme \
                        port:gconf \
                        port:libdivecomputer \
                        port:gtk-osx-application \
                        port:osm-gps-map-gtk2 \
                        port:libsoup \
                        port:py27-pygtk \
                        port:libzip \
                        port:libxslt

# declare universal variant, so get_canonical_archflags works
variant universal       {}

use_configure           no

build.args-append       CC=${configure.cc} \
                        EXTRACFLAGS="${configure.cflags} [get_canonical_archflags]" \
                        LDFLAGS="${configure.ldflags} [get_canonical_archflags]" \
                        mpprefix="${prefix}" \
                        mpappdir="${destroot}${applications_dir}" \
                        prefix="${destroot}${prefix}" \
                        VERSION_STRING=${version}

destroot.args-append    CC=${configure.cc} \
                        EXTRACFLAGS="${configure.cflags} [get_canonical_archflags]" \
                        LDFLAGS="${configure.ldflags} [get_canonical_archflags]" \
                        prefix="${destroot}${prefix}" \
                        mpappdir="${destroot}${applications_dir}"

destroot.target         install-macosx