From 6ba4aebdce8cd9d67a1f509449f9b18300cd5be9 Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Tue, 16 Jun 2015 16:54:35 -0400 Subject: [PATCH 1/3] rust: enable debuginfo This gets split out in do_package, so there's no harm in including it. It is useful to be able to get debug info for the standard library by installing the -dbg package. --- recipes/rust/rust.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc index 19e3548..e6f25c8 100644 --- a/recipes/rust/rust.inc +++ b/recipes/rust/rust.inc @@ -306,6 +306,7 @@ do_configure () { "--disable-docs" \ "--disable-manage-submodules" \ "--disable-debug" \ + "--enable-debuginfo" \ "--enable-optimize" \ "--enable-optimize-cxx" \ "--enable-optimize-llvm" \ From 411f10502c02d3ad7349c9c9521a831c7a5ad959 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 18 Jun 2015 15:19:14 -0400 Subject: [PATCH 2/3] rust-llvm-native: build LLVM in its own recipe rust takes a painfully long time to build. A non-trivial part of that is building LLVM. Fortuitiously, the LLVM component is common between the -native compiler and all variants of the -cross compiler. That means we can build it once, and reuse the output for any flavor of rust. That saves build time, and it utilizes bitbake's sstate more efficiently. It's win/win! --- recipes/rust/rust-llvm-native_1.1.0.bb | 27 ++++++++++++++++++++++++++ recipes/rust/rust-release.inc | 1 - recipes/rust/rust_1.1.0.bb | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 recipes/rust/rust-llvm-native_1.1.0.bb diff --git a/recipes/rust/rust-llvm-native_1.1.0.bb b/recipes/rust/rust-llvm-native_1.1.0.bb new file mode 100644 index 0000000..207bd2c --- /dev/null +++ b/recipes/rust/rust-llvm-native_1.1.0.bb @@ -0,0 +1,27 @@ +SUMMARY = "LLVM compiler framework (packaged with rust)" +LICENSE = "NCSA" + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=47e311aa9caedd1b3abf098bd7814d1d" + +# 1.1.0 +require rust-release.inc +SRC_URI[rust.md5sum] = "5f2f923f8d1c77a55721d1f0813a158a" +SRC_URI[rust.sha256sum] = "cb09f443b37ec1b81fe73c04eb413f9f656859cf7d00bc5088008cbc2a63fa8a" + +S = "${WORKDIR}/rustc-${PV}/src/llvm" + +inherit autotools +inherit native + +EXTRA_OECONF += "--enable-targets=x86,x86_64,arm,aarch64,mips,powerpc" +EXTRA_OECONF += "--enable-optimized" +EXTRA_OECONF += "--disable-bindings" + +do_install_append () { + cd ${D}${bindir} + ln -s *-llc llc + for i in *-llvm-*; do + link=$(echo $i | sed -e 's/.*-llvm-\(.*\)/\1/') + ln -s $i llvm-$link + done +} diff --git a/recipes/rust/rust-release.inc b/recipes/rust/rust-release.inc index fd8e3da..7ece6e1 100644 --- a/recipes/rust/rust-release.inc +++ b/recipes/rust/rust-release.inc @@ -3,5 +3,4 @@ SRC_URI = "\ " S = "${WORKDIR}/rustc-${PV}" -require rust.inc diff --git a/recipes/rust/rust_1.1.0.bb b/recipes/rust/rust_1.1.0.bb index 7ada207..5e75bd8 100644 --- a/recipes/rust/rust_1.1.0.bb +++ b/recipes/rust/rust_1.1.0.bb @@ -1,5 +1,6 @@ # 1.1.0 require rust-release.inc +require rust.inc SRC_URI[rust.md5sum] = "5f2f923f8d1c77a55721d1f0813a158a" SRC_URI[rust.sha256sum] = "cb09f443b37ec1b81fe73c04eb413f9f656859cf7d00bc5088008cbc2a63fa8a" From 2af0e67983fc108779e8153300c5a7c8daab8eca Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 18 Jun 2015 15:30:09 -0400 Subject: [PATCH 3/3] rust.inc: use separately-built LLVM This makes builds more efficient, in that we only have to rebuild llvm when llvm changes, rather than every time rustc changes --- recipes/rust/rust.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc index e6f25c8..e80c9f7 100644 --- a/recipes/rust/rust.inc +++ b/recipes/rust/rust.inc @@ -8,6 +8,9 @@ LICENSE = "MIT | Apache-2.0" B = "${WORKDIR}/build" +DEPENDS += "rust-llvm-native" +DEPENDS_class-cross += "rust-llvm-native" + # Avoid having the default bitbake.conf disable sub-make parallelization EXTRA_OEMAKE = "" @@ -272,6 +275,8 @@ python do_rust_arch_fixup () { addtask rust_arch_fixup before do_configure after do_patch do_rust_arch_fixup[dirs] = "${S}/mk/cfg" +llvmdir = "${STAGING_DIR_NATIVE}/${prefix_native}" + do_configure () { # FIXME: target_prefix vs prefix, see cross.bbclass @@ -309,7 +314,7 @@ do_configure () { "--enable-debuginfo" \ "--enable-optimize" \ "--enable-optimize-cxx" \ - "--enable-optimize-llvm" \ + "--llvm-root=${llvmdir}" \ "--enable-optimize-tests" \ "--prefix=${prefix}" \ "--target=${TARGET_SYS}" \