2022-08-21 23:52:06 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config
|
|
|
|
, libdeflate, libpng, libtiff, zlib, lcms2, jpylyzer
|
2015-05-27 15:48:03 +00:00
|
|
|
, jpipLibSupport ? false # JPIP library & executables
|
2022-08-21 23:52:06 +00:00
|
|
|
, jpipServerSupport ? false, curl, fcgi # JPIP Server
|
|
|
|
, opjViewerSupport ? false, wxGTK # OPJViewer executable
|
2015-05-27 15:48:03 +00:00
|
|
|
, openjpegJarSupport ? false # Openjpeg jar (Java)
|
2022-08-21 23:52:06 +00:00
|
|
|
, jdk
|
2015-02-21 03:20:19 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2015-05-27 15:48:03 +00:00
|
|
|
mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
|
2015-02-21 03:20:19 +00:00
|
|
|
in
|
|
|
|
|
2021-01-25 09:13:24 +00:00
|
|
|
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
|
|
|
|
2016-09-25 12:44:26 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "uclouvain";
|
|
|
|
repo = "openjpeg";
|
2021-01-25 09:13:24 +00:00
|
|
|
rev = "v${version}";
|
2022-08-21 23:52:06 +00:00
|
|
|
sha256 = "sha256-/0o3Fl6/jx5zu854TCqMyOz/8mnEyEC9lpZ6ij/tbHc=";
|
2015-05-27 15:48:03 +00:00
|
|
|
};
|
2015-02-21 03:20:19 +00:00
|
|
|
|
2016-08-29 00:30:01 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
2016-04-25 11:51:15 +00:00
|
|
|
|
2015-02-21 03:20:19 +00:00
|
|
|
cmakeFlags = [
|
2015-05-27 15:48:03 +00:00
|
|
|
"-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"
|
2015-02-21 03:20:19 +00:00
|
|
|
(mkFlag jpipLibSupport "BUILD_JPIP")
|
|
|
|
(mkFlag jpipServerSupport "BUILD_JPIP_SERVER")
|
2022-08-21 23:52:06 +00:00
|
|
|
(mkFlag opjViewerSupport "BUILD_VIEWER")
|
2015-02-21 03:20:19 +00:00
|
|
|
(mkFlag openjpegJarSupport "BUILD_JAVA")
|
2022-08-21 23:52:06 +00:00
|
|
|
(mkFlag doCheck "BUILD_TESTING")
|
2021-01-25 09:13:24 +00:00
|
|
|
];
|
2015-02-21 03:20:19 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2015-02-21 03:20:19 +00:00
|
|
|
|
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;
|
2015-02-21 03:20:19 +00:00
|
|
|
|
2022-08-21 23:52:06 +00:00
|
|
|
doCheck = (!stdenv.isAarch64 && !stdenv.hostPlatform.isPower64); # tests fail on aarch64-linux and powerpc64
|
2015-02-21 03:20:19 +00:00
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2015-02-21 03:20:19 +00:00
|
|
|
passthru = {
|
2022-08-21 23:52:06 +00:00
|
|
|
incDir = "openjpeg-${lib.versions.majorMinor version}";
|
2015-02-21 03:20:19 +00:00
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2015-02-21 03:20:19 +00:00
|
|
|
description = "Open-source JPEG 2000 codec written in C language";
|
2021-01-09 05:41:01 +00:00
|
|
|
homepage = "https://www.openjpeg.org/";
|
2015-05-27 15:48:03 +00:00
|
|
|
license = licenses.bsd2;
|
2016-02-10 13:59:36 +00:00
|
|
|
maintainers = with maintainers; [ codyopel ];
|
2015-05-27 15:48:03 +00:00
|
|
|
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);
|
2015-02-21 03:20:19 +00:00
|
|
|
};
|
|
|
|
}
|