Skip to content

Commit 5073c45

Browse files
authored
Merge pull request #119 from treymarc/support_lib_bin_examples_install
Install lib and bin each in their respective destination folder
2 parents d939a7e + 0a9beec commit 5073c45

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

classes/cargo.bbclass

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,40 @@ cargo_do_compile() {
128128
}
129129

130130
cargo_do_install() {
131-
install -d "${CARGO_INSTALL_DIR}"
132131
if [ "${CARGO_BUILD_TYPE}" = "--release" ]; then
133132
local cargo_bindir="${CARGO_RELEASE_DIR}"
134133
else
135134
local cargo_bindir="${CARGO_DEBUG_DIR}"
136135
fi
137136

138137
local files_installed=""
139-
for f in "$cargo_bindir"/*; do
140-
if [ -f "$f" ] && [ -x "$f" ]; then
141-
install -m 0755 "$f" "${CARGO_INSTALL_DIR}"
142-
files_installed="$files_installed $f"
143-
fi
138+
139+
for tgt in "${cargo_bindir}"/*; do
140+
case $tgt in
141+
*.so|*.rlib)
142+
install -d "${D}${libdir}"
143+
install -m755 "$tgt" "${D}${libdir}"
144+
files_installed="$files_installed $tgt"
145+
;;
146+
*examples)
147+
if [ -d "$tgt" ]; then
148+
for example in "$tgt/"*; do
149+
if [ -f "$example" ] && [ -x "$example" ]; then
150+
install -d "${CARGO_INSTALL_DIR}"
151+
install -m755 "$example" "${CARGO_INSTALL_DIR}"
152+
files_installed="$files_installed $example"
153+
fi
154+
done
155+
fi
156+
;;
157+
*)
158+
if [ -f "$tgt" ] && [ -x "$tgt" ]; then
159+
install -d "${CARGO_INSTALL_DIR}"
160+
install -m755 "$tgt" "${CARGO_INSTALL_DIR}"
161+
files_installed="$files_installed $tgt"
162+
fi
163+
;;
164+
esac
144165
done
145166

146167
if [ -z "$files_installed" ]; then

0 commit comments

Comments
 (0)