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

name                libgpod
version             0.8.3
revision            1
set branch          [join [lrange [split ${version} .] 0 1] .]
categories          multimedia
maintainers         nomaintainer
license             LGPL-2.1+ GPL-2+

description         libgpod is a library to access the contents of an iPod.

long_description    ${description} This library is based on code used in the \
                    gtkpod project. Starting with V0.96.CVS gtkpod depends \
                    on this library.

homepage            https://web.archive.org/web/20210118214105/http://www.gtkpod.org/libgpod/
master_sites        sourceforge:project/gtkpod/libgpod/libgpod-${branch}
use_bzip2           yes

checksums           rmd160  96a2b0e48c0af6ecc62fc4aba4e38e8d0579c6cd \
                    sha256  638a7959d04e95f1e62abad02bd33702e4e8dfef98485ac7d9d50395c37e955d \
                    size    801903

depends_build       port:autoconf \
                    port:automake \
                    port:gnome-common \
                    port:gtk-doc \
                    port:intltool \
                    port:libtool \
                    path:bin/pkg-config:pkgconfig

depends_lib         path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    port:libplist \
                    port:libpng \
                    path:lib/pkgconfig/libusb-1.0.pc:libusb \
                    port:taglib

patchfiles-append   patch-bindings-python-gpod.i.in.diff
patchfiles-append   patch-tools-generic-callout.c.diff

# reconfigure using upstream autogen.sh for intltool 0.51 compatibility

post-patch {
    xinstall -m 755 ${filespath}/autogen.sh ${worksrcpath}
}

configure.cmd       ./autogen.sh

# make sure to not use already-installed files,
# to the best of our ability
configure.ldflags-delete "-L${prefix}/lib"
configure.cppflags-delete "-I${prefix}/include"

variant python27 description {Build Bindings for Python 2.7} {}
default_variants +python27

set python.branch ""
if {[variant_isset python27]} {
    set python.branch 2.7
}

if {${python.branch} != ""} {
    set python.prefix ${frameworks_dir}/Python.framework/Versions/${python.branch}
    set pyver [join [split ${python.branch} "."] ""]
    depends_build-append port:swig-python
    depends_lib-append  port:py${pyver}-gobject port:py${pyver}-mutagen
    configure.env-append PYGOBJECT_CODEGEN=${python.prefix}/bin/pygobject-codegen-2.0
    configure.pkg_config_path ${python.prefix}/lib/pkgconfig
    configure.env-append PYTHON=${prefix}/bin/python${python.branch}
} else {
    configure.args-append --disable-pygobject --with-python=no
}

configure.args-append \
                    --disable-more-warnings \
                    --disable-silent-rules \
                    --disable-udev

livecheck.type      regex
livecheck.url       http://sourceforge.net/projects/gtkpod/files/${name}/${name}-${branch}
livecheck.regex     "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
