cargo-native builds

This commit is contained in:
Cody P Schafer
2014-12-01 11:06:00 -05:00
parent d45bd8f7a3
commit e7917112b6
6 changed files with 58 additions and 8 deletions

View File

@@ -41,6 +41,14 @@ rpath = true
EOF
}
# All the rust & cargo ecosystem assume that CC, LD, etc are a path to a single
# command. Fixup the ones we give it so that is the case.
# XXX: this is hard coded based on meta/conf/bitbake.conf
# TODO: we do quite a bit very similar to this in rust.inc, see if it can be
# generalized.
export RUST_CC = "${CCACHE}${TARGET_PREFIX}gcc"
export RUST_CFLAGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${CFLAGS}"
oe_cargo_build () {
# FIXME: if there is already an entry for this target, in an existing
# cargo/config, this won't work.
@@ -53,6 +61,8 @@ oe_cargo_build () {
cargo_do_compile () {
cd "${B}"
export CC="${RUST_CC}"
export CFLAGS="${RUST_CFLAGS}"
oe_cargo_build
}

View File

@@ -44,7 +44,6 @@ RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}"
RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}"
RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}"
# BUILD_LDFLAGS
# ${STAGING_LIBDIR_NATIVE}
# ${STAGING_BASE_LIBDIR_NATIVE}

View File

@@ -1,4 +1,6 @@
inherit cargo
inherit patch
SUMMARY = "Cargo downloads your Rust project's dependencies and builds your project"
HOMEPAGE = "http://crates.io"
SECTION = "devel"
@@ -19,12 +21,6 @@ PV .= "+git${SRCPV}"
S = "${WORKDIR}/git"
B = "${S}"
do_cargo_config_patch () {
rust_cargo_patch
}
addtask cargo_config_patch after do_patch before do_configure
do_cargo_config_patch[dirs] = "${WORKDIR}"
do_configure () {
"${S}/configure" \
"--prefix=${prefix}" \
@@ -45,6 +41,8 @@ do_configure () {
}
do_compile () {
export CC="${RUST_CC}"
export CFLAGS="${RUST_CFLAGS}"
oe_runmake ARGS="--verbose"
}

View File

@@ -7,12 +7,16 @@ SRC_URI += " \
file://curl-rust/0001-openssl-sys-is-used-in-curl-rust-so-include-it-expli.patch;patchdir=../curl-rust \
\
git://github.com/alexcrichton/gcc-rs.git;protocol=https;name=gcc-rs;destsuffix=gcc-rs \
\
git://github.com/alexcrichton/ssh2-rs.git;protocol=https;name=ssh2-rs;destsuffix=ssh2-rs \
file://ssh2-rs/0001-Unconditionally-depend-on-openssl-sys.patch;patchdir=../ssh2-rs \
"
#file://gcc-rs/0001-XXX-hacks.patch;patchdir=../gcc-rs
SRCREV_curl-rust = "c1b96e146f6752353a1e84cca932c628e6bf73af"
SRCREV_gcc-rs = "903e8f8a2e3766ad3d514404d452dbaa1d3b2d79"
SRCREV_FORMAT = "cargo_curl-rust_gcc-rs"
SRCREV_ssh2-rs = "922531da4c22abe7a216672314315d41769d7fb1"
SRCREV_FORMAT = "cargo_curl-rust_gcc-rs_ssh2-rs"
EXTRA_OECARGO_PATHS = "\
${WORKDIR}/curl-rust \
${WORKDIR}/gcc-rs \

View File

@@ -0,0 +1,35 @@
From 89782cabdc9848865845b2d00a444074ce3d59e7 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 1 Dec 2014 10:51:31 -0500
Subject: [PATCH] Unconditionally depend on openssl-sys
---
libssh2-sys/Cargo.toml | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/libssh2-sys/Cargo.toml b/libssh2-sys/Cargo.toml
index b16493b..10ad017 100644
--- a/libssh2-sys/Cargo.toml
+++ b/libssh2-sys/Cargo.toml
@@ -12,17 +12,7 @@ path = "lib.rs"
[dependencies.libz-sys]
git = "https://github.com/alexcrichton/libz-sys"
-[target.i686-apple-darwin.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.x86_64-apple-darwin.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.i686-unknown-linux-gnu.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.x86_64-unknown-linux-gnu.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.i686-unknown-freebsd.dependencies.openssl-sys]
- git = "https://github.com/sfackler/rust-openssl"
-[target.x86_64-unknown-freebsd.dependencies.openssl-sys]
+[dependencies.openssl-sys]
git = "https://github.com/sfackler/rust-openssl"
[build-dependencies.pkg-config]
--
2.1.3

View File

@@ -340,6 +340,10 @@ rust_do_install () {
for tgt in "${WORKDIR}/targets/"* ; do
install -m 0644 "$tgt" "$td"
done
## rust will complain about multiple providers of the runtime libs
## (libstd, libsync, etc.) without this.
ln -sf "${D}${libdir}/rustlib/${HOST_SYS}/lib/lib*.so" "${D}${libdir}/"
}
do_install () {