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

github.setup        beekeeper-studio beekeeper-studio 6.1.4 v
revision            0

homepage            https://beekeeperstudio.io

description         Cross platform SQL editor and database management app for \
                    Windows, Linux, and Mac.

long_description    Beekeeper Studio is a free and open source SQL editor and \
                    database manager. Beekeeper Studio is cross-platform, and \
                    available for Linux, Mac, and Windows. It features \
                    autocomplete SQL query editor with syntax highlighting, \
                    tabbed interface, so you can multitask, the ability to \
                    sort and filter table data to find just what you need, \
                    sensible keyboard-shortcuts, the ability to save queries \
                    for later, query run-history so you can find that one \
                    query you got working 3 days ago, and a default dark theme.

categories          databases
license             MIT
# Electron's headers need <source_location>, which the libc++ of Xcode 14
# and earlier lacks; the buildbots for macOS 13 and earlier fail.
platforms           {darwin >= 23}
supported_archs     x86_64 arm64

maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  af729b4285ed96e6d03dfc23f23eebb925a75ced \
                    sha256  cc812dad7dacb32b08e772f1530d3cc9b1fd711e9574d173173d91ea74334c8a \
                    size    86121116

depends_build       port:yarn \
                    port:npm10

build.env-append    CSC_IDENTITY_AUTO_DISCOVERY=false \
                    CXX=${configure.cxx}

use_configure       no
use_xcode           yes

build {
    # Set up all JS dependencies
    system -W ${worksrcpath} "${build.env} yarn --frozen-lockfile"

    # Build electron app
    system -W ${worksrcpath} \
        "${build.env} yarn run electron:build --mac dir --publish never"
}

destroot {
    copy {*}[glob "${worksrcpath}/apps/studio/dist_electron/mac*/Beekeeper Studio.app"] \
         ${destroot}${applications_dir}
}

github.livecheck.regex  {([0-9.]+)}
github.tarball_from     archive
