Skip to content

Commit 782d7a9

Browse files
authored
Merge pull request #7 from sailfishos/jb50499-cross
Allow rust to cross-compile under scratchbox
2 parents 79f4e5d + c381daa commit 782d7a9

8 files changed

+644
-48
lines changed

0001-Use-a-non-existent-test-path-instead-of-clobbering-d.patch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From e9491f4aa3b1c2c0f9b1fdc684e986ba035a5486 Mon Sep 17 00:00:00 2001
1+
From cbdcd1136ceb6e2e4defcea0796b3b520fc35443 Mon Sep 17 00:00:00 2001
22
From: Josh Stone <jistone@redhat.com>
33
Date: Fri, 1 May 2020 16:50:10 -0700
4-
Subject: [PATCH 1/3] Use a non-existent test path instead of clobbering
4+
Subject: [PATCH 1/4] Use a non-existent test path instead of clobbering
55
/dev/null
66

77
Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com>
@@ -53,6 +53,8 @@ index f732abc52b7..edadecf273a 100644
5353

5454
error: aborting due to previous error; 1 warning emitted
5555

56+
57+
base-commit: 49cae55760da0a43428eba73abcb659bb70cf2e4
5658
--
57-
2.26.2
59+
2.20.1
5860

0002-Set-proper-llvm-targets.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 60d68652869d79e75d30c45ae8a7575bc2da6019 Mon Sep 17 00:00:00 2001
1+
From 72aaa3d28daa1b187059ef148c45bd9f186b430d Mon Sep 17 00:00:00 2001
22
From: Matti Kosola <matti.kosola@jolla.com>
33
Date: Thu, 9 Jul 2020 11:22:10 +0000
4-
Subject: [PATCH 2/3] Set proper llvm targets.
4+
Subject: [PATCH 2/4] Set proper llvm targets.
55

66
Signed-off-by: Matti Kosola <matti.kosola@jolla.com>
77
---
@@ -22,5 +22,5 @@ index 9121d1e1799..7990f01ab42 100644
2222
# LLVM experimental targets to build support for. These targets are specified in
2323
# the same format as above, but since these targets are experimental, they are
2424
--
25-
2.26.2
25+
2.20.1
2626

0003-Disable-statx-for-all-builds.-JB-50106.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
From 191c6df3cfb0a3daae7ba40966ed22f8a63af453 Mon Sep 17 00:00:00 2001
1+
From f131514903bb02f5f9f1d312aea19e954ab1ffee Mon Sep 17 00:00:00 2001
22
From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= <tomi.leppanen@jolla.com>
33
Date: Fri, 26 Jun 2020 11:58:19 +0300
4-
Subject: [PATCH 3/3] Disable statx for all builds. JB#50106
4+
Subject: [PATCH 3/4] Disable statx for all builds. JB#50106
55
MIME-Version: 1.0
66
Content-Type: text/plain; charset=UTF-8
77
Content-Transfer-Encoding: 8bit
@@ -46,5 +46,5 @@ index a233aa47dff..45fb192fc8c 100644
4646

4747
cfg_has_statx! {{
4848
--
49-
2.26.2
49+
2.20.1
5050

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
From ee426fcbb8e03d1a7834c73225a65697b3dd4a1a Mon Sep 17 00:00:00 2001
2+
From: David Greaves <david.greaves@jolla.com>
3+
Date: Mon, 5 Oct 2020 10:14:39 +0100
4+
Subject: [PATCH 4/4] Scratchbox2 needs to be able to tell rustc the default
5+
target.
6+
7+
Currently this defaults to the target rust was built with. Rather than
8+
hardcode this for a cross-compiler, using an environment variable
9+
allows the same rustc binary to be used for all builds.
10+
11+
Signed-off-by: David Greaves <david.greaves@jolla.com>
12+
---
13+
src/librustc_session/config.rs | 9 ++++++++-
14+
1 file changed, 8 insertions(+), 1 deletion(-)
15+
16+
diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs
17+
index 2513cfa73e5..529d836dc82 100644
18+
--- a/src/librustc_session/config.rs
19+
+++ b/src/librustc_session/config.rs
20+
@@ -1363,7 +1363,14 @@ fn parse_target_triple(matches: &getopts::Matches, error_format: ErrorOutputType
21+
})
22+
}
23+
Some(target) => TargetTriple::TargetTriple(target),
24+
- _ => TargetTriple::from_triple(host_triple()),
25+
+ // In SFOS we use SB2 and need to tell rust what the
26+
+ // 'default' target is. If the SB2_RUST_TARGET_TRIPLE
27+
+ // environment variable is set then it is used. Otherwise
28+
+ // the fallback is the host_triple as usual
29+
+ _ => match std::env::var("SB2_RUST_TARGET_TRIPLE") {
30+
+ Ok(tgt) => TargetTriple::TargetTriple(tgt),
31+
+ Err(_) => TargetTriple::from_triple(host_triple()),
32+
+ }
33+
}
34+
}
35+
36+
--
37+
2.20.1
38+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From f58f4a0fb53df2b1b27c11986596c62de803afdf Mon Sep 17 00:00:00 2001
2+
From: David Greaves <david.greaves@jolla.com>
3+
Date: Mon, 30 Nov 2020 13:07:39 +0000
4+
Subject: [PATCH] Force the target when building for CompileKind::Host
5+
6+
Currently hardwired to be i686-unknown-linux-gnu
7+
8+
Signed-off-by: David Greaves <david.greaves@jolla.com>
9+
---
10+
src/tools/cargo/src/cargo/core/compiler/mod.rs | 3 +++
11+
1 file changed, 3 insertions(+)
12+
13+
diff --git a/src/tools/cargo/src/cargo/core/compiler/mod.rs b/src/tools/cargo/src/cargo/core/compiler/mod.rs
14+
index faee6e5..4af3f29 100644
15+
--- a/src/tools/cargo/src/cargo/core/compiler/mod.rs
16+
+++ b/src/tools/cargo/src/cargo/core/compiler/mod.rs
17+
@@ -912,6 +912,9 @@ fn build_base_args<'a, 'cfg>(
18+
19+
if let CompileKind::Target(n) = unit.kind {
20+
cmd.arg("--target").arg(n.rustc_target());
21+
+ } else {
22+
+ debug!("kind is {:?} - Forcing this to be 686", unit.kind);
23+
+ cmd.arg("--target").arg("i686-unknown-linux-gnu");
24+
}
25+
26+
opt(
27+
--
28+
2.20.1
29+

0 commit comments

Comments
 (0)