diff --git a/classes/rust-bin.bbclass b/classes/rust-bin.bbclass index 48df8e1..8afe5cb 100644 --- a/classes/rust-bin.bbclass +++ b/classes/rust-bin.bbclass @@ -1,5 +1,6 @@ inherit rust +DEPENDS_append = " patchelf-native" RDEPENDS_${PN} += "${RUSTLIB_DEP}" RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir}" @@ -54,6 +55,11 @@ get_overlap_externs () { do_configure () { } +oe_runrustc () { + bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" + "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" +} + oe_compile_rust_lib () { [ "${CRATE_TYPE}" == "dylib" ] && suffix=so || suffix=rlib rm -rf ${LIBNAME}.{rlib,so} @@ -88,3 +94,19 @@ 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" + diff --git a/classes/rust.bbclass b/classes/rust.bbclass index e4fb677..e954825 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -16,7 +16,7 @@ def rust_base_dep(d): deps += " rust-native" return deps -DEPENDS_append = " ${@rust_base_dep(d)} patchelf-native" +DEPENDS_append = " ${@rust_base_dep(d)}" # BUILD_LDFLAGS # ${STAGING_LIBDIR_NATIVE} @@ -31,11 +31,6 @@ DEPENDS_append = " ${@rust_base_dep(d)} patchelf-native" # -L${STAGING_BASE_LIBDIR_NATIVE} \ #" -oe_runrustc () { - bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" - "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" -} - # XXX: for some reason bitbake sets BUILD_* & TARGET_* but uses the bare # variables for HOST. Alias things to make it easier for us. HOST_LDFLAGS ?= "${LDFLAGS}" @@ -45,21 +40,6 @@ 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}"