# -*- 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               cmake 1.1
PortGroup               github 1.0
PortGroup               qt5 1.0

qt5.min_version         5.9
qt5.depends_component   qtbase qttools qtsvg qtdeclarative

github.setup            bibletime bibletime 3.0 v
revision                0
github.tarball_from     releases

categories              textproc
platforms               darwin
license                 GPL-2
maintainers             nomaintainer

description             Bible study tool

long_description        BibleTime is a completely free Bible study program, built for Linux,\
                        Windows, FreeBSD and macOS. BibleTime contains over 400 free Bible\
                        texts, commentaries, dictionaries and books, provided by the\
                        Crosswire Bible Society.

homepage                http://bibletime.info

use_xz                  yes

checksums               rmd160  9d838bd20fbcb7ca850fba4837cc66096b6f073e \
                        sha256  d6beef62ad44b255e3dc4c5e89214bf01a0e85c9136073b0be12fca3d2b22622 \
                        size    1568732

compiler.cxx_standard   2011
cmake.build_type        Release

# there is rather extensive multilingual documentation
# the logic for languages is here cmake/BTDocumentation.cmake
# available lang lists are here ./i18n/handbook and ./i18n/howto
# and of course, they are not quite the same for each
# normally if you spec none of them, you get all of them
# unfortunately building "ar" fails on my systems so have to spec all the others instead
# could just force the build of English, but that's not multicultural...

# set handbook_langs_to_build       en
# set howto_langs_to_build          en

set handbook_langs_to_build "en;br;cs;de;es;fi;fr;hu;it;ko;lt;nl;pt_BR;th;uk"
set howto_langs_to_build    "en;br;cs;de;es;fi;fr;hu;it;ko;lt;nl;pt_BR;th;bg;da;ja;ru"

depends_build-append    port:pkgconfig \
                        port:docbook-xsl-ns \
                        port:docbook-xml \
                        port:fop \
                        port:libxslt \
                        port:po4a

depends_lib-append      port:sword \
                        port:clucene

# remove several hard-coded flags, deployment target, and sysroot
patchfiles              patch-bibletime-macports.diff

configure.args-append   -DBT_DOCBOOK_XSL_HTML_CHUNK_XSL=${prefix}/share/xsl/docbook-xsl-ns/html/chunk.xsl  \
                        -DBT_DOCBOOK_XSL_PDF_DOCBOOK_XSL=${prefix}/share/xsl/docbook-xsl-ns/fo/docbook.xsl \
                        -DBUILD_HOWTO_HTML_LANGUAGES=\"${howto_langs_to_build}\" \
                        -DBUILD_HOWTO_PDF_LANGUAGES=\"${howto_langs_to_build}\"  \
                        -DBUILD_HANDBOOK_HTML_LANGUAGES=\"${handbook_langs_to_build}\" \
                        -DBUILD_HANDBOOK_PDF_LANGUAGES=\"${handbook_langs_to_build}\"

post-destroot {
    # layout is important -- app will not start if doc directory not properly located
    move ${destroot}${prefix}/BibleTime.app ${destroot}${applications_dir}
    move ${destroot}${prefix}/share/doc ${destroot}${applications_dir}/BibleTime.app/Contents/share
}
