Prechádzať zdrojové kódy

libpeconv: add 2024.09.06 version (#5328)

* libpeconv: add 2024.09.06 version

* patch mingw

* limit plat
star9029 1 rok pred
rodič
commit
30c4b7b54b
1 zmenil súbory, kde vykonal 19 pridanie a 7 odobranie
  1. 19 7
      packages/l/libpeconv/xmake.lua

+ 19 - 7
packages/l/libpeconv/xmake.lua

@@ -4,22 +4,34 @@ package("libpeconv")
     set_license("BSD-2-Clause")
 
     add_urls("https://github.com/hasherezade/libpeconv.git")
+
+    add_versions("2024.09.06", "e4841b678c14a2e735e59354aa1b0f6755339cab")
     add_versions("2023.05.31", "709a9b40fa6420c6cd7aa1145b0ff1a154858358")
 
+    add_configs("unicode", {description = "Enable Unicode support.", default = false, type = "boolean"})
+    add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+
+    add_syslinks("kernel32", "ntdll")
+
     add_deps("cmake")
 
-    if is_plat("windows", "mingw") then
-        add_syslinks("kernel32", "ntdll")
-    end
+    on_install("windows|x64", "windows|x86", "mingw", "msys", function (package)
+        if package:config("unicode") then
+            package:add("defines", "UNICODE", "_UNICODE")
+        end
 
-    on_install("windows", "mingw", function (package)
         local configs = {"-DPECONV_BUILD_TESTING=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, "-DPECONV_UNICODE=" .. (package:config("unicode") and "ON" or "OFF"))
+
+        io.replace("run_pe/CMakeLists.txt", "/MT", "", {plain = true})
         io.replace("libpeconv/CMakeLists.txt", "/MT", "", {plain = true})
-        io.replace("CMakeLists.txt", "add_subdirectory ( run_pe )", "", {plain = true})
-        io.replace("CMakeLists.txt", "add_dependencies ( run_pe libpeconv )", "", {plain = true})
+        if package:is_plat("windows") then
+            os.mkdir(path.join(package:buildir(), "run_pe/pdb"))
+            os.mkdir(path.join(package:buildir(), "libpeconv/pdb"))
+        end
         import("package.tools.cmake").install(package, configs)
+        os.trycp(path.join(package:buildir(), "run_pe/pdb/run_pe.pdb"), package:installdir("bin"))
     end)
 
     on_test(function (package)