From 34dbaede64a094d59b04a8e76f366f4da4f396cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 22 Aug 2022 01:52:06 +0200 Subject: [PATCH] openjpeg: 2.4.0 -> 2.5.0 --- .../libraries/openjpeg/default.nix | 59 ++++++------------- .../fix-cmake-config-includedir.patch | 44 -------------- 2 files changed, 18 insertions(+), 85 deletions(-) delete mode 100644 pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch diff --git a/pkgs/development/libraries/openjpeg/default.nix b/pkgs/development/libraries/openjpeg/default.nix index b26738c9ea15..b577bcfed458 100644 --- a/pkgs/development/libraries/openjpeg/default.nix +++ b/pkgs/development/libraries/openjpeg/default.nix @@ -1,75 +1,50 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, pkg-config -, libpng, libtiff, lcms2, jpylyzer -, mj2Support ? true # MJ2 executables -, jpwlLibSupport ? true # JPWL library & executables +{ lib, stdenv, fetchFromGitHub, cmake, pkg-config +, libdeflate, libpng, libtiff, zlib, lcms2, jpylyzer , jpipLibSupport ? false # JPIP library & executables -, jpipServerSupport ? false, curl ? null, fcgi ? null # JPIP Server -#, opjViewerSupport ? false, wxGTK ? null # OPJViewer executable +, jpipServerSupport ? false, curl, fcgi # JPIP Server +, opjViewerSupport ? false, wxGTK # 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 +, jdk }: -assert jpipServerSupport -> jpipLibSupport && curl != null && fcgi != null; -#assert opjViewerSupport -> (wxGTK != null); -assert (openjpegJarSupport || jpipLibSupport) -> jdk != null; - let - inherit (lib) optional optionals; mkFlag = optSet: flag: "-D${flag}=${if optSet then "ON" else "OFF"}"; in stdenv.mkDerivation rec { pname = "openjpeg"; - version = "2.4.0"; # don't forget to change passthru.incDir + version = "2.5.0"; src = fetchFromGitHub { owner = "uclouvain"; repo = "openjpeg"; rev = "v${version}"; - sha256 = "143dvy5g6v6129lzvl0r8mrgva2fppkn0zl099qmi9yi9l9h7yyf"; + sha256 = "sha256-/0o3Fl6/jx5zu854TCqMyOz/8mnEyEC9lpZ6ij/tbHc="; }; - patches = [ - ./fix-cmake-config-includedir.patch - (fetchpatch { - url = "https://patch-diff.githubusercontent.com/raw/uclouvain/openjpeg/pull/1321.patch"; - sha256 = "1cjpr76nf9g65nqkfnxnjzi3bv7ifbxpc74kxxibh58pzjlp6al8"; - }) - ]; - 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") + "-DBUILD_THIRDPARTY=OFF" (mkFlag jpipLibSupport "BUILD_JPIP") (mkFlag jpipServerSupport "BUILD_JPIP_SERVER") - #(mkFlag opjViewerSupport "BUILD_VIEWER") - "-DBUILD_VIEWER=OFF" + (mkFlag opjViewerSupport "BUILD_VIEWER") (mkFlag openjpegJarSupport "BUILD_JAVA") - (mkFlag jp3dSupport "BUILD_JP3D") - (mkFlag thirdPartySupport "BUILD_THIRDPARTY") - (mkFlag testsSupport "BUILD_TESTING") - "-DOPENJPEG_INSTALL_INCLUDE_DIR=${placeholder "dev"}/include/${passthru.incDir}" - "-DOPENJPEG_INSTALL_PACKAGE_DIR=${placeholder "dev"}/lib/${passthru.incDir}" + (mkFlag doCheck "BUILD_TESTING") ]; nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ ] - ++ optionals jpipServerSupport [ curl fcgi ] - #++ optional opjViewerSupport wxGTK - ++ optional (openjpegJarSupport || jpipLibSupport) jdk; + buildInputs = [ libdeflate libpng libtiff zlib lcms2 ] + ++ lib.optionals jpipServerSupport [ curl fcgi ] + ++ lib.optional opjViewerSupport wxGTK + ++ lib.optional (openjpegJarSupport || jpipLibSupport) jdk; - propagatedBuildInputs = [ libpng libtiff lcms2 ]; + doCheck = (!stdenv.isAarch64 && !stdenv.hostPlatform.isPower64); # tests fail on aarch64-linux and powerpc64 - doCheck = (testsSupport && !stdenv.isAarch64 && !stdenv.hostPlatform.isPower64); # tests fail on aarch64-linux and powerpc64 checkPhase = '' substituteInPlace ../tools/ctest_scripts/travis-ci.cmake \ --replace "JPYLYZER_EXECUTABLE=" "JPYLYZER_EXECUTABLE=\"${jpylyzer}/bin/jpylyzer\" # " @@ -77,7 +52,7 @@ stdenv.mkDerivation rec { ''; passthru = { - incDir = "openjpeg-2.4"; + incDir = "openjpeg-${lib.versions.majorMinor version}"; }; meta = with lib; { @@ -86,5 +61,7 @@ stdenv.mkDerivation rec { license = licenses.bsd2; maintainers = with maintainers; [ codyopel ]; platforms = platforms.all; + # opj viewer fails to compile with lots of errors, jar requires openjpeg library already compiled and installed + broken = (opjViewerSupport || openjpegJarSupport); }; } diff --git a/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch b/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch deleted file mode 100644 index 21306400dd46..000000000000 --- a/pkgs/development/libraries/openjpeg/fix-cmake-config-includedir.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- 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)