Cargo build scripts (build.rs) need special care to support cross-compilation correctly.
Don't use `#[cfg(target…)]`/`cfg!(target=…)`, because all macros and constants in the source code are for the machine that does the compilation, which may be different from the architecture the code is cross-compiled for (e.g. macOS can build libraries for Android).
Instead, check values of `std::env::var("TARGET")`, `CARGO_CFG_TARGET_ARCH`, etc.
https://kazlauskas.me/entries/writing-proper-buildrs-scripts.html