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:
Tyler Hall
2015-06-12 12:52:19 -04:00
committed by Steven Walter
parent 709957b3b6
commit a91af9bbae
2 changed files with 32 additions and 3 deletions
+31
View File
@@ -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"
+1 -3
View File
@@ -3,13 +3,11 @@ HOMEPAGE = "http://www.rust-lang.org"
SECTION = "devel"
LICENSE = "MIT | Apache-2.0"
inherit rust
inherit rust-bin
DEPENDS += "virtual/${TARGET_PREFIX}rust"
RUSTLIB_DEP = ""
rustlib="${libdir}/${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
do_install () {
mkdir -p ${D}/${rustlib}
cp ${STAGING_DIR_NATIVE}/${rustlib}/*.so ${D}/${rustlib}