mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: Add maturin.
* gnu/packages/rust-apps.scm (maturin): New variable. * gnu/packages/patches/maturin-no-cross-compile.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it.
This commit is contained in:
parent
3cb37724ff
commit
c08da95dae
3 changed files with 221 additions and 0 deletions
|
@ -41,6 +41,7 @@
|
|||
|
||||
(define-module (gnu packages rust-apps)
|
||||
#:use-module (guix build-system cargo)
|
||||
#:use-module (guix build-system pyproject)
|
||||
#:use-module (guix deprecation)
|
||||
#:use-module (guix download)
|
||||
#:use-module (guix gexp)
|
||||
|
@ -74,6 +75,8 @@
|
|||
#:use-module (gnu packages perl)
|
||||
#:use-module (gnu packages pkg-config)
|
||||
#:use-module (gnu packages pulseaudio)
|
||||
#:use-module (gnu packages python)
|
||||
#:use-module (gnu packages python-build)
|
||||
#:use-module (gnu packages python-xyz)
|
||||
#:use-module (gnu packages rust)
|
||||
#:use-module (gnu packages tls)
|
||||
|
@ -734,6 +737,168 @@ replacement for i3status, written in pure Rust. It provides a way to display
|
|||
bar. It is also compatible with sway.")
|
||||
(license license:gpl3)))
|
||||
|
||||
(define-public maturin
|
||||
(package
|
||||
(name "maturin")
|
||||
(version "1.1.0")
|
||||
(source (origin
|
||||
(method url-fetch)
|
||||
(uri (crate-uri "maturin" version))
|
||||
(file-name (string-append name "-" version ".tar.gz"))
|
||||
(sha256
|
||||
(base32
|
||||
"0asdljd396kdsvnx9kbsr5s0x6w73b59kdpx732333dhm13qgn03"))
|
||||
(patches (search-patches "maturin-no-cross-compile.patch"))))
|
||||
(build-system cargo-build-system)
|
||||
(arguments
|
||||
`(#:modules ((guix build cargo-build-system)
|
||||
((guix build pyproject-build-system) #:prefix py:)
|
||||
(guix build utils))
|
||||
#:imported-modules ((guix build cargo-build-system)
|
||||
(guix build cargo-utils)
|
||||
,@%pyproject-build-system-modules)
|
||||
#:install-source? #f
|
||||
#:cargo-test-flags
|
||||
'("--release" "--"
|
||||
;; Not all files are included.
|
||||
"--skip=build_options::test::test_find_bridge_bin"
|
||||
"--skip=build_options::test::test_find_bridge_cffi"
|
||||
"--skip=build_options::test::test_find_bridge_pyo3"
|
||||
"--skip=build_options::test::test_find_bridge_pyo3_abi3"
|
||||
"--skip=build_options::test::test_find_bridge_pyo3_feature"
|
||||
"--skip=metadata::test::test_implicit_readme"
|
||||
"--skip=metadata::test::test_merge_metadata_from_pyproject_dynamic_license_test"
|
||||
"--skip=metadata::test::test_merge_metadata_from_pyproject_toml"
|
||||
"--skip=metadata::test::test_merge_metadata_from_pyproject_toml_with_customized_python_source_dir"
|
||||
"--skip=pyproject_toml::tests::test_warn_missing_maturin_version")
|
||||
#:cargo-inputs
|
||||
(("rust-anyhow" ,rust-anyhow-1)
|
||||
("rust-base64" ,rust-base64-0.21)
|
||||
("rust-bytesize" ,rust-bytesize-1)
|
||||
("rust-cargo-config2" ,rust-cargo-config2-0.1)
|
||||
("rust-cargo-options" ,rust-cargo-options-0.6)
|
||||
;("rust-cargo-xwin" ,rust-cargo-xwin-0.14)
|
||||
;("rust-cargo-zigbuild" ,rust-cargo-zigbuild-0.16)
|
||||
("rust-cargo-metadata" ,rust-cargo-metadata-0.15)
|
||||
("rust-cbindgen" ,rust-cbindgen-0.24)
|
||||
("rust-cc" ,rust-cc-1)
|
||||
("rust-clap" ,rust-clap-4)
|
||||
("rust-clap-complete-command" ,rust-clap-complete-command-0.5)
|
||||
("rust-configparser" ,rust-configparser-3)
|
||||
("rust-console" ,rust-console-0.15)
|
||||
("rust-dialoguer" ,rust-dialoguer-0.10)
|
||||
("rust-dirs" ,rust-dirs-5)
|
||||
("rust-dunce" ,rust-dunce-1)
|
||||
("rust-fat-macho" ,rust-fat-macho-0.4)
|
||||
("rust-flate2" ,rust-flate2-1)
|
||||
("rust-fs-err" ,rust-fs-err-2)
|
||||
("rust-glob" ,rust-glob-0.3)
|
||||
("rust-goblin" ,rust-goblin-0.6)
|
||||
("rust-ignore" ,rust-ignore-0.4)
|
||||
("rust-indexmap" ,rust-indexmap-1)
|
||||
("rust-itertools" ,rust-itertools-0.10)
|
||||
("rust-keyring" ,rust-keyring-2)
|
||||
("rust-lddtree" ,rust-lddtree-0.3)
|
||||
("rust-minijinja" ,rust-minijinja-0.34)
|
||||
("rust-multipart" ,rust-multipart-0.18)
|
||||
("rust-native-tls" ,rust-native-tls-0.2)
|
||||
("rust-normpath" ,rust-normpath-1)
|
||||
("rust-once-cell" ,rust-once-cell-1)
|
||||
("rust-pep440-rs" ,rust-pep440-rs-0.3)
|
||||
("rust-pep508-rs" ,rust-pep508-rs-0.2)
|
||||
("rust-platform-info" ,rust-platform-info-2)
|
||||
("rust-pyproject-toml" ,rust-pyproject-toml-0.6)
|
||||
("rust-python-pkginfo" ,rust-python-pkginfo-0.5)
|
||||
("rust-regex" ,rust-regex-1)
|
||||
("rust-rustc-version" ,rust-rustc-version-0.4)
|
||||
("rust-rustls" ,rust-rustls-0.20)
|
||||
("rust-rustls-pemfile" ,rust-rustls-pemfile-1)
|
||||
("rust-same-file" ,rust-same-file-1)
|
||||
("rust-semver" ,rust-semver-1)
|
||||
("rust-serde" ,rust-serde-1)
|
||||
("rust-serde-json" ,rust-serde-json-1)
|
||||
("rust-sha2" ,rust-sha2-0.10)
|
||||
("rust-tar" ,rust-tar-0.4)
|
||||
("rust-target-lexicon" ,rust-target-lexicon-0.12)
|
||||
("rust-tempfile" ,rust-tempfile-3)
|
||||
("rust-textwrap" ,rust-textwrap-0.16)
|
||||
("rust-thiserror" ,rust-thiserror-1)
|
||||
("rust-time" ,rust-time-0.3)
|
||||
("rust-toml" ,rust-toml-0.7)
|
||||
("rust-toml-edit" ,rust-toml-edit-0.19)
|
||||
("rust-tracing" ,rust-tracing-0.1)
|
||||
("rust-tracing-subscriber" ,rust-tracing-subscriber-0.3)
|
||||
("rust-ureq" ,rust-ureq-2)
|
||||
("rust-url" ,rust-url-2)
|
||||
("rust-wild" ,rust-wild-2)
|
||||
("rust-zip" ,rust-zip-0.6))
|
||||
#:cargo-development-inputs
|
||||
(("rust-indoc" ,rust-indoc-2)
|
||||
("rust-pretty-assertions" ,rust-pretty-assertions-1)
|
||||
("rust-rustversion" ,rust-rustversion-1)
|
||||
("rust-time" ,rust-time-0.3)
|
||||
("rust-trycmd" ,rust-trycmd-0.14)
|
||||
("rust-which" ,rust-which-4))
|
||||
#:phases
|
||||
(modify-phases %standard-phases
|
||||
(add-after 'build 'build-python-module
|
||||
(lambda _
|
||||
;; Match the features from the cargo-build-system and Cargo.toml.
|
||||
(setenv "MATURIN_SETUP_ARGS" "--features=default")
|
||||
((assoc-ref py:%standard-phases 'build))))
|
||||
|
||||
;; We can't use the pyproject install phase because maturin is a
|
||||
;; binary, not a python script.
|
||||
(add-after 'install 'install-python-module
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(let ((out (assoc-ref outputs "out"))
|
||||
(wheel (car (find-files "dist" "\\.whl$")))
|
||||
(site-dir (py:site-packages inputs outputs))
|
||||
(pyversion
|
||||
(string-append "python"
|
||||
(py:python-version
|
||||
(assoc-ref inputs "python-wrapper")))))
|
||||
(invoke "python" "-m" "zipfile" "-e" wheel site-dir)
|
||||
(mkdir-p (string-append out "/bin"))
|
||||
(for-each delete-file
|
||||
(find-files (string-append out "/lib/" pyversion)
|
||||
"^maturin$")))))
|
||||
(add-after 'install 'install-completions
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(let* ((out (assoc-ref outputs "out"))
|
||||
(share (string-append out "/share"))
|
||||
(maturin (string-append out "/bin/maturin")))
|
||||
;; TODO? fig, nushell, powershell
|
||||
(mkdir-p (string-append share "/bash-completion/completions"))
|
||||
(with-output-to-file
|
||||
(string-append share "/bash-completion/completions/maturin")
|
||||
(lambda _ (invoke maturin "completions" "bash")))
|
||||
(mkdir-p (string-append share "/fish/vendor_completions.d"))
|
||||
(with-output-to-file
|
||||
(string-append share "/fish/vendor_completions.d/maturin.fish")
|
||||
(lambda _ (invoke maturin "completions" "fish")))
|
||||
(mkdir-p (string-append share "/zsh/site-functions"))
|
||||
(with-output-to-file
|
||||
(string-append share "/zsh/site-functions/_maturin")
|
||||
(lambda _ (invoke maturin "completions" "zsh")))
|
||||
(mkdir-p (string-append share "/elvish/lib"))
|
||||
(with-output-to-file
|
||||
(string-append share "/elvish/lib/maturin")
|
||||
(lambda _ (invoke maturin "completions" "elvish")))))))))
|
||||
(propagated-inputs
|
||||
(list python-tomli))
|
||||
(native-inputs
|
||||
(list perl
|
||||
python-wheel
|
||||
python-wrapper
|
||||
python-setuptools-rust))
|
||||
(home-page "https://github.com/pyo3/maturin")
|
||||
(synopsis "Build and publish crates and python packages")
|
||||
(description
|
||||
"Build and publish crates with @code{pyo3}, @code{rust-cpython} and
|
||||
@code{cffi} bindings as well as rust binaries as python packages.")
|
||||
(license (list license:expat license:asl2.0))))
|
||||
|
||||
(define-public ripgrep
|
||||
(package
|
||||
(name "ripgrep")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue