Move rust-bin fixups to rust.bbclass
This post-processing will need to be shared between rust-bin and cargo-based recipes. Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
inherit rust
|
||||
|
||||
RDEPENDS_${PN} += "${RUSTLIB_DEP}"
|
||||
DEPENDS += "patchelf-native"
|
||||
|
||||
RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir}"
|
||||
EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'
|
||||
@@ -89,19 +88,3 @@ oe_install_rust_bin () {
|
||||
echo Installing ${BINNAME}
|
||||
install -D -m 755 ${BINNAME} ${D}/${bindir}/${BINNAME}
|
||||
}
|
||||
|
||||
do_rust_bin_fixups() {
|
||||
for f in `find ${PKGD} -name '*.so*'`; do
|
||||
echo "Strip rust note: $f"
|
||||
${OBJCOPY} -R .note.rustc $f $f
|
||||
done
|
||||
|
||||
for f in `find ${PKGD}`; do
|
||||
file "$f" | grep -q ELF || continue
|
||||
readelf -d "$f" | grep RUNPATH | grep -q rustlib || continue
|
||||
echo "Set rpath:" "$f"
|
||||
patchelf --set-rpath '$ORIGIN:'${rustlibdir}:${rustlib} "$f"
|
||||
done
|
||||
}
|
||||
|
||||
PACKAGE_PREPROCESS_FUNCS += "do_rust_bin_fixups"
|
||||
|
||||
+16
-1
@@ -15,7 +15,7 @@ def rust_base_dep(d):
|
||||
deps += " rust-native"
|
||||
return deps
|
||||
|
||||
DEPENDS_append = " ${@rust_base_dep(d)}"
|
||||
DEPENDS_append = " ${@rust_base_dep(d)} patchelf-native"
|
||||
|
||||
def rust_base_triple(d, thing):
|
||||
'''
|
||||
@@ -86,6 +86,21 @@ HOST_CPPFLAGS ?= "${CPPFLAGS}"
|
||||
|
||||
EXTRA_OECONF_remove = "--disable-static"
|
||||
|
||||
do_rust_bin_fixups() {
|
||||
for f in `find ${PKGD} -name '*.so*'`; do
|
||||
echo "Strip rust note: $f"
|
||||
${OBJCOPY} -R .note.rustc $f $f
|
||||
done
|
||||
|
||||
for f in `find ${PKGD}`; do
|
||||
file "$f" | grep -q ELF || continue
|
||||
readelf -d "$f" | grep RUNPATH | grep -q rustlib || continue
|
||||
echo "Set rpath:" "$f"
|
||||
patchelf --set-rpath '$ORIGIN:'${rustlibdir}:${rustlib} "$f"
|
||||
done
|
||||
}
|
||||
PACKAGE_PREPROCESS_FUNCS += "do_rust_bin_fixups"
|
||||
|
||||
rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
|
||||
# Native sysroot standard library path
|
||||
rustlib_src="${prefix}/lib/${rustlib_suffix}"
|
||||
|
||||
Reference in New Issue
Block a user