{% set version = "1.71.1" %}

package:
  name: 'rust-suite'
  version: {{ version }}

source:
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-unknown-linux-gnu.tar.gz  # [linux64]
    sha256: 34778d1cda674990dfc0537bc600066046ae9cb5d65a07809f7e7da31d4689c4  # [linux64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-aarch64-unknown-linux-gnu.tar.gz  # [aarch64]
    sha256: c7cf230c740a62ea1ca6a4304d955c286aea44e3c6fc960b986a8c2eeea4ec3f  # [aarch64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-powerpc64le-unknown-linux-gnu.tar.gz  # [ppc64le]
    sha256: bac57066882366e4628d1ed2bbe4ab19c0b373aaf45582c2da9f639f2f6ea537  # [ppc64le]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-s390x-unknown-linux-gnu.tar.gz  # [s390x]
    sha256: 4205dc823ef57c4d9bdf80fb4ecb1e23a71af6dca05432b9fb5a6e9e08fe8f19  # [s390x]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-apple-darwin.tar.gz  # [osx and x86_64]
    sha256: 916056603da88336aba68bbeab49711cc8fdb9cfb46a49b04850c0c09761f58c  # [osx and x86_64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-aarch64-apple-darwin.tar.gz  # [osx and arm64]
    sha256: f4061b65b31ac75b9b5384c1f518e555f3da23f93bcf64dce252461ee65e9351  # [osx and arm64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-pc-windows-msvc.tar.gz  # [win64]
    sha256: 0234bf6ef1ef3efe1809ba548d0ac9c6eeb8a91fb25145caf5547d8614da0049  # [win64]
    folder: msvc  # [win64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-pc-windows-gnu.tar.gz  # [win64]
    sha256: 15289233721ad7c3d697890d9c6079ca3b8a0f6740c080fbec3e8ae3a5ea5c8c  # [win64]
    folder: gnu  # [win64]

build:
  number: 0
  # the distributed binaries are already relocatable
  binary_relocation: False
  runpath_whitelist:
    - $ORIGIN/../lib
  missing_dso_whitelist:
    - /usr/lib/libresolv.9.dylib
    - /usr/lib/libc++.1.dylib
    - /usr/lib/libc++abi.dylib
    - /usr/lib/libiconv.2.dylib
    - /usr/lib/libcurl.4.dylib
    - /usr/lib/libxar.1.dylib
    - $RPATH/libLLVM-14-rust-1.64.0-stable.so
    # Since 1.32.0 macOS also needs:
    - /System/Library/Frameworks/Python.framework/Versions/2.7/Python
    - /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols
    - /usr/lib/libcompression.dylib
    - /usr/lib/libedit.3.dylib
    - /usr/lib/libform.5.4.dylib
    - /usr/lib/libncurses.5.4.dylib
    - /usr/lib/libpanel.5.4.dylib
    - /usr/lib/libxml2.2.dylib
    # Fixed via install_name_tool now (just declaring it here meant the thing using -
    # lib/rustlib/x86_64-apple-darwin/lib/python2.7/site-packages/lldb/lldb-argdumper - was
    # still unable to find it at runtime).
    # - $RPATH/libLLVM.dylib

    - '**/ld-linux-x86-64.so.2'
    - '**/libc.so.6'
    - '**/libdl.so.2'
    - '**/ld64.so.*'
    - '**/libgcc_s.so.1'
    - '**/libm.so.6'
    - '**/libpthread.so.0'
    - '**/librt.so.1'
    - '**/libgcc_s.so.1'
    - '**/libz.so.1'
    # Since 1.32.0 linux also needs:
    - '**/libstdc++.so.6'

outputs:
  - name: rust
    script: install-msvc.bat  # [win]
    script: install-unix.sh  # [not win]
    requirements:
      build:
        - {{ compiler('c') }}    # [osx]
        - posix  # [win]
    test:
      commands:
        - rustc --version
        - cargo --help


  - name: rust-gnu  # [win]
    script: install-gnu.bat  # [win]
    requirements:  # [win]
      build:  # [win]
        - posix # [win]
    test:  # [win]
      commands:  # [win]
        - rustc --version  # [win]
        - cargo --help  # [win]

about:
  home: https://www.rust-lang.org
  license: MIT AND Apache-2.0
  license_family: OTHER
  license_url: https://github.com/rust-lang/rust/blob/{{ version }}/COPYRIGHT
  summary: |
    Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.
  description: |
    This package provides the compiler (rustc) and the documentation utilities rustdoc.
  dev_url: https://github.com/rust-lang/rust
  doc_url: https://www.rust-lang.org/learn
  doc_source_url: https://github.com/rust-lang/rust/tree/{{ version }}/src/doc

extra:
  # The license files cannot be found properly on Windows
  skip-lints:
    - missing_license_file
  recipe-maintainers:
    - abhi18av
    - dlaehnemann
    - johanneskoester
    - pkgw
    - katietz
