{% set version = "3.7.2" %}

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

source:
  url: https://github.com/bazelbuild/bazel/releases/download/{{ version }}/bazel-{{ version }}-dist.zip
  sha256: de255bb42163a915312df9f4b86e5b874b46d9e8d4b72604b5123c3a845ed9b1
  patches:
    - 0001-allow-args-to-be-passed-to-bazel_build.patch  # [unix]
    - 0002-do-not-use-enable-gold-unless-supported.patch # [unix]
    - 0005-Use-LSFindApplicationForInfo-for-locating-xcode.patch # [osx]
    - osx_os_log.patch  # [osx]
    - fix_netrc_protocol.patch  # [osx]
    - missing_inttype_h.patch
    - patch2.patch

build:
  number: 0
  ignore_prefix_files: True
  binary_relocation: False  # [osx]
  skip: True  # [linux32]
  skip: True  # [win and vc<14]
  skip: True  # [win32 or py<30]
  # libc++/libstdc++: statically linked
  ignore_run_exports:
    - libcxx # [not osx]
    - libstdcxx-ng
  missing_dso_whitelist:
    - "*/libc++.1.dylib" # [osx]

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - patch  # [unix]
    - python >=3
  host:
    - openjdk >=8
    - posix  # [win]
    - unzip  # [linux]
    - zip    # [linux]
  run:
    - openjdk >=8
    - posix  # [win]

test:
  requires:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
  commands:
    - bazel -h
    - readelf -d $PREFIX/bin/bazel  # [linux]
    - conda inspect linkages -p $PREFIX bazel # [unix]
    # manually check that -lstdc++ appears in the bundled unix_cc_configure.bzl
    # tar xf /path/to/pkgs/bazel-0.5.4-hf484d3e_0.tar.bz2 bin/bazel
    # unzip -p bin/bazel embedded_tools/tools/cpp/unix_cc_configure.bzl | grep stdc++

about:
  home: https://www.bazel.io/
  summary: build system originally authored by Google
  description: |
    Bazel is Google's own build tool, now publicly available in Beta. Bazel has
    built-in support for building both client and server software, including
    client applications for both Android and iOS platforms. It also provides an
    extensible framework that you can use to develop your own build rules.
  dev_url: https://github.com/bazelbuild/bazel
  doc_url: https://www.bazel.io/versions/master/docs/install.html
  license: Apache 2.0
  license_family: Apache
  license_file: LICENSE

extra:
  recipe-maintainers:
    - jjhelmus
    - nehaljwani
