From 3d4b776702ad085925909be57a213d45e20127de Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Thu, 6 Feb 2025 18:51:59 +0100 Subject: [PATCH] python312Packages.primp: 0.6.5 -> 0.12.0 Co-authored-by: Pol Dellaiera --- .../python-modules/primp/default.nix | 51 ++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/pkgs/development/python-modules/primp/default.nix b/pkgs/development/python-modules/primp/default.nix index fc0e7d96ab97..8c8e94229551 100644 --- a/pkgs/development/python-modules/primp/default.nix +++ b/pkgs/development/python-modules/primp/default.nix @@ -12,33 +12,71 @@ patchelf, gcc-unwrapped, python, + fetchpatch, }: let + boringsslPatched = boringssl.overrideAttrs (oa: { + # boringssl source obtained from https://github.com/0x676e67/boring2/tree/1a0f1cd24e728aac100df68027c820f858199224/boring-sys/deps + src = fetchFromGitHub { + owner = "google"; + repo = "boringssl"; + rev = "44b3df6f03d85c901767250329c571db405122d5"; + hash = "sha256-REELo7X9aFy2OHjubYLO1UQXLTgekD4QFd2vyFthIrg="; + }; + modRoot = "./src"; + patches = [ + # A patch required to build boringssl compatible with `boring-sys2`. + # See https://github.com/0x676e67/boring2/blob/1a0f1cd24e728aac100df68027c820f858199224/boring-sys/build/main.rs#L486-L489 + (fetchpatch { + name = "boringssl-44b3df6f03d85c901767250329c571db405122d5.patch"; + url = "https://raw.githubusercontent.com/0x676e67/boring2/4edbff8cade24d5d83cc372c4502b59c5192b5a1/boring-sys/patches/boringssl-44b3df6f03d85c901767250329c571db405122d5.patch"; + hash = "sha256-lM+2lLvfDHnxLl+OgZ6R8Y4Z6JfA9AiDqboT1mbxmao="; + }) + ]; + + # Remove bazel specific build file to make way for build directory + # This is a problem on Darwin because of case-insensitive filesystem + preBuild = + (lib.optionalString stdenv.isDarwin '' + rm ../BUILD + '') + + oa.preBuild; + + env.NIX_CFLAGS_COMPILE = + oa.env.NIX_CFLAGS_COMPILE + + " " + + toString ( + lib.optionals stdenv.cc.isGNU [ + "-Wno-error=ignored-attributes" + ] + ); + + vendorHash = "sha256-06MkjXl0DKFzIH/H+uT9kXsQdPq7qdZh2dlLW/YhJuk="; + }); # boring-sys expects the static libraries in build/ instead of lib/ boringssl-wrapper = runCommand "boringssl-wrapper" { } '' mkdir $out - cd $out - ln -s ${boringssl.out}/lib build - ln -s ${boringssl.dev}/include include + ln -s ${boringsslPatched.out}/lib $out/build + ln -s ${boringsslPatched.dev}/include $out/include ''; in buildPythonPackage rec { pname = "primp"; - version = "0.6.5"; + version = "0.12.0"; pyproject = true; src = fetchFromGitHub { owner = "deedy5"; repo = "primp"; tag = "v${version}"; - hash = "sha256-dexJdeNGpRsPLk8b/gNeQc1dsQLOiXNL5zgDEN9qHfQ="; + hash = "sha256-yzcrUER+NiDfSjJ3my45IS+2GmeusvJgyX5nFSaqFUk="; }; cargoDeps = rustPlatform.fetchCargoVendor { inherit src; name = "${pname}-${version}"; - hash = "sha256-s+LAuZmnmTDPIFDSi9AkyWposFFnboJCmog1kiEBnrw="; + hash = "sha256-gCNnP0B0D6AJ1L/E6sQKASx8BbSJU5jTNia+tL2USvU="; }; nativeBuildInputs = [ @@ -58,6 +96,7 @@ buildPythonPackage rec { ]; env.BORING_BSSL_PATH = boringssl-wrapper; + env.BORING_BSSL_ASSUME_PATCHED = true; optional-dependencies = { dev = [ pytest ];