3.2 KiB
Dev-Setup
Toolchain
Install rustup
See rustup.rs to install rustup. It is recommended to use a non-root user.
cargo, rustc, rustup and other commands will be installed to Cargo's bin directory. The default path is $HOME/.cargo/bin, and the following examples will use this. You need to add this directory to your PATH environment variable.
-
Bash
The setup script should have already added the following line to your $HOME/.profile:
source "$HOME/.cargo/env" -
Fish
Run the following command:
set -U fish_user_paths $HOME/.cargo/bin $fish_user_paths
Update rustup
rustup self update
Install stable toolchains
List all available components:
rustup component list
The following components is required and should have already been installed:
- rustc
- rust-std
- cargo
- rustfmt
- clippy
llvm-tools-preview and rust-src is also recommended being installed:
rustup component add llvm-tools-preview
rustup component add rust-src
Install nightly toolchains
Install nightly toolchains:
rustup toolchain install nightly
List components in nightly channel:
rustup component list --toolchain nightly
Update toolchains
Run the following command to update the toolchains for all channel:
rustup update
Plugins for cargo
To install:
cargo install <crate name>
To update:
cargo install -f <crate name>
The following plugins is recommended:
-
cargo-expand
Needed by IDE(at least JetBrains' rust plugin) to expand macros. The nightly toolchain is also required to run this.
-
cargo-audit
Audit Cargo.lock for crates with security vulnerabilities.
-
cargo-binutils
To run llvm-tools-preview installed via rustup.
IDE
JetBrains
There is an official rust plugin for JetBrains IDEs.
PyCharm Community Edition is recommended as we also use Python scripts in this repo. Clion is needed if you want the DEBUG feature.
Dependent Tools and Libraries
Development Libraries
For g3proxy:
c-ares
lua
python3
Development Tools
The tools for C development should be installed, including but not limited to:
gcc
pkg-config
If the c-ares version in the OS repo is too old, the following tools is also required:
libtool
make
Rpc Code Generator
We use capnproto rpc in g3proxy:
capnproto
Testing Tools
The following tools are needed to run testing scripts:
mkcert
curl
Scripting Tools
The following tools are used in scripts under directory scripts/:
git
jq
tar
xz
Scripting Libraries
We use python3 for more complicated scripts, the following packages are needed:
toml
requests
semver
PySocks
dnspython
Document Tools
We use sphinx to generate docs.
Packaging Tools
deb
For all Debian based distributions:
lsb-release
devscripts
dpkg-dev
debhelper
rpm
For all rhel based distributions:
rpmdevtools
rpm-build