mirror of
https://github.com/safedv/RustiveDump
synced 2026-06-08 17:19:41 +00:00
82 lines
3.5 KiB
TOML
82 lines
3.5 KiB
TOML
[config]
|
|
skip_core_tasks = true
|
|
|
|
[env]
|
|
# Target platforms
|
|
TARGET_GNU = "x86_64-pc-windows-gnu"
|
|
TARGET_MSVC = "x86_64-pc-windows-msvc"
|
|
|
|
# Flags for GNU PIC and EXE builds
|
|
RUSTFLAGS_GNU_PIC = "-C link-arg=-nostdlib -C codegen-units=1 -C link-arg=-fno-ident -C link-arg=-fpack-struct=8 -C link-arg=-Wl,--gc-sections -C link-arg=-falign-jumps=1 -C link-arg=-w -C link-arg=-falign-labels=1 -C relocation-model=pic -C link-arg=-Wl,-T./Linker.ld,--build-id=none -C link-arg=-Wl,-s,--no-seh,--enable-stdcall-fixup -C link-arg=-Wl,--subsystem,console -C link-arg=-nostartfiles -C link-arg=-Wl,-e_start"
|
|
RUSTFLAGS_GNU_EXE = "-C link-arg=-nostdlib -C link-arg=-Wl,--gc-sections -C link-arg=-Wl,--subsystem,console -C link-arg=-nostartfiles -C link-arg=-Wl,-e_start"
|
|
|
|
# Flags for MSVC builds
|
|
RUSTFLAGS_MSVC_PIC = "-C codegen-units=1 -C strip=symbols -C opt-level=z -C link-arg=/NODEFAULTLIB -C link-arg=/ENTRY:_start -C link-arg=/SUBSYSTEM:CONSOLE -C link-arg=/OPT:REF,ICF -C link-arg=/SAFESEH:NO -C link-arg=/DEBUG:NONE -C link-arg=/FILEALIGN:512 -C link-arg=/ALIGN:16 -C link-arg=/SECTION:.bss,D -C link-arg=/SECTION:.edata,D -C link-arg=/SECTION:.idata,D -C link-arg=/SECTION:.pdata,D -C link-arg=/SECTION:.xdata,D"
|
|
|
|
[tasks.default]
|
|
description = "Default build task: builds the project as a GNU executable."
|
|
dependencies = ["build"]
|
|
|
|
[tasks.build]
|
|
description = "Builds the project as a GNU executable, strips unnecessary sections."
|
|
dependencies = ["clean", "cargo-build", "strip"]
|
|
|
|
[tasks.clean]
|
|
description = "Cleans the project directory, removing old binaries."
|
|
script = [
|
|
"cargo clean"
|
|
]
|
|
|
|
[tasks.cargo-build]
|
|
description = "Compiles the project for the GNU target (exe)."
|
|
command = "cargo"
|
|
args = ["build", "--release", "--target", "${TARGET_GNU}", "--features", "${FEATURES}"]
|
|
env = { "RUSTFLAGS" = "${RUSTFLAGS_GNU_EXE}" }
|
|
|
|
[tasks.strip]
|
|
description = "Strips unneeded sections from the GNU binary."
|
|
command = "strip"
|
|
args = ["-s", "--strip-unneeded", "-x", "-X", "target/${TARGET_GNU}/release/RustiveDump.exe"]
|
|
|
|
[tasks.pic-gnu]
|
|
description = "Builds the project as Shellcode (PIC) for the GNU target."
|
|
dependencies = ["cleanpic", "cargo-build-pic-gnu", "strip", "objcopy"]
|
|
|
|
[tasks.cleanpic]
|
|
description = "Cleans the project and removes the old PIC binary."
|
|
script = [
|
|
"cargo clean",
|
|
"rm -f RustiveDump.bin"
|
|
]
|
|
|
|
[tasks.cargo-build-pic-gnu]
|
|
description = "Compiles the project as PIC for the GNU target."
|
|
command = "cargo"
|
|
args = ["build", "--release", "--target", "${TARGET_GNU}", "--features", "${FEATURES}"]
|
|
env = { "RUSTFLAGS" = "${RUSTFLAGS_GNU_PIC}" }
|
|
|
|
[tasks.objcopy]
|
|
description = "Converts the GNU binary to a .bin file using objcopy."
|
|
command = "objcopy"
|
|
args = ["-O", "binary", "target/${TARGET_GNU}/release/RustiveDump.exe", "RustiveDump.bin"]
|
|
|
|
[tasks.pic-msvc]
|
|
description = "Builds the project as Shellcode (PIC) for the MSVC target."
|
|
dependencies = ["clean", "cargo-build-pic-msvc", "strip-msvc", "objcopy-msvc"]
|
|
|
|
[tasks.cargo-build-pic-msvc]
|
|
description = "Compiles the project as PIC for the MSVC target."
|
|
command = "cargo"
|
|
args = ["build", "--release", "--target", "${TARGET_MSVC}", "--features", "${FEATURES}"]
|
|
env = { "RUSTFLAGS" = "${RUSTFLAGS_MSVC_PIC}" }
|
|
|
|
[tasks.strip-msvc]
|
|
description = "Strips unneeded sections from the MSVC binary."
|
|
command = "strip"
|
|
args = ["-s", "--strip-unneeded", "-x", "-X", "target/${TARGET_MSVC}/release/RustiveDump.exe"]
|
|
|
|
[tasks.objcopy-msvc]
|
|
description = "Converts the MSVC binary to a .bin file using objcopy."
|
|
command = "objcopy"
|
|
args = ["-O", "binary", "target/${TARGET_MSVC}/release/RustiveDump.exe", "RustiveDump.bin"]
|