Current File : /home/inlingua/miniconda3/pkgs/libarchive-3.7.7-hfab0078_0/info/recipe/meta.yaml.template
{% set version = "3.7.7" %}

package:
  name: libarchive
  version: {{ version }}

source:
  url: https://github.com/libarchive/libarchive/releases/download/v{{ version }}/libarchive-{{ version }}.tar.gz
  sha256: 4cc540a3e9a1eebdefa1045d2e4184831100667e6d7d5b315bb1cbc951f8ddff
  patches:
    - patches/0001-Add-lib-to-CMAKE_FIND_LIBRARY_PREFIXES-for-lzma.patch
    - patches/0009-CMake-Force-Multi-threaded-DLL-runtime.patch

build:
  number: 0
  run_exports:
    # https://abi-laboratory.pro/index.php?view=timeline&l=libarchive
    - {{ pin_subpackage('libarchive', max_pin='x.x') }}
  # macOS' native crypto gets used here, but the headers are needed
  ignore_run_exports:  # [osx]
    - openssl  # [osx]

requirements:
  build:
    - {{ compiler('c') }}
    - cmake
    - ninja-base
    - patch       # [not win]
    - m2-patch    # [win]
  host:
    - bzip2 {{ bzip2 }}
    - libiconv 1.16    # [not linux]
    - lz4-c 1.9
    - xz {{ xz }}
    # This is GPL-v2+, the libarchive authors explicitly ask that
    # people do not link to this (and if we do, this would need to
    # also be released as GPL-v2+, and that is against their wishes
    # and it is not clear if that is even possible)
    # https://github.com/libarchive/libarchive/releases/tag/v3.3.2
    # "Linking libarchive against liblzo violates LZO GPL licence.
    #  Please don't distribute binary packages of libarchive linked
    #  against liblzo."
    # - lzo
    - openssl {{ openssl }} # [not osx]
    - libxml2 {{ libxml2 }}
    - zlib {{ zlib }}
    - zstd {{ zstd }}
  run:
    - openssl  # [not osx]

test:
  requires:
    - ripgrep
  files:
    - test-archives/hello_world.xar
    - test-archives/archive.7z
    - test-archives/hello_world.tar.zst
  commands:
    # Verify pkg-config file is in place.
    - test -f "${PREFIX}/lib/pkgconfig/libarchive.pc"  # [unix]

    # Verify headers are in place.
    - test -f "${PREFIX}/include/archive.h"            # [unix]
    - test -f "${PREFIX}/include/archive_entry.h"      # [unix]

    # Verify libraries are in place.
    - test -f "${PREFIX}/lib/libarchive.a"             # [unix]
    - test -f "${PREFIX}/lib/libarchive${SHLIB_EXT}"   # [unix]

    # Check for commands
    - bsdcat --version
    - bsdcpio --version
    - bsdtar --version
    - pushd test-archives
    -   bsdtar -vxf hello_world.xar 2>&1 | rg "x hello_world"
    -   bsdtar -vxf archive.7z 2>&1 | rg "x 7zip-archive"
    -   bsdtar -vxf hello_world.tar.zst 2>&1 | rg "greets"
    - popd

about:
  home: https://libarchive.org/
  license: BSD-2-Clause
  license_file: COPYING
  license_family: BSD
  summary: Multi-format archive and compression library
  description: |
    Libarchive is an open-source BSD-licensed C programming library that provides streaming access
    to a variety of different archive formats, including tar, cpio, pax, Zip, and ISO9660 images.
    The distribution also includes bsdtar and bsdcpio, full-featured implementations of tar and cpio
    that use libarchive.
    When reading archives, libarchive uses a robust automatic format detector that can automatically handle archives
    that have been compressed with gzip, bzip2, xz, lzip, and several other popular compression algorithms.
  dev_url: https://github.com/libarchive/libarchive
  doc_url: https://github.com/libarchive/libarchive/wiki

extra:
  recipe-maintainers:
    - jakirkham
    - mingwandroid
    - ocefpaf