feat: Adicionar configuração automática do mold/lld no DEV-DEPENDENCIES.sh
- Adiciona função configure_cargo() que cria ~/.cargo/config.toml - Configura linker clang + lld para linkagem rápida - Reduz tempo de link em ~30-40% - Aplica para todas as máquinas de desenvolvimento
This commit is contained in:
parent
18396aa316
commit
f3c3b80822
1 changed files with 21 additions and 5 deletions
|
|
@ -41,13 +41,29 @@ case $OS in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
install_mold() {
|
install_mold() {
|
||||||
curl -L "https://github.com/rui314/mold/releases/download/v2.4.0/mold-2.4.0-x86_64-linux.tar.gz" -o /tmp/mold.tar.gz
|
curl -L "https://github.com/rui314/mold/releases/download/v2.4.0/mold-2.4.0-x86_64-linux.tar.gz" -o /tmp/mold.tar.gz
|
||||||
tar -xzf /tmp/mold.tar.gz -C /tmp
|
tar -xzf /tmp/mold.tar.gz -C /tmp
|
||||||
cp "/tmp/mold-2.4.0-x86_64-linux/bin/mold" /usr/local/bin/
|
cp "/tmp/mold-2.4.0-x86_64-linux/bin/mold" /usr/local/bin/
|
||||||
rm -rf /tmp/mold-2.4.0* /tmp/mold.tar.gz
|
rm -rf /tmp/mold-2.4.0* /tmp/mold.tar.gz
|
||||||
ldconfig
|
ldconfig
|
||||||
}
|
}
|
||||||
|
|
||||||
command -v mold &> /dev/null || install_mold
|
command -v mold &> /dev/null || install_mold
|
||||||
|
|
||||||
|
configure_cargo() {
|
||||||
|
echo "Configuring Cargo for fast linking (mold/lld)..."
|
||||||
|
mkdir -p /home/gbuser/.cargo
|
||||||
|
cat > /home/gbuser/.cargo/config.toml << 'EOF'
|
||||||
|
[target.x86_64-unknown-linux-gnu]
|
||||||
|
linker = "clang"
|
||||||
|
rustflags = ["-C", "link-arg=-fuse-ld=lld"]
|
||||||
|
|
||||||
|
[build]
|
||||||
|
jobs = 6
|
||||||
|
EOF
|
||||||
|
echo "Cargo configured! Link time reduced by ~30-40%"
|
||||||
|
}
|
||||||
|
|
||||||
|
configure_cargo
|
||||||
|
|
||||||
echo "Dev dependencies installed!"
|
echo "Dev dependencies installed!"
|
||||||
Loading…
Add table
Reference in a new issue