-
-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libmem: add package #5430
base: dev
Are you sure you want to change the base?
libmem: add package #5430
Changes from 4 commits
797807a
5ac6151
c52b158
eaed43b
33b6d0d
bff94dc
72d8d1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
package("libmem") | ||
|
||
set_homepage("https://github.com/rdbo/libmem") | ||
set_description("Advanced Game Hacking Library for C, Modern C++, Rust and Python (Windows/Linux/FreeBSD) (Process/Memory Hacking) (Hooking/Detouring) (Cross Platform) (x86/x64/ARM/ARM64) (DLL/SO Injection) (Internal/External) (Assembler/Disassembler)") | ||
set_license("AGPL-3.0") | ||
|
||
add_urls("https://github.com/rdbo/libmem.git", {submodules = true}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 没有 tar url ,加上。还有对应的 sha256 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have added tar link 33b6d0d, but what is sha256 about? add_versions("5.0.2", "99adea3e86bd3b83985dce9076adda16968646ebd9d9316c9f57e6854aeeab9c") That I have added recently? |
||
add_versions("5.0.2", "99adea3e86bd3b83985dce9076adda16968646ebd9d9316c9f57e6854aeeab9c") | ||
add_deps("cmake") | ||
|
||
-- Installation instructions | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 注释去掉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done…? 72d8d1d |
||
on_install(function (package) | ||
-- Set the build configuration parameters | ||
local configs = {} | ||
|
||
io.writefile("xmake.lua", [[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 复杂的配置,挪到 port/xmake.lua 独立文件维护,参考其他包 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🏳️🏳️🏳️ |
||
set_languages("c17", "c++20") | ||
if is_plat("windows") then | ||
set_toolset("make", "nmake") -- Use NMAKE as the make tool | ||
end | ||
-- Set options | ||
option("build_tests", {description = "Build tests", default = false, showmenu = true}) | ||
option("deep_tests", {description = "Enable deep testing", default = false, showmenu = true}) | ||
option("build_static", {description = "Build static library", default = true, showmenu = true}) | ||
set_arch(os.arch()) | ||
-- Set Capstone, Keystone, and LLVM directories (adjust as needed) | ||
local external_dependencies_dir = path.join(os.projectdir(), "external") | ||
local capstone_dir = path.join(external_dependencies_dir, "capstone") | ||
local keystone_dir = path.join(external_dependencies_dir, "keystone") | ||
local llvm_dir = path.join(external_dependencies_dir, "llvm") | ||
-- Set external dependencies | ||
add_includedirs(path.join(capstone_dir, "include")) | ||
add_includedirs(path.join(keystone_dir, "include")) | ||
add_includedirs(path.join(llvm_dir, "include")) | ||
-- Define source directories | ||
local libmem_dir = os.projectdir() | ||
local internal_dir = path.join(libmem_dir, "internal") | ||
local common_dir = path.join(libmem_dir, "src", "common") | ||
-- Add source files based on platform | ||
local libmem_src = {} | ||
if is_plat("windows") then | ||
libmem_src = { | ||
path.join(libmem_dir, "src/win/*.c"), | ||
path.join(common_dir, "*.c"), | ||
path.join(common_dir, "*.cpp"), | ||
path.join(internal_dir, "winutils/*.c"), | ||
path.join(internal_dir, "demangler/*.cpp") | ||
} | ||
elseif is_plat("linux") then | ||
if is_arch("x86_64") then | ||
libmem_src = { | ||
path.join(common_dir, "arch/x86.c"), | ||
path.join(libmem_dir, "src/linux/ptrace/x64/*.c"), | ||
path.join(libmem_dir, "src/linux/*.c"), | ||
path.join(common_dir, "*.c"), | ||
path.join(common_dir, "*.cpp"), | ||
path.join(internal_dir, "posixutils/*.c"), | ||
path.join(internal_dir, "elfutils/*.c"), | ||
path.join(internal_dir, "demangler/*.cpp") | ||
} | ||
elseif is_arch("i386") then | ||
libmem_src = { | ||
path.join(common_dir, "arch/x86.c"), | ||
path.join(libmem_dir, "src/linux/ptrace/x86/*.c"), | ||
path.join(libmem_dir, "src/linux/*.c"), | ||
path.join(common_dir, "*.c"), | ||
path.join(common_dir, "*.cpp"), | ||
path.join(internal_dir, "posixutils/*.c"), | ||
path.join(internal_dir, "elfutils/*.c"), | ||
path.join(internal_dir, "demangler/*.cpp") | ||
} | ||
end | ||
elseif is_plat("freebsd") then | ||
if is_arch("x86_64") then | ||
libmem_src = { | ||
path.join(common_dir, "arch/x86.c"), | ||
path.join(libmem_dir, "src/freebsd/ptrace/x64/*.c"), | ||
path.join(libmem_dir, "src/freebsd/*.c"), | ||
path.join(common_dir, "*.c"), | ||
path.join(common_dir, "*.cpp"), | ||
path.join(internal_dir, "posixutils/*.c"), | ||
path.join(internal_dir, "elfutils/*.c"), | ||
path.join(internal_dir, "demangler/*.cpp") | ||
} | ||
elseif is_arch("i386") then | ||
libmem_src = { | ||
path.join(common_dir, "arch/x86.c"), | ||
path.join(libmem_dir, "src/freebsd/ptrace/x86/*.c"), | ||
path.join(libmem_dir, "src/freebsd/*.c"), | ||
path.join(common_dir, "*.c"), | ||
path.join(common_dir, "*.cpp"), | ||
path.join(internal_dir, "posixutils/*.c"), | ||
path.join(internal_dir, "elfutils/*.c"), | ||
path.join(internal_dir, "demangler/*.cpp") | ||
} | ||
end | ||
end | ||
-- Add target for libmem | ||
target("libmem") | ||
if has_config("build_static") then | ||
set_kind("static") | ||
else | ||
set_kind("shared") | ||
end | ||
add_files(libmem_src) | ||
-- Correct the include directory to point to "include" | ||
add_includedirs(path.join(libmem_dir, "include"), { public = true }) | ||
add_includedirs(path.join(libmem_dir, "src")) | ||
add_includedirs(internal_dir) | ||
add_includedirs(common_dir) | ||
-- Link against external libraries | ||
add_links("capstone", "keystone", "llvm") | ||
-- Platform-specific dependencies | ||
if is_plat("windows") then | ||
add_syslinks("user32", "psapi", "ntdll", "shell32") | ||
elseif is_plat("linux") then | ||
add_syslinks("dl", "stdc++", "m") | ||
elseif is_plat("freebsd") then | ||
add_syslinks("dl", "kvm", "procstat", "elf", "stdc++", "m") | ||
end | ||
-- Define for export symbol | ||
add_defines("LM_EXPORT") | ||
-- Optionally build tests | ||
if has_config("build_tests") then | ||
target("libmem_tests") | ||
set_kind("binary") | ||
add_files(path.join(libmem_dir, "tests/*.cpp")) | ||
add_deps("libmem") | ||
end | ||
]]) | ||
-- Use xmake to build and install libmem | ||
import("package.tools.xmake").install(package, configs) | ||
end) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 缺少 on_test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🏳️🏳️🏳️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
简化下描述
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done…? bff94dc