pkgname=(rustc rustc-libs-32bit) pkgbase=rustc pkgver=1.83.0 pkgrel=1 pkgdesc="Systems programming language focused on safety, speed and concurrency" arch=('x86_64') url="https://blog.rust-lang.org/" license=('Apache-2.0 OR MIT') depends=( 'bash' 'curl' 'gcc' 'gcc-libs' 'glibc' 'libssh2' 'llvm-libs' 'openssl' 'zlib' ) makedepends=( 'clang' 'cmake' 'gcc-libs-32bit' 'glibc-32bit' 'libffi' 'llvm' 'ninja' 'perl' 'python' 'sqlite' ) options=('!emptydirs' '!lto') source=(https://static.rust-lang.org/dist/${pkgbase}-${pkgver}-src.tar.xz) sha256sums=(7b11d4242dab0921a7d54758ad3fe805153c979c144625fecde11735760f97df) prepare() { cd ${pkgbase}-${pkgver}-src cat << EOF > config.toml # see config.toml.example for more possible options # See the 8.4 book for an old example using shipped LLVM # e.g. if not installing clang, or using a version before 13.0 # Tell x.py the editors have reviewed the content of this file # and updated it to follow the major changes of the building system, # so x.py will not warn us to do such a review. change-id = 131075 [llvm] # When using system llvm prefer shared libraries link-shared = true # Do not download pre-built LLVM, instead either use the system # LLVM or build LLVM from the shipped source. download-ci-llvm = false # If building the shipped LLVM source, only enable the x86 target # instead of all the targets supported by LLVM. # targets = "X86" [build] target = [ "x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu", ] # omit docs to save time and space (default is to build them) docs = false python = "python3" # install extended tools: cargo, clippy, etc extended = true # Do not query new versions of dependencies online. locked-deps = true # Specify which extended tools (those from the default install). tools = ["cargo", "clippy", "rustdoc", "rustfmt"] # Use the source code shipped in the tarball for the dependencies. # The combination of this and the "locked-deps" entry avoids downloading # many crates from Internet, and makes the Rustc build more stable. vendor = true [install] prefix = "/usr" libdir = "/usr/lib64" docdir = "share/doc/rustc-${pkgver}" [rust] channel = "stable" description = "Flarebird ${pkgname} ${pkgver}-${pkgrel}" # Enable the same optimizations as the official upstream build. lto = "thin" codegen-units = 1 [target.x86_64-unknown-linux-gnu] cc = "/usr/bin/gcc" cxx = "/usr/bin/g++" ar = "/usr/bin/gcc-ar" ranlib = "/usr/bin/gcc-ranlib" llvm-config = "/usr/bin/llvm-config" [target.i686-unknown-linux-gnu] cc = "/usr/bin/gcc" cxx = "/usr/bin/g++" ar = "/usr/bin/gcc-ar" ranlib = "/usr/bin/gcc-ranlib" llvm-config = "/usr/bin/llvm-config" EOF sed '/MirOpt/d' -i src/bootstrap/src/core/builder.rs } build() { cd ${pkgbase}-${pkgver}-src export RUST_BACKTRACE=1 export RUSTUP_DIST_SERVER="https://rsproxy.cn" export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" [ ! -e /usr/include/libssh2.h ] || export LIBSSH2_SYS_USE_PKG_CONFIG=1 [ ! -e /usr/include/sqlite3.h ] || export LIBSQLITE3_SYS_USE_PKG_CONFIG=1 python3 x.py build -j "$(nproc)" } package_rustc() { cd ${pkgbase}-${pkgver}-src DESTDIR=${pkgdir} python3 x.py install rustc std DESTDIR=${pkgdir} python3 x.py install --stage=1 cargo clippy rustfmt rm -fv /usr/share/doc/${pkgname}-${pkgver}/*.old install -vm644 README.md ${pkgdir}/usr/share/doc/${pkgname}-${pkgver} install -vdm755 ${pkgdir}/usr/share/zsh/site-functions ln -sfv /usr/share/zsh/site-functions/_cargo ${pkgdir}/usr/share/zsh/site-functions install -vdm755 ${pkgdir}/usr/share/bash-completion/completions mv -v ${pkgdir}/etc/bash_completion.d/cargo ${pkgdir}/usr/share/bash-completion/completions unset LIB{SSH2,SQLITE3}_SYS_USE_PKG_CONFIG # delete unnecessary files, e.g. files only used for the uninstall script rm -v ${pkgdir}/usr/lib64/rustlib/{components,install.log,rust-installer-version,uninstall.sh} rm -v ${pkgdir}/usr/lib64/rustlib/manifest-* _pick dest-i686 ${pkgdir}/usr/lib64/rustlib/i686-unknown-linux-gnu } package_rustc-libs-32bit() { pkgdesc="32-bit target and libraries for Rust" depends=('gcc-libs-32bit' 'glibc-32bit' 'rustc') cp -a dest-i686/* ${pkgdir} }