{% set version = "5.4.2" %}

package:
  name: xz
  version: {{ version }}

source:
  url: https://sourceforge.net/projects/lzmautils/files/xz-{{ version }}.tar.bz2
  sha256: aa49909cbd9028c4666a35fa4975f9a6203ed98154fbb8223ee43ef9ceee97c3

build:
  number: 0
  run_exports:
    # XZ's track record of backcompat is very good.  Keep default pins (next major version)
    #    https://abi-laboratory.pro/tracker/timeline/xz/
    - {{ pin_subpackage('xz') }}

requirements:
  build:
    - {{ compiler('c') }}
    - m2w64-toolchain      # [win]
    - posix     # [win]
    - make      # [not win]
    - automake  # [not win]
    - libtool   # [not win]
  host:
    - msinttypes  # [win and vc<14]

test:
  requires:
    # To use 'conda inspect', install conda-build
    - conda-build # [not win]
  commands:
    - xz --help  # [not win]
    - unxz --help  # [not win]
    - lzma --help  # [not win]
    - xz.exe --help  # [win]
    - unxz.exe --help  # [win]
    - if not exist %PREFIX%\\Library\\bin\\liblzma.dll exit 1  # [win]
    - if not exist %PREFIX%\\Library\\lib\\liblzma.lib exit 1  # [win]
    - if not exist %PREFIX%\\Library\\lib\\liblzma_static.lib exit 1  # [win]
    - if not exist %PREFIX%\\Library\\include\\lzma.h exit 1  # [win]
    - if not exist %PREFIX%\\Library\\bin\\xz.exe exit 1  # [win]
    - if exist %PREFIX%\\lib exit 1 # [win]
    - conda inspect linkages -p $PREFIX $PKG_NAME  # [not win]
    - conda inspect objects -p $PREFIX $PKG_NAME  # [osx]

about:
  home: https://tukaani.org/xz/
  license: LGPL-2.1-or-later and GPL-2.0-or-later
  license_file: COPYING
  license_family: GPL2
  summary: Data compression software with high compression ratio
  description: |
    XZ Utils is free general-purpose data compression software with a high
    compression ratio. XZ Utils were written for POSIX-like systems, but also
    work on some not-so-POSIX systems.
  doc_url: https://tukaani.org/xz/
  dev_url: https://git.tukaani.org/

extra:
  recipe-maintainers:
    - msarahan
    - ocefpaf
    - mingwandroid
    - nehaljwani
    - scopatz
