Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust-nightly v1.82.0 changes #21

Merged
merged 2 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions recipe/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# *****************************************************************
# (C) Copyright IBM Corp. 2020, 2021. All Rights Reserved.
# (C) Copyright IBM Corp. 2020, 2024. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -14,12 +14,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# *****************************************************************
#!/bin/bash

set -ex

./install.sh --prefix=$PREFIX
# windows shell doesn't start here
cd $SRC_DIR

DESTDIR=$PWD/destdir/

# we want to install only a portion of the full installation.
# To do that, let's use destdir and then use the manifest-rust-std-* file
# to install the files corresponding to rust-std
./install.sh --prefix=$PREFIX --destdir=$DESTDIR

if [ "$c_compiler" = gcc ] ; then
mkdir -p $PREFIX/etc/conda/activate.d $PREFIX/etc/conda/deactivate.d
cp $RECIPE_DIR/../scripts/rust_activate.sh $PREFIX/etc/conda/activate.d
cp $RECIPE_DIR/../scripts/rust_deactivate.sh $PREFIX/etc/conda/deactivate.d
fi
# install.log is large because it records full paths for each file.
# => conda-build is slow to parse ripgrep's output for prefix replacement.
# => replace path records beforehand:
install_log="${DESTDIR}${PREFIX}/lib/rustlib/install.log"
sed \
-e "s|${PREFIX}|/prefix|g" \
-e "s|${DESTDIR}|/destdir|g" \
-e "s|${PWD}|/source|g" \
-i.bak "${install_log}"
rm "${install_log}.bak"
9 changes: 9 additions & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
c_stdlib_version: # [linux64]
- '2.17' # [linux64]
rust_arch:
- x86_64-unknown-linux-gnu # [linux64]
- aarch64-unknown-linux-gnu # [aarch64]
- powerpc64le-unknown-linux-gnu # [ppc64le]
- x86_64-pc-windows-msvc # [win64]
- x86_64-apple-darwin # [osx and x86_64]
- aarch64-apple-darwin # [osx and arm64]
8 changes: 8 additions & 0 deletions recipe/install-rust.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set MSYSTEM=MINGW%ARCH%
set MSYS2_PATH_TYPE=inherit
set CHERE_INVOKING=1
FOR /F "delims=" %%i in ('cygpath.exe -u "%PREFIX%/Library"') DO set "PREFIX=%%i"
FOR /F "delims=" %%i in ('cygpath.exe -u "%SRC_DIR%"') DO set "SRC_DIR=%%i"
copy "%RECIPE_DIR%\install-rust.sh" .
bash -lce "%SRC_DIR%/install-rust.sh"
if errorlevel 1 exit 1
39 changes: 39 additions & 0 deletions recipe/install-rust.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -ex

# windows shell doesn't start here
cd $SRC_DIR

DESTDIR=$PWD/destdir/

# Copy everything that has been prepared by build.sh from DESTDIR to PREFIX.
cp -aR "${DESTDIR}${PREFIX}"/* "${PREFIX}/"

# Fun times -- by default, Rust/Cargo tries to link executables on Linux by
# invoking `cc`. An executable of this name is not necessarily available. By
# setting a magic environment variable, we can override this default.

case "$target_platform" in
linux-64) rust_env_arch=X86_64_UNKNOWN_LINUX_GNU ;;
linux-aarch64) rust_env_arch=AARCH64_UNKNOWN_LINUX_GNU ;;
linux-ppc64le) rust_env_arch=POWERPC64LE_UNKNOWN_LINUX_GNU ;;
win-64) rust_env_arch=X86_64_PC_WINDOWS_MSVC ;;
osx-64) rust_env_arch=X86_64_APPLE_DARWIN ;;
osx-arm64) rust_env_arch=AARCH64_APPLE_DARWIN ;;
*) echo "unknown target_platform $target_platform" ; exit 1 ;;
esac

if [[ "$target_platform" == linux* ]]; then

mkdir -p $PREFIX/etc/conda/activate.d $PREFIX/etc/conda/deactivate.d

cat <<EOF >$PREFIX/etc/conda/activate.d/rust.sh
export CARGO_TARGET_${rust_env_arch}_LINKER=$CC
EOF

cat <<EOF >$PREFIX/etc/conda/deactivate.d/rust.sh
unset CARGO_TARGET_${rust_env_arch}_LINKER
EOF

fi
60 changes: 49 additions & 11 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,66 @@
{% set version = "1.53.0" %}
{% set version = "1.82.0" %}
{% set year = "2024" %}
{% set month = "08" %}
{% set day = "26" %}

package:
name: rust-nightly
version: {{ version }}

source:
url: https://static.rust-lang.org/dist/2021-04-01/rust-nightly-x86_64-unknown-linux-gnu.tar.gz # [linux and x86_64]
url: https://static.rust-lang.org/dist/2021-04-01/rust-nightly-powerpc64le-unknown-linux-gnu.tar.gz # [ppc64le]
- url: https://static.rust-lang.org/dist/{{ year }}-{{ month }}-{{ day }}/rust-nightly-x86_64-unknown-linux-gnu.tar.gz # [linux and x86_64]
sha256: bb601cbc057f704d9e028a4c0fab1430d4614b9f83bb73b0013ad2c347d751d7 # [linux and x86_64]
- url: https://static.rust-lang.org/dist/{{ year }}-{{ month }}-{{ day }}/rust-nightly-powerpc64le-unknown-linux-gnu.tar.gz # [ppc64le]
sha256: e0921ee9c2c3433b11079c91177ae3dcaf15139955938ae3c4422c55c99aa69b # [ppc64le]

build:
number: 1
# the distributed binaries are already relocatable
binary_relocation: False

requirements:
run:
- {{ compiler('c') }} # [linux] -- rustc needs a toolchain to link executables on Linux
build:
- posix # [build_platform == "win-64"]
host:

test:
files:
- run_test.sh
commands:
- time bash ./run_test.sh # [not win]
- rustc -V | grep -q {{ version }}-nightly # [(linux and x86_64) or ppc64le]
outputs:
- name: rust-nightly
script: install-rust.sh # [unix]
script: install-rust.bat # [win]
build:
# the distributed binaries are already relocatable
binary_relocation: false
missing_dso_whitelist: # [linux]
- /lib64/librt.so.1 # [linux]
- /lib64/libdl.so.2 # [linux]
- /lib64/libpthread.so.0 # [linux]
- /lib64/libm.so.6 # [linux]
- /lib64/libc.so.6 # [linux]
- /lib64/ld-linux-x86-64.so.2 # [linux]
# Added as run deps: libgcc-ng (via compiler strong run_exports), zlib
# - /lib64/libgcc_s.so.1 # [linux]
# - /lib64/libz.so.1 # [linux]
requirements:
build:
- posix # [build_platform == "win-64"]
host:
- {{ compiler('c') }} # [linux] -- rustc needs a toolchain to link executables
# zlib is linked by **/lib/libLLVM-*-rust-*.so
- zlib # [linux]
run:
- gcc_impl_{{ target_platform }} # [linux]
test:
requires:
- posix # [build_platform == "win-64"]
commands:
- rustc --help
- rustdoc --help
- cargo --help
- rustc --version
- rustc --version | grep "rustc {{ '.'.join(version.split('.')[:3]) }}" # [unix]
- cargo --config registries.crates-io.protocol=\"sparse\" install --force xsv
- echo {{ rust_arch }}
- if exist %LIBRARY_PREFIX%\share\doc\rust\html\sysroot exit 1 # [win]

about:
home: https://www.rust-lang.org
Expand Down
Loading