boringssl: refactor build

Co-Authored-By: Theo Paris <theo@tinted.dev>
This commit is contained in:
Niklas Korz
2025-11-05 13:00:21 +01:00
co-authored by Theo Paris
parent 100a688336
commit c951587477
+1 -37
View File
@@ -5,12 +5,11 @@
cmake,
ninja,
perl,
buildGoModule,
gitUpdater,
}:
# reference: https://boringssl.googlesource.com/boringssl/+/refs/tags/0.20250818.0/BUILDING.md
buildGoModule (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
pname = "boringssl";
version = "0.20251002.0";
@@ -31,18 +30,6 @@ buildGoModule (finalAttrs: {
perl
];
vendorHash = "sha256-IXmnoCYLoiQ/XL2wjksRFv5Kwsje0VNkcupgGxG6rSY=";
proxyVendor = true;
# hack to get both go and cmake configure phase
# (if we use postConfigure then cmake will loop runHook postConfigure)
preBuild = ''
cmakeConfigurePhase
''
+ lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
export GOARCH=$(go env GOHOSTARCH)
'';
env.NIX_CFLAGS_COMPILE = toString (
lib.optionals stdenv.cc.isGNU [
# Needed with GCC 12 but breaks on darwin (with clang)
@@ -53,29 +40,6 @@ buildGoModule (finalAttrs: {
]
);
buildPhase = ''
ninjaBuildPhase
'';
# CMAKE_OSX_ARCHITECTURES is set to x86_64 by Nix, but it confuses boringssl on aarch64-linux.
cmakeFlags = [
"-GNinja"
]
++ lib.optionals (stdenv.hostPlatform.isLinux) [ "-DCMAKE_OSX_ARCHITECTURES=" ];
installPhase = ''
runHook preInstall
mkdir -p $bin/bin $dev $out/lib
install -Dm755 bssl -t $bin/bin
install -Dm644 {libcrypto,libdecrepit,libpki,libssl}.a -t $out/lib
cp -r ../include $dev
runHook postInstall
'';
outputs = [
"out"
"bin"