general:rust
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
general:rust [2024/09/19 06:46] – [Script to update after verifying GPG signatures] sunkan | general:rust [2024/10/30 15:09] (current) – [User cargo config] sunkan | ||
---|---|---|---|
Line 11: | Line 11: | ||
====== Script to update after verifying GPG signatures ====== | ====== Script to update after verifying GPG signatures ====== | ||
- | < | + | < |
#!/bin/sh | #!/bin/sh | ||
Line 23: | Line 23: | ||
exit 1 | exit 1 | ||
fi | fi | ||
+ | |||
+ | TMPDIR_BASE=/ | ||
RUST_VERSION=$1 | RUST_VERSION=$1 | ||
Line 29: | Line 31: | ||
RUST_FILE=" | RUST_FILE=" | ||
RUSTC_FILE=" | RUSTC_FILE=" | ||
- | WASM_FILE="rust-std-${RUST_VERSION}-wasm32-unknown-unknown.tar.xz" | + | |
- | ARMV7HF_FILE="rust-std-${RUST_VERSION}-armv7-unknown-linux-gnueabihf.tar.xz" | + | ARMV7HF_EXT="armv7-unknown-linux-gnueabihf" |
- | WINX64_FILE="rust-std-${RUST_VERSION}-x86_64-pc-windows-gnu.tar.xz" | + | MUSL_EXT="x86_64-unknown-linux-musl" |
- | MUSL_FILE="rust-std-${RUST_VERSION}-x86_64-unknown-linux-musl.tar.xz" | + | WASM_EXT="wasm32-unknown-unknown" |
- | TMPDIR_BASE=/tmp | + | WINX64_EXT=" |
+ | |||
+ | #EXTENSIONS="$ARMV7HF_EXT $MUSL_EXT $WASM_EXT $WINX64_EXT" | ||
+ | EXTENSIONS="" | ||
create_rust_pgp_key_file() { | create_rust_pgp_key_file() { | ||
Line 113: | Line 118: | ||
if [ -f $TMPDIR_BASE/ | if [ -f $TMPDIR_BASE/ | ||
- | | + | mv $TMPDIR_BASE/ |
else | else | ||
- | | + | wget -c $RUST_REPO/ |
fi | fi | ||
| | ||
Line 129: | Line 134: | ||
download_if_missing $RUSTC_FILE.asc $tmpdir | download_if_missing $RUSTC_FILE.asc $tmpdir | ||
- | download_if_missing | + | for ext in $EXTENSIONS; do |
- | download_if_missing | + | |
- | + | ||
- | download_if_missing $ARMV7HF_FILE $tmpdir | + | |
- | download_if_missing $ARMV7HF_FILE.asc $tmpdir | + | |
- | + | ||
- | download_if_missing $WINX64_FILE $tmpdir | + | |
- | download_if_missing $WINX64_FILE.asc $tmpdir | + | |
- | + | ||
- | download_if_missing $MUSL_FILE $tmpdir | + | |
- | download_if_missing $MUSL_FILE.asc $tmpdir | + | |
+ | download_if_missing $tarfile $tmpdir | ||
+ | download_if_missing $tarfile.asc $tmpdir | ||
+ | done | ||
create_rust_pgp_key_file | create_rust_pgp_key_file | ||
Line 146: | Line 145: | ||
gpgv --keyring ./rust.key $RUST_FILE.asc $RUST_FILE || exit 2 | gpgv --keyring ./rust.key $RUST_FILE.asc $RUST_FILE || exit 2 | ||
gpgv --keyring ./rust.key $RUSTC_FILE.asc $RUSTC_FILE || exit 3 | gpgv --keyring ./rust.key $RUSTC_FILE.asc $RUSTC_FILE || exit 3 | ||
- | gpgv --keyring | + | |
- | gpgv --keyring ./rust.key $ARMV7HF_FILE.asc $ARMV7HF_FILE | + | exitcode=10 |
- | gpgv --keyring ./ | + | for ext in $EXTENSIONS; |
- | gpgv --keyring ./rust.key $MUSL_FILE.asc $MUSL_FILE || exit 7 | + | tarfile=" |
+ | |||
+ | gpgv --keyring ./rust.key $tarfile.asc $tarfile | ||
+ | exitcode=$((exitcode + 1)) | ||
+ | done | ||
+ | |||
+ | # Remove previously installed rustlibs | ||
+ | find / | ||
tar xaf $RUST_FILE | tar xaf $RUST_FILE | ||
Line 164: | Line 170: | ||
cd .. | cd .. | ||
- | tar xaf $WASM_FILE | + | for ext in $EXTENSIONS; do |
- | cd rust-std-${RUST_VERSION}-wasm32-unknown-unknown | + | |
- | rm -rf / | + | tar xaf $tarfile |
- | cp -dR --preserve=timestamps rust-std-wasm32-unknown-unknown/ | + | cd rust-std-${RUST_VERSION}-$ext |
- | cd .. | + | rm -rf "/ |
- | + | cp -dR --preserve=timestamps | |
- | tar xaf $ARMV7HF_FILE | + | cd .. |
- | cd rust-std-${RUST_VERSION}-armv7-unknown-linux-gnueabihf | + | done |
- | rm -rf / | + | |
- | cp -dR --preserve=timestamps rust-std-armv7-unknown-linux-gnueabihf/ | + | |
- | cd .. | + | |
- | + | ||
- | tar xaf $WINX64_FILE | + | |
- | cd rust-std-${RUST_VERSION}-x86_64-pc-windows-gnu | + | |
- | rm -rf / | + | |
- | cp -dR --preserve=timestamps rust-std-x86_64-pc-windows-gnu/ | + | |
- | cd .. | + | |
- | + | ||
- | tar xaf $MUSL_FILE | + | |
- | cd rust-std-${RUST_VERSION}-x86_64-unknown-linux-musl | + | |
- | rm -rf / | + | |
- | cp -dR --preserve=timestamps rust-std-x86_64-unknown-linux-musl/ | + | |
- | cd .. | + | |
- | read -p "Keep the downloaded archives? (y/n) " keep_archives | + | read -p "Keep the downloaded archives? (y/N) " keep_archives |
- | if [ $keep_archives = "y" -o $keep_archives = "Y" ]; then | + | if [ ${keep_archives}X = "yX" -o ${keep_archives}X = "YX" ]; then |
mv $tmpdir/ | mv $tmpdir/ | ||
mv $tmpdir/ | mv $tmpdir/ | ||
Line 197: | Line 188: | ||
mv $tmpdir/ | mv $tmpdir/ | ||
- | | + | |
- | | + | tarfile=" |
- | | + | mv $tmpdir/$tarfile |
- | mv $tmpdir/$ARMV7HF_FILE.asc $TMPDIR_BASE | + | mv $tmpdir/$tarfile.asc $TMPDIR_BASE |
+ | done | ||
fi | fi | ||
Line 286: | Line 278: | ||
</ | </ | ||
- | The -F99 tells perf to sample at 99 Hz, which avoids generating too much data for longer runs (why 99 Hz you ask? It is often chosen because it is unlikely to be in lockstep with other periodic activity). The --call-graph dwarf tells perf to get call-graph information from debuginfo, which is accurate. The XXX is the command you want to profile. | + | The -F99 tells perf to sample at 99 Hz, which avoids generating too much data for longer runs (why 99 Hz you ask? It is often chosen because it is unlikely to be in lockstep with other periodic activity). The --call-graph dwarf tells perf to get call-graph information from debuginfo, which is accurate. The XXX is the command you want to profile. |
====== Find unused source files ====== | ====== Find unused source files ====== | ||
Line 293: | Line 285: | ||
</ | </ | ||
+ | ====== User cargo config ====== | ||
+ | ~/ | ||
+ | < | ||
+ | [registries.crates-io] | ||
+ | protocol = " | ||
+ | |||
+ | [target.x86_64-unknown-linux-gnu] | ||
+ | # linker = " | ||
+ | # rustflags = [" | ||
+ | rustflags = [" | ||
+ | |||
+ | [profile.profiling] | ||
+ | inherits = " | ||
+ | debug = true | ||
+ | </ | ||
+ | |||
+ | To build release with debug info: '' |
general/rust.1726728370.txt.gz · Last modified: 2024/09/19 06:46 by sunkan