Browse Source

add minhook and ip2region (#176)

yecate 4 years ago
parent
commit
25bbe0736e
2 changed files with 66 additions and 0 deletions
  1. 30 0
      packages/i/ip2region/xmake.lua
  2. 36 0
      packages/m/minhook/xmake.lua

+ 30 - 0
packages/i/ip2region/xmake.lua

@@ -0,0 +1,30 @@
+package("ip2region")
+
+    set_homepage("https://github.com/lionsoul2014/ip2region")
+    set_description("IP address region search library.")
+    set_license("Apache-2.0")
+
+    set_urls("https://github.com/lionsoul2014/ip2region/archive/$(version)-release.tar.gz",
+            {version = function (version) return version:gsub('%.', '-') end})
+
+    add_versions("v2020.10.31", "83d9bfef8e8e3a5107f605a17fe36b22078b3993b0928f88e2163f17d74eb759")
+
+    on_install(function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            target("ip2region")
+                set_kind("$(kind)")
+                add_includedirs("binding/c")
+                add_files("binding/c/ip2region.c")
+                add_headerfiles("binding/c/ip2region.h")
+        ]])
+        local configs = {}
+        if package:config("shared") then
+            configs.kind = "shared"
+        end
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("ip2region_create", {includes = "ip2region.h"}))
+    end)

+ 36 - 0
packages/m/minhook/xmake.lua

@@ -0,0 +1,36 @@
+package("minhook")
+
+    set_homepage("https://github.com/TsudaKageyu/minhook")
+    set_description("The Minimalistic x86/x64 API Hooking Library for Windows.")
+    set_license("BSD-2-Clause")
+
+    set_urls("https://github.com/TsudaKageyu/minhook/archive/$(version).tar.gz",
+             "https://github.com/TsudaKageyu/minhook.git")
+
+    add_versions("v1.3.3", "5bec16358ec9086d4593124bf558635e89135abea2c76e5761ecaf09f4546b19")
+
+    on_install("windows", "mingw", function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            target("minhook")
+                set_kind("$(kind)")
+                add_includedirs("src/", "src/hde/")
+                add_files("src/*.c", is_arch("x64", "x86_64") and "src/hde/hde64.c" or "src/hde/hde32.c")
+                if is_kind("shared") then
+                    add_files("dll_resources/MinHook.rc")
+                    if is_plat("windows") then
+                        add_shflags("/def:dll_resources/MinHook.def")
+                    end
+                end
+                add_headerfiles("include/MinHook.h")
+        ]])
+        local configs = {}
+        if package:config("shared") then
+            configs.kind = "shared"
+        end
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("MH_Initialize", {includes = "MinHook.h"}))
+    end)