python310Packages.unrardll: fix build on darwin

This commit is contained in:
Weijia Wang 2022-10-06 22:26:14 +02:00
parent a989aa4619
commit a6137e79b6

View File

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, unrar }:
{ lib, stdenv, buildPythonPackage, fetchPypi, unrar }:
buildPythonPackage rec {
pname = "unrardll";
@ -11,6 +11,13 @@ buildPythonPackage rec {
buildInputs = [ unrar ];
NIX_CFLAGS_LINK = lib.optionalString stdenv.isDarwin "-headerpad_max_install_names";
postInstall = lib.optionalString stdenv.isDarwin ''
install_name_tool -change libunrar.so ${unrar}/lib/libunrar.so $out/lib/python*/site-packages/unrardll/unrar.*-darwin.so
install_name_tool -change libunrar.so ${unrar}/lib/libunrar.so build/lib.*/unrardll/unrar.*-darwin.so
'';
pythonImportsCheck = [ "unrardll" ];
meta = with lib; {