Skip to contentSkip to conversation

Merge meta-rust to oe-core

PATCH New Randy MacLeod 2 participants 13 messages Feb 24, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Clean-up the merge of meta-rust to oe-core by squashing most of the meta-rust history so we are left with:

35da4b252f rust: add a language demo image to test reproducibility 088374371b cargo/rust/rustfmt: exclude from world 7df10d2a22 meta-rust: merge commits
4187796cd6 rust: mv README.md to recipes-devtools/rust/README-rust.md 03b9c60ef4 meta-rust: move code to oe-core from meta-rust layer 2c62874204 libgit2: pull in updates from meta-oe 24cb3db88c libssh2: pull in additional commits from meta-oe e9a0a3bad2 Add libgit2, libssh2 from meta-oe for rust

The full diffstat is below. (1)

I didn't really notice the scripts shown below since they are mostly harmless. I'll review them and remove them in v2 if they don't make sense for oe-core.

----------
BUILDALL-QEMU LOG FOR rust-hello-world
START TIME: 2021-02-23_16:39:26
HOSTNAME: ala-lpggp3
HOST OS: Ubuntu 18.04.3 LTS
HOST KERNEL: 5.4.0-62-generic
===============
BUILD RESULTS:
[glibc]
PASS: qemuarmv5
PASS: qemumips
PASS: qemux86-64
PASS: qemuarm64
PASS: qemumips64
PASS: qemuarm
PASS: qemuppc
PASS: qemuriscv64
PASS: qemux86
[musl]
PASS: qemuarmv5
PASS: qemumips
PASS: qemux86-64
PASS: qemuarm64
PASS: qemumips64
PASS: qemuarm
FAIL: qemuppc
FAIL: qemuriscv64
PASS: qemux86
===============
PASSED: 16
FAILED: 2
----------

Khem is aware of the musl/riscv64 issue and hopes to have a fix for the next release of rustc. I haven't looked into the musl/ppc problem yet. World build is clean.

The SDK changes aren't included since they haven't been merged to meta-rust.
The SDK works for older releases but there is a problem with libcrypto and glibc-2.33:
ldd sysroots/x86_64-oesdk-linux/usr/bin/../lib/libcrypto.so.1.1
sysroots/x86_64-oesdk-linux/usr/bin/../lib/libcrypto.so.1.1: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by sysroots/x86_64-oesdk-linux/usr/bin/../lib/libcrypto.so.1.1)

I have a reproducible build test somewhere but it's not tested recently so I'll send that later.

I'll create a rust version of meta/lib/oeqa/selftest/cases/gotoolchain.py but for the local rust-hello-world recipe so it should be simpler.

../Randy

1)

 meta/classes/cargo.bbclass                                              |   77 +
 meta/classes/cargo_common.bbclass                                       |  121 ++
 meta/classes/crate-fetch.bbclass                                        |   13 
 meta/classes/rust-bin.bbclass                                           |  149 ++
 meta/classes/rust-common.bbclass                                        |  167 +++
 meta/classes/rust.bbclass                                               |   45 
 meta/conf/distro/include/rust_security_flags.inc                        |    7 
 meta/conf/distro/include/rust_versions.inc                              |   13 
 meta/conf/layer.conf                                                    |    2 
 meta/lib/crate.py                                                       |  149 ++
 meta/recipes-devtools/cargo/cargo-1.47.0/0001-Disable-http2.patch       |   31 
 meta/recipes-devtools/cargo/cargo-1.49.0/0001-Disable-http2.patch       |   31 
 meta/recipes-devtools/cargo/cargo.inc                                   |   52 
 meta/recipes-devtools/cargo/cargo_1.47.0.bb                             |    3 
 meta/recipes-devtools/cargo/cargo_1.49.0.bb                             |    3 
 meta/recipes-devtools/images/core-image-languages.bb                    |   12 
 meta/recipes-devtools/rust/README-rust.md                               |   69 +
 meta/recipes-devtools/rust/libstd-rs.inc                                |   40 
 meta/recipes-devtools/rust/libstd-rs_1.47.0.bb                          |    5 
 meta/recipes-devtools/rust/libstd-rs_1.49.0.bb                          |    5 
 meta/recipes-devtools/rust/rust-cross.inc                               |   71 +
 meta/recipes-devtools/rust/rust-cross_1.47.0.bb                         |    2 
 meta/recipes-devtools/rust/rust-cross_1.49.0.bb                         |    2 
 meta/recipes-devtools/rust/rust-llvm.inc                                |   64 +
 s-devtools/rust/rust-llvm/0002-llvm-allow-env-override-of-exe-path.patch|   32 
 meta/recipes-devtools/rust/rust-llvm_1.47.0.bb                          |    2 
 meta/recipes-devtools/rust/rust-llvm_1.49.0.bb                          |    2 
 meta/recipes-devtools/rust/rust-snapshot-1.47.0.inc                     |   13 
 meta/recipes-devtools/rust/rust-snapshot-1.49.0.inc                     |   13 
 meta/recipes-devtools/rust/rust-snapshot.inc                            |    9 
 meta/recipes-devtools/rust/rust-source-1.47.0.inc                       |    3 
 meta/recipes-devtools/rust/rust-source-1.49.0.inc                       |    3 
 meta/recipes-devtools/rust/rust-source.inc                              |    3 
 meta/recipes-devtools/rust/rust-target.inc                              |   10 
 meta/recipes-devtools/rust/rust.inc                                     |  524 ++++++++++
 ust/rust/0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch|   75 +
 meta/recipes-devtools/rust/rust_1.47.0.bb                               |    9 
 meta/recipes-devtools/rust/rust_1.49.0.bb                               |   15 
 /recipes-example/rust-hello-world/rust-hello-world/0001-enable-LTO.patch|   23 
 meta/recipes-example/rust-hello-world/rust-hello-world_git.bb           |   17 
 meta/recipes-example/rustfmt/rustfmt_1.4.2.bb                           |  171 +++
 meta/recipes-support/libgit2/libgit2_1.1.0.bb                           |   22 
 h2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch|   46 
 bssh2/files/0001-configure-Conditionally-undefine-backend-m4-macro.patch|   30 
 meta/recipes-support/libssh2/files/CVE-2019-17498.patch                 |  131 ++
 meta/recipes-support/libssh2/files/run-ptest                            |    8 
 meta/recipes-support/libssh2/libssh2_1.9.0.bb                           |   53 +
 scripts/build.sh                                                        |   19 
 scripts/cleanup-env.sh                                                  |   14 
 scripts/containerize.sh                                                 |   54 +
 scripts/fetch.sh                                                        |  103 +
 scripts/publish-build-cache.sh                                          |   13 
 scripts/setup-env.sh                                                    |   12 
 53 files changed, 2562 insertions(+)
#1 lore raw

PATCH 1/8 Add libgit2, libssh2 from meta-oe for rust

---
 .../recipes-support/libgit2/libgit2_0.27.8.bb | 25 +++++++++++++++++
 meta/recipes-support/libssh2/libssh2_1.8.2.bb | 27 +++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 meta/recipes-support/libgit2/libgit2_0.27.8.bb
 create mode 100644 meta/recipes-support/libssh2/libssh2_1.8.2.bb
meta/recipes-support/libgit2/libgit2_0.27.8.bb new file +25 -0
new file mode 100644
index 0000000000..a43408908c
@@ -0,0 +1,25 @@
+SUMMARY = "the Git linkable library"
+HOMEPAGE = "http://libgit2.github.com/"
+LICENSE = "GPL-2.0-with-GCC-exception & MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3f2cd5d3cccd71d62066ba619614592b"
+
+DEPENDS = "curl openssl zlib libssh2 libgcrypt"
+
+SRC_URI = "git://github.com/libgit2/libgit2.git;branch=maint/v0.27"
+#v0.27.8
+SRCREV = "2882803ca2b2cdedd069746422155a23fdd002b2"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+EXTRA_OECMAKE = "\
+    -DTHREADSAFE=ON \
+    -DBUILD_CLAR=OFF \
+    -DSHA1_TYPE="builtin" \
+    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+    -DBUILD_EXAMPLES=OFF \
+    -DLIB_INSTALL_DIR=${libdir} \
+"
+
+BBCLASSEXTEND = "native"
meta/recipes-support/libssh2/libssh2_1.8.2.bb new file +27 -0
new file mode 100644
index 0000000000..fe853cde4f
@@ -0,0 +1,27 @@
+SUMMARY = "A client-side C library implementing the SSH2 protocol"
+HOMEPAGE = "http://www.libssh2.org/"
+SECTION = "libs"
+
+DEPENDS = "zlib"
+
+LICENSE = "BSD"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c5cf34fc0acb44b082ef50ef5e4354ca"
+
+SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz"
+
+SRC_URI[md5sum] = "616efd99af3d9ef731a26bed6cee9593"
+SRC_URI[sha256sum] = "088307d9f6b6c4b8c13f34602e8ff65d21c2dc4d55284dfe15d502c4ee190d67"
+
+inherit autotools pkgconfig
+
+EXTRA_OECONF += "\
+                 --with-libz \
+                 --with-libz-prefix=${STAGING_LIBDIR} \
+                "
+
+# only one of openssl and gcrypt could be set
+PACKAGECONFIG ??= "openssl"
+PACKAGECONFIG[openssl] = "--with-openssl --with-libssl-prefix=${STAGING_LIBDIR},--without-openssl,openssl"
+PACKAGECONFIG[gcrypt] = "--with-libgcrypt --with-libgcrypt-prefix=${STAGING_EXECPREFIXDIR},--without-libgcrypt,libgcrypt"
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/8 libssh2: pull in additional commits from meta-oe

In reply to Randy MacLeod

b24ef04ae libssh2: Fix build with autoconf 2.70+ d7aa71734 libssh2: enhance ptest
b3e9b51c9 libssh2: fix ptest
f5df715e2 libssh2: enable ptest
c1d1697c5 libssh2: add nativesdk support
3a6cbf246 libssh2: Security Advisory - libssh2 - CVE-2019-17498 40ea4c939 libssh2: upgrade 1.8.2 -> 1.9.0
5a7e65cbf libssh2: Clarify BSD license variant

---
 ...nviroment-to-decide-if-a-test-is-bui.patch |  46 ++++++
 ...ditionally-undefine-backend-m4-macro.patch |  30 ++++
 .../libssh2/files/CVE-2019-17498.patch        | 131 ++++++++++++++++++
 meta/recipes-support/libssh2/files/run-ptest  |   8 ++
 meta/recipes-support/libssh2/libssh2_1.8.2.bb |  27 ----
 meta/recipes-support/libssh2/libssh2_1.9.0.bb |  53 +++++++
 6 files changed, 268 insertions(+), 27 deletions(-)
 create mode 100644 meta/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch
 create mode 100644 meta/recipes-support/libssh2/files/0001-configure-Conditionally-undefine-backend-m4-macro.patch
 create mode 100644 meta/recipes-support/libssh2/files/CVE-2019-17498.patch
 create mode 100644 meta/recipes-support/libssh2/files/run-ptest
 delete mode 100644 meta/recipes-support/libssh2/libssh2_1.8.2.bb
 create mode 100644 meta/recipes-support/libssh2/libssh2_1.9.0.bb
meta/recipes-support/libssh2/files/0001-Don-t-let-host-enviroment-to-decide-if-a-test-is-bui.patch new file +46 -0
new file mode 100644
index 0000000000..5ff9bf8462
@@ -0,0 +1,46 @@
+From f9e3e2ee7b18ba5bb8efe083171f3e701eb0a663 Mon Sep 17 00:00:00 2001
+From: Your Name <[email protected]>
+Date: Mon, 28 Dec 2020 02:08:03 +0000
+Subject: [PATCH] Don't let host enviroment to decide if a test is build
+
+test ssh2.sh need sshd, for cross compile, we need it on target, so
+don't use SSHD on host to decide weither to build a test
+
+Upstream-Status: Inappropriate[oe specific]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ tests/Makefile.am | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index dc0922f..6cbc35d 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -1,16 +1,12 @@
+ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_builddir)/src
+ LDADD = ../src/libssh2.la
+ 
+-if SSHD
+ noinst_PROGRAMS = ssh2
+ ssh2_SOURCES = ssh2.c
+-endif
+ 
+ ctests = simple$(EXEEXT)
+ TESTS = $(ctests) mansyntax.sh
+-if SSHD
+ TESTS += ssh2.sh
+-endif
+ check_PROGRAMS = $(ctests)
+ 
+ TESTS_ENVIRONMENT = SSHD=$(SSHD) EXEEXT=$(EXEEXT)
+@@ -38,4 +34,4 @@ if OPENSSL
+ # EXTRA_DIST += test_public_key_auth_succeeds_with_correct_encrypted_ed25519_key.c
+ # EXTRA_DIST += test_public_key_auth_succeeds_with_correct_ed25519_key_from_mem.c
+ EXTRA_DIST += test_public_key_auth_succeeds_with_correct_rsa_openssh_key.c
+-endif
+\ No newline at end of file
++endif
+-- 
+2.20.1
+
meta/recipes-support/libssh2/files/0001-configure-Conditionally-undefine-backend-m4-macro.patch new file +30 -0
new file mode 100644
index 0000000000..1128c7ea0c
@@ -0,0 +1,30 @@
+From efe7101786193eaddb749c0583af6b54aec6f289 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Tue, 2 Feb 2021 18:45:16 -0800
+Subject: [PATCH] configure: Conditionally undefine backend m4 macro
+
+Unlike the M4 builtin, this macro fails if macro is not defined
+therefore recover the behavior of the builtin.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index fe5054a..758f8c2 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -127,7 +127,7 @@ fi
+ m4_set_foreach([crypto_backends], [backend],
+   [AM_CONDITIONAL(m4_toupper(backend), test "$found_crypto" = "backend")]
+ )
+-m4_undefine([backend])
++m4_ifdef([backend], [m4_undefine([backend])])
+ 
+ 
+ # libz
+-- 
+2.30.0
+
meta/recipes-support/libssh2/files/CVE-2019-17498.patch new file +131 -0

131 lines not on this page · raw message

meta/recipes-support/libssh2/files/run-ptest new file +8 -0
new file mode 100644
index 0000000000..5fd7ec65f6
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+ptestdir=$(dirname "$(readlink -f "$0")")
+cd tests
+for test in simple ssh2.sh mansyntax.sh
+do
+	./../test-driver --test-name $test --log-file ../$test.log --trs-file ../$test.trs --color-tests no --enable-hard-errors yes --expect-failure no -- ./$test
+done
meta/recipes-support/libssh2/libssh2_1.8.2.bb deleted +0 -27
deleted file mode 100644
index fe853cde4f..0000000000
@@ -1,27 +0,0 @@
-SUMMARY = "A client-side C library implementing the SSH2 protocol"
-HOMEPAGE = "http://www.libssh2.org/"
-SECTION = "libs"
-
-DEPENDS = "zlib"
-
-LICENSE = "BSD"
-LIC_FILES_CHKSUM = "file://COPYING;md5=c5cf34fc0acb44b082ef50ef5e4354ca"
-
-SRC_URI = "http://www.libssh2.org/download/${BP}.tar.gz"
-
-SRC_URI[md5sum] = "616efd99af3d9ef731a26bed6cee9593"
-SRC_URI[sha256sum] = "088307d9f6b6c4b8c13f34602e8ff65d21c2dc4d55284dfe15d502c4ee190d67"
-
-inherit autotools pkgconfig
-
-EXTRA_OECONF += "\
-                 --with-libz \
-                 --with-libz-prefix=${STAGING_LIBDIR} \
-                "
-
-# only one of openssl and gcrypt could be set
-PACKAGECONFIG ??= "openssl"
-PACKAGECONFIG[openssl] = "--with-openssl --with-libssl-prefix=${STAGING_LIBDIR},--without-openssl,openssl"
-PACKAGECONFIG[gcrypt] = "--with-libgcrypt --with-libgcrypt-prefix=${STAGING_EXECPREFIXDIR},--without-libgcrypt,libgcrypt"
-
-BBCLASSEXTEND = "native"
meta/recipes-support/libssh2/libssh2_1.9.0.bb new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/8 libgit2: pull in updates from meta-oe

In reply to Randy MacLeod

d62613046 libgit2: update to 1.1.0
ce47a064d libgit2: upgrade 1.0.0 -> 1.0.1
7d137c5b2 libgit2: Enable pcre2 regexp backend
14894a4c4 libgit2: Update to v1.0.0
7b39ea059 libgit2: Upgrade to 0.28.4
da358cf1f libgit2: Don't pass parameters with their default values to cmake bcd89f7cd libgit2: Upgrade 0.27.9 -> 0.28.3
87c9da253 libgit2: Upgrade 0.27.8 -> 0.27.9

---
 .../recipes-support/libgit2/libgit2_0.27.8.bb | 25 -------------------
 meta/recipes-support/libgit2/libgit2_1.1.0.bb | 22 ++++++++++++++++
 2 files changed, 22 insertions(+), 25 deletions(-)
 delete mode 100644 meta/recipes-support/libgit2/libgit2_0.27.8.bb
 create mode 100644 meta/recipes-support/libgit2/libgit2_1.1.0.bb
meta/recipes-support/libgit2/libgit2_0.27.8.bb deleted +0 -25
deleted file mode 100644
index a43408908c..0000000000
@@ -1,25 +0,0 @@
-SUMMARY = "the Git linkable library"
-HOMEPAGE = "http://libgit2.github.com/"
-LICENSE = "GPL-2.0-with-GCC-exception & MIT"
-LIC_FILES_CHKSUM = "file://COPYING;md5=3f2cd5d3cccd71d62066ba619614592b"
-
-DEPENDS = "curl openssl zlib libssh2 libgcrypt"
-
-SRC_URI = "git://github.com/libgit2/libgit2.git;branch=maint/v0.27"
-#v0.27.8
-SRCREV = "2882803ca2b2cdedd069746422155a23fdd002b2"
-
-S = "${WORKDIR}/git"
-
-inherit cmake
-
-EXTRA_OECMAKE = "\
-    -DTHREADSAFE=ON \
-    -DBUILD_CLAR=OFF \
-    -DSHA1_TYPE="builtin" \
-    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-    -DBUILD_EXAMPLES=OFF \
-    -DLIB_INSTALL_DIR=${libdir} \
-"
-
-BBCLASSEXTEND = "native"
meta/recipes-support/libgit2/libgit2_1.1.0.bb new file +22 -0
new file mode 100644
index 0000000000..2bbf59ea74
@@ -0,0 +1,22 @@
+SUMMARY = "the Git linkable library"
+HOMEPAGE = "http://libgit2.github.com/"
+LICENSE = "GPL-2.0-with-GCC-exception & MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=5b002a195fb7ea2d8d583f07eaff3a8e"
+
+DEPENDS = "curl openssl zlib libssh2 libgcrypt libpcre2"
+
+SRC_URI = "git://github.com/libgit2/libgit2.git;branch=maint/v1.1"
+SRCREV = "7f4fa178629d559c037a1f72f79f79af9c1ef8ce"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+EXTRA_OECMAKE = "\
+    -DBUILD_CLAR=OFF \
+    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+    -DLIB_INSTALL_DIR=${libdir} \
+    -DREGEX_BACKEND='pcre2' \
+"
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.27.0
#4 lore raw

PATCH 4/8 meta-rust: move code to oe-core from meta-rust layer

In reply to Randy MacLeod

Rust is becoming more widely used so move the
meta-rust layer. Taken from meta-rust at commit:
11aed43 cargo-1.37.0: fix patch fuzz

---
 meta/classes/cargo.bbclass                    |  70 +++
 meta/classes/cargo_common.bbclass             |  98 ++++
 meta/classes/crate-fetch.bbclass              |  13 +
 meta/classes/rust-bin.bbclass                 | 149 +++++
 meta/classes/rust-common.bbclass              | 144 +++++
 meta/classes/rust.bbclass                     |  45 ++
 .../distro/include/rust_security_flags.inc    |   7 +
 meta/conf/layer.conf                          |   2 +
 meta/lib/crate.py                             | 149 +++++
 .../cargo-1.34.2/0001-Disable-http2.patch     |  29 +
 .../cargo-1.36.0/0001-Disable-http2.patch     |  31 ++
 .../cargo-1.37.0/0001-Disable-http2.patch     |  29 +
 meta/recipes-devtools/cargo/cargo.inc         |  43 ++
 meta/recipes-devtools/cargo/cargo_1.34.2.bb   |   8 +
 meta/recipes-devtools/cargo/cargo_1.36.0.bb   |   8 +
 meta/recipes-devtools/cargo/cargo_1.37.0.bb   |   8 +
 meta/recipes-devtools/rust/libstd-rs.inc      |  31 ++
 .../recipes-devtools/rust/libstd-rs_1.34.2.bb |   8 +
 .../recipes-devtools/rust/libstd-rs_1.36.0.bb |   8 +
 .../recipes-devtools/rust/libstd-rs_1.37.0.bb |   8 +
 meta/recipes-devtools/rust/rust-cross.inc     |  52 ++
 .../rust/rust-cross_1.34.2.bb                 |   3 +
 .../rust/rust-cross_1.36.0.bb                 |   3 +
 .../rust/rust-cross_1.37.0.bb                 |   3 +
 meta/recipes-devtools/rust/rust-llvm.inc      |  62 +++
 ...-llvm-allow-env-override-of-exe-path.patch |  32 ++
 .../recipes-devtools/rust/rust-llvm_1.34.2.bb |  16 +
 .../recipes-devtools/rust/rust-llvm_1.36.0.bb |  16 +
 .../recipes-devtools/rust/rust-llvm_1.37.0.bb |  16 +
 .../rust/rust-snapshot-1.34.2.inc             |  24 +
 .../rust/rust-snapshot-1.36.0.inc             |  24 +
 .../rust/rust-snapshot-1.37.0.inc             |  24 +
 .../rust/rust-source-1.34.2.inc               |  11 +
 .../rust/rust-source-1.36.0.inc               |  11 +
 .../rust/rust-source-1.37.0.inc               |  11 +
 meta/recipes-devtools/rust/rust.inc           | 509 ++++++++++++++++++
 meta/recipes-devtools/rust/rust_1.34.2.bb     |  12 +
 meta/recipes-devtools/rust/rust_1.36.0.bb     |  12 +
 meta/recipes-devtools/rust/rust_1.37.0.bb     |  12 +
 .../rust-hello-world/rust-hello-world_git.bb  |  13 +
 meta/recipes-example/rustfmt/rustfmt_0.8.0.bb |  67 +++
 scripts/build.sh                              |  19 +
 scripts/cleanup-env.sh                        |  14 +
 scripts/containerize.sh                       |  54 ++
 scripts/fetch.sh                              | 103 ++++
 scripts/publish-build-cache.sh                |  13 +
 scripts/setup-env.sh                          |  12 +
 47 files changed, 2036 insertions(+)
 create mode 100644 meta/classes/cargo.bbclass
 create mode 100644 meta/classes/cargo_common.bbclass
 create mode 100644 meta/classes/crate-fetch.bbclass
 create mode 100644 meta/classes/rust-bin.bbclass
 create mode 100644 meta/classes/rust-common.bbclass
 create mode 100644 meta/classes/rust.bbclass
 create mode 100644 meta/conf/distro/include/rust_security_flags.inc
 create mode 100644 meta/lib/crate.py
 create mode 100644 meta/recipes-devtools/cargo/cargo-1.34.2/0001-Disable-http2.patch
 create mode 100644 meta/recipes-devtools/cargo/cargo-1.36.0/0001-Disable-http2.patch
 create mode 100644 meta/recipes-devtools/cargo/cargo-1.37.0/0001-Disable-http2.patch
 create mode 100644 meta/recipes-devtools/cargo/cargo.inc
 create mode 100644 meta/recipes-devtools/cargo/cargo_1.34.2.bb
 create mode 100644 meta/recipes-devtools/cargo/cargo_1.36.0.bb
 create mode 100644 meta/recipes-devtools/cargo/cargo_1.37.0.bb
 create mode 100644 meta/recipes-devtools/rust/libstd-rs.inc
 create mode 100644 meta/recipes-devtools/rust/libstd-rs_1.34.2.bb
 create mode 100644 meta/recipes-devtools/rust/libstd-rs_1.36.0.bb
 create mode 100644 meta/recipes-devtools/rust/libstd-rs_1.37.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust-cross.inc
 create mode 100644 meta/recipes-devtools/rust/rust-cross_1.34.2.bb
 create mode 100644 meta/recipes-devtools/rust/rust-cross_1.36.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust-cross_1.37.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust-llvm.inc
 create mode 100644 meta/recipes-devtools/rust/rust-llvm/0002-llvm-allow-env-override-of-exe-path.patch
 create mode 100644 meta/recipes-devtools/rust/rust-llvm_1.34.2.bb
 create mode 100644 meta/recipes-devtools/rust/rust-llvm_1.36.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust-llvm_1.37.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.34.2.inc
 create mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.36.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.37.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-source-1.34.2.inc
 create mode 100644 meta/recipes-devtools/rust/rust-source-1.36.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-source-1.37.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust.inc
 create mode 100644 meta/recipes-devtools/rust/rust_1.34.2.bb
 create mode 100644 meta/recipes-devtools/rust/rust_1.36.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust_1.37.0.bb
 create mode 100644 meta/recipes-example/rust-hello-world/rust-hello-world_git.bb
 create mode 100644 meta/recipes-example/rustfmt/rustfmt_0.8.0.bb
 create mode 100755 scripts/build.sh
 create mode 100755 scripts/cleanup-env.sh
 create mode 100755 scripts/containerize.sh
 create mode 100755 scripts/fetch.sh
 create mode 100755 scripts/publish-build-cache.sh
 create mode 100755 scripts/setup-env.sh
meta/classes/cargo.bbclass new file +70 -0
new file mode 100644
index 0000000000..c321e6bf70
@@ -0,0 +1,70 @@
+##
+## Purpose:
+## This class is used by any recipes that are built using
+## Cargo.
+
+inherit cargo_common
+
+# the binary we will use
+CARGO = "cargo"
+
+# We need cargo to compile for the target
+BASEDEPENDS_append = " cargo-native"
+
+# Ensure we get the right rust variant
+DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
+DEPENDS_append_class-native = " rust-native"
+
+# Cargo only supports in-tree builds at the moment
+B = "${S}"
+
+# In case something fails in the build process, give a bit more feedback on
+# where the issue occured
+export RUST_BACKTRACE = "1"
+
+RUSTFLAGS ??= ""
+BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
+CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} ${BUILD_MODE}"
+
+# This is based on the content of CARGO_BUILD_FLAGS and generally will need to
+# change if CARGO_BUILD_FLAGS changes.
+BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
+CARGO_TARGET_SUBDIR="${HOST_SYS}/${BUILD_DIR}"
+oe_cargo_build () {
+	export RUSTFLAGS="${RUSTFLAGS}"
+	export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
+	bbnote "cargo = $(which ${CARGO})"
+	bbnote "rustc = $(which ${RUSTC})"
+	bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
+	"${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
+}
+
+cargo_do_compile () {
+	oe_cargo_fix_env
+	oe_cargo_build
+}
+
+cargo_do_install () {
+	local have_installed=false
+	for tgt in "${B}/target/${CARGO_TARGET_SUBDIR}/"*; do
+		case $tgt in
+		*.so|*.rlib)
+			install -d "${D}${rustlibdir}"
+			install -m755 "$tgt" "${D}${rustlibdir}"
+			have_installed=true
+			;;
+		*)
+			if [ -f "$tgt" ] && [ -x "$tgt" ]; then
+				install -d "${D}${bindir}"
+				install -m755 "$tgt" "${D}${bindir}"
+				have_installed=true
+			fi
+			;;
+		esac
+	done
+	if ! $have_installed; then
+		die "Did not find anything to install"
+	fi
+}
+
+EXPORT_FUNCTIONS do_compile do_install
meta/classes/cargo_common.bbclass new file +98 -0

98 lines not on this page · raw message

meta/classes/crate-fetch.bbclass new file +13 -0
new file mode 100644
index 0000000000..c0ed434a96
@@ -0,0 +1,13 @@
+#
+# crate-fetch class
+#
+# Registers 'crate' method for Bitbake fetch2.
+#
+# Adds support for following format in recipe SRC_URI:
+# crate://<packagename>/<version>
+#
+
+python () {
+        import crate
+        bb.fetch2.methods.append( crate.Crate() )
+}
meta/classes/rust-bin.bbclass new file +149 -0

149 lines not on this page · raw message

meta/classes/rust-common.bbclass new file +144 -0

144 lines not on this page · raw message

meta/classes/rust.bbclass new file +45 -0

45 lines not on this page · raw message

meta/conf/distro/include/rust_security_flags.inc new file +7 -0
new file mode 100644
index 0000000000..7e6377e8c7
@@ -0,0 +1,7 @@
+# Build errors with PIE options enabled
+SECURITY_CFLAGS_pn-rust-native = "${SECURITY_NO_PIE_CFLAGS}"
+SECURITY_CFLAGS_pn-rust-cross-${TARGET_ARCH} = "${SECURITY_NO_PIE_CFLAGS}"
+SECURITY_CFLAGS_pn-rust = "${SECURITY_NO_PIE_CFLAGS}"
+SECURITY_CFLAGS_pn-rust-llvm = "${SECURITY_NO_PIE_CFLAGS}"
+
+SECURITY_LDFLAGS_pn-rust-cross-arm = " -lssp_nonshared -lssp"
meta/conf/layer.conf +2 -0
index cda37c33b4..d834be1d02 100644
@@ -105,3 +105,5 @@ SSTATE_EXCLUDEDEPS_SYSROOT += ".*->autoconf-archive-native"
 # Avoid empty path entries
 BITBAKEPATH := "${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}"
 PATH := "${@'${BITBAKEPATH}:' if '${BITBAKEPATH}' != '' else ''}${HOSTTOOLS_DIR}"
+
+require conf/distro/include/rust_security_flags.inc
meta/lib/crate.py new file +149 -0

149 lines not on this page · raw message

meta/recipes-devtools/cargo/cargo-1.34.2/0001-Disable-http2.patch new file +29 -0
new file mode 100644
index 0000000000..a44482a112
@@ -0,0 +1,29 @@
+From 44cf21036646e4849e9f8566db7decb7da917394 Mon Sep 17 00:00:00 2001
+From: Johan Anderholm <[email protected]>
+Date: Sun, 27 Jan 2019 10:19:00 +0100
+Subject: [PATCH] Disable http2
+
+http2 requires that curl is build with nghttp2 which in turn depends on
+many dependencies and ultimately a dependency loop in the case of
+curl-native. As long as multiplexing is disabled in cargo this should
+be fine.
+
+Upstream-Status: Inappropriate
+
+---
+ Cargo.toml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index 8238380861d9..ced1defea459 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -24,7 +24,7 @@ bytesize = "1.0"
+ crates-io = { path = "src/crates-io", version = "0.23" }
+ crossbeam-utils = "0.6"
+ crypto-hash = "0.3.1"
+-curl = { version = "0.4.19", features = ['http2'] }
++curl = { version = "0.4.19" }
+ curl-sys = "0.4.15"
+ env_logger = "0.6.0"
+ pretty_env_logger = { version = "0.3", optional = true }
meta/recipes-devtools/cargo/cargo-1.36.0/0001-Disable-http2.patch new file +31 -0
new file mode 100644
index 0000000000..9794ec05f9
@@ -0,0 +1,31 @@
+From 42e65192b6f7520b7a05924856e00600961f6758 Mon Sep 17 00:00:00 2001
+From: Johan Anderholm <[email protected]>
+Date: Sun, 27 Jan 2019 10:19:00 +0100
+Subject: [PATCH] Disable http2
+
+http2 requires that curl is build with nghttp2 which in turn depends on
+many dependencies and ultimately a dependency loop in the case of
+curl-native. As long as multiplexing is disabled in cargo this should
+be fine.
+
+Upstream-Status: Inappropriate
+---
+ Cargo.toml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index c3fcacf5..bd6ec50b 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -24,7 +24,7 @@ bytesize = "1.0"
+ crates-io = { path = "src/crates-io", version = "0.25" }
+ crossbeam-utils = "0.6"
+ crypto-hash = "0.3.1"
+-curl = { version = "0.4.21", features = ['http2'] }
++curl = { version = "0.4.21" }
+ curl-sys = "0.4.18"
+ env_logger = "0.6.0"
+ pretty_env_logger = { version = "0.3", optional = true }
+-- 
+2.11.0
+
meta/recipes-devtools/cargo/cargo-1.37.0/0001-Disable-http2.patch new file +29 -0
new file mode 100644
index 0000000000..c804297d48
@@ -0,0 +1,29 @@
+From 0e2384133664ebeb548b782ad763c3a627c1bc66 Mon Sep 17 00:00:00 2001
+From: Johan Anderholm <[email protected]>
+Date: Sun, 27 Jan 2019 10:19:00 +0100
+Subject: [PATCH] Disable http2
+
+http2 requires that curl is build with nghttp2 which in turn depends on
+many dependencies and ultimately a dependency loop in the case of
+curl-native. As long as multiplexing is disabled in cargo this should
+be fine.
+
+Upstream-Status: Inappropriate
+
+---
+ src/tools/cargo/Cargo.toml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index d15aa2513..ba9c77d25 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -24,7 +24,7 @@ bytesize = "1.0"
+ crates-io = { path = "crates/crates-io", version = "0.26" }
+ crossbeam-utils = "0.6"
+ crypto-hash = "0.3.1"
+-curl = { version = "0.4.21", features = ['http2'] }
++curl = { version = "0.4.21" }
+ curl-sys = "0.4.18"
+ env_logger = "0.6.0"
+ pretty_env_logger = { version = "0.3", optional = true }
meta/recipes-devtools/cargo/cargo.inc new file +43 -0

43 lines not on this page · raw message

meta/recipes-devtools/cargo/cargo_1.34.2.bb new file +8 -0
new file mode 100644
index 0000000000..d79f958c6e
@@ -0,0 +1,8 @@
+require recipes-devtools/rust/rust-source-${PV}.inc
+require recipes-devtools/rust/rust-snapshot-${PV}.inc
+require cargo.inc
+
+LIC_FILES_CHKSUM += " \
+    file://LICENSE-APACHE;md5=1836efb2eb779966696f473ee8540542 \
+    file://LICENSE-THIRD-PARTY;md5=892ea68b169e69cfe75097fc38a15b56 \
+"
meta/recipes-devtools/cargo/cargo_1.36.0.bb new file +8 -0
new file mode 100644
index 0000000000..f048779aae
@@ -0,0 +1,8 @@
+require recipes-devtools/rust/rust-source-${PV}.inc
+require recipes-devtools/rust/rust-snapshot-${PV}.inc
+require cargo.inc
+
+LIC_FILES_CHKSUM += " \
+    file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
+    file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
+"
meta/recipes-devtools/cargo/cargo_1.37.0.bb new file +8 -0
new file mode 100644
index 0000000000..f048779aae
@@ -0,0 +1,8 @@
+require recipes-devtools/rust/rust-source-${PV}.inc
+require recipes-devtools/rust/rust-snapshot-${PV}.inc
+require cargo.inc
+
+LIC_FILES_CHKSUM += " \
+    file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
+    file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
+"
meta/recipes-devtools/rust/libstd-rs.inc new file +31 -0
new file mode 100644
index 0000000000..5298c00706
@@ -0,0 +1,31 @@
+SUMMARY = "Rust standard libaries"
+HOMEPAGE = "http://www.rust-lang.org"
+SECTION = "devel"
+LICENSE = "MIT | Apache-2.0"
+
+RUSTLIB_DEP = ""
+inherit cargo
+
+DEPENDS_append_libc-musl = " libunwind"
+# Needed so cargo can find libbacktrace
+RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so"
+
+S = "${RUSTSRC}/src/libstd"
+
+CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'"
+
+do_compile_prepend () {
+    export CARGO_TARGET_DIR="${B}"
+    # For Rust 1.13.0 and newer
+    export RUSTC_BOOTSTRAP="1"
+}
+
+do_install () {
+    mkdir -p ${D}${rustlibdir}
+
+    # With the incremental build support added in 1.24, the libstd deps directory also includes dependency
+    # files that get installed. Those are really only needed to incrementally rebuild the libstd library
+    # itself and don't need to be installed.
+    rm -f ${B}/${TARGET_SYS}/${BUILD_DIR}/deps/*.d
+    cp ${B}/${TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir}
+}
meta/recipes-devtools/rust/libstd-rs_1.34.2.bb new file +8 -0
new file mode 100644
index 0000000000..69cb48ad07
@@ -0,0 +1,8 @@
+require rust-source-${PV}.inc
+require libstd-rs.inc
+
+LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
+
+CARGO_FEATURES ?= "panic-unwind backtrace"
+
+CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
meta/recipes-devtools/rust/libstd-rs_1.36.0.bb new file +8 -0
new file mode 100644
index 0000000000..69cb48ad07
@@ -0,0 +1,8 @@
+require rust-source-${PV}.inc
+require libstd-rs.inc
+
+LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
+
+CARGO_FEATURES ?= "panic-unwind backtrace"
+
+CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
meta/recipes-devtools/rust/libstd-rs_1.37.0.bb new file +8 -0
new file mode 100644
index 0000000000..69cb48ad07
@@ -0,0 +1,8 @@
+require rust-source-${PV}.inc
+require libstd-rs.inc
+
+LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
+
+CARGO_FEATURES ?= "panic-unwind backtrace"
+
+CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
meta/recipes-devtools/rust/rust-cross.inc new file +52 -0

52 lines not on this page · raw message

meta/recipes-devtools/rust/rust-cross_1.34.2.bb new file +3 -0
new file mode 100644
index 0000000000..bb92b99ccc
@@ -0,0 +1,3 @@
+require rust-cross.inc
+require rust-source-${PV}.inc
+
meta/recipes-devtools/rust/rust-cross_1.36.0.bb new file +3 -0
new file mode 100644
index 0000000000..bb92b99ccc
@@ -0,0 +1,3 @@
+require rust-cross.inc
+require rust-source-${PV}.inc
+
meta/recipes-devtools/rust/rust-cross_1.37.0.bb new file +3 -0
new file mode 100644
index 0000000000..bb92b99ccc
@@ -0,0 +1,3 @@
+require rust-cross.inc
+require rust-source-${PV}.inc
+
meta/recipes-devtools/rust/rust-llvm.inc new file +62 -0

62 lines not on this page · raw message

meta/recipes-devtools/rust/rust-llvm/0002-llvm-allow-env-override-of-exe-path.patch new file +32 -0
new file mode 100644
index 0000000000..65dbd6ffd6
@@ -0,0 +1,32 @@
+From 7111770e8290082530d920e120995bf81431b0aa Mon Sep 17 00:00:00 2001
+From: Martin Kelly <[email protected]>
+Date: Fri, 19 May 2017 00:22:57 -0700
+Subject: [PATCH 12/18] llvm: allow env override of exe path
+
+When using a native llvm-config from inside a sysroot, we need llvm-config to
+return the libraries, include directories, etc. from inside the sysroot rather
+than from the native sysroot. Thus provide an env override for calling
+llvm-config from a target sysroot.
+
+Signed-off-by: Martin Kelly <[email protected]>
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tools/llvm-config/llvm-config.cpp | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -226,6 +226,13 @@ Typical components:\n\
+ 
+ /// Compute the path to the main executable.
+ std::string GetExecutablePath(const char *Argv0) {
++  // Hack for Yocto: we need to override the root path when we are using
++  // llvm-config from within a target sysroot.
++  const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
++  if (Sysroot != nullptr) {
++    return Sysroot;
++  }
++
+   // This just needs to be some symbol in the binary; C++ doesn't
+   // allow taking the address of ::main however.
+   void *P = (void *)(intptr_t)GetExecutablePath;
meta/recipes-devtools/rust/rust-llvm_1.34.2.bb new file +16 -0
new file mode 100644
index 0000000000..d41fa28477
@@ -0,0 +1,16 @@
+require rust-source-${PV}.inc
+require rust-llvm.inc
+
+LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
+
+do_install_prepend () {
+	# the install does a sed on this without installing the file
+	# we don't need it for anything
+	mkdir -p "${D}/usr/share/llvm/cmake"
+	touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake"
+}
+
+do_install_append () {
+	# we don't need any of this stuff to build Rust
+	rm -rf "${D}/usr/lib/cmake"
+}
meta/recipes-devtools/rust/rust-llvm_1.36.0.bb new file +16 -0
new file mode 100644
index 0000000000..d41fa28477
@@ -0,0 +1,16 @@
+require rust-source-${PV}.inc
+require rust-llvm.inc
+
+LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
+
+do_install_prepend () {
+	# the install does a sed on this without installing the file
+	# we don't need it for anything
+	mkdir -p "${D}/usr/share/llvm/cmake"
+	touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake"
+}
+
+do_install_append () {
+	# we don't need any of this stuff to build Rust
+	rm -rf "${D}/usr/lib/cmake"
+}
meta/recipes-devtools/rust/rust-llvm_1.37.0.bb new file +16 -0
new file mode 100644
index 0000000000..d41fa28477
@@ -0,0 +1,16 @@
+require rust-source-${PV}.inc
+require rust-llvm.inc
+
+LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
+
+do_install_prepend () {
+	# the install does a sed on this without installing the file
+	# we don't need it for anything
+	mkdir -p "${D}/usr/share/llvm/cmake"
+	touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake"
+}
+
+do_install_append () {
+	# we don't need any of this stuff to build Rust
+	rm -rf "${D}/usr/lib/cmake"
+}
meta/recipes-devtools/rust/rust-snapshot-1.34.2.inc new file +24 -0
new file mode 100644
index 0000000000..d0209bb864
@@ -0,0 +1,24 @@
+## This is information on the rust-snapshot (binary) used to build our current release.
+## snapshot info is taken from rust/src/stage0.txt
+## TODO: find a way to add additional SRC_URIs based on the contents of an
+##       earlier SRC_URI.
+RS_VERSION = "1.33.0"
+
+RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+CARGO_VERSION = "0.34.0"
+CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+
+SRC_URI += " \
+	https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.gz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.gz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.gz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	"
+
+# TODO: Add hashes for other architecture toolchains as well. Make a script?
+SRC_URI[rustc-snapshot-x86_64.md5sum] = "c1ec989c1965dce754dda1e54274a68c"
+SRC_URI[rustc-snapshot-x86_64.sha256sum] = "54a342f718b712d8a17fd7878ebd37d22a82ebc70b59c421168cd4153fd04c2b"
+SRC_URI[rust-std-snapshot-x86_64.md5sum] = "d573c5bd3a965c973734c1606968a91e"
+SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "661c2ba717ae1502f002b4c6e7aeb8941685c7ea8fe7ac26ed9ede26f615b7af"
+SRC_URI[cargo-snapshot-x86_64.md5sum] = "de0e635afa9bf495cefecea476bfce36"
+SRC_URI[cargo-snapshot-x86_64.sha256sum] = "4795ae5ca3bb8c7c83ca338676bb02b670efa1eb474e346284b629dc872bcce8"
meta/recipes-devtools/rust/rust-snapshot-1.36.0.inc new file +24 -0
new file mode 100644
index 0000000000..e4b6813e84
@@ -0,0 +1,24 @@
+## This is information on the rust-snapshot (binary) used to build our current release.
+## snapshot info is taken from rust/src/stage0.txt
+## TODO: find a way to add additional SRC_URIs based on the contents of an
+##       earlier SRC_URI.
+RS_VERSION = "1.35.0"
+
+RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+CARGO_VERSION = "0.36.0"
+CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+
+SRC_URI += " \
+	https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	"
+
+# TODO: Add hashes for other architecture toolchains as well. Make a script?
+SRC_URI[rustc-snapshot-x86_64.md5sum] = "47ea78f6b3f68e30f24b9c94e465d6bd"
+SRC_URI[rustc-snapshot-x86_64.sha256sum] = "5d6dc216ba429ddf3a1657e70f3e5e380549b546fe56de897677a11d72aa4e07"
+SRC_URI[rust-std-snapshot-x86_64.md5sum] = "348ec23ca8e47fc65079bc80e63cca5f"
+SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "ccff05d0e2d88499505b10f8e33e8b1645df057f918edc81f8acb0fcee9f90b2"
+SRC_URI[cargo-snapshot-x86_64.md5sum] = "93a375e771f3d9b3a139e612dd4730ee"
+SRC_URI[cargo-snapshot-x86_64.sha256sum] = "ab5a6ff1947463dbd2477ca5dac2012494dae821112098ae0c54add652adfdc3"
meta/recipes-devtools/rust/rust-snapshot-1.37.0.inc new file +24 -0
new file mode 100644
index 0000000000..8d4c1801ed
@@ -0,0 +1,24 @@
+## This is information on the rust-snapshot (binary) used to build our current release.
+## snapshot info is taken from rust/src/stage0.txt
+## TODO: find a way to add additional SRC_URIs based on the contents of an
+##       earlier SRC_URI.
+RS_VERSION = "1.36.0"
+
+RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+CARGO_VERSION = "0.37.0"
+CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+
+SRC_URI += " \
+	https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+	"
+
+# TODO: Add hashes for other architecture toolchains as well. Make a script?
+SRC_URI[rustc-snapshot-x86_64.md5sum] = "ec27794c94cc1df1a0a69f7244a09176"
+SRC_URI[rustc-snapshot-x86_64.sha256sum] = "fff0158da6f5af2a89936dc3e0c361077c06c2983eb310615e02f81ebbde1416"
+SRC_URI[rust-std-snapshot-x86_64.md5sum] = "b71a6fd6f44527c3bf09584e89ad8958"
+SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "ce8e12684b568a8a4f7d346a743383429849cf3f028f5712ad3d3e31590c8db3"
+SRC_URI[cargo-snapshot-x86_64.md5sum] = "8c661276a0da7a1aa48affbe33b347e6"
+SRC_URI[cargo-snapshot-x86_64.sha256sum] = "d20fa121951339d5492cf8862f8a7af59efc99d18f3c27b95ab6d4658b6a7d67"
meta/recipes-devtools/rust/rust-source-1.34.2.inc new file +11 -0
new file mode 100644
index 0000000000..5c83f6f000
@@ -0,0 +1,11 @@
+SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust"
+
+SRC_URI[rust.md5sum] = "7c85e6a60dda740295f7e004a1fb15e1"
+SRC_URI[rust.sha256sum] = "c69a4a85a1c464368597df8878cb9e1121aae93e215616d45ad7d23af3052f56"
+
+# later versions of rust change the directory that they unextract to
+RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
+# set this as our default
+S = "${RUSTSRC}"
+
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
meta/recipes-devtools/rust/rust-source-1.36.0.inc new file +11 -0
new file mode 100644
index 0000000000..1a1d07c72f
@@ -0,0 +1,11 @@
+SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz;name=rust"
+
+SRC_URI[rust.md5sum] = "78ffc0b029aaed216b45c3fe24747d46"
+SRC_URI[rust.sha256sum] = "f51645b9f787af4a5d94db17f6af39db0c55980ed24fe366cad55b57900f8f2d"
+
+# later versions of rust change the directory that they unextract to
+RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
+# set this as our default
+S = "${RUSTSRC}"
+
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
meta/recipes-devtools/rust/rust-source-1.37.0.inc new file +11 -0
new file mode 100644
index 0000000000..0169cd3fbd
@@ -0,0 +1,11 @@
+SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz;name=rust"
+
+SRC_URI[rust.md5sum] = "ee6300b1d7e5767115492915c4c0d8ef"
+SRC_URI[rust.sha256sum] = "10abffac50a729cf74cef6dd03193a2f4647541bd19ee9281be9e5b12ca8cdfd"
+
+# later versions of rust change the directory that they unextract to
+RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
+# set this as our default
+S = "${RUSTSRC}"
+
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
meta/recipes-devtools/rust/rust.inc new file +509 -0

509 lines not on this page · raw message

meta/recipes-devtools/rust/rust_1.34.2.bb new file +12 -0
new file mode 100644
index 0000000000..c7f9f4fd87
@@ -0,0 +1,12 @@
+require rust.inc
+require rust-source-${PV}.inc
+require rust-snapshot-${PV}.inc
+
+DEPENDS += "rust-llvm (=${PV})"
+
+# Otherwise we'll depend on what we provide
+INHIBIT_DEFAULT_RUST_DEPS_class-native = "1"
+# We don't need to depend on gcc-native because yocto assumes it exists
+PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust"
+
+BBCLASSEXTEND = "native"
meta/recipes-devtools/rust/rust_1.36.0.bb new file +12 -0
new file mode 100644
index 0000000000..c7f9f4fd87
@@ -0,0 +1,12 @@
+require rust.inc
+require rust-source-${PV}.inc
+require rust-snapshot-${PV}.inc
+
+DEPENDS += "rust-llvm (=${PV})"
+
+# Otherwise we'll depend on what we provide
+INHIBIT_DEFAULT_RUST_DEPS_class-native = "1"
+# We don't need to depend on gcc-native because yocto assumes it exists
+PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust"
+
+BBCLASSEXTEND = "native"
meta/recipes-devtools/rust/rust_1.37.0.bb new file +12 -0
new file mode 100644
index 0000000000..c7f9f4fd87
@@ -0,0 +1,12 @@
+require rust.inc
+require rust-source-${PV}.inc
+require rust-snapshot-${PV}.inc
+
+DEPENDS += "rust-llvm (=${PV})"
+
+# Otherwise we'll depend on what we provide
+INHIBIT_DEFAULT_RUST_DEPS_class-native = "1"
+# We don't need to depend on gcc-native because yocto assumes it exists
+PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust"
+
+BBCLASSEXTEND = "native"
meta/recipes-example/rust-hello-world/rust-hello-world_git.bb new file +13 -0
new file mode 100644
index 0000000000..ba8854849d
@@ -0,0 +1,13 @@
+inherit cargo
+
+SRC_URI = "git://github.com/jmesmon/rust-hello-world.git;protocol=https"
+SRCREV="e0fa23f1a3cb1eb1407165bd2fc36d2f6e6ad728"
+LIC_FILES_CHKSUM="file://COPYRIGHT;md5=e6b2207ac3740d2d01141c49208c2147"
+
+SUMMARY = "Hello World by Cargo for Rust"
+HOMEPAGE = "https://github.com/jmesmon/rust-hello-world"
+LICENSE = "MIT | Apache-2.0"
+
+S = "${WORKDIR}/git"
+
+BBCLASSEXTEND = "native"
meta/recipes-example/rustfmt/rustfmt_0.8.0.bb new file +67 -0

67 lines not on this page · raw message

scripts/build.sh new file +19 -0
new file mode 100755
index 0000000000..cfff7c1ba8
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Grab the MACHINE from the environment; otherwise, set it to a sane default
+export MACHINE="${MACHINE-qemux86-64}"
+
+# What to build
+BUILD_TARGETS="\
+    rustfmt \
+    "
+
+die() {
+    echo "$*" >&2
+    exit 1
+}
+
+rm -f build/conf/bblayers.conf || die "failed to nuke bblayers.conf"
+rm -f build/conf/local.conf || die "failed to nuke local.conf"
+
+./scripts/containerize.sh bitbake ${BUILD_TARGETS} || die "failed to build"
scripts/cleanup-env.sh new file +14 -0
new file mode 100755
index 0000000000..d2d57295b2
@@ -0,0 +1,14 @@
+#!/bin/bash -x
+
+sudo fuser -m `pwd`/build
+
+# Only attempt to unmount if the directory is already mounted
+if mountpoint -q `pwd`/build; then
+    sudo umount `pwd`/build
+fi
+
+sudo fuser -m `pwd`/build
+
+ps -ef
+
+exit 0
scripts/containerize.sh new file +54 -0

54 lines not on this page · raw message

scripts/fetch.sh new file +103 -0

103 lines not on this page · raw message

scripts/publish-build-cache.sh new file +13 -0
new file mode 100755
index 0000000000..e3a0a1829a
@@ -0,0 +1,13 @@
+#!/bin/bash -x
+
+if [[ $# -lt 1 ]]; then
+    echo "No Yocto branch specified, defaulting to master"
+    echo "To change this pass a Yocto branch name as an argument to this script"
+fi
+branch=${1-master}
+
+rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress build/downloads [email protected]:/srv/yocto-cache/
+
+rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress build/sstate-cache [email protected]:/srv/yocto-cache/${branch}/
+
+exit 0
scripts/setup-env.sh new file +12 -0
new file mode 100755
index 0000000000..dbed06111b
@@ -0,0 +1,12 @@
+#!/bin/bash -e
+
+mkdir -p build
+
+total_mem=`grep MemTotal /proc/meminfo | awk '{print $2}'`
+
+# Only have the slaves with large amounts of RAM mount the tmpfs
+if [ "$total_mem" -ge "67108864" ]; then
+    sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build
+fi
+
+exit 0
Signature · 1 line
2.27.0
#5 lore raw

PATCH 5/8 rust: mv README.md to recipes-devtools/rust/README-rust.md

In reply to Randy MacLeod

Import the meta-rust/README.md but relocate and rename it.

---
 meta/recipes-devtools/rust/README-rust.md | 69 +++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 meta/recipes-devtools/rust/README-rust.md
meta/recipes-devtools/rust/README-rust.md new file +69 -0
new file mode 100644
index 0000000000..329d59ab7b
@@ -0,0 +1,69 @@
+## Introduction
+
+This OpenEmbedded layer provides the rust compiler, tools for building packages
+(cargo), and a few example projects.
+
+## What works:
+
+ - Building `rust-native` and `cargo-native`
+ - Building Rust based projects with Cargo for the TARGET
+   - e.g. `rustfmt` which is used by the CI system
+ - `-buildsdk` and `-crosssdk` packages
+
+## What doesn't:
+
+ - Using anything but x86_64 as the build environment
+ - rust (built for target) issue #81
+
+## What's untested:
+
+ - cargo (built for target)
+
+## Building a rust package
+
+When building a rust package in bitbake, it's usually easiest to build with
+cargo using cargo.bbclass.  If the package already has a Cargo.toml file (most
+rust packages do), then it's especially easy.  Otherwise you should probably
+get the code building in cargo first.
+
+Once your package builds in cargo, you can use
+[cargo-bitbake](https://github.com/cardoe/cargo-bitbake) to generate a bitbake
+recipe for it.  This allows bitbake to fetch all the necessary dependent
+crates, as well as a pegged version of the crates.io index, to ensure maximum
+reproducibility.
+
+NOTE: You will have to edit the generated recipe based on the comments
+contained within it
+
+## TODO
+
+## Pitfalls
+
+ - TARGET_SYS _must_ be different from BUILD_SYS. This is due to the way Rust configuration options are tracked for different targets. This is the reason we use the Yocto triples instead of the native Rust triples. See rust-lang/cargo#3349.
+
+## Dependencies
+
+On the host:
+ - Any `-sys` packages your project might need must have RDEPENDs for
+ the native library.
+
+On the target:
+ - Any `-sys` packages your project might need must have RDEPENDs for
+ the native library.
+
+## Maintainer(s) & Patch policy
+
+Open a Pull Request.
+
+The master branch supports the latest master of poky. When poky creates releases, we will create a branch with the same name as the poky release. This release branch should always work with that poky release. Note that these release branches will typically be less tested than the master branch.
+
+All new patches against rust, rust-llvm, and cargo must have referenced
+upstream issues or PRs opened or an explanation why the patch cannot be
+upstreamed. This cooresponds to the OpenEmbedded policy for other meta layers.
+
+More info can be seen on the wiki.
+
+## Copyright
+
+MIT OR Apache-2.0 - Same as rust
+
Signature · 1 line
2.27.0
#6 lore raw

PATCH 6/8 meta-rust: merge commits

In reply to Randy MacLeod

Merge most of:
git log --oneline --no-merges 5cda04c..029f1ea
with two layer.conf exceptions explained below.

920328c rust-native shouldn't depend on TARGET variables
4e96013 Factor in CARGO_SRC_DIR when setting MANIFEST_PATH.
87e8d50 Keep only the most recent two Rust versions.
53c9aab rust: Drop v8.1a tune for aarch64
7feed5d recipes-example/rust-hello-world: move to new url in meta-rust org
1b94401 readme: fix url and link issue number
26609f4 rust.inc: use 'v8.1a' feature when building for aarch64 instead of 'v8' 71538c8 rust_versions.inc: switch the default version to 1.49.0
c976184 {cargo,rust}-1.49.0: simplify as in https://github.com/meta-rust/meta-rust/pull/299
0025ceb Fix *-native cargo builds
3ab7542 rust-source, rust-snaphost: drop md5sums
b163a89 rust-source, rust-snapshot: simplify as well
0ee328a add rust 1.49.0
3e73030 rust-target.inc: add new include file to simplify all rust_*.bb
9c0a105 rust_versions.inc: add include for easy switching between versions
a31a407 cargo: move LIC_FILES_CHKSUM from cargo_*.bb to cargo.inc where LICENSE is set 1d64f90 rust: move LIC_FILES_CHKSUM from rust-source-*.inc to rust.inc where LICENSE is set 80c30c3 rust-llvm-ncsa.inc: reorder to actually set LICENSE and LIC_FILES_CHKSUM 1cb40bd Revert "rust-llvm: Use early variable assignment for the license checksum in rust-llvm.inc" d5ab20d rust-hello-world: enable LTO in the build
b7eacc0 libstd-rs: embed bitcode for LTO
1936904 cargo: Mark the cargo-native dependency specific to target
5dda6c4 rust-llvm: Use early variable assignment for the license checksum in rust-llvm.inc 47de35e libstd-rs: Remove libunwind on riscv
e297948 rust: Add riscv32/riscv64 support
a679b6f rust: Build rust backend
a59ddd9 rust: Correct the data layout for riscv32
e5ee880 cargo_common: Make output more readable
a673320 cargo: Enable build separation
cb4f829 Use proper llvm-target for armv7
4b151fa add rust 1.47.0
8cfc3c9 clean up some common definitions across rust versions
aec6519 cargo: add missing version 1.46.0
7afffa0 rust-bin.bbclass: Do not use append and += together
2822b50 layer.conf: Add gatesgarth to LAYERSERIES_COMPAT
skip the layer compat change but keep
rust-llvm.inc: export YOCTO_ALTERNATE_EXE_PATH
8a44bae Disable LIBGIT2_SYS_USE_PKG_CONFIG due to incompatibility with 0.28.x b7f9c1d Add rust 1.46.0
647b976 rust: use PARALLEL_MAKE instead of BB_NUMBER_THREADS
8d3f79f rust.inc: whitelist BB_NUMBER_THREADS in do_compile
2c7321d Bump to Rust version 1.43
b84c61e Revert "cargo: fix progress output"
dd0fc89 cargo: fix progress output
afcb58e rust.inc: cut build time in half
40a6bd8 rust.inc: run bootstrap.py in parallel
c023edd rust.inc: make max-atomic-width an integer
3b78365 rust-native shouldn't depend on TARGET variables
8ef8b39 rustfmt: Upgrade to 1.4.2
e4d25b9 layer.conf: Mark it 3.1 release compatible
skip the layer compat change so this commit was omitted
ea97549 Avoid extra sh process from shell wrapper
4a763a2 Update 0001-Disable-http2.patch for cargo 1.41.0
5c7f51b Update to Rust 1.41.0
837b635 cargo: Refresh http2 disable patch
2668f6a Update 0001-Disable-http2.patch for Cargo shipped with Rust 1.40.0
e5c2a40 Update to Rust and Cargo 1.40.0.
72aa4ef rust: Use Python3 native for build
186ec59 rust: Improve TUNE_FEATURE parsing
71895ec Update to Rust and Cargo 1.39.0

---
 meta/classes/cargo.bbclass                    |  13 +-
 meta/classes/cargo_common.bbclass             |  63 +++++--
 meta/classes/rust-bin.bbclass                 |   2 +-
 meta/classes/rust-common.bbclass              |  27 ++-
 meta/conf/distro/include/rust_versions.inc    |  13 ++
 .../cargo-1.37.0/0001-Disable-http2.patch     |  29 ---
 .../0001-Disable-http2.patch                  |  22 +--
 .../0001-Disable-http2.patch                  |  24 +--
 meta/recipes-devtools/cargo/cargo.inc         |  18 +-
 meta/recipes-devtools/cargo/cargo_1.34.2.bb   |   8 -
 meta/recipes-devtools/cargo/cargo_1.36.0.bb   |   8 -
 meta/recipes-devtools/cargo/cargo_1.37.0.bb   |   8 -
 meta/recipes-devtools/cargo/cargo_1.47.0.bb   |   3 +
 meta/recipes-devtools/cargo/cargo_1.49.0.bb   |   3 +
 meta/recipes-devtools/rust/README-rust.md     |   6 +-
 meta/recipes-devtools/rust/libstd-rs.inc      |   9 +
 .../recipes-devtools/rust/libstd-rs_1.34.2.bb |   8 -
 .../recipes-devtools/rust/libstd-rs_1.36.0.bb |   8 -
 .../recipes-devtools/rust/libstd-rs_1.37.0.bb |   8 -
 .../recipes-devtools/rust/libstd-rs_1.47.0.bb |   5 +
 .../recipes-devtools/rust/libstd-rs_1.49.0.bb |   5 +
 meta/recipes-devtools/rust/rust-cross.inc     |  19 ++
 ...t-cross_1.34.2.bb => rust-cross_1.47.0.bb} |   1 -
 ...t-cross_1.36.0.bb => rust-cross_1.49.0.bb} |   1 -
 meta/recipes-devtools/rust/rust-llvm.inc      |  16 +-
 .../recipes-devtools/rust/rust-llvm_1.34.2.bb |  16 --
 .../recipes-devtools/rust/rust-llvm_1.36.0.bb |  16 --
 .../recipes-devtools/rust/rust-llvm_1.37.0.bb |  16 --
 ...st-cross_1.37.0.bb => rust-llvm_1.47.0.bb} |   3 +-
 .../recipes-devtools/rust/rust-llvm_1.49.0.bb |   2 +
 .../rust/rust-snapshot-1.34.2.inc             |  24 ---
 .../rust/rust-snapshot-1.36.0.inc             |  24 ---
 .../rust/rust-snapshot-1.37.0.inc             |  24 ---
 .../rust/rust-snapshot-1.47.0.inc             |  13 ++
 .../rust/rust-snapshot-1.49.0.inc             |  13 ++
 meta/recipes-devtools/rust/rust-snapshot.inc  |   9 +
 .../rust/rust-source-1.34.2.inc               |  11 --
 .../rust/rust-source-1.36.0.inc               |  11 --
 .../rust/rust-source-1.37.0.inc               |  11 --
 .../rust/rust-source-1.47.0.inc               |   3 +
 .../rust/rust-source-1.49.0.inc               |   3 +
 meta/recipes-devtools/rust/rust-source.inc    |   3 +
 .../rust/{rust_1.36.0.bb => rust-target.inc}  |   2 -
 meta/recipes-devtools/rust/rust.inc           | 105 ++++++-----
 ...-dash-vs-underscore-mismatches-in-op.patch |  75 ++++++++
 meta/recipes-devtools/rust/rust_1.34.2.bb     |  12 --
 meta/recipes-devtools/rust/rust_1.37.0.bb     |  12 --
 meta/recipes-devtools/rust/rust_1.47.0.bb     |   9 +
 meta/recipes-devtools/rust/rust_1.49.0.bb     |  15 ++
 .../rust-hello-world/0001-enable-LTO.patch    |  23 +++
 .../rust-hello-world/rust-hello-world_git.bb  |   8 +-
 meta/recipes-example/rustfmt/rustfmt_0.8.0.bb |  67 -------
 meta/recipes-example/rustfmt/rustfmt_1.4.2.bb | 171 ++++++++++++++++++
 53 files changed, 591 insertions(+), 437 deletions(-)
 create mode 100644 meta/conf/distro/include/rust_versions.inc
 delete mode 100644 meta/recipes-devtools/cargo/cargo-1.37.0/0001-Disable-http2.patch
 rename meta/recipes-devtools/cargo/{cargo-1.36.0 => cargo-1.47.0}/0001-Disable-http2.patch (53%)
 rename meta/recipes-devtools/cargo/{cargo-1.34.2 => cargo-1.49.0}/0001-Disable-http2.patch (53%)
 delete mode 100644 meta/recipes-devtools/cargo/cargo_1.34.2.bb
 delete mode 100644 meta/recipes-devtools/cargo/cargo_1.36.0.bb
 delete mode 100644 meta/recipes-devtools/cargo/cargo_1.37.0.bb
 create mode 100644 meta/recipes-devtools/cargo/cargo_1.47.0.bb
 create mode 100644 meta/recipes-devtools/cargo/cargo_1.49.0.bb
 delete mode 100644 meta/recipes-devtools/rust/libstd-rs_1.34.2.bb
 delete mode 100644 meta/recipes-devtools/rust/libstd-rs_1.36.0.bb
 delete mode 100644 meta/recipes-devtools/rust/libstd-rs_1.37.0.bb
 create mode 100644 meta/recipes-devtools/rust/libstd-rs_1.47.0.bb
 create mode 100644 meta/recipes-devtools/rust/libstd-rs_1.49.0.bb
 rename meta/recipes-devtools/rust/{rust-cross_1.34.2.bb => rust-cross_1.47.0.bb} (98%)
 rename meta/recipes-devtools/rust/{rust-cross_1.36.0.bb => rust-cross_1.49.0.bb} (98%)
 delete mode 100644 meta/recipes-devtools/rust/rust-llvm_1.34.2.bb
 delete mode 100644 meta/recipes-devtools/rust/rust-llvm_1.36.0.bb
 delete mode 100644 meta/recipes-devtools/rust/rust-llvm_1.37.0.bb
 rename meta/recipes-devtools/rust/{rust-cross_1.37.0.bb => rust-llvm_1.47.0.bb} (55%)
 create mode 100644 meta/recipes-devtools/rust/rust-llvm_1.49.0.bb
 delete mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.34.2.inc
 delete mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.36.0.inc
 delete mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.37.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.47.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-snapshot-1.49.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-snapshot.inc
 delete mode 100644 meta/recipes-devtools/rust/rust-source-1.34.2.inc
 delete mode 100644 meta/recipes-devtools/rust/rust-source-1.36.0.inc
 delete mode 100644 meta/recipes-devtools/rust/rust-source-1.37.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-source-1.47.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-source-1.49.0.inc
 create mode 100644 meta/recipes-devtools/rust/rust-source.inc
 rename meta/recipes-devtools/rust/{rust_1.36.0.bb => rust-target.inc} (82%)
 create mode 100644 meta/recipes-devtools/rust/rust/0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch
 delete mode 100644 meta/recipes-devtools/rust/rust_1.34.2.bb
 delete mode 100644 meta/recipes-devtools/rust/rust_1.37.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust_1.47.0.bb
 create mode 100644 meta/recipes-devtools/rust/rust_1.49.0.bb
 create mode 100644 meta/recipes-example/rust-hello-world/rust-hello-world/0001-enable-LTO.patch
 delete mode 100644 meta/recipes-example/rustfmt/rustfmt_0.8.0.bb
 create mode 100644 meta/recipes-example/rustfmt/rustfmt_1.4.2.bb
meta/classes/cargo.bbclass +10 -3
index c321e6bf70..c2eee101bd 100644
@@ -15,16 +15,23 @@ BASEDEPENDS_append = " cargo-native"
 DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
 DEPENDS_append_class-native = " rust-native"
 
-# Cargo only supports in-tree builds at the moment
-B = "${S}"
+# Enable build separation
+B = "${WORKDIR}/build"
 
 # In case something fails in the build process, give a bit more feedback on
 # where the issue occured
 export RUST_BACKTRACE = "1"
 
+# The directory of the Cargo.toml relative to the root directory, per default
+# assume there's a Cargo.toml directly in the root directory
+CARGO_SRC_DIR ??= ""
+
+# The actual path to the Cargo.toml
+MANIFEST_PATH ??= "${S}/${CARGO_SRC_DIR}/Cargo.toml"
+
 RUSTFLAGS ??= ""
 BUILD_MODE = "${@['--release', ''][d.getVar('DEBUG_BUILD') == '1']}"
-CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} ${BUILD_MODE}"
+CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} ${BUILD_MODE} --manifest-path=${MANIFEST_PATH}"
 
 # This is based on the content of CARGO_BUILD_FLAGS and generally will need to
 # change if CARGO_BUILD_FLAGS changes.
meta/classes/cargo_common.bbclass +43 -20

91 lines not on this page · raw message

meta/classes/rust-bin.bbclass +1 -1
index a13fbafb56..6819c9e061 100644
@@ -1,6 +1,6 @@
 inherit rust
 
-RDEPENDS_${PN}_append_class-target += "${RUSTLIB_DEP}"
+RDEPENDS_${PN}_append_class-target = " ${RUSTLIB_DEP}"
 
 RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir} -C linker=${RUST_TARGET_CCLD}"
 EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'
meta/classes/rust-common.bbclass +25 -2
index cbc7d3cfe6..ff7b9da8f3 100644
@@ -31,6 +31,24 @@ def determine_libc(d, thing):
 
     return libc
 
+def target_is_armv7(d):
+    '''Determine if target is armv7'''
+    # TUNE_FEATURES may include arm* even if the target is not arm
+    # in the case of *-native packages
+    if d.getVar('TARGET_ARCH') != 'arm':
+        return False
+
+    feat = d.getVar('TUNE_FEATURES')
+    feat = frozenset(feat.split())
+    mach_overrides = d.getVar('MACHINEOVERRIDES')
+    mach_overrides = frozenset(mach_overrides.split(':'))
+
+    v7=frozenset(['armv7a', 'armv7r', 'armv7m', 'armv7ve'])
+    if mach_overrides.isdisjoint(v7) and feat.isdisjoint(v7):
+        return False
+    else:
+        return True
+
 # Responsible for taking Yocto triples and converting it to Rust triples
 def rust_base_triple(d, thing):
     '''
@@ -40,7 +58,12 @@ def rust_base_triple(d, thing):
     Note that os is assumed to be some linux form
     '''
 
-    arch = d.getVar('{}_ARCH'.format(thing))
+    # The llvm-target for armv7 is armv7-unknown-linux-gnueabihf
+    if thing == "TARGET" and target_is_armv7(d):
+        arch = "armv7"
+    else:
+        arch = d.getVar('{}_ARCH'.format(thing))
+
     # All the Yocto targets are Linux and are 'unknown'
     vendor = "-unknown"
     os = d.getVar('{}_OS'.format(thing))
@@ -110,7 +133,7 @@ create_wrapper () {
 
 	cat <<- EOF > "${file}"
 	#!/bin/sh
-	$@ "\$@"
+	exec $@ "\$@"
 	EOF
 	chmod +x "${file}"
 }
meta/conf/distro/include/rust_versions.inc new file +13 -0
new file mode 100644
index 0000000000..8e328a720f
@@ -0,0 +1,13 @@
+# include this in your distribution to easily switch between versions
+# just by changing RUST_VERSION variable
+
+RUST_VERSION ?= "1.49.0"
+
+PREFERRED_VERSION_cargo ?= "${RUST_VERSION}"
+PREFERRED_VERSION_cargo-native ?= "${RUST_VERSION}"
+PREFERRED_VERSION_libstd-rs ?= "${RUST_VERSION}"
+PREFERRED_VERSION_rust ?= "${RUST_VERSION}"
+PREFERRED_VERSION_rust-cross-${TARGET_ARCH} ?= "${RUST_VERSION}"
+PREFERRED_VERSION_rust-llvm ?= "${RUST_VERSION}"
+PREFERRED_VERSION_rust-llvm-native ?= "${RUST_VERSION}"
+PREFERRED_VERSION_rust-native ?= "${RUST_VERSION}"
meta/recipes-devtools/cargo/cargo-1.37.0/0001-Disable-http2.patch deleted +0 -29
deleted file mode 100644
index c804297d48..0000000000
@@ -1,29 +0,0 @@
-From 0e2384133664ebeb548b782ad763c3a627c1bc66 Mon Sep 17 00:00:00 2001
-From: Johan Anderholm <[email protected]>
-Date: Sun, 27 Jan 2019 10:19:00 +0100
-Subject: [PATCH] Disable http2
-
-http2 requires that curl is build with nghttp2 which in turn depends on
-many dependencies and ultimately a dependency loop in the case of
-curl-native. As long as multiplexing is disabled in cargo this should
-be fine.
-
-Upstream-Status: Inappropriate
-
----
- src/tools/cargo/Cargo.toml | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Cargo.toml b/Cargo.toml
-index d15aa2513..ba9c77d25 100644
---- a/Cargo.toml
-+++ b/Cargo.toml
-@@ -24,7 +24,7 @@ bytesize = "1.0"
- crates-io = { path = "crates/crates-io", version = "0.26" }
- crossbeam-utils = "0.6"
- crypto-hash = "0.3.1"
--curl = { version = "0.4.21", features = ['http2'] }
-+curl = { version = "0.4.21" }
- curl-sys = "0.4.18"
- env_logger = "0.6.0"
- pretty_env_logger = { version = "0.3", optional = true }
meta/recipes-devtools/cargo/cargo-1.47.0/0001-Disable-http2.patch renamed from meta/recipes-devtools/cargo/cargo-1.36.0/0001-Disable-http2.patch +11 -11
similarity index 53%
rename from meta/recipes-devtools/cargo/cargo-1.36.0/0001-Disable-http2.patch
rename to meta/recipes-devtools/cargo/cargo-1.47.0/0001-Disable-http2.patch
index 9794ec05f9..b08f7ac133 100644
@@ -1,4 +1,4 @@
-From 42e65192b6f7520b7a05924856e00600961f6758 Mon Sep 17 00:00:00 2001
+From 40802c3a42fab9cfcd27fda8d00e98f8cc30016a Mon Sep 17 00:00:00 2001
 From: Johan Anderholm <[email protected]>
 Date: Sun, 27 Jan 2019 10:19:00 +0100
 Subject: [PATCH] Disable http2
@@ -14,18 +14,18 @@ Upstream-Status: Inappropriate
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Cargo.toml b/Cargo.toml
-index c3fcacf5..bd6ec50b 100644
+index 95cea90c4..56211532f 100644
 --- a/Cargo.toml
 +++ b/Cargo.toml
-@@ -24,7 +24,7 @@ bytesize = "1.0"
- crates-io = { path = "src/crates-io", version = "0.25" }
- crossbeam-utils = "0.6"
+@@ -25,7 +25,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.1" }
+ crates-io = { path = "crates/crates-io", version = "0.31.1" }
+ crossbeam-utils = "0.7"
  crypto-hash = "0.3.1"
--curl = { version = "0.4.21", features = ['http2'] }
-+curl = { version = "0.4.21" }
- curl-sys = "0.4.18"
- env_logger = "0.6.0"
- pretty_env_logger = { version = "0.3", optional = true }
+-curl = { version = "0.4.23", features = ["http2"] }
++curl = { version = "0.4.23" }
+ curl-sys = "0.4.22"
+ env_logger = "0.7.0"
+ pretty_env_logger = { version = "0.4", optional = true }
 -- 
-2.11.0
+2.28.0
 
meta/recipes-devtools/cargo/cargo-1.49.0/0001-Disable-http2.patch renamed from meta/recipes-devtools/cargo/cargo-1.34.2/0001-Disable-http2.patch +13 -11
similarity index 53%
rename from meta/recipes-devtools/cargo/cargo-1.34.2/0001-Disable-http2.patch
rename to meta/recipes-devtools/cargo/cargo-1.49.0/0001-Disable-http2.patch
index a44482a112..51f37d3b51 100644
@@ -1,4 +1,4 @@
-From 44cf21036646e4849e9f8566db7decb7da917394 Mon Sep 17 00:00:00 2001
+From 7f8a197af9c33d0575187663f796f882064136dc Mon Sep 17 00:00:00 2001
 From: Johan Anderholm <[email protected]>
 Date: Sun, 27 Jan 2019 10:19:00 +0100
 Subject: [PATCH] Disable http2
@@ -9,21 +9,23 @@ curl-native. As long as multiplexing is disabled in cargo this should
 be fine.
 
 Upstream-Status: Inappropriate
-
 ---
  Cargo.toml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Cargo.toml b/Cargo.toml
-index 8238380861d9..ced1defea459 100644
+index fde0a3188..a4a51939a 100644
 --- a/Cargo.toml
 +++ b/Cargo.toml
-@@ -24,7 +24,7 @@ bytesize = "1.0"
- crates-io = { path = "src/crates-io", version = "0.23" }
- crossbeam-utils = "0.6"
+@@ -25,7 +25,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.1" }
+ crates-io = { path = "crates/crates-io", version = "0.31.1" }
+ crossbeam-utils = "0.8"
  crypto-hash = "0.3.1"
--curl = { version = "0.4.19", features = ['http2'] }
-+curl = { version = "0.4.19" }
- curl-sys = "0.4.15"
- env_logger = "0.6.0"
- pretty_env_logger = { version = "0.3", optional = true }
+-curl = { version = "0.4.23", features = ["http2"] }
++curl = { version = "0.4.23" }
+ curl-sys = "0.4.22"
+ env_logger = "0.8.1"
+ pretty_env_logger = { version = "0.4", optional = true }
+-- 
+2.28.0
+
meta/recipes-devtools/cargo/cargo.inc +13 -5
index 48012520d9..9645b90df6 100644
@@ -3,10 +3,12 @@ HOMEPAGE = "https://crates.io"
 LICENSE = "MIT | Apache-2.0"
 SECTION = "devel"
 
-DEPENDS = "openssl zlib libgit2 curl ca-certificates libssh2"
+DEPENDS = "openssl zlib curl ca-certificates libssh2"
 
 LIC_FILES_CHKSUM = " \
     file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \
+    file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
+    file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
 "
 
 SRC_URI += "file://0001-Disable-http2.patch"
@@ -29,15 +31,21 @@ do_compile_prepend () {
 
 do_install () {
 	install -d "${D}${bindir}"
-	install -m 755 "${RUSTSRC}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}"
+	install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}"
 }
 
+# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1)
+# as shipped by Yocto Dunfell.
+# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between
+# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off.
+#export LIBGIT2_SYS_USE_PKG_CONFIG = "1"
+
 # Needed for pkg-config to be used
-export LIBGIT2_SYS_USE_PKG_CONFIG = "1"
 export LIBSSH2_SYS_USE_PKG_CONFIG = "1"
 
 BBCLASSEXTEND = "native"
 
-# When building cargo-native we don't have a built cargo to use so we must use
-# the snapshot to bootstrap the build of cargo
+# When building cargo-native we don't have cargo-native to use and depend on,
+# so we must use the locally set up snapshot to bootstrap the build.
+BASEDEPENDS_remove_class-native = "cargo-native"
 CARGO_class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
meta/recipes-devtools/cargo/cargo_1.34.2.bb deleted +0 -8
deleted file mode 100644
index d79f958c6e..0000000000
@@ -1,8 +0,0 @@
-require recipes-devtools/rust/rust-source-${PV}.inc
-require recipes-devtools/rust/rust-snapshot-${PV}.inc
-require cargo.inc
-
-LIC_FILES_CHKSUM += " \
-    file://LICENSE-APACHE;md5=1836efb2eb779966696f473ee8540542 \
-    file://LICENSE-THIRD-PARTY;md5=892ea68b169e69cfe75097fc38a15b56 \
-"
meta/recipes-devtools/cargo/cargo_1.36.0.bb deleted +0 -8
deleted file mode 100644
index f048779aae..0000000000
@@ -1,8 +0,0 @@
-require recipes-devtools/rust/rust-source-${PV}.inc
-require recipes-devtools/rust/rust-snapshot-${PV}.inc
-require cargo.inc
-
-LIC_FILES_CHKSUM += " \
-    file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
-    file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
-"
meta/recipes-devtools/cargo/cargo_1.37.0.bb deleted +0 -8
deleted file mode 100644
index f048779aae..0000000000
@@ -1,8 +0,0 @@
-require recipes-devtools/rust/rust-source-${PV}.inc
-require recipes-devtools/rust/rust-snapshot-${PV}.inc
-require cargo.inc
-
-LIC_FILES_CHKSUM += " \
-    file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
-    file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
-"
meta/recipes-devtools/cargo/cargo_1.47.0.bb new file +3 -0
new file mode 100644
index 0000000000..dd050a82a0
@@ -0,0 +1,3 @@
+require recipes-devtools/rust/rust-source-${PV}.inc
+require recipes-devtools/rust/rust-snapshot-${PV}.inc
+require cargo.inc
meta/recipes-devtools/cargo/cargo_1.49.0.bb new file +3 -0
new file mode 100644
index 0000000000..dd050a82a0
@@ -0,0 +1,3 @@
+require recipes-devtools/rust/rust-source-${PV}.inc
+require recipes-devtools/rust/rust-snapshot-${PV}.inc
+require cargo.inc
meta/recipes-devtools/rust/README-rust.md +3 -3
index 329d59ab7b..400baf700d 100644
@@ -13,7 +13,7 @@ This OpenEmbedded layer provides the rust compiler, tools for building packages
 ## What doesn't:
 
  - Using anything but x86_64 as the build environment
- - rust (built for target) issue #81
+ - rust (built for target) [issue #81](https://github.com/meta-rust/meta-rust/issues/81)
 
 ## What's untested:
 
@@ -27,7 +27,7 @@ rust packages do), then it's especially easy.  Otherwise you should probably
 get the code building in cargo first.
 
 Once your package builds in cargo, you can use
-[cargo-bitbake](https://github.com/cardoe/cargo-bitbake) to generate a bitbake
+[cargo-bitbake](https://github.com/meta-rust/cargo-bitbake) to generate a bitbake
 recipe for it.  This allows bitbake to fetch all the necessary dependent
 crates, as well as a pegged version of the crates.io index, to ensure maximum
 reproducibility.
@@ -39,7 +39,7 @@ contained within it
 
 ## Pitfalls
 
- - TARGET_SYS _must_ be different from BUILD_SYS. This is due to the way Rust configuration options are tracked for different targets. This is the reason we use the Yocto triples instead of the native Rust triples. See rust-lang/cargo#3349.
+ - TARGET_SYS _must_ be different from BUILD_SYS. This is due to the way Rust configuration options are tracked for different targets. This is the reason we use the Yocto triples instead of the native Rust triples. See [rust-lang/cargo#3349](https://github.com/rust-lang/cargo/issues/3349).
 
 ## Dependencies
 
meta/recipes-devtools/rust/libstd-rs.inc +9 -0
index 5298c00706..1bf2dab0a5 100644
@@ -2,17 +2,26 @@ SUMMARY = "Rust standard libaries"
 HOMEPAGE = "http://www.rust-lang.org"
 SECTION = "devel"
 LICENSE = "MIT | Apache-2.0"
+LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
 
 RUSTLIB_DEP = ""
 inherit cargo
 
 DEPENDS_append_libc-musl = " libunwind"
+# rv32 does not have libunwind ported yet
+DEPENDS_remove_riscv32 = "libunwind"
+DEPENDS_remove_riscv64 = "libunwind"
+
+# Embed bitcode in order to allow compiling both with and without LTO
+RUSTFLAGS += "-Cembed-bitcode=yes"
 # Needed so cargo can find libbacktrace
 RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so"
 
 S = "${RUSTSRC}/src/libstd"
 
+CARGO_FEATURES ?= "panic-unwind backtrace"
 CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'"
+CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
 
 do_compile_prepend () {
     export CARGO_TARGET_DIR="${B}"
meta/recipes-devtools/rust/libstd-rs_1.34.2.bb deleted +0 -8
deleted file mode 100644
index 69cb48ad07..0000000000
@@ -1,8 +0,0 @@
-require rust-source-${PV}.inc
-require libstd-rs.inc
-
-LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
-
-CARGO_FEATURES ?= "panic-unwind backtrace"
-
-CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
meta/recipes-devtools/rust/libstd-rs_1.36.0.bb deleted +0 -8
deleted file mode 100644
index 69cb48ad07..0000000000
@@ -1,8 +0,0 @@
-require rust-source-${PV}.inc
-require libstd-rs.inc
-
-LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
-
-CARGO_FEATURES ?= "panic-unwind backtrace"
-
-CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
meta/recipes-devtools/rust/libstd-rs_1.37.0.bb deleted +0 -8
deleted file mode 100644
index 69cb48ad07..0000000000
@@ -1,8 +0,0 @@
-require rust-source-${PV}.inc
-require libstd-rs.inc
-
-LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
-
-CARGO_FEATURES ?= "panic-unwind backtrace"
-
-CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
meta/recipes-devtools/rust/libstd-rs_1.47.0.bb new file +5 -0
new file mode 100644
index 0000000000..4398a22986
@@ -0,0 +1,5 @@
+require rust-source-${PV}.inc
+require libstd-rs.inc
+
+# libstd moved from src/libstd to library/std in 1.47+
+S = "${RUSTSRC}/library/std"
meta/recipes-devtools/rust/libstd-rs_1.49.0.bb new file +5 -0
new file mode 100644
index 0000000000..4398a22986
@@ -0,0 +1,5 @@
+require rust-source-${PV}.inc
+require libstd-rs.inc
+
+# libstd moved from src/libstd to library/std in 1.47+
+S = "${RUSTSRC}/library/std"
meta/recipes-devtools/rust/rust-cross.inc +19 -0
index 4869b85c03..b3698cdb20 100644
@@ -1,6 +1,25 @@
 require rust.inc
 inherit cross
 
+python do_rust_gen_targets () {
+    wd = d.getVar('WORKDIR') + '/targets/'
+    # It is important 'TARGET' is last here so that it overrides our less
+    # informed choices for BUILD & HOST if TARGET happens to be the same as
+    # either of them.
+    for thing in ['BUILD', 'HOST', 'TARGET']:
+        bb.debug(1, "rust_gen_target for " + thing)
+        features = ""
+        cpu = "generic"
+        arch = d.getVar('{}_ARCH'.format(thing))
+        if thing is "TARGET":
+            # arm and armv7 have different targets in llvm
+            if arch == "arm" and target_is_armv7(d):
+                arch = 'armv7'
+            features = d.getVar('TARGET_LLVM_FEATURES') or ""
+            cpu = d.getVar('TARGET_LLVM_CPU')
+        rust_gen_target(d, thing, wd, features, cpu, arch)
+}
+
 # Otherwise we'll depend on what we provide
 INHIBIT_DEFAULT_RUST_DEPS = "1"
 
meta/recipes-devtools/rust/rust-cross_1.47.0.bb renamed from meta/recipes-devtools/rust/rust-cross_1.34.2.bb +0 -1
similarity index 98%
rename from meta/recipes-devtools/rust/rust-cross_1.34.2.bb
rename to meta/recipes-devtools/rust/rust-cross_1.47.0.bb
index bb92b99ccc..ddc25d36b5 100644
@@ -1,3 +1,2 @@
 require rust-cross.inc
 require rust-source-${PV}.inc
-
meta/recipes-devtools/rust/rust-cross_1.49.0.bb renamed from meta/recipes-devtools/rust/rust-cross_1.36.0.bb +0 -1
similarity index 98%
rename from meta/recipes-devtools/rust/rust-cross_1.36.0.bb
rename to meta/recipes-devtools/rust/rust-cross_1.49.0.bb
index bb92b99ccc..ddc25d36b5 100644
@@ -1,3 +1,2 @@
 require rust-cross.inc
 require rust-source-${PV}.inc
-
meta/recipes-devtools/rust/rust-llvm.inc +9 -7
index b4bef3875c..53ae87ed0f 100644
@@ -1,13 +1,13 @@
 SUMMARY = "LLVM compiler framework (packaged with rust)"
-LICENSE = "NCSA"
+LICENSE ?= "Apache-2.0-with-LLVM-exception"
 
 SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch"
 
 S = "${RUSTSRC}/src/llvm-project/llvm"
 
-LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa"
+LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe"
 
-inherit cmake pythonnative
+inherit cmake python3native
 
 DEPENDS += "ninja-native rust-llvm-native"
 
@@ -19,7 +19,7 @@ LLVM_DIR = "llvm${LLVM_RELEASE}"
 
 EXTRA_OECMAKE = " \
     -DCMAKE_BUILD_TYPE=Release \
-    -DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;PowerPC;Mips' \
+    -DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \
     -DLLVM_BUILD_DOCS=OFF \
     -DLLVM_ENABLE_TERMINFO=OFF \
     -DLLVM_ENABLE_ZLIB=OFF \
@@ -44,9 +44,11 @@ EXTRA_OECMAKE_append_class-target = "\
 # provide almost no value. If you really need them then override this
 INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 
-do_install_append_class-target() {
-    # Disable checks on the native tools, since these should came from the native recipe
-    sed -i -e 's/\(.*APPEND.*_IMPORT_CHECK_FILES_FOR_.*{_IMPORT_PREFIX}\/bin\/.*\)/#\1/' ${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config"
+
+do_install_append () {
+    # we don't need any of this stuff to build Rust
+    rm -rf "${D}/usr/lib/cmake"
 }
 
 PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto"
meta/recipes-devtools/rust/rust-llvm_1.34.2.bb deleted +0 -16
deleted file mode 100644
index d41fa28477..0000000000
@@ -1,16 +0,0 @@
-require rust-source-${PV}.inc
-require rust-llvm.inc
-
-LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
-
-do_install_prepend () {
-	# the install does a sed on this without installing the file
-	# we don't need it for anything
-	mkdir -p "${D}/usr/share/llvm/cmake"
-	touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake"
-}
-
-do_install_append () {
-	# we don't need any of this stuff to build Rust
-	rm -rf "${D}/usr/lib/cmake"
-}
meta/recipes-devtools/rust/rust-llvm_1.36.0.bb deleted +0 -16
deleted file mode 100644
index d41fa28477..0000000000
@@ -1,16 +0,0 @@
-require rust-source-${PV}.inc
-require rust-llvm.inc
-
-LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
-
-do_install_prepend () {
-	# the install does a sed on this without installing the file
-	# we don't need it for anything
-	mkdir -p "${D}/usr/share/llvm/cmake"
-	touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake"
-}
-
-do_install_append () {
-	# we don't need any of this stuff to build Rust
-	rm -rf "${D}/usr/lib/cmake"
-}
meta/recipes-devtools/rust/rust-llvm_1.37.0.bb deleted +0 -16
deleted file mode 100644
index d41fa28477..0000000000
@@ -1,16 +0,0 @@
-require rust-source-${PV}.inc
-require rust-llvm.inc
-
-LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=c6b766a4e85dd28301eeed54a6684648"
-
-do_install_prepend () {
-	# the install does a sed on this without installing the file
-	# we don't need it for anything
-	mkdir -p "${D}/usr/share/llvm/cmake"
-	touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake"
-}
-
-do_install_append () {
-	# we don't need any of this stuff to build Rust
-	rm -rf "${D}/usr/lib/cmake"
-}
meta/recipes-devtools/rust/rust-llvm_1.47.0.bb renamed from meta/recipes-devtools/rust/rust-cross_1.37.0.bb +1 -2
similarity index 55%
rename from meta/recipes-devtools/rust/rust-cross_1.37.0.bb
rename to meta/recipes-devtools/rust/rust-llvm_1.47.0.bb
index bb92b99ccc..1dca22bd60 100644
@@ -1,3 +1,2 @@
-require rust-cross.inc
 require rust-source-${PV}.inc
-
+require rust-llvm.inc
meta/recipes-devtools/rust/rust-llvm_1.49.0.bb new file +2 -0
new file mode 100644
index 0000000000..1dca22bd60
@@ -0,0 +1,2 @@
+require rust-source-${PV}.inc
+require rust-llvm.inc
meta/recipes-devtools/rust/rust-snapshot-1.34.2.inc deleted +0 -24
deleted file mode 100644
index d0209bb864..0000000000
@@ -1,24 +0,0 @@
-## This is information on the rust-snapshot (binary) used to build our current release.
-## snapshot info is taken from rust/src/stage0.txt
-## TODO: find a way to add additional SRC_URIs based on the contents of an
-##       earlier SRC_URI.
-RS_VERSION = "1.33.0"
-
-RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-CARGO_VERSION = "0.34.0"
-CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-
-SRC_URI += " \
-	https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.gz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.gz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.gz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	"
-
-# TODO: Add hashes for other architecture toolchains as well. Make a script?
-SRC_URI[rustc-snapshot-x86_64.md5sum] = "c1ec989c1965dce754dda1e54274a68c"
-SRC_URI[rustc-snapshot-x86_64.sha256sum] = "54a342f718b712d8a17fd7878ebd37d22a82ebc70b59c421168cd4153fd04c2b"
-SRC_URI[rust-std-snapshot-x86_64.md5sum] = "d573c5bd3a965c973734c1606968a91e"
-SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "661c2ba717ae1502f002b4c6e7aeb8941685c7ea8fe7ac26ed9ede26f615b7af"
-SRC_URI[cargo-snapshot-x86_64.md5sum] = "de0e635afa9bf495cefecea476bfce36"
-SRC_URI[cargo-snapshot-x86_64.sha256sum] = "4795ae5ca3bb8c7c83ca338676bb02b670efa1eb474e346284b629dc872bcce8"
meta/recipes-devtools/rust/rust-snapshot-1.36.0.inc deleted +0 -24
deleted file mode 100644
index e4b6813e84..0000000000
@@ -1,24 +0,0 @@
-## This is information on the rust-snapshot (binary) used to build our current release.
-## snapshot info is taken from rust/src/stage0.txt
-## TODO: find a way to add additional SRC_URIs based on the contents of an
-##       earlier SRC_URI.
-RS_VERSION = "1.35.0"
-
-RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-CARGO_VERSION = "0.36.0"
-CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-
-SRC_URI += " \
-	https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	"
-
-# TODO: Add hashes for other architecture toolchains as well. Make a script?
-SRC_URI[rustc-snapshot-x86_64.md5sum] = "47ea78f6b3f68e30f24b9c94e465d6bd"
-SRC_URI[rustc-snapshot-x86_64.sha256sum] = "5d6dc216ba429ddf3a1657e70f3e5e380549b546fe56de897677a11d72aa4e07"
-SRC_URI[rust-std-snapshot-x86_64.md5sum] = "348ec23ca8e47fc65079bc80e63cca5f"
-SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "ccff05d0e2d88499505b10f8e33e8b1645df057f918edc81f8acb0fcee9f90b2"
-SRC_URI[cargo-snapshot-x86_64.md5sum] = "93a375e771f3d9b3a139e612dd4730ee"
-SRC_URI[cargo-snapshot-x86_64.sha256sum] = "ab5a6ff1947463dbd2477ca5dac2012494dae821112098ae0c54add652adfdc3"
meta/recipes-devtools/rust/rust-snapshot-1.37.0.inc deleted +0 -24
deleted file mode 100644
index 8d4c1801ed..0000000000
@@ -1,24 +0,0 @@
-## This is information on the rust-snapshot (binary) used to build our current release.
-## snapshot info is taken from rust/src/stage0.txt
-## TODO: find a way to add additional SRC_URIs based on the contents of an
-##       earlier SRC_URI.
-RS_VERSION = "1.36.0"
-
-RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-CARGO_VERSION = "0.37.0"
-CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
-
-SRC_URI += " \
-	https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
-	"
-
-# TODO: Add hashes for other architecture toolchains as well. Make a script?
-SRC_URI[rustc-snapshot-x86_64.md5sum] = "ec27794c94cc1df1a0a69f7244a09176"
-SRC_URI[rustc-snapshot-x86_64.sha256sum] = "fff0158da6f5af2a89936dc3e0c361077c06c2983eb310615e02f81ebbde1416"
-SRC_URI[rust-std-snapshot-x86_64.md5sum] = "b71a6fd6f44527c3bf09584e89ad8958"
-SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "ce8e12684b568a8a4f7d346a743383429849cf3f028f5712ad3d3e31590c8db3"
-SRC_URI[cargo-snapshot-x86_64.md5sum] = "8c661276a0da7a1aa48affbe33b347e6"
-SRC_URI[cargo-snapshot-x86_64.sha256sum] = "d20fa121951339d5492cf8862f8a7af59efc99d18f3c27b95ab6d4658b6a7d67"
meta/recipes-devtools/rust/rust-snapshot-1.47.0.inc new file +13 -0
new file mode 100644
index 0000000000..cdd52f6d3a
@@ -0,0 +1,13 @@
+require rust-snapshot.inc
+
+## This is information on the rust-snapshot (binary) used to build our current release.
+## snapshot info is taken from rust/src/stage0.txt
+## TODO: find a way to add additional SRC_URIs based on the contents of an
+##       earlier SRC_URI.
+RS_VERSION = "1.46.0"
+CARGO_VERSION = "0.47.0"
+
+# TODO: Add hashes for other architecture toolchains as well. Make a script?
+SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "e631d80cb03539769c041ee4566e94e36a271d4b3cdd149e1447d1f77fda979c"
+SRC_URI[rustc-snapshot-x86_64.sha256sum] = "6edcec5367f9fcaee78cbcabfb1f6757fa95d7fd2c0853913223fe20ad534f12"
+SRC_URI[cargo-snapshot-x86_64.sha256sum] = "9da5c4888c6025fa174eaef330337e49666ca9562f876a34d40c03a80d432b8d"
meta/recipes-devtools/rust/rust-snapshot-1.49.0.inc new file +13 -0
new file mode 100644
index 0000000000..18f2b7c25e
@@ -0,0 +1,13 @@
+require rust-snapshot.inc
+
+## This is information on the rust-snapshot (binary) used to build our current release.
+## snapshot info is taken from rust/src/stage0.txt
+## TODO: find a way to add additional SRC_URIs based on the contents of an
+##       earlier SRC_URI.
+RS_VERSION = "1.48.0"
+CARGO_VERSION = "1.48.0"
+
+# TODO: Add hashes for other architecture toolchains as well. Make a script?
+SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "1c00a6a0dabbf6290728b09f9307d9fa6cc985487f727075c68acd4a600ef3f8"
+SRC_URI[rustc-snapshot-x86_64.sha256sum] = "fc4d292a52cbb6b84fb9f065d0d7596064a9b957381d639d5a750d6e2bf02483"
+SRC_URI[cargo-snapshot-x86_64.sha256sum] = "b11d595581e2580c069b5039214e1031a0e4f87ff6490ac39f92f77857e37055"
meta/recipes-devtools/rust/rust-snapshot.inc new file +9 -0
new file mode 100644
index 0000000000..79d03afd1b
@@ -0,0 +1,9 @@
+SRC_URI += " \
+    https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+    https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
+"
+
+RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
+CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
meta/recipes-devtools/rust/rust-source-1.34.2.inc deleted +0 -11
deleted file mode 100644
index 5c83f6f000..0000000000
@@ -1,11 +0,0 @@
-SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust"
-
-SRC_URI[rust.md5sum] = "7c85e6a60dda740295f7e004a1fb15e1"
-SRC_URI[rust.sha256sum] = "c69a4a85a1c464368597df8878cb9e1121aae93e215616d45ad7d23af3052f56"
-
-# later versions of rust change the directory that they unextract to
-RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
-# set this as our default
-S = "${RUSTSRC}"
-
-LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
meta/recipes-devtools/rust/rust-source-1.36.0.inc deleted +0 -11
deleted file mode 100644
index 1a1d07c72f..0000000000
@@ -1,11 +0,0 @@
-SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz;name=rust"
-
-SRC_URI[rust.md5sum] = "78ffc0b029aaed216b45c3fe24747d46"
-SRC_URI[rust.sha256sum] = "f51645b9f787af4a5d94db17f6af39db0c55980ed24fe366cad55b57900f8f2d"
-
-# later versions of rust change the directory that they unextract to
-RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
-# set this as our default
-S = "${RUSTSRC}"
-
-LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
meta/recipes-devtools/rust/rust-source-1.37.0.inc deleted +0 -11
deleted file mode 100644
index 0169cd3fbd..0000000000
@@ -1,11 +0,0 @@
-SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz;name=rust"
-
-SRC_URI[rust.md5sum] = "ee6300b1d7e5767115492915c4c0d8ef"
-SRC_URI[rust.sha256sum] = "10abffac50a729cf74cef6dd03193a2f4647541bd19ee9281be9e5b12ca8cdfd"
-
-# later versions of rust change the directory that they unextract to
-RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
-# set this as our default
-S = "${RUSTSRC}"
-
-LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
meta/recipes-devtools/rust/rust-source-1.47.0.inc new file +3 -0
new file mode 100644
index 0000000000..6bf6e726b1
@@ -0,0 +1,3 @@
+require rust-source.inc
+
+SRC_URI[rust.sha256sum] = "ec2c81d2d34890486094a6407589be96161e4e301c238332d32c6dbae4f38ea2"
meta/recipes-devtools/rust/rust-source-1.49.0.inc new file +3 -0
new file mode 100644
index 0000000000..645fa2819b
@@ -0,0 +1,3 @@
+require rust-source.inc
+
+SRC_URI[rust.sha256sum] = "ebe910edc824a0a037a10be443446a0511923ba8342fa3c331ec8a22481d5d15"
meta/recipes-devtools/rust/rust-source.inc new file +3 -0
new file mode 100644
index 0000000000..52502fb49f
@@ -0,0 +1,3 @@
+SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz;name=rust"
+
+RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
meta/recipes-devtools/rust/rust-target.inc renamed from meta/recipes-devtools/rust/rust_1.36.0.bb +0 -2
similarity index 82%
rename from meta/recipes-devtools/rust/rust_1.36.0.bb
rename to meta/recipes-devtools/rust/rust-target.inc
index c7f9f4fd87..0a5b127f3c 100644
@@ -1,6 +1,4 @@
 require rust.inc
-require rust-source-${PV}.inc
-require rust-snapshot-${PV}.inc
 
 DEPENDS += "rust-llvm (=${PV})"
 
meta/recipes-devtools/rust/rust.inc +60 -45

243 lines not on this page · raw message

meta/recipes-devtools/rust/rust/0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch new file +75 -0

75 lines not on this page · raw message

meta/recipes-devtools/rust/rust_1.34.2.bb deleted +0 -12
deleted file mode 100644
index c7f9f4fd87..0000000000
@@ -1,12 +0,0 @@
-require rust.inc
-require rust-source-${PV}.inc
-require rust-snapshot-${PV}.inc
-
-DEPENDS += "rust-llvm (=${PV})"
-
-# Otherwise we'll depend on what we provide
-INHIBIT_DEFAULT_RUST_DEPS_class-native = "1"
-# We don't need to depend on gcc-native because yocto assumes it exists
-PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust"
-
-BBCLASSEXTEND = "native"
meta/recipes-devtools/rust/rust_1.37.0.bb deleted +0 -12
deleted file mode 100644
index c7f9f4fd87..0000000000
@@ -1,12 +0,0 @@
-require rust.inc
-require rust-source-${PV}.inc
-require rust-snapshot-${PV}.inc
-
-DEPENDS += "rust-llvm (=${PV})"
-
-# Otherwise we'll depend on what we provide
-INHIBIT_DEFAULT_RUST_DEPS_class-native = "1"
-# We don't need to depend on gcc-native because yocto assumes it exists
-PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust"
-
-BBCLASSEXTEND = "native"
meta/recipes-devtools/rust/rust_1.47.0.bb new file +9 -0
new file mode 100644
index 0000000000..894f715e16
@@ -0,0 +1,9 @@
+require rust-target.inc
+require rust-source-${PV}.inc
+require rust-snapshot-${PV}.inc
+
+# The default behaviour of x.py changed in 1.47+ so now we need to
+# explicitly ask for the stage 2 compiler to be assembled.
+do_compile () {
+    rust_runx build --stage 2 src/rustc
+}
meta/recipes-devtools/rust/rust_1.49.0.bb new file +15 -0
new file mode 100644
index 0000000000..96d625f6c3
@@ -0,0 +1,15 @@
+require rust-target.inc
+require rust-source-${PV}.inc
+require rust-snapshot-${PV}.inc
+
+SRC_URI += "\
+    file://0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch \
+    "
+
+do_compile () {
+    rust_runx build --stage 2
+}
+
+rust_do_install() {
+    rust_runx install
+}
meta/recipes-example/rust-hello-world/rust-hello-world/0001-enable-LTO.patch new file +23 -0
new file mode 100644
index 0000000000..56ef9e73e6
@@ -0,0 +1,23 @@
+From fa40b874f6470ec11a8fd7b0c9909d0cdd2d6feb Mon Sep 17 00:00:00 2001
+From: Dan Callaghan <[email protected]>
+Date: Fri, 5 Feb 2021 08:56:34 +1000
+Subject: [PATCH] enable LTO
+
+---
+ Cargo.toml | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index 7a2f6c8..cdb6b5d 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -3,3 +3,6 @@
+ name = "rust-hello-world"
+ version = "0.0.1"
+ authors = ["Cody P Schafer <[email protected]>"]
++
++[profile.release]
++lto = true
+-- 
+2.28.0
+
meta/recipes-example/rust-hello-world/rust-hello-world_git.bb +6 -2
index ba8854849d..c29eac34e5 100644
@@ -1,11 +1,15 @@
 inherit cargo
 
-SRC_URI = "git://github.com/jmesmon/rust-hello-world.git;protocol=https"
+SRC_URI = "git://github.com/meta-rust/rust-hello-world.git;protocol=https"
 SRCREV="e0fa23f1a3cb1eb1407165bd2fc36d2f6e6ad728"
 LIC_FILES_CHKSUM="file://COPYRIGHT;md5=e6b2207ac3740d2d01141c49208c2147"
 
+SRC_URI += "\
+    file://0001-enable-LTO.patch \
+    "
+
 SUMMARY = "Hello World by Cargo for Rust"
-HOMEPAGE = "https://github.com/jmesmon/rust-hello-world"
+HOMEPAGE = "https://github.com/meta-rust/rust-hello-world"
 LICENSE = "MIT | Apache-2.0"
 
 S = "${WORKDIR}/git"
meta/recipes-example/rustfmt/rustfmt_0.8.0.bb deleted +0 -67

67 lines not on this page · raw message

meta/recipes-example/rustfmt/rustfmt_1.4.2.bb new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
2.27.0
#7 lore raw

PATCH 7/8 cargo/rust/rustfmt: exclude from world

In reply to Randy MacLeod

cargo, rust, and rustfmt can't be built for the targets yet so exclude them from world builds.

---
 meta/recipes-devtools/cargo/cargo.inc         | 1 +
 meta/recipes-example/rustfmt/rustfmt_1.4.2.bb | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/cargo/cargo.inc +1 -0
index 9645b90df6..5118cc1ab1 100644
@@ -15,6 +15,7 @@ SRC_URI += "file://0001-Disable-http2.patch"
 
 S = "${RUSTSRC}/src/tools/cargo"
 CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
+EXCLUDE_FROM_WORLD = "1"
 
 inherit cargo
 
meta/recipes-example/rustfmt/rustfmt_1.4.2.bb +1 -1
index ecced49049..b7deb4097c 100644
@@ -11,7 +11,7 @@ SRC_URI += "git://github.com/rust-lang/rustfmt/;protocol=https;nobranch=1"
 SRCREV = "aeb3496f31a0dfa90fc511520d2023634e885260"
 S = "${WORKDIR}/git"
 CARGO_SRC_DIR = ""
-
+EXCLUDE_FROM_WORLD = "1"
 
 # please note if you have entries that do not begin with crate://
 # you must change them to how that package can be fetched
Signature · 1 line
2.27.0
#8 lore raw

PATCH 8/8 rust: add a language demo image to test reproducibility

In reply to Randy MacLeod

The image should contain a demo program from a variety of languages but let's start with rust.

---
 meta/recipes-devtools/images/core-image-languages.bb | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 meta/recipes-devtools/images/core-image-languages.bb
meta/recipes-devtools/images/core-image-languages.bb new file +12 -0
new file mode 100644
index 0000000000..087a2a8aba
@@ -0,0 +1,12 @@
+SUMMARY = "A small image to test language support."
+
+IMAGE_INSTALL = "packagegroup-core-boot rust-hello-world ${CORE_IMAGE_EXTRA_INSTALL}"
+
+IMAGE_LINGUAS = " "
+
+LICENSE = "MIT"
+
+inherit core-image
+
+IMAGE_ROOTFS_SIZE ?= "8192"
+IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
Signature · 1 line
2.27.0
#9 lore raw
In reply to Randy MacLeod
Quoted 12 lines · Randy MacLeod

Clean-up the merge of meta-rust to oe-core by squashing most of the meta-rust history so we are left with:

  35da4b252f rust: add a language demo image to test reproducibility 088374371b cargo/rust/rustfmt: exclude from world 7df10d2a22 meta-rust: merge commits
  4187796cd6 rust: mv README.md to recipes-devtools/rust/README-rust.md 03b9c60ef4 meta-rust: move code to oe-core from meta-rust layer 2c62874204 libgit2: pull in updates from meta-oe 24cb3db88c libssh2: pull in additional commits from meta-oe e9a0a3bad2 Add libgit2, libssh2 from meta-oe for rust

Quoted 4 lines

The full diffstat is below. (1)

I didn't really notice the scripts shown below since they are mostly harmless. I'll review them and remove them in v2 if they don't make sense for oe-core.

This is better, thanks. My feedback from a quick glance:

a) Need maintainer entries for the new recipes
b) The scripts in scripts/ look at the very least inappropriately named for OE-Core, I suspect we don't want/need those.
c) Not entirely sure about the languages demo image, its not how we test any other language
d) There aren't any tests in meta/lib/oeqa!
e) The rust README starts "This OpenEmbedded layer provides" and has a few other issues.

Cheers,

Richard

#10 lore raw
Quoted 13 lines · Richard Purdie
Quoted 12 lines · Randy MacLeod

Clean-up the merge of meta-rust to oe-core by squashing most of the meta-rust history so we are left with:

  35da4b252f rust: add a language demo image to test reproducibility 088374371b cargo/rust/rustfmt: exclude from world 7df10d2a22 meta-rust: merge commits
  4187796cd6 rust: mv README.md to recipes-devtools/rust/README-rust.md 03b9c60ef4 meta-rust: move code to oe-core from meta-rust layer 2c62874204 libgit2: pull in updates from meta-oe 24cb3db88c libssh2: pull in additional commits from meta-oe e9a0a3bad2 Add libgit2, libssh2 from meta-oe for rust

Quoted 6 lines
Quoted 4 lines

The full diffstat is below. (1)

I didn't really notice the scripts shown below since they are mostly harmless. I'll review them and remove them in v2 if they don't make sense for oe-core.

This is better, thanks. My feedback from a quick glance:

Thanks for the comments.

Quoted 2 lines

a) Need maintainer entries for the new recipes

Fixed by adding myself but making it clear that other maintainers are welcome. Once libssh/libgit2 are in master, I'll do the same for them since they are unassigned in master-next.

Quoted 2 lines

b) The scripts in scripts/ look at the very least inappropriately named for OE-Core, I suspect we don't want/need those.

Working on that next (after 2 more meetings...).

Quoted 2 lines

c) Not entirely sure about the languages demo image, its not how we test any other language

Removed.

Quoted 1 line

d) There aren't any tests in meta/lib/oeqa!

To come. Is:
meta/lib/oeqa/selftest/cases/gotoolchain.py
a good first step as I mentioned earlier?

Quoted 2 lines

e) The rust README starts "This OpenEmbedded layer provides" and has a few other issues.

Fixed.

To Do List
==========

1) cargo-bitbake - the README suggest adding this using desktop cargo but once we get the SDK merged, it should be added there. Someone suggested using devtool for this rather than cargo-bitbake.

2) Fix the SDK libcrypto, libstdc++ glibc-2.33 problem. I'm running a git bisect using poky, meta-oe/master, meta-rust+SDK patches.

N) Remaining bugs in:

---

Would it be worth adding this to master-next in the next few days to confirm that rust-hello-world builds for all the supported machines? I suspect that will work but I've mostly used Ubuntu so it'd be good to get some coverage testing.

Signature · 2 lines
# Randy MacLeod
# Wind River Linux
#11 lore raw
Quoted 26 lines · Randy MacLeod
Quoted 13 lines · Richard Purdie
Quoted 12 lines · Randy MacLeod

Clean-up the merge of meta-rust to oe-core by squashing most of the meta-rust history so we are left with:

   35da4b252f rust: add a language demo image to test reproducibility 088374371b cargo/rust/rustfmt: exclude from world 7df10d2a22 meta-rust: merge commits
   4187796cd6 rust: mv README.md to recipes-devtools/rust/README-rust.md 03b9c60ef4 meta-rust: move code to oe-core from meta-rust layer 2c62874204 libgit2: pull in updates from meta-oe 24cb3db88c libssh2: pull in additional commits from meta-oe e9a0a3bad2 Add libgit2, libssh2 from meta-oe for rust

Quoted 6 lines
Quoted 4 lines

The full diffstat is below. (1)

I didn't really notice the scripts shown below since they are mostly harmless. I'll review them and remove them in v2 if they don't make sense for oe-core.

This is better, thanks. My feedback from a quick glance:

Thanks for the comments.

Quoted 2 lines

a) Need maintainer entries for the new recipes

Quoted 8 lines

Fixed by adding myself but making it clear that other maintainers are welcome. Once libssh/libgit2 are in master, I'll do the same for them since they are unassigned in master-next.

Quoted 2 lines

b) The scripts in scripts/ look at the very least inappropriately named for OE-Core, I suspect we don't want/need those.

Working on that next (after 2 more meetings...).

You're right, they are not useful for oe-core.
Removed.

Quoted 11 lines
Quoted 3 lines

c) Not entirely sure about the languages demo image, its not how we test any other language

Removed.

Quoted 1 line

d) There aren't any tests in meta/lib/oeqa!

To come. Is:
  meta/lib/oeqa/selftest/cases/gotoolchain.py
a good first step as I mentioned earlier?

??
I'll start on that next.

Quoted 11 lines
Quoted 3 lines

e) The rust README starts "This OpenEmbedded layer provides" and has a few other issues.

Fixed.

To Do List
==========

Quoted 6 lines

1) cargo-bitbake - the README suggest adding this using desktop cargo but once we get the SDK merged, it should be added there. Someone suggested using devtool for this rather than cargo-bitbake.

2) Fix the SDK libcrypto, libstdc++ glibc-2.33 problem. I'm running a git bisect using poky, meta-oe/master, meta-rust+SDK patches.

Coming along.

Quoted 2 lines

N) Remaining bugs in:

*Some* of the remaining bugs in:
https://github.com/meta-rust/meta-rust/issues

Quoted 11 lines

---

Would it be worth adding this to master-next in the next few days to confirm that rust-hello-world builds for all the supported machines? I suspect that will work but I've mostly used Ubuntu so it'd be good to get some coverage testing.

Updated commit history:

86109491bc maintainers: Add myself as maintainer for rust pkgs 791684e0c1 cargo/rust/rustfmt: exclude from world b411e322b3 rust: remove container build scripts used by meta-rust c646d47ebc rust: update the README to conform to being in oe-core e19d823567 meta-rust: merge commits
...

This last commit also squashes a new commit from meta-rust:
f8b9103 Remove checks for Rust versions we don't build anymore.

I'll test it and if you have capacity on the AB tonight, I can send you a v2 in an hour or so.

Signature · 2 lines
# Randy MacLeod
# Wind River Linux

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw
Quoted 13 lines · Richard Purdie via lists.openembedded.org
Quoted 12 lines · Randy MacLeod

Clean-up the merge of meta-rust to oe-core by squashing most of the meta-rust history so we are left with:

  35da4b252f rust: add a language demo image to test reproducibility 088374371b cargo/rust/rustfmt: exclude from world 7df10d2a22 meta-rust: merge commits
  4187796cd6 rust: mv README.md to recipes-devtools/rust/README-rust.md 03b9c60ef4 meta-rust: move code to oe-core from meta-rust layer 2c62874204 libgit2: pull in updates from meta-oe 24cb3db88c libssh2: pull in additional commits from meta-oe e9a0a3bad2 Add libgit2, libssh2 from meta-oe for rust

Quoted 8 lines
Quoted 4 lines

The full diffstat is below. (1)

I didn't really notice the scripts shown below since they are mostly harmless. I'll review them and remove them in v2 if they don't make sense for oe-core.

This is better, thanks. My feedback from a quick glance:

a) Need maintainer entries for the new recipes

In the interests of moving things forward, I added entries for libgit2 and libssh2 and queued those bits in master-next since they seem near enough ready.

There are other recipes which will need maintainers entries.

Cheers,

Richard