diff options
| author | Danny Milosavljevic <dannym@friendly-machines.com> | 2024-12-21 20:01:20 +0100 |
|---|---|---|
| committer | Danny Milosavljevic <dannym@friendly-machines.com> | 2024-12-21 20:22:52 +0100 |
| commit | 63041aacbb3e557dc35a2a4181ddd510acace5ec (patch) | |
| tree | 93f7bd10391e68ba40d478aa88adbee8b20985cd /gnu/packages/c2rust.scm | |
| parent | 91af94dc9d628a7b62bce62f8a0da6d3234a91dd (diff) | |
gnu: Add c2rust.
* gnu/packages/c2rust.scm (c2rust): New variable.
* gnu/packages/patches/c2rust-ast-exporter-local-search.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add reference to it.
Change-Id: I9a80c6071a48ab5baed0a83e1c2463f83a6c6b9b
Diffstat (limited to 'gnu/packages/c2rust.scm')
| -rw-r--r-- | gnu/packages/c2rust.scm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gnu/packages/c2rust.scm b/gnu/packages/c2rust.scm index 8e913414bb6..a4ba8217deb 100644 --- a/gnu/packages/c2rust.scm +++ b/gnu/packages/c2rust.scm | |||
| @@ -249,3 +249,51 @@ | |||
| 249 | (synopsis "C2Rust transpiler implementation") | 249 | (synopsis "C2Rust transpiler implementation") |
| 250 | (description "This package provides C2Rust transpiler implementation.") | 250 | (description "This package provides C2Rust transpiler implementation.") |
| 251 | (license license:bsd-3))) | 251 | (license license:bsd-3))) |
| 252 | |||
| 253 | (define-public c2rust | ||
| 254 | (package | ||
| 255 | (name "c2rust") | ||
| 256 | (version "0.18.0") | ||
| 257 | (source | ||
| 258 | (origin | ||
| 259 | (method url-fetch) | ||
| 260 | (uri (crate-uri "c2rust" version)) | ||
| 261 | (file-name (string-append name "-" version ".tar.gz")) | ||
| 262 | (sha256 | ||
| 263 | (base32 "1rg9cvvmh9zw89mz2bpyvqlwbfhzl5dw2hab9z6d5rasr8mir7nh")))) | ||
| 264 | (build-system cargo-build-system) | ||
| 265 | (native-inputs | ||
| 266 | `(("tinycbor-src" ,%tinycbor-source) | ||
| 267 | ("cmake" ,cmake) | ||
| 268 | ("clang" ,clang))) | ||
| 269 | (inputs (list llvm)) | ||
| 270 | (arguments | ||
| 271 | `(#:cargo-inputs (("rust-anyhow" ,rust-anyhow-1) | ||
| 272 | ("rust-c2rust-build-paths" ,rust-c2rust-build-paths-0.18) | ||
| 273 | ("rust-c2rust-transpile" ,rust-c2rust-transpile-0.18) | ||
| 274 | ("rust-clap" ,rust-clap-3) | ||
| 275 | ("rust-env-logger" ,rust-env-logger-0.10) | ||
| 276 | ("rust-git-testament" ,rust-git-testament-0.2) | ||
| 277 | ("rust-is-executable" ,rust-is-executable-1) | ||
| 278 | ("rust-log" ,rust-log-0.4) | ||
| 279 | ("rust-regex" ,rust-regex-1) | ||
| 280 | ("rust-shlex" ,rust-shlex-1) | ||
| 281 | ("rust-time-macros" ,rust-time-macros-0.2)) | ||
| 282 | #:phases | ||
| 283 | (modify-phases %standard-phases | ||
| 284 | (add-after 'unpack 'patch-deps | ||
| 285 | (lambda _ | ||
| 286 | ;; This is incorrect in the release to begin with. | ||
| 287 | (substitute* "Cargo.toml" | ||
| 288 | (("=0.2.6") "=0.2.18")))) | ||
| 289 | (add-before 'build 'patch | ||
| 290 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 291 | ;; The build process will slightly patch the sources. | ||
| 292 | (copy-recursively (assoc-ref inputs "tinycbor-src") | ||
| 293 | "/tmp/tinycbor") | ||
| 294 | (setenv "CMAKE_TINYCBOR_SOURCE_DIR" "/tmp/tinycbor")))))) | ||
| 295 | (home-page "https://c2rust.com/") | ||
| 296 | (synopsis "C to Rust translation, refactoring, and cross-checking") | ||
| 297 | (description | ||
| 298 | "This package provides C to Rust translation, refactoring, and cross-checking.") | ||
| 299 | (license license:bsd-3))) | ||
