minus-squareElectricMoose@lemmy.worldtoRust Programming@lemmy.ml•Bash Script to compile a single rust script, execute the binary and delete the binarylinkfedilinkarrow-up3·edit-222 days agoAllow me to retort with an all-in-one self build script, along with pass-through args and exitcode. #!/bin/sh out=$(mktemp) sed -e '0,/^#SELFBUILD$/d' "$0" | rustc --o "$out" - && "$out" "$@" status=$? rm -f "$out" exit "$status" #SELFBUILD fn main() { dbg!(std::env::args()); println!("hello rust"); std::process::exit(2); } P.S. I have no idea why you’d want that, as it’s a terribly inefficient way to ship code, but it’s a fascinating glimpse at how we used to do self-extract archives decades ago. linkfedilink
Allow me to retort with an all-in-one self build script, along with pass-through args and exitcode.
#!/bin/sh out=$(mktemp) sed -e '0,/^#SELFBUILD$/d' "$0" | rustc --o "$out" - && "$out" "$@" status=$? rm -f "$out" exit "$status" #SELFBUILD fn main() { dbg!(std::env::args()); println!("hello rust"); std::process::exit(2); }
P.S. I have no idea why you’d want that, as it’s a terribly inefficient way to ship code, but it’s a fascinating glimpse at how we used to do self-extract archives decades ago.