Merge remote-tracking branch 'upstream/master' into merge-upstream
Conflicts: conf/distro/include/rust_security_flags.inc conf/layer.conf recipes-devtools/cargo/cargo_git.bb recipes-devtools/cargo/files/0001-update-Rust.patch recipes-devtools/cargo/files/0001-update-pkg-versions.patch recipes-devtools/cargo/files/curl-rust/0001-curl-sys-avoid-explicitly-linking-in-openssl.-If-it-.patch recipes-devtools/cargo/files/curl-rust/0002-remove-per-triple-deps-on-openssl-sys.patch recipes-devtools/cargo/files/git2-rs/0001-Add-generic-openssl-sys-dep.patch recipes-devtools/cargo/files/git2-rs/0002-libgit2-sys-avoid-the-build-script-it-is-a-disaster.patch recipes-devtools/cargo/files/git2-rs/0003-bump-libssh2-to-fix-build-with-nightly.patch recipes-devtools/cargo/files/ssh2-rs/0001-Unconditionally-depend-on-openssl-sys.patch recipes-devtools/rust/files/rust-1.3.0/0001-platform.mk-avoid-choking-on-i586.patch recipes-devtools/rust/files/rust-1.3.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch recipes-devtools/rust/files/rust-1.3.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch recipes-devtools/rust/files/rust-1.3.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch recipes-devtools/rust/files/rust-1.3.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch recipes-devtools/rust/files/rust-1.3.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch recipes-devtools/rust/files/rust-1.3.0/0007-mk-install-use-disable-rewrite-paths.patch recipes-devtools/rust/files/rust-1.3.0/0008-install-disable-ldconfig.patch recipes-devtools/rust/files/rust-1.3.0/0009-Remove-crate-metadata-from-symbol-hashing.patch recipes-devtools/rust/files/rust-1.3.0/0010-mk-tell-rustc-that-we-re-only-looking-for-native-lib.patch recipes-devtools/rust/files/rust-git/0001-platform.mk-avoid-choking-on-i586.patch recipes-devtools/rust/files/rust-git/0002-Target-add-default-target.json-path-libdir-rust-targ.patch recipes-devtools/rust/files/rust-git/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch recipes-devtools/rust/files/rust-git/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch recipes-devtools/rust/files/rust-git/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch recipes-devtools/rust/files/rust-git/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch recipes-devtools/rust/files/rust-git/0007-mk-install-use-disable-rewrite-paths.patch recipes-devtools/rust/files/rust-git/0008-install-disable-ldconfig.patch recipes-devtools/rust/files/rust/0001-platform.mk-avoid-choking-on-i586.patch recipes-devtools/rust/files/rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch recipes-devtools/rust/files/rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch recipes-devtools/rust/files/rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch recipes-devtools/rust/files/rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch recipes-devtools/rust/files/rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch recipes-devtools/rust/files/rust/0009-Remove-crate-metadata-from-symbol-hashing.patch recipes-devtools/rust/rust-1.3.0.inc recipes-devtools/rust/rust-git.inc recipes-devtools/rust/rust-llvm_1.3.0.bb recipes-devtools/rust/rust.inc recipes-devtools/rust/rust_1.3.0.bb recipes-devtools/rust/rust_git.bb recipes/rust/files/rust-1.3.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch recipes/rust/files/rust-1.3.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch recipes/rust/files/rust-git/0001-platform.mk-avoid-choking-on-i586.patch recipes/rust/files/rust-git/0002-Target-add-default-target.json-path-libdir-rust-targ.patch recipes/rust/files/rust-git/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch
This commit is contained in:
@@ -5,7 +5,7 @@ export CARGO_HOME = "${WORKDIR}/cargo_home"
|
||||
|
||||
def cargo_base_dep(d):
|
||||
deps = ""
|
||||
if not d.getVar('INHIBIT_DEFAULT_DEPS') and not d.getVar('INHIBIT_CARGO_DEP'):
|
||||
if not d.getVar('INHIBIT_DEFAULT_DEPS', True) and not d.getVar('INHIBIT_CARGO_DEP', True):
|
||||
deps += " cargo-native"
|
||||
return deps
|
||||
|
||||
@@ -31,19 +31,19 @@ export PKG_CONFIG_ALLOW_CROSS = "1"
|
||||
EXTRA_OECARGO_PATHS ??= ""
|
||||
|
||||
cargo_do_configure () {
|
||||
mkdir -p .cargo
|
||||
# FIXME: we currently blow away the entire config because duplicate
|
||||
# sections are treated as a parse error by cargo (causing the entire
|
||||
# config to be silently ignored.
|
||||
# FIXME: we currently make a mess in the directory above us
|
||||
# (${WORKDIR}), which may not be ideal. Look into whether this is
|
||||
# allowed
|
||||
mkdir -p ../.cargo
|
||||
# NOTE: we cannot pass more flags via this interface, the 'linker' is
|
||||
# assumed to be a path to a binary. If flags are needed, a wrapper must
|
||||
# be used.
|
||||
echo "paths = [" >.cargo/config
|
||||
echo "paths = [" >../.cargo/config
|
||||
|
||||
for p in ${EXTRA_OECARGO_PATHS}; do
|
||||
printf "\"%s\"\n" "$p"
|
||||
done | sed -e 's/$/,/' >>.cargo/config
|
||||
echo "]" >>.cargo/config
|
||||
done | sed -e 's/$/,/' >>../.cargo/config
|
||||
echo "]" >>../.cargo/config
|
||||
}
|
||||
|
||||
rust_cargo_patch () {
|
||||
|
||||
@@ -2,6 +2,7 @@ inherit rust
|
||||
|
||||
RUSTLIB_DEP ?= " rustlib"
|
||||
DEPENDS .= "${RUSTLIB_DEP}"
|
||||
RDEPENDS_${PN} .= "${RUSTLIB_DEP}"
|
||||
DEPENDS += "patchelf-native"
|
||||
|
||||
export rustlibdir = "${libdir}/rust"
|
||||
@@ -19,9 +20,10 @@ OVERLAP_LIBS = "\
|
||||
libc \
|
||||
log \
|
||||
getopts \
|
||||
rand \
|
||||
"
|
||||
def get_overlap_deps(d):
|
||||
deps = d.getVar("DEPENDS").split()
|
||||
deps = d.getVar("DEPENDS", True).split()
|
||||
overlap_deps = []
|
||||
for o in d.getVar("OVERLAP_LIBS", True).split():
|
||||
l = len([o for dep in deps if (o + '-rs' in dep)])
|
||||
@@ -41,7 +43,7 @@ rustlib_src="${prefix}/lib/${rustlib_suffix}"
|
||||
rustlib="${libdir}/${rustlib_suffix}"
|
||||
CRATE_NAME ?= "${@d.getVar('BPN', True).replace('-rs', '').replace('-', '_')}"
|
||||
BINNAME ?= "${BPN}"
|
||||
LIBNAME ?= "lib${CRATE_NAME}"
|
||||
LIBNAME ?= "lib${CRATE_NAME}-rs"
|
||||
CRATE_TYPE ?= "dylib"
|
||||
BIN_SRC ?= "${S}/src/main.rs"
|
||||
LIB_SRC ?= "${S}/src/lib.rs"
|
||||
@@ -49,7 +51,7 @@ LIB_SRC ?= "${S}/src/lib.rs"
|
||||
get_overlap_externs () {
|
||||
externs=
|
||||
for dep in ${OVERLAP_DEPS}; do
|
||||
extern=$(ls ${STAGING_DIR_HOST}/${rustlibdir}/lib$dep.{so,rlib} 2>/dev/null \
|
||||
extern=$(ls ${STAGING_DIR_HOST}/${rustlibdir}/lib$dep-rs.{so,rlib} 2>/dev/null \
|
||||
| awk '{print $1}');
|
||||
if [ -n "$extern" ]; then
|
||||
externs="$externs --extern $dep=$extern"
|
||||
@@ -61,16 +63,21 @@ get_overlap_externs () {
|
||||
echo "$externs"
|
||||
}
|
||||
|
||||
do_configure () {
|
||||
}
|
||||
|
||||
oe_compile_rust_lib () {
|
||||
[ "${CRATE_TYPE}" == "dylib" ] && suffix=so || suffix=rlib
|
||||
rm -rf ${LIBNAME}.{rlib,so}
|
||||
local -a link_args
|
||||
if [ "${CRATE_TYPE}" == "dylib" ]; then
|
||||
link_args[0]="-C"
|
||||
link_args[1]="link-args=-Wl,-soname -Wl,${LIBNAME}.so"
|
||||
link_args[1]="link-args=-Wl,-soname -Wl,${LIBNAME}.$suffix"
|
||||
fi
|
||||
oe_runrustc $(get_overlap_externs) \
|
||||
"${link_args[@]}" \
|
||||
${LIB_SRC} \
|
||||
-o ${LIBNAME}.$suffix \
|
||||
--crate-name=${CRATE_NAME} --crate-type=${CRATE_TYPE} \
|
||||
"$@"
|
||||
}
|
||||
@@ -102,7 +109,7 @@ do_rust_bin_fixups() {
|
||||
|
||||
for f in `find ${PKGD}`; do
|
||||
file "$f" | grep -q ELF || continue
|
||||
readelf -d "$f" | grep RPATH | grep -q rustlib || continue
|
||||
readelf -d "$f" | grep RUNPATH | grep -q rustlib || continue
|
||||
echo "Set rpath:" "$f"
|
||||
patchelf --set-rpath '$ORIGIN:'${rustlibdir}:${rustlib} "$f"
|
||||
done
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
RUSTC = "rustc"
|
||||
|
||||
# FIXME: --sysroot might be needed
|
||||
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} -C rpath"
|
||||
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} -C rpath -C crate_hash=${BB_TASKHASH}"
|
||||
|
||||
def rust_base_dep(d):
|
||||
# Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to
|
||||
# use rust instead of gcc
|
||||
deps = ""
|
||||
if not d.getVar('INHIBIT_DEFAULT_RUST_DEPS'):
|
||||
if not d.getVar('INHIBIT_DEFAULT_RUST_DEPS', True):
|
||||
if (d.getVar('HOST_SYS', True) != d.getVar('BUILD_SYS', True)):
|
||||
deps += " virtual/${TARGET_PREFIX}rust"
|
||||
else:
|
||||
@@ -82,3 +82,5 @@ HOST_LDFLAGS ?= "${LDFLAGS}"
|
||||
HOST_CFLAGS ?= "${CFLAGS}"
|
||||
HOST_CXXFLAGS ?= "${CXXFLAGS}"
|
||||
HOST_CPPFLAGS ?= "${CPPFLAGS}"
|
||||
|
||||
EXTRA_OECONF_remove = "--disable-static"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# In order to share the same source between multiple packages (.bb files), we
|
||||
# unpack and patch the X source here into a shared dir.
|
||||
#
|
||||
# Take a look at gcc-source.inc for the general structure of this
|
||||
|
||||
# We require that "SOURCE_NAME" be set
|
||||
|
||||
# nopackages.bbclass {
|
||||
deltask do_package
|
||||
deltask do_package_write_rpm
|
||||
deltask do_package_write_ipk
|
||||
deltask do_package_write_deb
|
||||
deltask do_package_qa
|
||||
deltask do_packagedata
|
||||
#}
|
||||
|
||||
deltask do_configure
|
||||
deltask do_compile
|
||||
deltask do_install
|
||||
deltask do_populate_sysroot
|
||||
deltask do_populate_lic
|
||||
deltask do_rm_work
|
||||
|
||||
|
||||
# override to get rid of '-native' or other misc
|
||||
# XXX: consider ${PR}
|
||||
PN = "${SOURCE_NAME}-source-${PV}"
|
||||
WORKDIR = "${TMPDIR}/work-shared/${SOURCE_NAME}-${PV}-${PR}"
|
||||
SSTATE_SWSPEC = "sstate:${SOURCE_NAME}::${PV}:${PR}::${SSTATE_VERSION}:"
|
||||
|
||||
STAMP = "${STAMPS_DIR}/work-shared/${SOURCE_NAME}-${PV}-${PR}"
|
||||
STAMPCLEAN = "${STAMPS_DIR}/work-shared/${SOURCE_NAME}-${PV}-*"
|
||||
|
||||
INHIBIT_DEFAULT_DEPS = "1"
|
||||
DEPENDS = ""
|
||||
PACKAGES = ""
|
||||
|
||||
EXCLUDE_FROM_WORLD = "1"
|
||||
@@ -0,0 +1,3 @@
|
||||
S = "${TMPDIR}/work-shared/${SOURCE_NAME}-${PV}-${PR}"
|
||||
|
||||
do_unpack[depends] += "${SOURCE_NAME}-source-${PV}:do_patch"
|
||||
Reference in New Issue
Block a user