# -*- 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
# $Id: Portfile 90193 2012-02-25 20:35:06Z rmstonecipher@macports.org $

PortSystem          1.0

name                libgpod
version             0.8.0
revision            8
categories          multimedia
platforms           darwin
maintainers         rmstonecipher openmaintainer
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            http://www.gtkpod.org/libgpod/
master_sites        sourceforge:gtkpod
checksums           md5     6660f74cc53293dcc847407aa5f672ce \
                    sha1    ddef7f3583535242b4928b300eb8aa6bc9a0e6dc \
                    rmd160  446d5045f6c91e55e894c5d5370658afc8abe8ef

depends_build       path:bin/pkg-config:pkgconfig \
                    port:intltool

depends_lib         port:p5.12-xml-parser \
                    port:libplist \
                    port:gdk-pixbuf2 \
                    port:taglib \
                    path:lib/pkgconfig/libusb-1.0.pc:libusb

# 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 conflicts python26 \
description {Build Bindings for Python 2.7} {}

variant python26 conflicts python27 \
description {Build Bindings for Python 2.6} {}

# default to python27 bindings
if {![variant_isset python27] && ![variant_isset python26]} {
    default_variants +python27
}

# allow for -python27 to disable all Python support

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

if {${python.branch} != ""} {
    set python.prefix ${frameworks_dir}/Python.framework/Versions/${python.branch}
    set pyver [join [split ${python.branch} "."] ""]
    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-silent-rules

post-destroot {
    # fix install location of Python stuff, if variant is selected
    if {${python.branch} != ""} {
        set dr_python_dir ${destroot}${python.prefix}/lib
        xinstall -m 755 -d ${dr_python_dir}
        move ${destroot}${prefix}/lib/python${python.branch} \
            ${dr_python_dir}
    }
}

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