2016-09-25 13:44:26 +01:00
|
|
|
{ stdenv, fetchFromGitHub, cmake, pkgconfig
|
2019-07-06 18:36:43 +01:00
|
|
|
, libpng, libtiff, lcms2, jpylyzer
|
2015-02-21 03:20:19 +00:00
|
|
|
, mj2Support ? true # MJ2 executables
|
|
|
|
, jpwlLibSupport ? true # JPWL library & executables
|
2015-05-27 16:48:03 +01:00
|
|
|
, jpipLibSupport ? false # JPIP library & executables
|
2015-02-21 03:20:19 +00:00
|
|
|
, jpipServerSupport ? false, curl ? null, fcgi ? null # JPIP Server
|
|
|
|
#, opjViewerSupport ? false, wxGTK ? null # OPJViewer executable
|
2015-05-27 16:48:03 +01:00
|
|
|
, openjpegJarSupport ? false # Openjpeg jar (Java)
|
2015-02-21 03:20:19 +00:00
|
|
|
, jp3dSupport ? true # # JP3D comp
|
|
|
|
, thirdPartySupport ? false # Third party libraries - OFF: only build when found, ON: always build
|
2019-07-06 18:36:43 +01:00
|
|
|
, testsSupport ? true
|
2015-05-27 16:48:03 +01:00
|
|
|
, jdk ? null
|
2015-02-21 03:20:19 +00:00
|
|
|
# Inherit generics
|
2018-12-23 01:01:49 +00:00
|
|
|
, branch, version, revision, sha256, patches ? [], extraFlags ? [], ...
|
2015-02-21 03:20:19 +00:00
|
|
|
}:
|
|
|
|
|
2015-05-27 16:48:03 +01:00
|
|
|
assert jpipServerSupport -> jpipLibSupport && curl != null && fcgi != null;
|
2015-02-21 03:20:19 +00:00
|
|
|
#assert opjViewerSupport -> (wxGTK != null);
|
2015-05-27 16:48:03 +01:00
|
|
|
assert (openjpegJarSupport || jpipLibSupport) -> jdk != null;
|
2015-02-21 03:20:19 +00:00
|
|
|
|
|
|
|
let
|
2015-05-27 16:48:03 +01:00
|
|
|
inherit (stdenv.lib) optional optionals;
|
|
|
|
mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
|
2015-02-21 03:20:19 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "openjpeg";
|
|
|
|
inherit version;
|
2016-04-25 12:51:15 +01:00
|
|
|
|
2016-09-25 13:44:26 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "uclouvain";
|
|
|
|
repo = "openjpeg";
|
|
|
|
rev = revision;
|
2015-05-27 16:48:03 +01:00
|
|
|
inherit sha256;
|
|
|
|
};
|
2015-02-21 03:20:19 +00:00
|
|
|
|
2016-12-21 13:16:43 +00:00
|
|
|
inherit patches;
|
|
|
|
|
2016-08-29 01:30:01 +01:00
|
|
|
outputs = [ "out" "dev" ];
|
2016-04-25 12:51:15 +01:00
|
|
|
|
2015-02-21 03:20:19 +00:00
|
|
|
cmakeFlags = [
|
2015-05-27 16:48:03 +01:00
|
|
|
"-DCMAKE_INSTALL_NAME_DIR=\${CMAKE_INSTALL_PREFIX}/lib"
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
|
|
|
"-DBUILD_CODEC=ON"
|
2015-02-21 03:20:19 +00:00
|
|
|
(mkFlag mj2Support "BUILD_MJ2")
|
|
|
|
(mkFlag jpwlLibSupport "BUILD_JPWL")
|
|
|
|
(mkFlag jpipLibSupport "BUILD_JPIP")
|
|
|
|
(mkFlag jpipServerSupport "BUILD_JPIP_SERVER")
|
|
|
|
#(mkFlag opjViewerSupport "BUILD_VIEWER")
|
2015-05-27 16:48:03 +01:00
|
|
|
"-DBUILD_VIEWER=OFF"
|
2015-02-21 03:20:19 +00:00
|
|
|
(mkFlag openjpegJarSupport "BUILD_JAVA")
|
|
|
|
(mkFlag jp3dSupport "BUILD_JP3D")
|
|
|
|
(mkFlag thirdPartySupport "BUILD_THIRDPARTY")
|
|
|
|
(mkFlag testsSupport "BUILD_TESTING")
|
2018-12-23 01:01:49 +00:00
|
|
|
] ++ extraFlags;
|
2015-02-21 03:20:19 +00:00
|
|
|
|
2015-05-27 16:48:03 +01:00
|
|
|
nativeBuildInputs = [ cmake pkgconfig ];
|
2015-02-21 03:20:19 +00:00
|
|
|
|
2015-05-27 16:48:03 +01:00
|
|
|
buildInputs = [ ]
|
2015-02-21 03:20:19 +00:00
|
|
|
++ optionals jpipServerSupport [ curl fcgi ]
|
|
|
|
#++ optional opjViewerSupport wxGTK
|
2015-05-27 16:48:03 +01:00
|
|
|
++ optional (openjpegJarSupport || jpipLibSupport) jdk;
|
2015-02-21 03:20:19 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ libpng libtiff lcms2 ];
|
|
|
|
|
2019-08-04 11:18:09 +01:00
|
|
|
doCheck = (testsSupport && !stdenv.isAarch64); # tests fail on aarch64-linux
|
2019-07-06 18:36:43 +01: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 = {
|
|
|
|
incDir = "openjpeg-${branch}";
|
|
|
|
};
|
|
|
|
|
2015-05-27 16:48:03 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-02-21 03:20:19 +00:00
|
|
|
description = "Open-source JPEG 2000 codec written in C language";
|
2015-05-27 16:48:03 +01:00
|
|
|
homepage = http://www.openjpeg.org/;
|
|
|
|
license = licenses.bsd2;
|
2016-02-10 13:59:36 +00:00
|
|
|
maintainers = with maintainers; [ codyopel ];
|
2015-05-27 16:48:03 +01:00
|
|
|
platforms = platforms.all;
|
2015-02-21 03:20:19 +00:00
|
|
|
};
|
|
|
|
}
|