# -*- 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 141563 2015-10-21 06:25:30Z devans@macports.org $

PortSystem          1.0

name                mobipocket
version             4.14.3
revision            2
categories          kde kde4
license             GPL-2+
maintainers         nomaintainer
description         Mobipocket plugins for Strigi indexing, Okular and thumbnails.
long_description    ${description}
homepage            https://www.kde.org/
master_sites        kde:stable/${version}/src/
use_xz              yes

# Binaries do not link to openssl, nor use the ssl backend of kdelibs4
license_noconflict  openssl

subport ${name}-qt5 {
    description     The qmobipocket library for Qt5
    long_description \
                    ${description}
}

patch.pre_args-replace -p0 -Np1

if {${subport} eq "${name}"} {
    PortGroup       kde4 1.1

    distname        kdegraphics-mobipocket-${version}
    checksums       rmd160  83892398df8bb55703ba238d48a602e45174bbed \
                    sha256  1b74264077e0c21e9b5291e6a6a1ea7eb0468a94d54d30aba91e16cf34d28154 \
                    size    14852

    depends_lib-append \
                    port:kdelibs4 \
                    port:strigi

    patchfiles-append \
                    patch-adapt-to-new-cmakemodule-location.diff
} else {
    PortGroup       qt5 1.0
    PortGroup       cmake 1.1

    set qt5.prefer_kde \
                    yes

    distname        kdegraphics-mobipocket-git
    fetch.type      git
    git.url         git://anongit.kde.org/kdegraphics-mobipocket.git
    git.branch      46aa52cf1fe052af184339d0b3e5b003503d26eb
    version         16.03.90

    patchfiles-append \
                    patch-build-against-qt5.diff
    configure.args-append \
                    -DTARGET_QT5:BOOL=ON \
                    -DAPPLE_SUPPRESS_X11_WARNING:BOOL=ON
}

livecheck.url       http://kde.mirrors.hoobly.com/stable/
livecheck.regex     (\\d+(\\.\\d+)+)
