Browse Source

Auto-update openexr to v3.4.0 (#8263)

* Update openexr to v3.4.0

* add openjph patch

* add mac support

* Update xmake.lua

* Update xmake.lua

* fix

---------

Co-authored-by: star9029 <[email protected]>
ruki 2 tháng trước cách đây
mục cha
commit
32efc48858

+ 23 - 0
packages/o/openexr/patches/3.4.0/openjph-include.patch

@@ -0,0 +1,23 @@
+diff --git a/src/lib/OpenEXRCore/internal_ht.cpp b/src/lib/OpenEXRCore/internal_ht.cpp
+index 14d1940ff..c4385ef5c 100644
+--- a/src/lib/OpenEXRCore/internal_ht.cpp
++++ b/src/lib/OpenEXRCore/internal_ht.cpp
+@@ -7,12 +7,12 @@
+ #include <string>
+ #include <fstream>
+ 
+-#include <ojph_arch.h>
+-#include <ojph_file.h>
+-#include <ojph_params.h>
+-#include <ojph_mem.h>
+-#include <ojph_codestream.h>
+-#include <ojph_message.h>
++#include <openjph/ojph_arch.h>
++#include <openjph/ojph_file.h>
++#include <openjph/ojph_params.h>
++#include <openjph/ojph_mem.h>
++#include <openjph/ojph_codestream.h>
++#include <openjph/ojph_message.h>
+ 
+ #include "openexr_decode.h"
+ #include "openexr_encode.h"

+ 14 - 1
packages/o/openexr/xmake.lua

@@ -6,6 +6,7 @@ package("openexr")
     add_urls("https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/$(version).tar.gz",
              "https://github.com/AcademySoftwareFoundation/openexr.git")
 
+    add_versions("v3.4.0", "d7b31637d7adc359f5e5a7517ba918cb5997bc1a4ae7a808ec874cdf91da93c0")
     add_versions("v3.3.5", "cb0c88710c906c9bfc59027eb147e780d508c7be1a90b43af3ec9e3c2987b70d")
     add_versions("v3.3.4", "63abac7c52f280e3e16fc868ac40e06449733bb19179008248ae7e34e4f19824")
     add_versions("v3.3.3", "0ffbd842a7ee2128d44affdea30f42294b4061293cde3aa75b61a53573413d1e")
@@ -24,6 +25,7 @@ package("openexr")
     add_versions("v3.1.5", "93925805c1fc4f8162b35f0ae109c4a75344e6decae5a240afdfce25f8a433ec")
     add_versions("v3.2.1", "61e175aa2203399fb3c8c2288752fbea3c2637680d50b6e306ea5f8ffdd46a9b")
 
+    add_patches("3.4.0", "patches/3.4.0/openjph-include.patch", "d8eb99fd9f064821134ee61c4bfb0e5dff4be557a21698365361250f13e82e53")
     add_patches("3.3.3", "patches/3.3.3/mingw32.patch", "17cbe9d0cbc0c670a846454893c1a427590789cf6bf052a4d800d1263e0faa9a")
 
     add_configs("build_both", {description = "Build both static library and shared library. (deprecated)", default = false, type = "boolean"})
@@ -39,6 +41,11 @@ package("openexr")
     add_deps("zlib", "libdeflate")
 
     if on_check then
+        on_check("android", function (package)
+            local ndk = package:toolchain("ndk")
+            local ndk_sdkver = ndk:config("ndk_sdkver")
+            assert(ndk_sdkver and tonumber(ndk_sdkver) >= 28, "package(openexr) dep(openjph) need ndk api level >= 28")
+        end)
         on_check("windows", function (package)
             local vs_toolset = package:toolchain("msvc"):config("vs_toolset")
             if vs_toolset and package:is_arch("arm.*") then
@@ -50,8 +57,11 @@ package("openexr")
     end
 
     on_load(function (package)
-        local ver = package:version()
+        local ver = assert(package:version(), "package(openexr) require version number")
         local suffix = format("-%d_%d", ver:major(), ver:minor())
+        if ver:ge("3.4.0") then
+            package:add("deps", "openjph")
+        end
         local links = {}
         if ver:ge("3.0") then
             package:add("deps", "imath")
@@ -70,6 +80,9 @@ package("openexr")
     on_install(function (package)
         io.replace("CMakeLists.txt", "add_subdirectory(website/src)", "", {plain = true})
         io.replace("cmake/OpenEXRSetup.cmake", [[set(CMAKE_DEBUG_POSTFIX "_d")]], "", {plain = true})
+        if package:version():ge("3.4.0") then
+            -- io.replace("src/lib/OpenEXRCore/CMakeLists.txt", "${EXR_OPENJPH_LIB}", "openjph::openjph", {plain = true})
+        end
 
         local configs = {
             "-DBUILD_TESTING=OFF",

+ 2 - 2
packages/o/openjph/xmake.lua

@@ -20,7 +20,7 @@ package("openjph")
         end)
     end
 
-    on_install("!macosx and !iphoneos", function (package)
+    on_install(function (package)
         if package:is_plat("windows", "mingw") and package:config("shared") then
             io.replace("src/core/common/ojph_arch.h", [[#else
 #define OJPH_EXPORT
@@ -42,5 +42,5 @@ package("openjph")
                 ojph::j2c_outfile file;
                 file.open("file.txt");
             }
-        ]]}, {languages = "c++11", includes = {"openjph/ojph_file.h"}}))
+        ]]}, {configs = {languages = "c++11"}, includes = "openjph/ojph_file.h"}))
     end)