2016-09-25 13:44:26 +01:00
|
|
|
{ stdenv, fetchFromGitHub, cmake, pkgconfig
|
2015-05-27 16:48:03 +01:00
|
|
|
, libpng, libtiff, lcms2
|
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
|
|
|
|
, testsSupport ? false
|
2015-05-27 16:48:03 +01:00
|
|
|
, jdk ? null
|
2015-02-21 03:20:19 +00:00
|
|
|
# Inherit generics
|
2016-12-21 13:16:43 +00:00
|
|
|
, branch, version, revision, sha256, patches ? [], ...
|
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 {
|
|
|
|
name = "openjpeg-${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")
|
|
|
|
];
|
|
|
|
|
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 ];
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|