gnu: rust: Add support for building 32-bit packages on 64-bit hosts.
* gnu/packages/rust.scm (rust-bootstrap, rust-1.23): Use nix-system->gnu-triplet to determine the system type. (rust-1.19): Use readelf instead of nm in the atomic-lock-free test. (rust-1.23): Disable the cargo_test_env test. Disable parallel execution of tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
		
							parent
							
								
									a078a6ec3b
								
							
						
					
					
						commit
						514026d7de
					
				
					 1 changed files with 38 additions and 24 deletions
				
			
		| 
						 | 
					@ -63,32 +63,34 @@
 | 
				
			||||||
  (package
 | 
					  (package
 | 
				
			||||||
    (name "rust-bootstrap")
 | 
					    (name "rust-bootstrap")
 | 
				
			||||||
    (version "1.22.1")
 | 
					    (version "1.22.1")
 | 
				
			||||||
    (source (origin
 | 
					    (source #f)
 | 
				
			||||||
              (method url-fetch)
 | 
					 | 
				
			||||||
              (uri (string-append
 | 
					 | 
				
			||||||
                    "https://static.rust-lang.org/dist/"
 | 
					 | 
				
			||||||
                    "rust-" version "-" %host-type ".tar.gz"))
 | 
					 | 
				
			||||||
              (sha256
 | 
					 | 
				
			||||||
               (base32
 | 
					 | 
				
			||||||
                (match %host-type
 | 
					 | 
				
			||||||
                  ("i686-unknown-linux-gnu"
 | 
					 | 
				
			||||||
                   "15zqbx86nm13d5vq2gm69b7av4vg479f74b5by64hs3bcwwm08pr")
 | 
					 | 
				
			||||||
                  ("x86_64-unknown-linux-gnu"
 | 
					 | 
				
			||||||
                   "1yll78x6b3abnvgjf2b66gvp6mmcb9y9jdiqcwhmgc0z0i0fix4c")
 | 
					 | 
				
			||||||
                  ("armv7-unknown-linux-gnueabihf"
 | 
					 | 
				
			||||||
                   "138a8l528kzp5wyk1mgjaxs304ac5ms8vlpq0ggjaznm6bn2j7a5")
 | 
					 | 
				
			||||||
                  ("aarch64-unknown-linux-gnu"
 | 
					 | 
				
			||||||
                   "0z6m9m1rx4d96nvybbfmpscq4dv616m615ijy16d5wh2vx0p4na8")
 | 
					 | 
				
			||||||
                  ("mips64el-unknown-linux-gnuabi64"
 | 
					 | 
				
			||||||
                   "07k4pcv7jvfa48cscdj8752lby7m7xdl88v3a6na1vs675lhgja2")
 | 
					 | 
				
			||||||
                  (_ ""))))))
 | 
					 | 
				
			||||||
    (build-system gnu-build-system)
 | 
					    (build-system gnu-build-system)
 | 
				
			||||||
    (native-inputs
 | 
					    (native-inputs
 | 
				
			||||||
     `(("patchelf" ,patchelf)))
 | 
					     `(("patchelf" ,patchelf)))
 | 
				
			||||||
    (inputs
 | 
					    (inputs
 | 
				
			||||||
     `(("gcc" ,(canonical-package gcc))
 | 
					     `(("gcc" ,(canonical-package gcc))
 | 
				
			||||||
       ("gcc:lib" ,(canonical-package gcc) "lib")
 | 
					       ("gcc:lib" ,(canonical-package gcc) "lib")
 | 
				
			||||||
       ("zlib" ,zlib)))
 | 
					       ("zlib" ,zlib)
 | 
				
			||||||
 | 
					       ("source"
 | 
				
			||||||
 | 
					        ,(origin
 | 
				
			||||||
 | 
					           (method url-fetch)
 | 
				
			||||||
 | 
					           (uri (string-append
 | 
				
			||||||
 | 
					                 "https://static.rust-lang.org/dist/"
 | 
				
			||||||
 | 
					                 "rust-" version "-" (nix-system->gnu-triplet) ".tar.gz"))
 | 
				
			||||||
 | 
					           (sha256
 | 
				
			||||||
 | 
					            (base32
 | 
				
			||||||
 | 
					             (match (nix-system->gnu-triplet)
 | 
				
			||||||
 | 
					               ("i686-unknown-linux-gnu"
 | 
				
			||||||
 | 
					                "15zqbx86nm13d5vq2gm69b7av4vg479f74b5by64hs3bcwwm08pr")
 | 
				
			||||||
 | 
					               ("x86_64-unknown-linux-gnu"
 | 
				
			||||||
 | 
					                "1yll78x6b3abnvgjf2b66gvp6mmcb9y9jdiqcwhmgc0z0i0fix4c")
 | 
				
			||||||
 | 
					               ("armv7-unknown-linux-gnueabihf"
 | 
				
			||||||
 | 
					                "138a8l528kzp5wyk1mgjaxs304ac5ms8vlpq0ggjaznm6bn2j7a5")
 | 
				
			||||||
 | 
					               ("aarch64-unknown-linux-gnu"
 | 
				
			||||||
 | 
					                "0z6m9m1rx4d96nvybbfmpscq4dv616m615ijy16d5wh2vx0p4na8")
 | 
				
			||||||
 | 
					               ("mips64el-unknown-linux-gnuabi64"
 | 
				
			||||||
 | 
					                "07k4pcv7jvfa48cscdj8752lby7m7xdl88v3a6na1vs675lhgja2")
 | 
				
			||||||
 | 
					               (_ ""))))))))
 | 
				
			||||||
    (outputs '("out" "cargo"))
 | 
					    (outputs '("out" "cargo"))
 | 
				
			||||||
    (arguments
 | 
					    (arguments
 | 
				
			||||||
     `(#:tests? #f
 | 
					     `(#:tests? #f
 | 
				
			||||||
| 
						 | 
					@ -117,7 +119,7 @@
 | 
				
			||||||
               (invoke "bash" "install.sh"
 | 
					               (invoke "bash" "install.sh"
 | 
				
			||||||
                        (string-append "--prefix=" out)
 | 
					                        (string-append "--prefix=" out)
 | 
				
			||||||
                        (string-append "--components=rustc,"
 | 
					                        (string-append "--components=rustc,"
 | 
				
			||||||
                                       "rust-std-" %host-type))
 | 
					                                       "rust-std-" ,(nix-system->gnu-triplet)))
 | 
				
			||||||
               ;; Instal cargo
 | 
					               ;; Instal cargo
 | 
				
			||||||
               (invoke "bash" "install.sh"
 | 
					               (invoke "bash" "install.sh"
 | 
				
			||||||
                        (string-append "--prefix=" cargo-out)
 | 
					                        (string-append "--prefix=" cargo-out)
 | 
				
			||||||
| 
						 | 
					@ -196,6 +198,12 @@ in turn be used to build the final Rust.")
 | 
				
			||||||
                 ;; This test is known to fail on aarch64 and powerpc64le:
 | 
					                 ;; This test is known to fail on aarch64 and powerpc64le:
 | 
				
			||||||
                 ;; https://github.com/rust-lang/rust/issues/45410
 | 
					                 ;; https://github.com/rust-lang/rust/issues/45410
 | 
				
			||||||
                 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
 | 
					                 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
 | 
				
			||||||
 | 
					               ;; nm doesn't recognize the file format because of the
 | 
				
			||||||
 | 
					               ;; nonstandard sections used by the Rust compiler, but readelf
 | 
				
			||||||
 | 
					               ;; ignores them.
 | 
				
			||||||
 | 
					               (substitute* "src/test/run-make/atomic-lock-free/Makefile"
 | 
				
			||||||
 | 
					                 (("\tnm ")
 | 
				
			||||||
 | 
					                  "\treadelf -c "))
 | 
				
			||||||
               #t)))
 | 
					               #t)))
 | 
				
			||||||
         (add-after 'patch-source-shebangs 'patch-cargo-checksums
 | 
					         (add-after 'patch-source-shebangs 'patch-cargo-checksums
 | 
				
			||||||
           (lambda* _
 | 
					           (lambda* _
 | 
				
			||||||
| 
						 | 
					@ -386,6 +394,10 @@ safety and thread safety guarantees.")
 | 
				
			||||||
               (substitute* "src/tools/cargo/tests/death.rs"
 | 
					               (substitute* "src/tools/cargo/tests/death.rs"
 | 
				
			||||||
                ;; This is stuck when built in container.
 | 
					                ;; This is stuck when built in container.
 | 
				
			||||||
                (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
 | 
					                (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
 | 
				
			||||||
 | 
					               ;; Prints test output in the wrong order when built on
 | 
				
			||||||
 | 
					               ;; i686-linux.
 | 
				
			||||||
 | 
					               (substitute* "src/tools/cargo/tests/test.rs"
 | 
				
			||||||
 | 
					                 (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
 | 
				
			||||||
               #t))
 | 
					               #t))
 | 
				
			||||||
           (add-after 'patch-cargo-tests 'fix-mtime-bug
 | 
					           (add-after 'patch-cargo-tests 'fix-mtime-bug
 | 
				
			||||||
             (lambda* _
 | 
					             (lambda* _
 | 
				
			||||||
| 
						 | 
					@ -433,7 +445,7 @@ rpath = true
 | 
				
			||||||
# codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
 | 
					# codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
 | 
				
			||||||
# This tests required patched LLVM
 | 
					# This tests required patched LLVM
 | 
				
			||||||
codegen-tests = false
 | 
					codegen-tests = false
 | 
				
			||||||
[target." %host-type "]
 | 
					[target." ,(nix-system->gnu-triplet) "]
 | 
				
			||||||
llvm-config = \"" llvm "/bin/llvm-config" "\"
 | 
					llvm-config = \"" llvm "/bin/llvm-config" "\"
 | 
				
			||||||
cc = \"" gcc "/bin/gcc" "\"
 | 
					cc = \"" gcc "/bin/gcc" "\"
 | 
				
			||||||
cxx = \"" gcc "/bin/g++" "\"
 | 
					cxx = \"" gcc "/bin/g++" "\"
 | 
				
			||||||
| 
						 | 
					@ -456,8 +468,10 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
 | 
				
			||||||
             (invoke "./x.py" "build" "src/tools/cargo")))
 | 
					             (invoke "./x.py" "build" "src/tools/cargo")))
 | 
				
			||||||
         (replace 'check
 | 
					         (replace 'check
 | 
				
			||||||
           (lambda* _
 | 
					           (lambda* _
 | 
				
			||||||
             (invoke "./x.py" "test")
 | 
					             ;; Disable parallel execution to prevent EAGAIN errors when
 | 
				
			||||||
             (invoke "./x.py" "test" "src/tools/cargo")))
 | 
					             ;; running tests.
 | 
				
			||||||
 | 
					             (invoke "./x.py" "-j1" "test")
 | 
				
			||||||
 | 
					             (invoke "./x.py" "-j1" "test" "src/tools/cargo")))
 | 
				
			||||||
         (replace 'install
 | 
					         (replace 'install
 | 
				
			||||||
           (lambda* (#:key outputs #:allow-other-keys)
 | 
					           (lambda* (#:key outputs #:allow-other-keys)
 | 
				
			||||||
             (invoke "./x.py" "install")
 | 
					             (invoke "./x.py" "install")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue