#!/bin/env beesh

# BEE_VERSION syncthing-1.3.3-0

## The source URL(s) array
SRCURL[0]="https://github.com/syncthing/syncthing/releases/download/v${PKGVERSION}/syncthing-source-v${PKGVERSION}.tar.gz syncthing-v${PKGVERSION}.tar.gz"

## Add URLs/paths to patch files
# PATCHURL+=()

## uncomment to change default
build_in_sourcedir

## specify different source directory
# sourcesubdir_append src

#mee_extract() {
#    bee_extract "${@}"
#}

#mee_patch() {
#    bee_patch
#}

#mee_configure() {
#    bee_configure
#}

mee_build() {
    export GOPATH=${F}
    go run build.go
#    go run build.go -no-upgrade
}

## mee_install() should install into "${D}"
## default: 'make install DESTDIR="${D}"'

mee_install() {

    mkdir -p ${D}/usr/bin
    for b in syncthing stcli stevents stcompdirs stvanity stfindignored stfileinfo stwatchfile stsigtool; do
        cp ${S}/bin/$b ${D}/usr/bin
    done

    mkdir -p ${D}/usr/share/man/man1
    cp ${S}/man/syncthing.1 ${D}/usr/share/man/man1

    mkdir -p ${D}/usr/share/man/man5
    cp ${S}/man/syncthing-{config,stignore}.5 ${D}/usr/share/man/man5

    mkdir -p ${D}/usr/share/man/man7
    cp ${S}/man/syncthing-*.7 ${D}/usr/share/man/man7
}

#mee_install_post() {
#    exit
#}