{% set version = "5.0.1" %}

package:
  name: jemalloc
  version: {{ version }}

source:
  fn: {{ version }}.tar.bz2
  url: https://github.com/jemalloc/jemalloc/releases/download/{{ version }}/jemalloc-{{ version }}.tar.bz2
  sha256: 4814781d395b0ef093b21a08e8e6e0bd3dab8762f9935bbfb71679b0dea7c3e9
  patches:
    # https://github.com/jemalloc/jemalloc/issues/937
    - 0001-Add-the-mtls-dialect-gnu2-to-compile-flags.patch
    - 0002-Make-sure-JE_CXXFLAGS_ADD-uses-CPP-compiler.patch

build:
  number: 1
  skip: true  # [win]
  run_exports:
    # https://abi-laboratory.pro/tracker/timeline/jemalloc/
    - {{ pin_subpackage('jemalloc') }}

requirements:
  host:
    # This should be removed once this is fixed:
    # https://github.com/conda/conda-build/issues/2607
    - libcxx  # [osx]
  build:
    - make
    - automake
    - autoconf
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}

test:
  commands:
    - test -f $PREFIX/lib/libjemalloc.so.2  # [linux]
    - test -f $PREFIX/lib/libjemalloc.a
    - test -f $PREFIX/lib/libjemalloc_pic.a
    - test -f $PREFIX/lib/libjemalloc.2.dylib  # [osx]
    - test -f $PREFIX/include/jemalloc/jemalloc.h

about:
  home: http://jemalloc.net
  dev_url: https://github.com/jemalloc/jemalloc
  license: BSD 2-Clause
  license_file: COPYING
  summary: 'general purpose malloc(3) implementation'

extra:
  recipe-maintainers:
    - wesm
    - xhochy
