nixpkgs/pkgs/development/libraries/openjpeg/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
2.7 KiB
Nix
Raw Normal View History

2022-09-23 16:20:48 +00:00
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, pkg-config
2022-08-21 23:52:06 +00:00
, libdeflate, libpng, libtiff, zlib, lcms2, jpylyzer
, jpipLibSupport ? false # JPIP library & executables
2022-08-21 23:52:06 +00:00
, jpipServerSupport ? false, curl, fcgi # JPIP Server
, opjViewerSupport ? false, wxGTK # OPJViewer executable
, openjpegJarSupport ? false # Openjpeg jar (Java)
2022-08-21 23:52:06 +00:00
, jdk
2022-09-23 16:20:48 +00:00
, poppler
}:
let
mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
in
stdenv.mkDerivation rec {
2019-08-13 21:52:01 +00:00
pname = "openjpeg";
2022-08-21 23:52:06 +00:00
version = "2.5.0";
2016-04-25 11:51:15 +00:00
src = fetchFromGitHub {
owner = "uclouvain";
repo = "openjpeg";
rev = "v${version}";
2022-08-21 23:52:06 +00:00
sha256 = "sha256-/0o3Fl6/jx5zu854TCqMyOz/8mnEyEC9lpZ6ij/tbHc=";
};
outputs = [ "out" "dev" ];
2016-04-25 11:51:15 +00:00
2022-09-23 16:20:48 +00:00
patches = [
# modernise cmake files, also fixes them for multiple outputs
2022-09-23 16:20:48 +00:00
(fetchpatch {
url = "https://github.com/uclouvain/openjpeg/pull/1424.patch";
sha256 = "sha256-CxVRt1u4HVOMUjWiZ2plmZC29t/zshCpSY+N4Wlrlvg=";
})
# fix cmake files cross compilation
(fetchpatch {
url = "https://github.com/uclouvain/openjpeg/commit/c6ceb84c221b5094f1e8a4c0c247dee3fb5074e8.patch";
sha256 = "sha256-gBUtmO/7RwSWEl7rc8HGr8gNtvNFdhjEwm0Dd51p5O8=";
})
];
cmakeFlags = [
"-DCMAKE_INSTALL_NAME_DIR=\${CMAKE_INSTALL_PREFIX}/lib"
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_CODEC=ON"
2022-08-21 23:52:06 +00:00
"-DBUILD_THIRDPARTY=OFF"
(mkFlag jpipLibSupport "BUILD_JPIP")
(mkFlag jpipServerSupport "BUILD_JPIP_SERVER")
2022-08-21 23:52:06 +00:00
(mkFlag opjViewerSupport "BUILD_VIEWER")
(mkFlag openjpegJarSupport "BUILD_JAVA")
2022-08-21 23:52:06 +00:00
(mkFlag doCheck "BUILD_TESTING")
];
nativeBuildInputs = [ cmake pkg-config ];
2022-08-21 23:52:06 +00:00
buildInputs = [ libdeflate libpng libtiff zlib lcms2 ]
++ lib.optionals jpipServerSupport [ curl fcgi ]
++ lib.optional opjViewerSupport wxGTK
++ lib.optional (openjpegJarSupport || jpipLibSupport) jdk;
2022-08-21 23:52:06 +00:00
doCheck = (!stdenv.isAarch64 && !stdenv.hostPlatform.isPower64); # tests fail on aarch64-linux and powerpc64
2019-07-06 17:36:43 +00:00
checkPhase = ''
substituteInPlace ../tools/ctest_scripts/travis-ci.cmake \
--replace "JPYLYZER_EXECUTABLE=" "JPYLYZER_EXECUTABLE=\"${jpylyzer}/bin/jpylyzer\" # "
OPJ_SOURCE_DIR=.. ctest -S ../tools/ctest_scripts/travis-ci.cmake
'';
passthru = {
2022-08-21 23:52:06 +00:00
incDir = "openjpeg-${lib.versions.majorMinor version}";
tests = {
inherit poppler;
};
};
meta = with lib; {
description = "Open-source JPEG 2000 codec written in C language";
homepage = "https://www.openjpeg.org/";
license = licenses.bsd2;
maintainers = with maintainers; [ codyopel ];
platforms = platforms.all;
2022-08-21 23:52:06 +00:00
# opj viewer fails to compile with lots of errors, jar requires openjpeg library already compiled and installed
broken = (opjViewerSupport || openjpegJarSupport);
};
}