-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
overrideSDK, | ||
cmakeMinimal, | ||
fetchFromGitHub, | ||
ninja, | ||
testers, | ||
aws-lc, | ||
useSharedLibraries ? !stdenv.targetPlatform.isStatic, | ||
}: | ||
let | ||
awsStdenv = if stdenv.hostPlatform.isDarwin then overrideSDK stdenv "11.0" else stdenv; | ||
in | ||
awsStdenv.mkDerivation (finalAttrs: { | ||
pname = "aws-lc"; | ||
version = "1.39.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "aws"; | ||
repo = "aws-lc"; | ||
rev = "v${finalAttrs.version}"; | ||
hash = "sha256-LbhSnIjZWBtbU++puuZW2hgswO1lArrD5+uhBZNItNM="; | ||
}; | ||
|
||
outputs = [ | ||
"out" | ||
"bin" | ||
"dev" | ||
]; | ||
|
||
nativeBuildInputs = [ | ||
cmakeMinimal | ||
ninja | ||
]; | ||
|
||
cmakeFlags = [ | ||
(lib.cmakeBool "BUILD_SHARED_LIBS" useSharedLibraries) | ||
"-GNinja" | ||
"-DDISABLE_GO=ON" | ||
"-DDISABLE_PERL=ON" | ||
"-DBUILD_TESTING=ON" | ||
]; | ||
|
||
doCheck = true; | ||
|
||
checkPhase = '' | ||
runHook preCheck | ||
ninja run_minimal_tests | ||
runHook postCheck | ||
''; | ||
|
||
env.NIX_CFLAGS_COMPILE = toString ( | ||
lib.optionals stdenv.cc.isGNU [ | ||
# Needed with GCC 12 but breaks on darwin (with clang) | ||
"-Wno-error=stringop-overflow" | ||
] | ||
); | ||
|
||
postFixup = '' | ||
for f in $out/lib/crypto/cmake/*/crypto-targets.cmake; do | ||
substituteInPlace "$f" \ | ||
--replace-fail 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES ""' | ||
done | ||
''; | ||
|
||
passthru.tests = { | ||
version = testers.testVersion { | ||
package = aws-lc; | ||
command = "bssl version"; | ||
}; | ||
pkg-config = testers.hasPkgConfigModules { | ||
package = aws-lc; | ||
moduleNames = [ | ||
"libcrypto" | ||
"libssl" | ||
"openssl" | ||
]; | ||
}; | ||
}; | ||
|
||
meta = { | ||
description = "General-purpose cryptographic library maintained by the AWS Cryptography team for AWS and their customers"; | ||
homepage = "https://github.com/aws/aws-lc"; | ||
license = [ | ||
lib.licenses.asl20 # or | ||
lib.licenses.isc | ||
]; | ||
maintainers = [ lib.maintainers.theoparis ]; | ||
platforms = lib.platforms.all; | ||
mainProgram = "bssl"; | ||
}; | ||
}) |