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

# Please keep this pegged, unless a newer version is fixed for Qt4 and confirmed to work.
# This port is meant only for old systems which do not presently support Qt5.
name                qsynth-qt4
set real_name       qsynth
version             0.5.3
revision            0
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
categories          audio
platforms           {darwin < 11}
license             GPL-2+
conflicts           qsynth

description         A fluidsynth GUI front-end application
long_description    Qsynth is a fluidsynth GUI front-end application, written in C++ using the Qt framework. \
                    This is a legacy version primarily aimed at PowerPC systems.

homepage            https://qsynth.sourceforge.io
master_sites        sourceforge:project/${real_name}/${real_name}/${version} \
                    https://download.sourceforge.net/${real_name}/

distname            ${real_name}-${version}

checksums           rmd160  35468f7b9fdbbcfcea919cd4749d4876de984276 \
                    sha256  2ce9791f8a927425d29bacc44fdfff575638b24512e0f0b6f2eca85deb67f0c9 \
                    size    269252

use_autoreconf      yes
autoreconf.cmd      ./autogen.sh
autoreconf.args

# The build system is crazy: in fact C++11 is not required, moreover, both configure and environment settings
# for compiler choice are stubbornly ignored, and the build picks the compiler which was used to build Qt4,
# which normally would mean gcc-4.2. Yet, just using gcc-4.2 leads to configure failure: Qt4 version
# is not recognized correctly. Despite this madness, build succeeds and the app works.
compiler.cxx_standard 2011

depends_lib-append  port:desktop-file-utils \
                    port:fluidsynth \
                    port:xorg-libX11 \
                    port:xorg-libXext

configure.args-append \
                    --bindir=${applications_dir} \
                    --enable-qt4

post-activate {
    system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
}
