nanopb: added option for malloc build

This is required by the criterion package, while preserving previous behavior for all others.
This commit is contained in:
thesola10 2022-07-17 10:47:54 +02:00 committed by TheSola10
parent 354b4390f6
commit 893145f73e
No known key found for this signature in database
GPG key ID: 89245619BEBB95BA
2 changed files with 3 additions and 1 deletions

View file

@ -6,6 +6,7 @@
, python3
, stdenv
, buildPackages
, mallocBuild ? false
}:
stdenv.mkDerivation rec {
@ -27,7 +28,7 @@ stdenv.mkDerivation rec {
"-DBUILD_SHARED_LIBS=ON" # generate $out/lib/libprotobuf-nanopb.so{.0,}
"-DBUILD_STATIC_LIBS=ON" # generate $out/lib/libprotobuf-nanopb.a
"-Dnanopb_PROTOC_PATH=${buildPackages.protobuf}/bin/protoc"
];
] ++ lib.optional mallocBuild "-DCMAKE_C_FLAGS=-DPB_ENABLE_MALLOC 1";
postInstall = ''
mkdir -p $out/share/nanopb/generator/proto

View file

@ -20818,6 +20818,7 @@ with pkgs;
flatbuffers = callPackage ../development/libraries/flatbuffers { };
nanopb = callPackage ../development/libraries/nanopb { };
nanopbMalloc = callPackage ../development/libraries/nanopb { mallocBuild = true; };
gnupth = callPackage ../development/libraries/pth { };
pth = if stdenv.hostPlatform.isMusl then npth else gnupth;