Procházet zdrojové kódy

proj: add older version (#6850)

* fix(proj): version comparison not working

* fix(proj): older version uses PROJ_TEST instead of BUILD_TESTING

* fix(proj): older version uses BUILD_X instead of BUILD_APPS

* feat(proj): add 6.3.1 patch

* fix(proj): add cstdint header

* fix(proj): fix hash

* Update xmake.lua

---------

Co-authored-by: star9029 <[email protected]>
Elite-stay před 3 měsíci
rodič
revize
f8c0c3e1a7

+ 27 - 0
packages/p/proj/patches/6.3.1/fixes.patch

@@ -0,0 +1,27 @@
+diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake
+index bc27baf..32902b0 100644
+--- a/src/lib_proj.cmake
++++ b/src/lib_proj.cmake
+@@ -435,6 +435,10 @@ if(UNIX)
+   if(M_LIB)
+     target_link_libraries(${PROJ_CORE_TARGET} -lm)
+   endif()
++  find_library(DL_LIB dl)
++  if(DL_LIB)
++    target_link_libraries(${PROJ_CORE_TARGET} -ldl)
++  endif()
+ endif()
+ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT)
+   target_link_libraries(${PROJ_CORE_TARGET} ${CMAKE_THREAD_LIBS_INIT})
+diff --git a/src/proj_json_streaming_writer.hpp b/src/proj_json_streaming_writer.hpp
+index 6267684..163da43 100644
+--- a/src/proj_json_streaming_writer.hpp
++++ b/src/proj_json_streaming_writer.hpp
+@@ -33,6 +33,7 @@
+ 
+ #include <vector>
+ #include <string>
++#include <cstdint>
+ 
+ #define CPL_DLL
+ 

+ 21 - 5
packages/p/proj/xmake.lua

@@ -7,6 +7,10 @@ package("proj")
     add_versions("9.4.0", "3643b19b1622fe6b2e3113bdb623969f5117984b39f173b4e3fb19a8833bd216")
     add_versions("9.0.1", "737eaacbe7906d0d6ff43f0d9ebedc5c734cccc9e6b8d7beefdec3ab22d9a6a3")
     add_versions("8.2.1", "76ed3d0c3a348a6693dfae535e5658bbfd47f71cb7ff7eb96d9f12f7e068b1cf")
+    add_versions("6.3.1", "6de0112778438dcae30fcc6942dee472ce31399b9e5a2b67e8642529868c86f8")
+
+    add_patches("6.3.1", path.join(os.scriptdir(), "patches", "6.3.1", "fixes.patch"),
+                        "8e3aa5ff9d10653ed7d8b16513e97eb2ffb39d1c87c1c37684e25336fa14e831")
 
     add_configs("apps", {description = "Build PROJ applications.", default = false, type = "boolean"})
     add_configs("tiff", {description = "Enable TIFF support.", default = false, type = "boolean"})
@@ -42,16 +46,28 @@ package("proj")
         if package:is_plat("windows") and package:is_arch("arm64") then
             io.replace("CMakeLists.txt", "add_subdirectory(data)", "", {plain = true})
         end
-        if package:config("curl") and (package:version():le(9.4)) then
+        if package:config("curl") and (package:version():le("9.4")) then
             io.replace("src/lib_proj.cmake", "${CURL_LIBRARIES}", "CURL::libcurl", {plain = true})
         end
-        local configs = {"-DNLOHMANN_JSON_ORIGIN=external", "-DBUILD_TESTING=OFF"}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+
+        local configs = {
+            "-DNLOHMANN_JSON_ORIGIN=external",
+            "-DBUILD_TESTING=OFF",
+            "-DPROJ_TESTS=OFF",
+        }
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
-        table.insert(configs, "-DBUILD_APPS=" .. (package:config("apps") and "ON" or "OFF"))
+        if package:version():ge("8.2") then
+            table.insert(configs, "-DBUILD_APPS=" .. (package:config("apps") and "ON" or "OFF"))
+        else
+            local apps = {"CCT", "CS2CS", "GEOD", "GIE", "PROJ", "PROJINFO"}
+            for _, v in pairs(apps) do
+                table.insert(configs, "-DBUILD_" .. v .. "=" .. (package:config("apps") and "ON" or "OFF"))
+            end
+        end
         table.insert(configs, "-DENABLE_TIFF=" .. (package:config("tiff") and "ON" or "OFF"))
         table.insert(configs, "-DENABLE_CURL=" .. (package:config("curl") and "ON" or "OFF"))
-        table.insert(configs, "-DBUILD_PROJSYNC=" .. (package:config("curl") and "ON" or "OFF"))
+        table.insert(configs, "-DBUILD_PROJSYNC=" .. (package:config("apps") and package:config("curl") and "ON" or "OFF"))
 
         if package:config("curl") and package:is_plat("macosx") then
             local exflags = {"-framework", "CoreFoundation", "-framework", "Security", "-framework", "SystemConfiguration"}