openjpeg: refactor to generic, add 1.x & 2.0.0 -> 2.1.0

This commit is contained in:
codyopel 2015-02-20 22:20:19 -05:00
parent 1aed33f68b
commit f10a8f8501
5 changed files with 104 additions and 41 deletions

View File

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

View File

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

View File

@ -1,40 +0,0 @@
{ stdenv, fetchurl, pkgconfig, libpng, libtiff, lcms, cmake, glib/*passthru only*/ }:
stdenv.mkDerivation rec {
name = "openjpeg-2.0.0";
passthru = {
incDir = "openjpeg-2.0";
};
src = fetchurl {
url = "http://openjpeg.googlecode.com/files/${name}.tar.gz";
sha1 = "0af78ab2283b43421458f80373422d8029a9f7a7";
};
buildInputs = [ cmake ];
nativebuildInputs = [ pkgconfig ];
propagatedBuildInputs = [ libpng libtiff lcms ]; # in closure anyway
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: @OPENJPEG_VERSION@
Libs: -L$out/lib -lopenjp2
Cflags: -I$out/include
EOF
'';
meta = {
homepage = http://www.openjpeg.org/;
description = "Open-source JPEG 2000 codec written in C language";
license = stdenv.lib.licenses.bsd2;
platforms = stdenv.lib.platforms.all;
};
}

View File

@ -0,0 +1,87 @@
{ stdenv, fetchurl, cmake, pkgconfig, libpng, libtiff, lcms2, glib/*passthru only*/
, sharedLibsSupport ? true # Build shared libraries
, codecSupport ? true # Codec executables
, mj2Support ? true # MJ2 executables
, jpwlLibSupport ? true # JPWL library & executables
, jpipLibSupport ? true # JPIP library & executables
, jpipServerSupport ? false, curl ? null, fcgi ? null # JPIP Server
#, opjViewerSupport ? false, wxGTK ? null # OPJViewer executable
, openjpegJarSupport ? false, jdk ? null # Openjpeg jar (Java)
, jp3dSupport ? true # # JP3D comp
, thirdPartySupport ? false # Third party libraries - OFF: only build when found, ON: always build
, testsSupport ? false
# Inherit generics
, branch, sha256, version, ...
}:
assert jpipServerSupport -> (jpipLibSupport && (curl != null) && (fcgi != null));
#assert opjViewerSupport -> (wxGTK != null);
assert openjpegJarSupport -> (jdk != null);
assert testsSupport -> codecSupport;
let
mkFlag = optSet: flag: if optSet then "-D${flag}=ON" else "-D${flag}=OFF";
in
with stdenv.lib;
stdenv.mkDerivation rec {
name = "openjpeg-${version}";
inherit branch;
inherit version;
src = fetchurl {
url = "mirror://gentoo/distfiles/${name}.tar.gz";
inherit sha256;
};
cmakeFlags = [
(mkFlag sharedLibsSupport "BUILD_SHARED_LIBS")
(mkFlag codecSupport "BUILD_CODEC")
(mkFlag mj2Support "BUILD_MJ2")
(mkFlag jpwlLibSupport "BUILD_JPWL")
(mkFlag jpipLibSupport "BUILD_JPIP")
(mkFlag jpipServerSupport "BUILD_JPIP_SERVER")
#(mkFlag opjViewerSupport "BUILD_VIEWER")
(mkFlag openjpegJarSupport "BUILD_JAVA")
(mkFlag jp3dSupport "BUILD_JP3D")
(mkFlag thirdPartySupport "BUILD_THIRDPARTY")
(mkFlag testsSupport "BUILD_TESTING")
];
nativebuildInputs = [ pkgconfig ];
buildInputs = [ cmake ]
++ optionals jpipServerSupport [ curl fcgi ]
#++ optional opjViewerSupport wxGTK
++ optional openjpegJarSupport 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: @OPENJPEG_VERSION@
Libs: -L$out/lib -lopenjp2
Cflags: -I$out/include
EOF
'';
passthru = {
incDir = "openjpeg-${branch}";
};
meta = {
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;
};
}

View File

@ -6915,7 +6915,9 @@ let
opal = callPackage ../development/libraries/opal {};
openjpeg = callPackage ../development/libraries/openjpeg { lcms = lcms2; };
openjpeg_1 = callPackage ../development/libraries/openjpeg/1.x.nix { };
openjpeg_2 = callPackage ../development/libraries/openjpeg/2.x.nix { };
openjpeg = openjpeg_2;
openscenegraph = callPackage ../development/libraries/openscenegraph {
giflib = giflib_4_1;