2015-05-27 17:48:03 +02:00
|
|
|
{ stdenv, fetchurl, cmake, pkgconfig
|
|
|
|
, libpng, libtiff, lcms2
|
2015-02-21 04:20:19 +01:00
|
|
|
, mj2Support ? true # MJ2 executables
|
|
|
|
, jpwlLibSupport ? true # JPWL library & executables
|
2015-05-27 17:48:03 +02:00
|
|
|
, jpipLibSupport ? false # JPIP library & executables
|
2015-02-21 04:20:19 +01:00
|
|
|
, jpipServerSupport ? false, curl ? null, fcgi ? null # JPIP Server
|
|
|
|
#, opjViewerSupport ? false, wxGTK ? null # OPJViewer executable
|
2015-05-27 17:48:03 +02:00
|
|
|
, openjpegJarSupport ? false # Openjpeg jar (Java)
|
2015-02-21 04:20:19 +01:00
|
|
|
, jp3dSupport ? true # # JP3D comp
|
|
|
|
, thirdPartySupport ? false # Third party libraries - OFF: only build when found, ON: always build
|
|
|
|
, testsSupport ? false
|
2015-05-27 17:48:03 +02:00
|
|
|
, jdk ? null
|
2015-02-21 04:20:19 +01:00
|
|
|
# Inherit generics
|
2015-05-27 17:48:03 +02:00
|
|
|
, branch, sha256, version, ...
|
2015-02-21 04:20:19 +01:00
|
|
|
}:
|
|
|
|
|
2015-05-27 17:48:03 +02:00
|
|
|
assert jpipServerSupport -> jpipLibSupport && curl != null && fcgi != null;
|
2015-02-21 04:20:19 +01:00
|
|
|
#assert opjViewerSupport -> (wxGTK != null);
|
2015-05-27 17:48:03 +02:00
|
|
|
assert (openjpegJarSupport || jpipLibSupport) -> jdk != null;
|
2015-02-21 04:20:19 +01:00
|
|
|
|
|
|
|
let
|
2015-05-27 17:48:03 +02:00
|
|
|
inherit (stdenv.lib) optional optionals;
|
|
|
|
mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
|
2015-02-21 04:20:19 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "openjpeg-${version}";
|
2016-04-25 13:51:15 +02:00
|
|
|
|
2015-05-27 17:48:03 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/openjpeg.mirror/${version}/openjpeg-${version}.tar.gz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
2015-02-21 04:20:19 +01:00
|
|
|
|
2016-08-29 02:30:01 +02:00
|
|
|
outputs = [ "out" "dev" ];
|
2016-04-25 13:51:15 +02:00
|
|
|
|
2015-02-21 04:20:19 +01:00
|
|
|
cmakeFlags = [
|
2015-05-27 17:48:03 +02:00
|
|
|
"-DCMAKE_INSTALL_NAME_DIR=\${CMAKE_INSTALL_PREFIX}/lib"
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
|
|
|
"-DBUILD_CODEC=ON"
|
2015-02-21 04:20:19 +01: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 17:48:03 +02:00
|
|
|
"-DBUILD_VIEWER=OFF"
|
2015-02-21 04:20:19 +01:00
|
|
|
(mkFlag openjpegJarSupport "BUILD_JAVA")
|
|
|
|
(mkFlag jp3dSupport "BUILD_JP3D")
|
|
|
|
(mkFlag thirdPartySupport "BUILD_THIRDPARTY")
|
|
|
|
(mkFlag testsSupport "BUILD_TESTING")
|
|
|
|
];
|
|
|
|
|
2015-05-27 17:48:03 +02:00
|
|
|
nativeBuildInputs = [ cmake pkgconfig ];
|
2015-02-21 04:20:19 +01:00
|
|
|
|
2015-05-27 17:48:03 +02:00
|
|
|
buildInputs = [ ]
|
2015-02-21 04:20:19 +01:00
|
|
|
++ optionals jpipServerSupport [ curl fcgi ]
|
|
|
|
#++ optional opjViewerSupport wxGTK
|
2015-05-27 17:48:03 +02:00
|
|
|
++ optional (openjpegJarSupport || jpipLibSupport) jdk;
|
2015-02-21 04:20:19 +01:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ libpng libtiff lcms2 ];
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
incDir = "openjpeg-${branch}";
|
|
|
|
};
|
|
|
|
|
2015-05-27 17:48:03 +02:00
|
|
|
meta = with stdenv.lib; {
|
2015-02-21 04:20:19 +01:00
|
|
|
description = "Open-source JPEG 2000 codec written in C language";
|
2015-05-27 17:48:03 +02:00
|
|
|
homepage = http://www.openjpeg.org/;
|
|
|
|
license = licenses.bsd2;
|
2016-02-10 14:59:36 +01:00
|
|
|
maintainers = with maintainers; [ codyopel ];
|
2015-05-27 17:48:03 +02:00
|
|
|
platforms = platforms.all;
|
2015-02-21 04:20:19 +01:00
|
|
|
};
|
|
|
|
}
|