1{ lib, stdenv, fetchFromGitHub, python3, fixDarwinDylibNames }:
2
3stdenv.mkDerivation rec {
4 pname = "jxrlib";
5 version = "1.1";
6
7 # Use the source from a fork on github because CodePlex does not
8 # deliver an easily downloadable tarball.
9 src = fetchFromGitHub {
10 owner = "4creators";
11 repo = pname;
12 rev = "f7521879862b9085318e814c6157490dd9dbbdb4";
13 sha256 = "0rk3hbh00nw0wgbfbqk1szrlfg3yq7w6ar16napww3nrlm9cj65w";
14 };
15
16 postPatch = ''
17 substituteInPlace Makefile \
18 --replace "cc" "$CC"
19 '' + lib.optionalString stdenv.isDarwin ''
20 substituteInPlace Makefile \
21 --replace '-shared' '-dynamiclib -undefined dynamic_lookup' \
22 --replace '.so' '.dylib'
23 '';
24
25 nativeBuildInputs = [ python3 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
26
27 strictDeps = true;
28
29 makeFlags = [ "DIR_INSTALL=$(out)" "SHARED=1" ];
30
31 meta = with lib; {
32 description = "Implementation of the JPEG XR image codec standard";
33 homepage = "https://jxrlib.codeplex.com";
34 license = licenses.bsd2;
35 platforms = platforms.unix;
36 maintainers = with maintainers; [ romildo ];
37 };
38}