distributable:
  url: https://github.com/MaestroError/heif-converter-image/archive/refs/tags/0.2.tar.gz
  strip-components: 1

versions:
  - 2023.6.23
  # FIXME once there has been an official release
  # See https://github.com/orgs/teaxyz/discussions/321
  # github: MaestroError/heif-converter-image
  # strip: /v/

provides:
  - bin/heif-converter

dependencies:
  github.com/strukturag/libheif: "*"

build:
  dependencies:
    go.dev: ^1.19
  script: |
    go mod download
    mkdir -p "{{ prefix }}"/bin
    go build -v -trimpath -ldflags="$LDFLAGS" -o $BUILDLOC .
  env:
    GOPROXY: https://proxy.golang.org,direct
    GOSUMDB: sum.golang.org
    GO111MODULE: on
    CGO_ENABLED: 1
    BUILDLOC: "{{prefix}}/bin/heif-converter"
    LDFLAGS:
      - -s
      - -w
    linux:
      # or segmentation fault
      # fix found here https://github.com/docker-library/golang/issues/402#issuecomment-982204575
      LDFLAGS:
        - -buildmode=pie

test:
  script:
    - which heif-converter
    - heif-converter avif star-wars.avif star-wars.png
