2015-05-27 16:48:03 +01:00
|
|
|
{ stdenv, fetchurl, cmake, pkgconfig
|
|
|
|
, 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
|
2015-05-27 16:48:03 +01:00
|
|
|
, branch, sha256, version, ...
|
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}";
|
2015-05-27 16:48:03 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/openjpeg.mirror/${version}/openjpeg-${version}.tar.gz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
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;
|
|
|
|
maintainer = with maintainers; [ codyopel ];
|
|
|
|
platforms = platforms.all;
|
2015-02-21 03:20:19 +00:00
|
|
|
};
|
|
|
|
}
|