nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

grpc: expose cxxStandard

+24 -23
+23 -22
pkgs/development/libraries/grpc/default.nix
··· 54 54 buildInputs = [ openssl protobuf ] 55 55 ++ lib.optionals stdenv.isLinux [ libnsl ]; 56 56 57 - cmakeFlags = 58 - let 59 - # Needs to be compiled with -std=c++11 for clang < 11. Interestingly this is 60 - # only an issue with the useLLVM stdenv, not the darwin stdenv… 61 - # https://github.com/grpc/grpc/issues/26473#issuecomment-860885484 62 - useLLVMAndOldCC = (stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "11.0"; 63 - # With GCC 9 (current aarch64-linux) it fails with c++17 but OK with c++14. 64 - useOldGCC = !(stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "10"; 65 - cxxStandard = if useLLVMAndOldCC then "11" else if useOldGCC then "14" else "17"; 66 - in 67 - [ 68 - "-DgRPC_ZLIB_PROVIDER=package" 69 - "-DgRPC_CARES_PROVIDER=package" 70 - "-DgRPC_RE2_PROVIDER=package" 71 - "-DgRPC_SSL_PROVIDER=package" 72 - "-DgRPC_PROTOBUF_PROVIDER=package" 73 - "-DgRPC_ABSL_PROVIDER=package" 74 - "-DBUILD_SHARED_LIBS=ON" 75 - "-DCMAKE_CXX_STANDARD=${cxxStandard}" 76 - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 77 - "-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc" 78 - ]; 57 + cmakeFlags = [ 58 + "-DgRPC_ZLIB_PROVIDER=package" 59 + "-DgRPC_CARES_PROVIDER=package" 60 + "-DgRPC_RE2_PROVIDER=package" 61 + "-DgRPC_SSL_PROVIDER=package" 62 + "-DgRPC_PROTOBUF_PROVIDER=package" 63 + "-DgRPC_ABSL_PROVIDER=package" 64 + "-DBUILD_SHARED_LIBS=ON" 65 + "-DCMAKE_CXX_STANDARD=${passthru.cxxStandard}" 66 + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 67 + "-D_gRPC_PROTOBUF_PROTOC_EXECUTABLE=${buildPackages.protobuf}/bin/protoc" 68 + ]; 79 69 80 70 # CMake creates a build directory by default, this conflicts with the 81 71 # basel BUILD file on case-insensitive filesystems. ··· 86 96 + lib.optionalString stdenv.isAarch64 "-Wno-error=format-security"; 87 97 88 98 enableParallelBuilds = true; 99 + 100 + passthru.cxxStandard = 101 + let 102 + # Needs to be compiled with -std=c++11 for clang < 11. Interestingly this is 103 + # only an issue with the useLLVM stdenv, not the darwin stdenv… 104 + # https://github.com/grpc/grpc/issues/26473#issuecomment-860885484 105 + useLLVMAndOldCC = (stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "11.0"; 106 + # With GCC 9 (current aarch64-linux) it fails with c++17 but OK with c++14. 107 + useOldGCC = !(stdenv.hostPlatform.useLLVM or false) && lib.versionOlder stdenv.cc.cc.version "10"; 108 + in 109 + (if useLLVMAndOldCC then "11" else if useOldGCC then "14" else "17"); 89 110 90 111 passthru.tests = { 91 112 inherit (python3.pkgs) grpcio-status grpcio-tools;
+1 -1
pkgs/top-level/all-packages.nix
··· 19522 19522 grpc = callPackage ../development/libraries/grpc { 19523 19523 # grpc builds with c++17 so abseil must also be built that way 19524 19524 abseil-cpp = abseil-cpp_202206.override { 19525 - cxxStandard = "17"; 19525 + cxxStandard = grpc.cxxStandard; 19526 19526 }; 19527 19527 }; 19528 19528