Add rust-bin class
This provides more defaults that aren't required for compiling with rustc, but standardize the output for inclusion in a distro. Things like - Where to install libraries - Stripping rustc note sections - Optimization by default
This commit is contained in:
committed by
Steven Walter
parent
709957b3b6
commit
a91af9bbae
@@ -0,0 +1,31 @@
|
|||||||
|
inherit rust
|
||||||
|
|
||||||
|
RUSTLIB_DEP ?= " rustlib"
|
||||||
|
DEPENDS .= "${RUSTLIB_DEP}"
|
||||||
|
DEPENDS += "patchelf-native"
|
||||||
|
|
||||||
|
export rustlibdir = "${libdir}/rust"
|
||||||
|
FILES_${PN} += "${rustlibdir}/*.so"
|
||||||
|
FILES_${PN}-dev += "${rustlibdir}/*.rlib"
|
||||||
|
FILES_${PN}-dbg += "${rustlibdir}/.debug"
|
||||||
|
|
||||||
|
RUSTC_ARCHFLAGS += "-C opt-level=3 -L ${STAGING_DIR_HOST}/${rustlibdir}"
|
||||||
|
EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'
|
||||||
|
|
||||||
|
rustlib="${libdir}/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
|
||||||
|
|
||||||
|
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 RPATH | grep -q rustlib || continue
|
||||||
|
echo "Set rpath:" "$f"
|
||||||
|
patchelf --set-rpath '$ORIGIN:'${rustlibdir}:${rustlib} "$f"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
PACKAGE_PREPROCESS_FUNCS += "do_rust_bin_fixups"
|
||||||
@@ -3,13 +3,11 @@ HOMEPAGE = "http://www.rust-lang.org"
|
|||||||
SECTION = "devel"
|
SECTION = "devel"
|
||||||
LICENSE = "MIT | Apache-2.0"
|
LICENSE = "MIT | Apache-2.0"
|
||||||
|
|
||||||
inherit rust
|
inherit rust-bin
|
||||||
|
|
||||||
DEPENDS += "virtual/${TARGET_PREFIX}rust"
|
DEPENDS += "virtual/${TARGET_PREFIX}rust"
|
||||||
RUSTLIB_DEP = ""
|
RUSTLIB_DEP = ""
|
||||||
|
|
||||||
rustlib="${libdir}/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
|
|
||||||
|
|
||||||
do_install () {
|
do_install () {
|
||||||
mkdir -p ${D}/${rustlib}
|
mkdir -p ${D}/${rustlib}
|
||||||
cp ${STAGING_DIR_NATIVE}/${rustlib}/*.so ${D}/${rustlib}
|
cp ${STAGING_DIR_NATIVE}/${rustlib}/*.so ${D}/${rustlib}
|
||||||
|
|||||||
Reference in New Issue
Block a user