Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 62 lines 1.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 cmake, 7 gtest, 8 static ? stdenv.hostPlatform.isStatic, 9 cxxStandard ? null, 10}: 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "abseil-cpp"; 14 version = "20230125.4"; 15 16 src = fetchFromGitHub { 17 owner = "abseil"; 18 repo = "abseil-cpp"; 19 rev = "refs/tags/${finalAttrs.version}"; 20 hash = "sha256-7C/QIXYRyUyNVVE0tqmv8b5g/uWc58iBI5jzdtddQ+U="; 21 }; 22 23 patches = [ 24 # Fixes: clang++: error: unsupported option '-msse4.1' for target 'aarch64-apple-darwin' 25 # https://github.com/abseil/abseil-cpp/pull/1707 26 (fetchpatch { 27 name = "fix-compile-breakage-on-darwin"; 28 url = "https://github.com/abseil/abseil-cpp/commit/6dee153242d7becebe026a9bed52f4114441719d.patch"; 29 hash = "sha256-r6QnHPnwPwOE/hv4kLNA3FqNq2vU/QGmwAc5q0/q1cs="; 30 }) 31 ] 32 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 33 # Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages 34 # that require a different SDK other than the default one. 35 ./cmake-core-foundation.patch 36 ]; 37 38 cmakeFlags = [ 39 "-DABSL_BUILD_TEST_HELPERS=ON" 40 "-DABSL_USE_EXTERNAL_GOOGLETEST=ON" 41 "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" 42 ] 43 ++ lib.optionals (cxxStandard != null) [ 44 "-DCMAKE_CXX_STANDARD=${cxxStandard}" 45 ]; 46 47 strictDeps = true; 48 49 nativeBuildInputs = [ cmake ]; 50 51 buildInputs = [ gtest ]; 52 53 meta = with lib; { 54 description = "Open-source collection of C++ code designed to augment the C++ standard library"; 55 homepage = "https://abseil.io/"; 56 license = licenses.asl20; 57 platforms = platforms.all; 58 maintainers = [ maintainers.andersk ]; 59 # Requires LFS64 APIs. 202401 and later are fine. 60 broken = stdenv.hostPlatform.isMusl; 61 }; 62})