]> git.proxmox.com Git - dh-cargo.git/commitdiff
If there was a custom build output, symlink it to cargo_out_dir
authorXimin Luo <infinity0@debian.org>
Sat, 4 Aug 2018 19:55:57 +0000 (12:55 -0700)
committerXimin Luo <infinity0@debian.org>
Sat, 4 Aug 2018 19:55:57 +0000 (12:55 -0700)
cargo.pm
debian/changelog

index b98733687f0cd062c5ceb9e6deec436cc65ccb4a..e67bf9d52ad5ebb581d01dd003aa960737def2cd 100644 (file)
--- a/cargo.pm
+++ b/cargo.pm
@@ -58,6 +58,7 @@ sub pre_building_step {
 
     $this->{cargo_home} = Cwd::abs_path($this->get_sourcepath("debian/cargo_home"));
     $this->{cargo_registry} = Cwd::abs_path($this->get_sourcepath("debian/cargo_registry"));
+    $this->{host_rust_type} = deb_host_rust_type;
 
     my $control = Dpkg::Control::Info->new();
 
@@ -165,7 +166,7 @@ sub test {
     # requires non-rust system dependencies and the maintainer didn't provide
     # this additional information to debcargo.
     doit("cargo", "build", "--verbose", "--verbose", @{$this->{j}},
-        "--target", deb_host_rust_type,
+        "--target", $this->{host_rust_type},
         "-Zavoid-dev-deps");
 }
 
@@ -194,11 +195,16 @@ sub install {
         # normally `cargo install` deletes them when it exits
         $ENV{'CARGO_TARGET_DIR'} = Cwd::abs_path($this->get_sourcepath("target"));
         doit("cargo", "install", "--verbose", "--verbose", @{$this->{j}},
-            "--target", deb_host_rust_type,
+            "--target", $this->{host_rust_type},
             $this->{crate},
             "--vers", cargo_version($this->get_sourcepath("Cargo.toml")),
             "--root", $target);
         doit("rm", "$target/.crates.toml");
+        # if there was a custom build output, symlink it to debian/cargo_out_dir
+        # hopefully cargo will provide a better solution in future https://github.com/rust-lang/cargo/issues/5457
+        my $out_dir = `ls -td "target/$this->{host_rust_type}/release/build/$this->{crate}"-*/out | head -n1`;
+        $out_dir =~ s/\n$//;
+        doit("ln", "-sf", "../$out_dir", "debian/cargo_out_dir") if $out_dir ne "";
     }
 }
 
index 1ebd1d49fbb55ae77f196ef38bcad0c517dd2876..c9e75114f424b08181dcb77059814ff2187a1d0c 100644 (file)
@@ -3,6 +3,7 @@ dh-cargo (7) UNRELEASED; urgency=medium
   * Be more verbose, as recommended by Policy.
   * Update to latest Standards-Version.
   * Set CARGO_TARGET_DIR so build products are saved.
+  * If there was a custom build output, symlink it to cargo_out_dir.
 
  -- Ximin Luo <infinity0@debian.org>  Sat, 04 Aug 2018 11:33:36 -0700