描述
Feature Request
Is your feature request related to a problem? Please describe:
Currently, building a tikv-server needs a Makefile to collect git hash and others, otherwise tikv-server --version shows unknown. This means a proper build needs helps from the outside of cargo.
Describe the feature you'd like:
Instead of Makefile, we can collect these info in cargo's build script.
rustc-env=VAR=VALUEindicates that the specified environment variable will be added to the environment which the compiler is run within. The value can be then retrieved by the env! macro in the compiled crate. This is useful for embedding additional metadata in crate's code, such as the hash of Git HEAD or the unique identifier of a continuous integration server.
https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script
EDIT: we should use rustc-env instead of rustc-cfg.