2021-04-22 02:08:21 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchgit
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, perl
|
|
|
|
, buildGoModule
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# reference: https://boringssl.googlesource.com/boringssl/+/2661/BUILDING.md
|
2021-04-22 02:08:21 +00:00
|
|
|
buildGoModule {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "boringssl";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "unstable-2024-02-15";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
2023-10-09 19:29:22 +00:00
|
|
|
url = "https://boringssl.googlesource.com/boringssl";
|
2024-02-29 20:09:43 +00:00
|
|
|
rev = "5a1a5fbdb865fa58f1da0fd8bf6426f801ea37ac";
|
|
|
|
hash = "sha256-nu+5TeWEAVLGhTE15kxmTWZxo0V2elNUy67gdaU3Y+I=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-22 02:08:21 +00:00
|
|
|
nativeBuildInputs = [ cmake ninja perl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
vendorHash = "sha256-074bgtoBRS3SOxLrwZbBdK1jFpdCvF6tRtU1CkrhoDY=";
|
2023-10-09 19:29:22 +00:00
|
|
|
proxyVendor = true;
|
2021-04-22 02:08:21 +00:00
|
|
|
|
|
|
|
# hack to get both go and cmake configure phase
|
|
|
|
# (if we use postConfigure then cmake will loop runHook postConfigure)
|
|
|
|
preBuild = ''
|
|
|
|
cmakeConfigurePhase
|
2022-05-18 14:49:53 +00:00
|
|
|
'' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
|
|
|
|
export GOARCH=$(go env GOHOSTARCH)
|
2021-04-22 02:08:21 +00:00
|
|
|
'';
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isGNU [
|
2023-02-16 17:41:37 +00:00
|
|
|
# Needed with GCC 12 but breaks on darwin (with clang)
|
|
|
|
"-Wno-error=stringop-overflow"
|
2023-03-04 12:14:45 +00:00
|
|
|
]);
|
2023-02-16 17:41:37 +00:00
|
|
|
|
2021-04-22 02:08:21 +00:00
|
|
|
buildPhase = ''
|
|
|
|
ninjaBuildPhase
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-17 17:02:09 +00:00
|
|
|
# CMAKE_OSX_ARCHITECTURES is set to x86_64 by Nix, but it confuses boringssl on aarch64-linux.
|
2024-09-26 11:04:55 +00:00
|
|
|
cmakeFlags = [ "-GNinja" ] ++ lib.optionals (stdenv.hostPlatform.isLinux) [ "-DCMAKE_OSX_ARCHITECTURES=" ];
|
2021-02-17 17:02:09 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2021-12-06 16:07:01 +00:00
|
|
|
mkdir -p $bin/bin $dev $out/lib
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
mv tool/bssl $bin/bin
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
mv ssl/libssl.a $out/lib
|
|
|
|
mv crypto/libcrypto.a $out/lib
|
|
|
|
mv decrepit/libdecrepit.a $out/lib
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
mv ../include $dev
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
outputs = [ "out" "bin" "dev" ];
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Free TLS/SSL implementation";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "bssl";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://boringssl.googlesource.com";
|
|
|
|
maintainers = [ maintainers.thoughtpolice ];
|
|
|
|
license = with licenses; [ openssl isc mit bsd3 ];
|
|
|
|
};
|
|
|
|
}
|