xen0n / loongson-overlay

Support overlay for Gentoo/Loongson users
21 stars 11 forks source link

Add rust-1.56.1 rust-1.57.0 for loongarch64 #6

Closed phorcys closed 2 years ago

phorcys commented 2 years ago

This pull request add rust loongarch port for gentoo orignal rust patches from :

http://pkg.loongnix.cn/loongnix/pool/main/r/rustc/rustc_1.41.1+dfsg1-1~deb10u1.lnd.2.debian.tar.xz

current support ebuild version:

    dev-lang/rust-1.56.1
    dev-lang/rust-1.57.0

Upstream llvm loongarch port is not merged yet. USE="system-llvm" is needed to emerge. eg:

    env USE="system-llvm clippy rls rustfmt wasm" emerge -av  rust

Rust cannot bootstrap without prebuilt rust compiler, but upstream has no loongarch64-unknown-linux-gnu tarballs. Ebuilds in this pr use tarballs hosted at

https://github.com/phorcys/loongson-overlay/releases/download/rust-2022-1-8/rust-1.56.1-loongarch64-unknown-linux-gnu.tar.xz

This pr patched cargo.eclass, to add a [patch] section to Cargo.toml, which belongs to the package that is been emerging.

    [dependencies]
    libc='0.2.102'
    [patch.crates-io]
    libc = { path = '/usr/lib/rust/lib/rustlib/src/loongarch/libc' }

rust-1.56.1 shipped liblibc-0.2.98 rust-1.57.0 shipped liblibc-0.2.102

Rust libc loongarch64 port is not upstream yet, so cargo should use libc source code shipped with local rust install.

libc/object source code were not installed by gentoo. this pr patched ebuilds to install them into : /usr/lib/rust/lib/rustlib/src/loongarch/{libc,object}

to use cargo command , add same [patch] section to package Cargo.toml, or edit ~/.cargo/config.toml to make it work globaly.