nixpkgs/pkgs/by-name/cr/cryptopp/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

65 lines
1.9 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, enableStatic ? stdenv.hostPlatform.isStatic
, enableShared ? !enableStatic
# Multi-threading with OpenMP is disabled by default
# more info on https://www.cryptopp.com/wiki/OpenMP
, withOpenMP ? false
, llvmPackages
}:
stdenv.mkDerivation rec {
pname = "crypto++";
version = "8.9.0";
underscoredVersion = lib.strings.replaceStrings ["."] ["_"] version;
src = fetchFromGitHub {
owner = "weidai11";
repo = "cryptopp";
rev = "CRYPTOPP_${underscoredVersion}";
hash = "sha256-HV+afSFkiXdy840JbHBTR8lLL0GMwsN3QdwaoQmicpQ=";
};
outputs = [ "out" "dev" ];
postPatch = ''
substituteInPlace GNUmakefile \
--replace "AR = /usr/bin/libtool" "AR = ar" \
--replace "ARFLAGS = -static -o" "ARFLAGS = -cru"
'';
buildInputs = lib.optionals (stdenv.cc.isClang && withOpenMP) [ llvmPackages.openmp ];
makeFlags = [ "PREFIX=${placeholder "out"}" ];
buildFlags =
lib.optional enableStatic "static"
++ lib.optional enableShared "shared"
++ [ "libcryptopp.pc" ];
enableParallelBuilding = true;
hardeningDisable = [ "fortify" ];
CXXFLAGS = lib.optionals (withOpenMP) [ "-fopenmp" ];
doCheck = true;
# always built for checks but install static lib only when necessary
preInstall = lib.optionalString (!enableStatic) "rm -f libcryptopp.a";
installTargets = [ "install-lib" ];
installFlags = [ "LDCONF=true" ];
meta = with lib; {
description = "Free C++ class library of cryptographic schemes";
homepage = "https://cryptopp.com/";
changelog = [
"https://raw.githubusercontent.com/weidai11/cryptopp/CRYPTOPP_${underscoredVersion}/History.txt"
"https://github.com/weidai11/cryptopp/releases/tag/CRYPTOPP_${underscoredVersion}"
];
license = with licenses; [ boost publicDomain ];
platforms = platforms.all;
maintainers = with maintainers; [ c0bw3b ];
};
}