# -*- 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.3.3 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  6a061f26ff244c3620d1156da6349a60201bddbc \
                    sha256  81e31fa4799399b3d6e14cff7c75baf30aedebb277a6bb640a8de3b59b1465f0 \
                    size    89688914

# 6.3 moved from yarn to pnpm (package.json's packageManager is pnpm@12.18.0).
depends_build       port:pnpm

# Use MacPorts' pnpm rather than letting it download the exact version
# packageManager names, and skip husky's Git hooks.
build.env-append    CSC_IDENTITY_AUTO_DISCOVERY=false \
                    CXX=${configure.cxx} \
                    npm_config_manage_package_manager_versions=false \
                    HUSKY=0

use_configure       no
use_xcode           yes

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

    # Build electron app
    system -W ${worksrcpath} \
        "${build.env} pnpm -F beekeeper-studio 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
