# Contributor: Marian Buschsieweke # Maintainer: Marian Buschsieweke pkgname=c2rust pkgver=0.20.0 pkgrel=0 pkgdesc="Transpile C99-compliant code to (unsafe) Rust code" url="https://github.com/immunant/c2rust" # riscv64, loongarch64: libc crate sup # s390x: missing big endian support in c2rust-bitfields-derive # ppc64le: tinycbor not packaged due to segfault in unit tests arch="all !riscv64 !s390x !ppc64le !loongarch64" license="BSD-3-Clause" # Note: LLVM's CMake hooks check for presence of static libs and tools and # failif they are missing. So they are needed for building even when linking # dynamically _llvmver=20 makedepends=" cargo cargo-auditable clang$_llvmver-dev clang$_llvmver-extra-tools clang$_llvmver-static cmake libxml2-dev llvm$_llvmver-dev llvm$_llvmver-gtest llvm$_llvmver-static ncurses-dev openssl-dev rust tinycbor-dev " checkdepends=" python3 py3-plumbum py3-psutil py3-toml " source=" $pkgname-$pkgver.tar.gz::https://github.com/immunant/c2rust/archive/refs/tags/v$pkgver.tar.gz 0001-link-clang-dynamic.patch 0002-use-system-tinycbor.patch 0003-fix-compilation-with-llvm20.patch " # Unit tests all fail using rust 1.86.0 with: # # error[E0554]: #![feature] may not be used on the stable release channel # # and # # error[E0635]: unknown feature `stdsimd` # # Eventually, unit tests should also run on stable rust options="!check" export CARGO_PROFILE_RELEASE_LTO="true" export CARGO_PROFILE_RELEASE_PANIC="abort" export CARGO_PROFILE_RELEASE_OPT_LEVEL="s" prepare() { default_prepare cargo fetch --target="$CTARGET" --locked } build() { export PATH="$PATH:/usr/lib/llvm$_llvmver/bin/" cargo auditable build --release --frozen --package c2rust } check() { ./scripts/test_translator.py tests } package() { mkdir -p "$pkgdir"/usr/bin "$pkgdir"/usr/lib for bin in c2rust c2rust-transpile; do install -D -m755 target/release/$bin -t "$pkgdir"/usr/bin/ done } sha512sums=" 96d045da1856fb0d2d8475763dde11886ed25713c56ee16aa43e07b6a830472d83297fb87ae5749d0b07085a0c3d1d877b0b467052f7330075fe065c76af34fc c2rust-0.20.0.tar.gz 423079102d0a350a2b2ba80e6f3f2c70f76db2d5d062d7308d217ea9a2608a521ae11b10b85733d12824284971a65af5fc598eedb29b4796f44ec689e5a553b1 0001-link-clang-dynamic.patch be29e0f4576301b64f5fc38684ddb90e469526be4ce8ef428feee0d5962748c428045dcb81635ff92e132daebb1fa1b338a81ce1ea13d02b802ec057d0653b93 0002-use-system-tinycbor.patch c4e7d0d837087b0adaa0ce740e101c9e0128590d2705020241495bca1e56ed1d551f75ccc4d73bfec4ed485ef06b2017c3e5060ee76f0079070fa41e10b1a72f 0003-fix-compilation-with-llvm20.patch "