# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
  hooks:
    # `go mod tidy` fails on public CI runners because internal/diff/sandbox.go
    # (//go:build sandbox) imports the closed-source pkg/sandbox/. tidy evaluates
    # all build tags. Use `go mod download` which only fetches what go.mod requires.
    - go mod download
    # you may remove this if you don't need go generate
    - ./hack/make/completions
    - ./hack/make/manpages

builds:
  # - id: linux-amd64
  #   main: ./cmd/ipsw
  #   binary: ipsw
  #   env:
  #     - CGO_ENABLED=1
  #   goos:
  #     - linux
  #   goarch:
  #     - amd64
  #   mod_timestamp: "{{ .CommitTimestamp }}"
  #   flags:
  #     - -trimpath
  #   ldflags: -s -w -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion={{.Version}} -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildCommit={{.Commit}}
  # - id: linux-arm64
  #   main: ./cmd/ipsw
  #   binary: ipsw
  #   env:
  #     - CGO_ENABLED=1
  #     - CC=aarch64-linux-gnu-gcc
  #   goos:
  #     - linux
  #   goarch:
  #     - arm64
  #   mod_timestamp: "{{ .CommitTimestamp }}"
  #   flags:
  #     - -trimpath
  #   ldflags: -s -w -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion={{.Version}} -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildCommit={{.Commit}}
  - id: linux-amd64-extras
    main: ./cmd/ipsw
    binary: ipsw
    env:
      - CGO_ENABLED=1
      - CGO_LDFLAGS=-L/usr/local/lib -ludev -static
      - CGO_CFLAGS=-I/usr/local/include
    goos:
      - linux
    goarch:
      - amd64
    tags:
      - libusb
      - unicorn
    mod_timestamp: "{{ .CommitTimestamp }}"
    flags:
      - -trimpath
    ldflags: -s -w -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppVersion={{.Version}} -X github.com/blacktop/ipsw/cmd/ipsw/cmd.AppBuildCommit={{.Commit}}

archives:
  # - id : linux-archive
  #   builds:
  #     - linux-amd64
  #     - linux-arm64
  #   replacements:
  #     darwin: macOS
  #     ios: iOS
  #     amd64: x86_64
  #     all: universal
  #   format_overrides:
  #     - goos: windows
  #       format: zip
  #   files:
  #     - README.md
  #     - LICENSE
  #     - completions/*
  #     - manpages/*
  #   wrap_in_directory: true
  - id : extras-archive
    builds:
      - linux-amd64-extras
    name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}_extras"
    replacements:
      darwin: macOS
      amd64: x86_64
    files:
      - README.md
      - LICENSE
      - completions/*
      - manpages/*
    wrap_in_directory: true

checksum:
  name_template: 'checksums.linux.extras.txt'

# nfpms:
#   - id: packages
#     builds:
#       - linux-amd64
#       - linux-arm64
#     homepage:  https://github.com/blacktop/ipsw
#     description: |-
#       iOS/macOS Research Swiss Army Knife.
#     maintainer: Blacktop <https://github.com/blacktop>
#     license: MIT
#     vendor: Blacktop
#     bindir: /usr/bin
#     section: utils
#     contents:
#       - src: ./completions/_bash
#         dst: /usr/share/bash-completion/completions/ipsw
#         file_info:
#           mode: 0644
#       - src: ./completions/_fish
#         dst: /usr/share/fish/completions/ipsw.fish
#         file_info:
#           mode: 0644
#       - src: ./completions/_zsh
#         dst:  /usr/share/zsh/vendor-completions/_ipsw
#         file_info:
#           mode: 0644
#       - src: ./manpages/ipsw.1.gz
#         dst: /usr/share/man/man1/ipsw.1.gz
#         file_info:
#           mode: 0644
#       - src: ./LICENSE
#         dst: /usr/share/doc/ipsw/copyright
#         file_info:
#           mode: 0644
#     replacements:
#       amd64: x86_64
#     formats:
#     - apk
#     - deb
#     - rpm

# snapcrafts:
#   - id: snaps
#     name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
#     builds:
#     - linux-amd64
#     - linux-arm64
#     summary: iOS/macOS Research Swiss Army Knife.
#     description: |
#       iOS/macOS Research Swiss Army Knife.
#     grade: stable
#     confinement: strict
#     publish: true
#     license: MIT
