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

github.setup            momentarylapse tsunami 47a4c1653c2d8114ad07b1033daa60583cfef205
version                 2024.11.11
revision                0
categories              audio
maintainers             {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description             Simple but powerful audio editor
long_description        ${name} is an open-source digital audio workstation (DAW)
license                 GPL-3

checksums               rmd160  fd86f8cf037c05aabccaf55bdaad95e182e68c83 \
                        sha256  02c348ce65b34a1ab3d13a950c5a5e986f3ac1863e7db83523441d542bc05084 \
                        size    1308911
github.tarball_from     archive

depends_build-append    path:bin/pkg-config:pkgconfig

depends_lib-append      port:fftw-3-single \
                        port:flac \
                        port:hicolor-icon-theme \
                        port:libogg \
                        port:libvorbis \
                        port:portaudio \
                        port:zlib

depends_run-append      port:desktop-file-utils

patchfiles-append       0001-AudioInputStreamCoreAudio.cpp-fix-types.patch \
                        0002-DeviceContextCoreAudio.cpp-fix-for-missing-kAudioObj.patch \
                        0003-CoreAudio-fix-assignments.patch \
                        0004-DeviceContextCoreMidi.cpp-fix-type.patch \
                        0005-MidiInputStreamCoreMidi.cpp-fix-for-10.15.patch \
                        0006-No-git-version.patch

post-patch {
    reinplace "s|@HASH@|${github.version}|" ${worksrcpath}/src/Tsunami.cpp
}

compiler.cxx_standard   2017

configure.args-append   -DLIB_ADWAITA_ENABLED=OFF \
                        -DLIB_ALSA_ENABLED=OFF \
                        -DLIB_COREAUDIO_ENABLED=ON \
                        -DLIB_COREMIDI_ENABLED=ON \
                        -DLIB_FLAC_ENABLED=ON \
                        -DLIB_GL_ENABLED=ON \
                        -DLIB_OGG_ENABLED=ON \
                        -DLIB_PIPEWIRE_ENABLED=OFF \
                        -DLIB_PORTAUDIO_ENABLED=ON \
                        -DLIB_PULSEAUDIO_ENABLED=OFF \
                        -DLIB_UNWIND_ENABLED=OFF

variant gtk3 description "Build against GTK3" {
    depends_lib-append  path:lib/pkgconfig/gtk+-3.0.pc:gtk3
    configure.args-append \
                        -DGTK4_OR_GTK3=gtk3
}

variant gtk4 description "Build against GTK4" {
    depends_lib-append  path:lib/pkgconfig/gtk4.pc:gtk4 \
                        port:libadwaita
    configure.args-append \
                        -DGTK4_OR_GTK3=gtk4
    configure.args-replace \
                        -DLIB_ADWAITA_ENABLED=OFF \
                        -DLIB_ADWAITA_ENABLED=ON
}

variant pulse description "Build with pulse audio enabled" {
    depends_lib-append  port:pulseaudio
    configure.args-replace \
                        -DLIB_PULSEAUDIO_ENABLED=OFF -DLIB_PULSEAUDIO_ENABLED=ON
}

if {![variant_isset gtk4]} {
    default_variants    +gtk3
}

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