#--------------------------------------------------------------------------------
# MetTools - A Collection of Software for Meteorology and Remote Sensing
# Copyright (C) 2018  EUMETSAT
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#--------------------------------------------------------------------------------

{% set name = "log4cxx" %}
{% set version = "0.11.0" %}

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

source:
  - url: http://archive.apache.org/dist/logging/{{ name }}/{{ version }}/apache-{{ name }}-{{ version }}.tar.gz
    fn:  apache-{{ name }}-{{ version }}.tar.gz
    sha256: c316705ee3c4e5b919d3561d5f305162d21687aa6ae1f31f02f6cdadc958b393
    patches:
      - 001-fix-osx-segfault.patch
      - 002-fix-osx.patch
  - path: CMakeLists.txt

build:
  number: 3
  skip: true  # [win and vc<14]
  run_exports:
    # no ABI lab data, soname is changing with each release
    - {{ pin_subpackage("log4cxx", max_pin="x.x.x") }}

requirements:
  build:
    - gnuconfig  # [unix]
    - {{ compiler('cxx') }}
    - {{ compiler('c') }}
    - cmake
    - make
    - zip  # [linux]
  host:
    - expat
    - apr
    - libiconv
  run:
    - expat
    - apr
    - libaprutil
    - libapr


test:
  commands:
    - test -f $PREFIX/include/log4cxx/appender.h  # [unix]
    - test -f $PREFIX/include/log4cxx/logmanager.h  # [unix]
    - test -f $PREFIX/lib/liblog4cxx.so  # [linux]
    - test -f $PREFIX/lib/liblog4cxx.dylib  # [osx]
    - if not exist %LIBRARY_INC%\\log4cxx\\log4cxx.h exit 1  # [win]
    - if not exist %LIBRARY_BIN%\\log4cxx.dll exit 1  # [win]
    - if not exist %LIBRARY_LIB%\\log4cxx.lib exit 1  # [win]

about:
  home: https://logging.apache.org/log4cxx
  license: Apache-2.0
  license_file: LICENSE
  summary:
    A logging framework for C++ patterned after Apache log4j.
  description: |
    Apache log4cxx is a logging framework for C++ patterned after Apache log4j,
    which uses Apache Portable Runtime for most platform-specific code and should be
    usable on any platform supported by APR. Apache log4cxx is licensed under the
    Apache License, an open source license certified by the Open Source Initiative.
  doc_url: https://logging.apache.org/log4cxx

extra:
  recipe-maintainers:
    - wolfv
    - lesteve
    - seanyen
    - brianv0
