From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Craven Subject: [PATCH 1/2] gnu: Add cargo. Date: Thu, 29 Dec 2016 16:34:52 +0100 Message-ID: <20161229153453.5698-1-david@craven.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMcjZ-0008RW-2G for guix-devel@gnu.org; Thu, 29 Dec 2016 10:35:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMcjU-0002Hb-6c for guix-devel@gnu.org; Thu, 29 Dec 2016 10:35:13 -0500 Received: from so254-10.mailgun.net ([198.61.254.10]:52046) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cMcjU-0002Dx-2S for guix-devel@gnu.org; Thu, 29 Dec 2016 10:35:08 -0500 List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org * gnu/packages/rust.scm (cargo): New variable. --- gnu/packages/rust.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 8aa867317..c6c4f3171 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -23,11 +23,15 @@ #:use-module (gnu packages bootstrap) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) + #:use-module (gnu packages curl) #:use-module (gnu packages elf) #:use-module (gnu packages gcc) #:use-module (gnu packages jemalloc) #:use-module (gnu packages llvm) + #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) + #:use-module (gnu packages ssh) + #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) @@ -265,3 +269,54 @@ safety and thread safety guarantees.") (home-page "https://www.rust-lang.org") ;; Dual licensed. (license (list license:asl2.0 license:expat)))) + +(define-public cargo + (package + (name "cargo") + (version (cargo-version (rustc-version %rust-bootstrap-binaries-version))) + (source (origin + (method url-fetch) + ;; Use a cargo tarball with vendored dependencies and a cargo + ;; config file. + (uri (string-append + "https://github.com/dvc94ch/cargo" + "/archive/" version "-cargo-vendor.tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0hpix5hwz10pm1wh65gimhsy9nxjvy7yikgbpw8afwglqr3bl856")))) + (build-system cargo-build-system) + (inputs + `(("cmake" ,cmake) + ("curl" ,curl) + ("libgit2" ,libgit2) + ("libssh2" ,libssh2) + ("openssl" ,openssl) + ("pkg-config" ,pkg-config) + ("python-2" ,python-2) + ("zlib" ,zlib))) + (arguments + `(#:cargo ,cargo-bootstrap + #:tests? #f ; FIXME + #:phases + (modify-phases %standard-phases + ;; Avoid cargo complaining about missmatched checksums. + (delete 'patch-source-shebangs) + (delete 'patch-generated-file-shebangs) + (delete 'patch-usr-bin-file) + ;; Set CARGO_HOME to use the vendored dependencies. + (add-after 'unpack 'set-cargo-home + (lambda* (#:key inputs #:allow-other-keys) + (let* ((gcc (assoc-ref inputs "gcc")) + (cc (string-append gcc "/bin/gcc"))) + (setenv "CARGO_HOME" (string-append (getcwd) "/cargohome")) + (setenv "CMAKE_C_COMPILER" cc) + (setenv "CC" cc)) + #t))))) + (home-page "https://github.com/rust-lang/cargo") + (synopsis "Build tool and package manager for Rust") + (description "Cargo downloads your Rust project’s dependencies and compiles +your project.") + ;; Cargo is dual licensed Apache and MIT. Also contains + ;; code from openssl which is GPL2 with linking exception. + (license (list license:asl2.0 license:expat license:gpl2+)))) -- 2.11.0