diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/openjpeg')
4 files changed, 174 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/1.x.nix b/nixpkgs/pkgs/development/libraries/openjpeg/1.x.nix new file mode 100644 index 000000000000..2a625f32e7ff --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/openjpeg/1.x.nix @@ -0,0 +1,9 @@ +{ callPackage, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "1.5.2"; + branch = "1.5"; + revision = "version.1.5.2"; + sha256 = "1dvvpvb597i5z8srz2v4c5dsbxb966h125jx3m2z0r2gd2wvpfkp"; + testsSupport = false; +}) diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/2.x.nix b/nixpkgs/pkgs/development/libraries/openjpeg/2.x.nix new file mode 100644 index 000000000000..24f3752ef435 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/openjpeg/2.x.nix @@ -0,0 +1,27 @@ +{ callPackage, fetchpatch, ... } @ args: + +callPackage ./generic.nix (args // rec { + version = "2.3.1"; + branch = "2.3"; + revision = "v${version}"; + sha256 = "1dn98d2dfa1lqyxxmab6rrcv52dyhjr4g7i4xf2w54fqsx14ynrb"; + + extraFlags = [ + "-DOPENJPEG_INSTALL_INCLUDE_DIR=${placeholder "dev"}/include/openjpeg-${branch}" + "-DOPENJPEG_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/openjpeg-${branch}" + ]; + + patches = [ + ./fix-cmake-config-includedir.patch + (fetchpatch { + url = "https://github.com/uclouvain/openjpeg/commit/21399f6b7d318fcdf4406d5e88723c4922202aa3.patch"; + name = "CVE-2019-12973-1.patch"; + sha256 = "161yvnfbzy2016qqapm0ywfgglgs1v8ljnk6fj8d2bwdh1cxxz8f"; + }) + (fetchpatch { + url = "https://github.com/uclouvain/openjpeg/commit/3aef207f90e937d4931daf6d411e092f76d82e66.patch"; + name = "CVE-2019-12973-2.patch"; + sha256 = "1jkkfw13l7nx4hxdhc7z17f4vfgqcaf09zpl235kypbxx1ygc7vq"; + }) + ]; +}) diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch b/nixpkgs/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch new file mode 100644 index 000000000000..6ff720ead4e1 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch @@ -0,0 +1,55 @@ +--- a/cmake/OpenJPEGConfig.cmake.in ++++ b/cmake/OpenJPEGConfig.cmake.in +@@ -32,7 +32,7 @@ + set(INC_DIR "@CMAKE_INSTALL_PREFIX@/@OPENJPEG_INSTALL_INCLUDE_DIR@") + file(RELATIVE_PATH PKG_TO_INC_RPATH "${PKG_DIR}" "${INC_DIR}") + +- get_filename_component(OPENJPEG_INCLUDE_DIRS "${SELF_DIR}/${PKG_TO_INC_RPATH}" ABSOLUTE) ++ get_filename_component(OPENJPEG_INCLUDE_DIRS "@OPENJPEG_INSTALL_INCLUDE_DIR@" ABSOLUTE) + + else() + if(EXISTS ${SELF_DIR}/OpenJPEGExports.cmake) +--- a/src/lib/openjp2/libopenjp2.pc.cmake.in ++++ b/src/lib/openjp2/libopenjp2.pc.cmake.in +@@ -3,7 +3,7 @@ + mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@ + docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@ + libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@ +-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@ ++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@ + + Name: openjp2 + Description: JPEG2000 library (Part 1 and 2) +--- a/src/lib/openjp3d/libopenjp3d.pc.cmake.in ++++ b/src/lib/openjp3d/libopenjp3d.pc.cmake.in +@@ -3,7 +3,7 @@ + mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@ + docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@ + libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@ +-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@ ++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@ + + Name: openjp3d + Description: JPEG2000 Extensions for three-dimensional data (Part 10) +--- a/src/lib/openjpip/libopenjpip.pc.cmake.in ++++ b/src/lib/openjpip/libopenjpip.pc.cmake.in +@@ -3,7 +3,7 @@ + mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@ + docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@ + libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@ +-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@ ++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@ + + Name: openjpip + Description: JPEG2000 Interactivity tools, APIs and protocols (Part 9) +--- a/src/lib/openjpwl/libopenjpwl.pc.cmake.in ++++ b/src/lib/openjpwl/libopenjpwl.pc.cmake.in +@@ -3,7 +3,7 @@ + mandir=${prefix}/@OPENJPEG_INSTALL_MAN_DIR@ + docdir=${prefix}/@OPENJPEG_INSTALL_DOC_DIR@ + libdir=${prefix}/@OPENJPEG_INSTALL_LIB_DIR@ +-includedir=${prefix}/@OPENJPEG_INSTALL_INCLUDE_DIR@ ++includedir=@OPENJPEG_INSTALL_INCLUDE_DIR@ + + Name: openjpwl + Description: JPEG2000 Wireless library (Part 11) diff --git a/nixpkgs/pkgs/development/libraries/openjpeg/generic.nix b/nixpkgs/pkgs/development/libraries/openjpeg/generic.nix new file mode 100644 index 000000000000..e26f4160921f --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/openjpeg/generic.nix @@ -0,0 +1,83 @@ +{ stdenv, fetchFromGitHub, cmake, pkgconfig +, libpng, libtiff, lcms2, jpylyzer +, 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 ? true +, jdk ? null +# Inherit generics +, branch, version, revision, sha256, patches ? [], extraFlags ? [], ... +}: + +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 = fetchFromGitHub { + owner = "uclouvain"; + repo = "openjpeg"; + rev = revision; + inherit sha256; + }; + + inherit patches; + + outputs = [ "out" "dev" ]; + + 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") + ] ++ extraFlags; + + nativeBuildInputs = [ cmake pkgconfig ]; + + buildInputs = [ ] + ++ optionals jpipServerSupport [ curl fcgi ] + #++ optional opjViewerSupport wxGTK + ++ optional (openjpegJarSupport || jpipLibSupport) jdk; + + propagatedBuildInputs = [ libpng libtiff lcms2 ]; + + doCheck = (testsSupport && !stdenv.isAarch64); # tests fail on aarch64-linux + checkPhase = '' + substituteInPlace ../tools/ctest_scripts/travis-ci.cmake \ + --replace "JPYLYZER_EXECUTABLE=" "JPYLYZER_EXECUTABLE=\"${jpylyzer}/bin/jpylyzer\" # " + OPJ_SOURCE_DIR=.. ctest -S ../tools/ctest_scripts/travis-ci.cmake + ''; + + 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; + maintainers = with maintainers; [ codyopel ]; + platforms = platforms.all; + }; +} |