Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce BORING_BSSL_SYSROOT and BORING_BSSL_EXTERNAL_TOOLCHAIN
These variables let us configure CMAKE_SYSROOT and CMAKE_{C,CXX,ASM}_EXTERNAL_TOOLCHAIN from env variables without needing an error-prone custom toolchain file. Most users won't need BORING_BSSL_EXTERNAL_TOOLCHAIN, but some packages (such as Homebrew package messense/macos-cross-toolchains/x86_64-unknown-linux-gnu) don't install the sysroot at the root of the GCC installation, so clang-12 cannot find crt1.o and crti.o. Finally, we also set up CMAKE_CROSSCOMPILING and CMAKE_{C,CXX,ASM}_COMPILER_TARGET to make cross compilation work with compilers that have cross-compiling drivers (i.e. clang). We can now cross build boring-sys from macOS to Linux with fips feature turned on: brew tap nox/misc brew install [email protected] export PATH="$(brew --prefix [email protected])/bin:$PATH" brew tap messense/macos-cross-toolchains brew install x86_64-unknown-linux-gnu export BORING_BSSL_FIPS_EXTERNAL_TOOLCHAIN="$(brew --prefix x86_64-unknown-linux-gnu)/toolchain" export BORING_BSSL_FIPS_SYSROOT="$BORING_BSSL_FIPS_EXTERNAL_TOOLCHAIN/x86_unknown-linux-gnu/sysroot" cargo build --target x86_64-unknown-linux-gnu -p boring-sys --features fips
- Loading branch information