1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 22:20:51 +00:00
nixpkgs/pkgs/development/libraries/openjpeg/generic.nix
codyopel 4587819638 openjpeg: refactor, fixes #8017
+ Disable JPIP which requires Java
+ fix typo in nativeBuildInputs, which fixes pkgconfig
2015-05-27 11:48:03 -04:00

71 lines
2.2 KiB
Nix

{ stdenv, fetchurl, cmake, pkgconfig
, libpng, libtiff, lcms2
, mj2Support ? true # MJ2 executables
, jpwlLibSupport ? true # JPWL library & executables
, jpipLibSupport ? false # JPIP library & executables
, jpipServerSupport ? false, curl ? null, fcgi ? null # JPIP Server
#, opjViewerSupport ? false, wxGTK ? null # OPJViewer executable
, openjpegJarSupport ? false # Openjpeg jar (Java)
, jp3dSupport ? true # # JP3D comp
, thirdPartySupport ? false # Third party libraries - OFF: only build when found, ON: always build
, testsSupport ? false
, jdk ? null
# Inherit generics
, branch, sha256, version, ...
}:
assert jpipServerSupport -> jpipLibSupport && curl != null && fcgi != null;
#assert opjViewerSupport -> (wxGTK != null);
assert (openjpegJarSupport || jpipLibSupport) -> jdk != null;
let
inherit (stdenv.lib) optional optionals;
mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
in
stdenv.mkDerivation rec {
name = "openjpeg-${version}";
src = fetchurl {
url = "mirror://sourceforge/openjpeg.mirror/${version}/openjpeg-${version}.tar.gz";
inherit sha256;
};
cmakeFlags = [
"-DCMAKE_INSTALL_NAME_DIR=\${CMAKE_INSTALL_PREFIX}/lib"
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_CODEC=ON"
(mkFlag mj2Support "BUILD_MJ2")
(mkFlag jpwlLibSupport "BUILD_JPWL")
(mkFlag jpipLibSupport "BUILD_JPIP")
(mkFlag jpipServerSupport "BUILD_JPIP_SERVER")
#(mkFlag opjViewerSupport "BUILD_VIEWER")
"-DBUILD_VIEWER=OFF"
(mkFlag openjpegJarSupport "BUILD_JAVA")
(mkFlag jp3dSupport "BUILD_JP3D")
(mkFlag thirdPartySupport "BUILD_THIRDPARTY")
(mkFlag testsSupport "BUILD_TESTING")
];
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ ]
++ optionals jpipServerSupport [ curl fcgi ]
#++ optional opjViewerSupport wxGTK
++ optional (openjpegJarSupport || jpipLibSupport) jdk;
propagatedBuildInputs = [ libpng libtiff lcms2 ];
passthru = {
incDir = "openjpeg-${branch}";
};
meta = with stdenv.lib; {
description = "Open-source JPEG 2000 codec written in C language";
homepage = http://www.openjpeg.org/;
license = licenses.bsd2;
maintainer = with maintainers; [ codyopel ];
platforms = platforms.all;
};
}