openjpeg: refactor, fixes #8017

+ Disable JPIP which requires Java
+ fix typo in nativeBuildInputs, which fixes pkgconfig
This commit is contained in:
codyopel 2015-05-27 11:48:03 -04:00
parent c11ccdbc99
commit 4587819638
6 changed files with 40 additions and 64 deletions

View File

@ -1,10 +1,7 @@
{ callPackage, fetchurl, ... } @ args:
{ callPackage, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "${branch}.2";
branch = "1.5";
src = fetchurl {
url = "mirror://gentoo/distfiles/openjpeg-${version}.tar.gz";
sha256 = "11waq9w215zvzxrpv40afyd18qf79mxc28fda80bm3ax98cpppqm";
};
sha256 = "11waq9w215zvzxrpv40afyd18qf79mxc28fda80bm3ax98cpppqm";
})

View File

@ -1,10 +0,0 @@
{ callPackage, fetchurl, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "${branch}.0.1";
branch = "2";
src = fetchurl {
url = "mirror://sourceforge/openjpeg.mirror/openjpeg-${version}.tar.gz";
sha256 = "1c2xc3nl2mg511b63rk7hrckmy14681p1m44mzw3n1fyqnjm0b0z";
};
})

View File

@ -0,0 +1,7 @@
{ callPackage, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "${branch}.0.1";
branch = "2";
sha256 = "1c2xc3nl2mg511b63rk7hrckmy14681p1m44mzw3n1fyqnjm0b0z";
})

View File

@ -1,10 +1,7 @@
{ callPackage, fetchurl, ... } @ args:
{ callPackage, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "${branch}.0";
branch = "2.1";
src = fetchurl {
url = "mirror://gentoo/distfiles/openjpeg-${version}.tar.gz";
sha256 = "00zzm303zvv4ijzancrsb1cqbph3pgz0nky92k9qx3fq9y0vnchj";
};
sha256 = "00zzm303zvv4ijzancrsb1cqbph3pgz0nky92k9qx3fq9y0vnchj";
})

View File

@ -1,85 +1,70 @@
{ stdenv, cmake, pkgconfig, libpng, libtiff, lcms2, glib/*passthru only*/
, sharedLibsSupport ? true # Build shared libraries
, codecSupport ? true # Codec executables
{ stdenv, fetchurl, cmake, pkgconfig
, libpng, libtiff, lcms2
, mj2Support ? true # MJ2 executables
, jpwlLibSupport ? true # JPWL library & executables
, jpipLibSupport ? true # JPIP library & executables
, jpipLibSupport ? false # JPIP library & executables
, jpipServerSupport ? false, curl ? null, fcgi ? null # JPIP Server
#, opjViewerSupport ? false, wxGTK ? null # OPJViewer executable
, openjpegJarSupport ? false, jdk ? null # Openjpeg jar (Java)
, 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, src, version, ...
, branch, sha256, version, ...
}:
assert jpipServerSupport -> (jpipLibSupport && (curl != null) && (fcgi != null));
assert jpipServerSupport -> jpipLibSupport && curl != null && fcgi != null;
#assert opjViewerSupport -> (wxGTK != null);
assert openjpegJarSupport -> (jdk != null);
assert testsSupport -> codecSupport;
assert (openjpegJarSupport || jpipLibSupport) -> jdk != null;
let
mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF";
inherit (stdenv.lib) optional optionals;
mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}";
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "openjpeg-${version}";
inherit branch;
inherit version;
inherit src;
src = fetchurl {
url = "mirror://sourceforge/openjpeg.mirror/${version}/openjpeg-${version}.tar.gz";
inherit sha256;
};
cmakeFlags = [
(mkFlag sharedLibsSupport "BUILD_SHARED_LIBS")
(mkFlag codecSupport "BUILD_CODEC")
"-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")
] ++ stdenv.lib.optionals stdenv.isDarwin
[ "-DCMAKE_INSTALL_NAME_DIR=\${CMAKE_INSTALL_PREFIX}/lib"
];
nativebuildInputs = [ pkgconfig ];
nativeBuildInputs = [ cmake pkgconfig ];
buildInputs = [ cmake ]
buildInputs = [ ]
++ optionals jpipServerSupport [ curl fcgi ]
#++ optional opjViewerSupport wxGTK
++ optional openjpegJarSupport jdk;
++ optional (openjpegJarSupport || jpipLibSupport) jdk;
propagatedBuildInputs = [ libpng libtiff lcms2 ];
postInstall = glib.flattenInclude + ''
mkdir -p "$out/lib/pkgconfig"
cat > "$out/lib/pkgconfig/libopenjp2.pc" <<EOF
prefix=$out
libdir=$out/lib
includedir=$out/include
Name: openjp2
Description: JPEG2000 library (Part 1 and 2)
URL: http://www.openjpeg.org/
Version: ${version}
Libs: -L$out/lib -lopenjp2
Cflags: -I$out/include
EOF
'';
passthru = {
incDir = "openjpeg-${branch}";
};
meta = {
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;
homepage = http://www.openjpeg.org/;
license = licenses.bsd2;
maintainer = with maintainers; [ codyopel ];
platforms = platforms.all;
};
}

View File

@ -7502,7 +7502,7 @@ let
opal = callPackage ../development/libraries/opal {};
openjpeg_1 = callPackage ../development/libraries/openjpeg/1.x.nix { };
openjpeg_2_0_1 = callPackage ../development/libraries/openjpeg/2.0.1.nix { };
openjpeg_2_0 = callPackage ../development/libraries/openjpeg/2.0.nix { };
openjpeg_2_1 = callPackage ../development/libraries/openjpeg/2.1.nix { };
openjpeg = openjpeg_2_1;
@ -11868,7 +11868,7 @@ let
maxlib = callPackage ../applications/audio/pd-plugins/maxlib { };
mupdf = callPackage ../applications/misc/mupdf {
openjpeg = openjpeg_2_0_1;
openjpeg = openjpeg_2_0;
};
mypaint = callPackage ../applications/graphics/mypaint { };