{% set version = "1.64.0" %}

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: a893977f238291370ab96726a74b6b9ae854dc75fbf5730954d901a93843bf9b  # [linux64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-aarch64-unknown-linux-gnu.tar.gz  # [aarch64]
    sha256: 7d8860572431bd4ee1b9cd0cd77cf7ff29fdd5b91ed7c92a820f872de6ced558  # [aarch64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-powerpc64le-unknown-linux-gnu.tar.gz  # [ppc64le]
    sha256: 9d4591033eac22093d107991a68fffccea087b26bb54115d46cc544fbf5ef66c  # [ppc64le]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-s390x-unknown-linux-gnu.tar.gz  # [s390x]
    sha256: 202c445d2a7742c761ad31e62a8ffdfbff4ecc691a79d04182b7e1e5b18383ad  # [s390x]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-apple-darwin.tar.gz  # [osx and x86_64]
    sha256: b6003d49fb857ff8dc105a3ccba98b851cd3e7d874005acb92284fd1113adc0d  # [osx and x86_64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-aarch64-apple-darwin.tar.gz  # [osx and arm64]
    sha256: e1a37dc5991304716e260144311fd291d8fb514042e45c244c582b3454477038  # [osx and arm64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-pc-windows-msvc.tar.gz  # [win64]
    sha256: 82ab0bf226cc64379612e050365f4944d6201cd5d9e527d7956c3fbdb715d0bb  # [win64]
    folder: msvc  # [win64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-pc-windows-gnu.tar.gz  # [win64]
    sha256: 40432058311e765a28605f9507fdc6df2d60fad70aa5def231709eb64adeea4d  # [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
