{% set name = "grpc-cpp" %}
{% set version = "1.26.0" %}

package:
  name: {{ name | lower }}
  version: {{ version }}

source:
  - url: https://github.com/grpc/grpc/archive/v{{ version }}.tar.gz
    sha256: 2fcb7f1ab160d6fd3aaade64520be3e5446fc4c6fa7ba6581afdc4e26094bd81
    # patches:
      # Building the Objective C plugin fails on Windows, skip it.
      # - 0001-remove-objective-c-target.patch  # [win]

build:
  number: 1
  # Requires C++ 11, VS 2008 is not supported
  skip: True  # [win and vc<14]
  run_exports:
    - {{ pin_subpackage('grpc-cpp', max_pin='x.x') }}

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake
    # `protoc` is also used for building
    - ninja
  host:
    - c-ares
    - gflags
    - libprotobuf >=3.11
    - openssl
    - zlib
  run:
    # Need to pin libprotobuf to the same version used when building,
    # otherwise we may get a different SO ABI version.
    # For example 3.6.1 is ABI-incompatible with 3.6.0...
    - c-ares
    - gflags
    - {{ pin_compatible("libprotobuf", min_pin="x.x.x", max_pin="x.x.x") }}
    - zlib

test:
  commands:
    - grpc_cpp_plugin < /dev/null  # [not win]
    - grpc_cpp_plugin < NUL  # [win]
    - if not exist %PREFIX%\\Lib\\address_sorting.lib exit 1  # [win]
    - if not exist %PREFIX%\\Lib\\gpr.lib exit 1  # [win]
    - if not exist %PREFIX%\\Lib\\grpc.lib exit 1  # [win]
    - if not exist %PREFIX%\\Lib\\grpc++.lib exit 1  # [win]

about:
  home: https://grpc.io/
  license: Apache-2.0
  license_family: APACHE
  license_file: LICENSE
  summary: gRPC - A high-performance, open-source universal RPC framework
  description: |
    <strong>LEGAL NOTICE: Use of this software package is subject to the
    software license agreement (as set forth above, in the license section of
    the installed Conda package and/or the README file) and all notices,
    disclaimers or license terms for third party or open source software
    included in or with the software.</strong> 
    <br/><br/>
    EULA: <a href="https://opensource.org/licenses/Apache-2.0" target="_blank">Apache-2.0</a>
    <br/><br/>
    
    gRPC is a modern, open source, high-performance remote procedure call
    (RPC) framework that can run anywhere. gRPC enables client and server
    applications to communicate transparently, and simplifies the building
    of connected systems.

    This package contains the gRPC C++ libraries and header files, as well
    as the code generation plugins.
  doc_url: https://grpc.io/docs/
