Unverified Commit 7f6c162b authored by Peder Bergebakken Sundt's avatar Peder Bergebakken Sundt Committed by GitHub
Browse files

python313Packages.pylibjpeg-libjpeg: unvendor libjpeg source (#434557)

parents a25aac7a bfe89bb8
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libjpeg-tools";
  version = "1.71";

  src = fetchFromGitHub {
    owner = "thorfdbg";
    repo = "libjpeg";
    rev = "25f71280913fde7400801772bbf885bb3e873242";
    hash = "sha256-40yb9EujJp9y1PnuYLcPxK31Kj2Q4UQ5YBwXQFYXI/Y=";
  };

  outputs = [
    "out"
    "lib"
  ];

  buildPhase = ''
    runHook preBuild
    make lib
    make final
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    install -m755 -D jpeg $out/bin/jpeg
    install -m644 -D libjpeg.so $lib/lib/libjpeg
    runHook postInstall
  '';

  doCheck = false; # no tests

  meta = {
    description = "A complete implementation of 10918-1 (JPEG) coming from jpeg.org (the ISO group) with extensions for HDR, lossless and alpha channel coding standardized as ISO/IEC 18477 (JPEG XT)";
    homepage = "https://github.com/thorfdbg/libjpeg";
    license = with lib.licenses; [ gpl3 ];
    changelog = "https://github.com/thorfdbg/libjpeg/README.history";
    maintainers = with lib.maintainers; [ bcdarwin ];
    platforms = lib.platforms.unix;
    mainProgram = "jpeg";
    # clang build fails with "ld: symbol(s) not found for architecture arm64" (on aarch64-darwin)
    broken = stdenv.hostPlatform.isDarwin;
  };
})
+5 −2
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
  pydicom,
  pylibjpeg-data,
  pylibjpeg,
  libjpeg-tools,
}:

let
@@ -25,13 +26,15 @@ let
      owner = "pydicom";
      repo = "pylibjpeg-libjpeg";
      tag = "v${self.version}";
      hash = "sha256-xqSA1cutTsH9k4l9CW96n/CURzkAyDi3PZylZeedVjA=";
      fetchSubmodules = true;
      hash = "sha256-P01pofPLTOa5ynsCkLnxiMzVfCg4tbT+/CcpPTeSViw=";
    };

    postPatch = ''
      substituteInPlace pyproject.toml \
        --replace-fail 'poetry-core >=1.8,<2' 'poetry-core'
      rmdir lib/libjpeg
      cp -r ${libjpeg-tools.src} lib/libjpeg
      chmod u+w lib/libjpeg
    '';

    build-system = [