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

# stlink static-links to libusb, which needs clock_gettime
PortGroup               legacysupport 1.1

github.setup            stlink-org stlink 1.7.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                1

categories              cross devel
license                 BSD
maintainers             {mails.ucas.ac.cn:chenguokai17 @chenguokai} openmaintainer

description             Stlink Tools Texane
long_description        Open source version of the STMicroelectronics Stlink Tools. \
                        Provides the following tools: st-flash, st-info, st-term, st-util.

checksums               rmd160  40627ba83e3a4749b0a7bbcbb8a66873df346c88 \
                        sha256  7fa9d8984a224357f516a5b483c5de99ebb97ed8afe1b29a8a0fb676360731db \
                        size    334972
                    
depends_lib-append      path:lib/pkgconfig/libusb-1.0.pc:libusb \
                        port:pkgconfig

# stlink static-links to libusb, which needs Security
patch.pre_args-replace  -p0 -p1
patchfiles              patch-stlink-libusb-Security-framework.diff

variant gui description "Enable st-link GUI" {
    PortGroup           app 1.0

    depends_lib-append  path:lib/pkgconfig/gtk+-3.0.pc:gtk3
    depends_run-append  port:adwaita-icon-theme

    app.create yes
    app.name stlink
    app.executable stlink-gui
    app.icon src/stlink-gui/icons/hicolor/128x128/apps/stlink-gui.png
    app.retina yes
}
