Pārlūkot izejas kodu

dpp: update to v10.0.23 (#1875)

* dpp: update to v10.0.23

* fix version in xmake file
Louis Bailleau 2 gadi atpakaļ
vecāks
revīzija
e1cf8d6ae8
2 mainītis faili ar 25 papildinājumiem un 15 dzēšanām
  1. 2 2
      packages/d/dpp/port/xmake.lua
  2. 23 13
      packages/d/dpp/xmake.lua

+ 2 - 2
packages/d/dpp/port/xmake.lua

@@ -5,12 +5,12 @@ add_requires("fmt", "nlohmann_json", "libsodium", "libopus", "openssl", "zlib")
 target("dpp")
     set_kind("$(kind)")
     set_languages("c++17")
-    add_includedirs("include")
+    add_includedirs("include", "include/dpp")
     add_headerfiles("include/(dpp/**.h)")
     add_files("src/dpp/**.cpp")
     add_packages("fmt", "nlohmann_json", "libsodium", "libopus", "openssl", "zlib")
 
-    add_defines("DPP_BUILD")
+    add_defines("DPP_BUILD", "DPP_USE_EXTERNAL_JSON")
 
     if is_plat("windows", "mingw") then
         add_defines("WIN32", "_WINSOCK_DEPRECATED_NO_WARNINGS", "WIN32_LEAN_AND_MEAN")

+ 23 - 13
packages/d/dpp/xmake.lua

@@ -5,11 +5,9 @@ package("dpp")
 
     add_urls("https://github.com/brainboxdotcc/DPP/archive/refs/tags/$(version).tar.gz",
              "https://github.com/brainboxdotcc/DPP.git")
- 
-    -- NOTE !
-    -- Keep all versions with the same major number. If D++ switch to a new major version,
-    -- keep only the latest previous versions.
-    -- i.e. if D++ switch to v11.x.x, keep only the latest v10.x.x and delete the rest.
+             
+    add_versions("v10.0.23", "8f9db61c3586a492ada378235300c509e3bc2fc090cef32de0a8241741038df0")
+
     add_versions("v10.0.22", "f8da36a9e24012fdff55a988e41d2015235b9e564b3151a1e5158fa1c7e05648")
 
     add_versions("v10.0.21", "8ef2bb75f16b80d742a99c3a18ab5a2a57bce74238518af9b9aca670c2d7034b")
@@ -61,10 +59,14 @@ package("dpp")
         add_syslinks("pthread")
     end
 
-    on_load("windows", "mingw", function (package)
+    on_load(function (package)
         if not package:config("shared") then
             package:add("defines", "DPP_STATIC")
         end
+        if package:config("have_voice") then
+            package:add("defines", "HAVE_VOICE")
+            package:add("deps", "libsodium", "libopus")
+        end
 
         if package:config("have_voice") then
             package:add("defines", "HAVE_VOICE")
@@ -74,22 +76,30 @@ package("dpp")
         if package:version():le("v10.0.13") then
             package:add("deps", "fmt")
         end
+
+        if package:version():ge("v10.0.23") then
+            package:add("defines", "DPP_USE_EXTERNAL_JSON")
+        end
     end)
 
     on_install("windows", "linux", "macosx", "mingw", function (package)
         -- fix dpp dependencies
         for _, file in ipairs(table.join(os.files("include/**.h"), os.files("src/**.cpp"))) do
             io.replace(file, "#include <dpp/fmt/", "#include <fmt/", {plain = true})
-            io.replace(file, "#include <dpp/nlohmann/", "#include <nlohmann/", {plain = true})
+
+            if package:version():lt("v10.0.23") then
+                io.replace(file, "#include <dpp/nlohmann/", "#include <nlohmann/", {plain = true})
+            end
         end
 
-	for _, file in ipairs(os.files("src/**.cpp")) do
-		io.replace(file, "#include <nlohmann/json_fwd.hpp>", "#include <nlohmann/json.hpp>", {plain = true})
-	end
+        for _, file in ipairs(os.files("src/**.cpp")) do
+            io.replace(file, "#include <nlohmann/json_fwd.hpp>", "#include <nlohmann/json.hpp>", {plain = true})
+        end
+
+        if package:version():le("v10.0.14") then
+            os.rmdir("include/dpp/fmt")
+        end
 
-	if package:version():le("v10.0.14") then
-                os.rmdir("include/dpp/fmt")
-	end
         io.replace("include/dpp/restrequest.h", "#include <nlohmann/json_fwd.hpp>", "#include <nlohmann/json.hpp>", {plain = true})
         os.rmdir("include/dpp/nlohmann")