Репозиторий Sisyphus
Последнее обновление: 26 октября 2021 | Пакетов: 17374 | Посещений: 22162894
en ru br
Репозитории ALT

Группа :: Разработка/Прочее
Пакет: rust

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Name: rust
Epoch: 1
Version: 1.55.0
Release: alt1
Summary: The Rust Programming Language

Group: Development/Other
License: Apache-2.0 and MIT
URL: http://www.rust-lang.org/

# https://static.rust-lang.org/dist/rustc-%version-src.tar.gz

Source: %name-%version.tar

Patch1: rust-gdb.patch
Patch2: rust-disable-lint-tests.patch

%def_without bootstrap
%def_without bundled_llvm
%def_without debuginfo
%global llvm_version 12.0

%define _unpackaged_files_terminate_build 1

BuildRequires: /proc

# for gdb python binding

BuildRequires(pre): rpm-build-python3

BuildRequires: libstdc++-devel
BuildRequires: curl
BuildRequires: cmake
BuildRequires: binutils
BuildRequires: python3-base
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(libgit2)
BuildRequires: pkgconfig(libssh2)
BuildRequires: pkgconfig(tinfo)
%if_without bundled_llvm
BuildRequires: pkgconfig(libffi)
BuildRequires: clang%{llvm_version}
BuildRequires: clang%{llvm_version}-devel
BuildRequires: llvm%{llvm_version}-devel
BuildRequires:  lld%{llvm_version}-devel
BuildRequires: gcc-c++
BuildRequires: ninja-build
%ifarch aarch64
BuildRequires: patchelf

%if_without bootstrap

BuildRequires: rust rust-cargo
%define cargo %_bindir/cargo
%define rustc %_bindir/rustc


%define r_ver 1.54.0
Source2: https://static.rust-lang.org/dist/rust-%r_ver-i686-unknown-linux-gnu.tar.gz
Source3: https://static.rust-lang.org/dist/rust-%r_ver-x86_64-unknown-linux-gnu.tar.gz
Source4: https://static.rust-lang.org/dist/rust-%r_ver-aarch64-unknown-linux-gnu.tar.gz
Source5: https://static.rust-lang.org/dist/rust-%r_ver-armv7-unknown-linux-gnueabihf.tar.gz
Source6: https://static.rust-lang.org/dist/rust-%r_ver-powerpc64le-unknown-linux-gnu.tar.gz

%ifarch %ix86
%define r_src %SOURCE2
%ifarch x86_64
%define r_src %SOURCE3
%ifarch aarch64
%define r_src %SOURCE4
%ifarch armh
%define r_src %SOURCE5
%ifarch ppc64le
%define r_src %SOURCE6

%define rustdir %_tmppath/rust
%define cargo %rustdir/bin/cargo
%define rustc %rustdir/bin/rustc


%ifarch %ix86
%define r_arch i686
%ifarch x86_64
%define r_arch x86_64
%ifarch aarch64
%define r_arch aarch64
%ifarch armh
%define r_arch armv7
%ifarch ppc64le
%define r_arch powerpc64le

%ifarch armh
%define abisuff eabihf
%define abisuff %nil

%define rust_triple %r_arch-unknown-linux-gnu%abisuff
%define rustlibdir %_libdir/rustlib
%define _libexecdir /usr/libexec

# Since 1.12.0: striping debuginfo damages *.so files

%if_without debuginfo
%add_debuginfo_skiplist %_libdir %_bindir

Rust is a systems programming language that runs blazingly fast, prevents
segfaults, and guarantees thread safety.

%package gdb
Group: Development/Other
Summary: run rust compiler under gdb
Requires: %name = %epoch:%version-%release
Requires: gdb
AutoReq: nopython,nopython3
AutoProv: nopython,nopython3

%description gdb

%package doc
Summary: Documentation for Rust
Group: Development/Documentation
# NOT BuildArch: noarch
# Note, while docs are mostly noarch, some things do vary by target_arch.

%description doc
This package includes HTML documentation for the Rust programming language and
its standard library.

%package cargo
Summary: The Rust package manager
Group: Development/Tools
Requires: rust

%description cargo
Cargo is a tool that allows Rust projects to declare their various dependencies
and ensure that you'll always get a repeatable build.

%package cargo-doc
Summary: Documentation for Cargo
Group: Development/Documentation
BuildArch: noarch
# Cargo no longer builds its own documentation
# https://github.com/rust-lang/cargo/pull/4904
Requires: rust-doc = %epoch:%version-%release

%description cargo-doc
This package includes HTML documentation for Cargo.

%package -n rustfmt
Summary: Tool to find and fix Rust formatting issues
Group: Development/Tools
Requires: rust-cargo = %epoch:%version-%release

%description -n rustfmt
A tool for formatting Rust code according to style guidelines.

%package -n rls
Summary: Rust Language Server for IDE integration
Group: Development/Tools
Requires: rust-analysis
Requires: %name = %epoch:%version-%release

%description -n rls
The Rust Language Server provides a server that runs in the background,
providing IDEs, editors, and other tools with information about Rust programs.
It supports functionality such as 'goto definition', symbol search,
reformatting, and code completion, and enables renaming and refactorings.

%package -n clippy
Summary: Lints to catch common mistakes and improve your Rust code
Group: Development/Tools
License: MPL-2.0
Requires: rust-cargo
Requires: %name = %epoch:%version-%release

%description -n clippy
A collection of lints to catch common mistakes and improve your Rust code.

%package src
Summary: Sources for the Rust standard library
Group: Development/Other
AutoReq: no
AutoProv: no

%description src
This package includes source files for the Rust standard library.  It may be
useful as a reference for code completion tools in various editors.

%package analysis
Summary: Compiler analysis data for the Rust standard library
Group: Development/Tools
Requires: %name = %epoch:%version-%release

%description analysis
This package contains analysis data files produced with rustc's -Zsave-analysis
feature for the Rust standard library. The RLS (Rust Language Server) uses this
data to provide information about the Rust standard library.

%autopatch -p1

%if_with bootstrap
tar xf %r_src
mkdir -p %rustdir
pushd rust-%r_ver-%rust_triple
./install.sh --prefix=%rustdir

%ifarch aarch64
patchelf --set-interpreter /lib64/ld-linux-aarch64.so.1 %rustdir/bin/cargo
patchelf --set-interpreter /lib64/ld-linux-aarch64.so.1 %rustdir/bin/rustc

# Fix libdir path for bootstrap
sed -i 's/Path::new("lib")/Path::new("%_lib")/' src/bootstrap/builder.rs

# This only affects the transient rust-installer, but let it use our dynamic xz-libs

sed -i -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs

%if_without bundled_llvm
rm -rf -- src/llvm-project
mkdir -p -- src/llvm-project/libunwind/

# We never enable emscripten.

rm -rf src/llvm-emscripten/

# We never enable other LLVM tools.

rm -rf src/tools/clang
rm -rf src/tools/lld
rm -rf src/tools/lldb

# Remove other unused vendored libraries

rm -rf vendor/curl-sys/curl
rm -rf vendor/jemalloc-sys/jemalloc
rm -rf vendor/libz-sys/src/zlib
rm -rf vendor/lzma-sys/xz-*
rm -rf vendor/openssl-src/openssl

# CI tooling won't be used

rm -rf src/ci

# Remove hidden files from source

find src/ -type f -name '.appveyor.yml' -delete
find src/ -type f -name '.travis.yml' -delete
find src/ -type f -name '.cirrus.yml' -delete

# The configure macro will modify some autoconf-related files, which upsets

# cargo when it tries to verify checksums in those files.  If we just truncate
# that file list, cargo won't have anything to complain about.
find vendor \
-name .cargo-checksum.json \
-exec sed -i -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'

cat >env.sh <<EOF
export RUSTFLAGS="-Clink-arg=-Wl,-z,relro,-z,now -Clink-args=-fPIC -Copt-level=2"
export DESTDIR="%buildroot"
export ALTWRAP_LLVM_VERSION="%llvm_version"

cat > config.toml <<EOF
cargo = "%cargo"
rustc = "%rustc"
python = "python3"
submodules = false
docs = true
verbose = 2
vendor = true
extended = true
tools = ["cargo", "rls", "clippy", "rustfmt", "analysis", "src"]
build-stage = 2
test-stage = 2
doc-stage = 2

prefix = "%prefix"
libdir = "%_lib"

channel = "stable"
codegen-tests = false
backtrace = true
jemalloc = false
rpath = false
debug = false
deny-warnings = false
%if_without debuginfo
debuginfo-level = 0
codegen-units = 2
debuginfo-level = 1
codegen-units = 0

ninja = true
use-libcxx = false
%if_without bundled_llvm
link-shared = true

cc = "clang"
cxx = "clang++"
ar = "llvm-ar"
ranlib = "llvm-ranlib"
llvm-config = "/usr/bin/llvm-config"

. ./env.sh

python3 x.py build
python3 x.py doc

. ./env.sh

python3 x.py install

rm -f -- %buildroot/%_libdir/lib*.so.old

# The libdir libraries are identical to those under rustlib/.  It's easier on

# library loading if we keep them in libdir, but we do need them in rustlib/
# to support dynamic linking for compiler plugins, so we'll symlink.
find %buildroot/%rustlibdir/%rust_triple/lib \
-name '*.so' -printf '%%f %%p\n' |
while read -r n rustlib; do

[ -e "$lib" ] ||

c="$(sha1sum "$rustlib" "$lib" |cut -f1 -d\  |uniq |wc -l)"

[ "$c" = 1 ] ||

ln -s -f -- "$(relative "$lib" "$rustlib")" "$rustlib"

# Remove installer artifacts (manifests, uninstall scripts, etc.)

find %buildroot/%rustlibdir -maxdepth 1 -type f -delete

# We don't actually need to ship any of those python scripts in rust-src anyway.

find %buildroot/%rustlibdir/src -type f -name '*.py' -delete

# Drop compiled python

find %buildroot/%rustlibdir/etc -type f -name '*.pyc' -delete
%add_python3_path %rustlibdir/etc

. ./env.sh
%if_without bundled_llvm
# ensure that rustc_driver is actually dynamically linked to libLLVM
find %buildroot/%_libdir \
-name 'librustc_driver-*.so' -execdir objdump -p '{}' '+' |
grep -qs 'NEEDED.*LLVM'

# https://rustc-dev-guide.rust-lang.org/tests/intro.html

for i in \
codegen \
codegen-units \
incremental \
mir-opt \
; do
: "### rust_src_test: running $i"
if ! python3 ./x.py test --no-doc --no-fail-fast "src/test/$i"; then
failed="$failed $i"
: "### rust_src_test: $i $status"

if [ -n "$failed" ]; then
: "### rust_src_test: failure summary: $failed"
: "### aborting due to test failures"
exit 1

%if_with bootstrap
rm -rf %rustdir

%exclude %_datadir/doc/rust
%dir %rustlibdir
%dir %rustlibdir/etc
%dir %rustlibdir/%rust_triple
%exclude %rustlibdir/%rust_triple/analysis
%exclude %rustlibdir/etc/*

%files gdb
%exclude %_bindir/rust-lldb
%exclude %rustlibdir/etc/lldb_*

%files doc
%exclude %_datadir/doc/%name/html/cargo

%files cargo

%files cargo-doc

%files -n rustfmt
%doc src/tools/rustfmt/{README.md,CHANGELOG.md,Configurations.md,LICENSE-APACHE,LICENSE-MIT}

%files -n rls
%doc src/tools/rls/{README.md,COPYRIGHT,debugging.md,LICENSE-APACHE,LICENSE-MIT}

%files -n clippy
%doc src/tools/clippy/{README.md,CHANGELOG.md,LICENSE*}

%files src

%files analysis


Полный changelog можно просмотреть здесь

дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin