mirror of
https://github.com/safedv/RustiveDump
synced 2026-06-08 17:19:41 +00:00
107 lines
4.4 KiB
TOML
107 lines
4.4 KiB
TOML
[config]
|
|
skip_core_tasks = true
|
|
|
|
[env]
|
|
NIGHTLY_VERSION = "nightly-2025-02-14"
|
|
OUTPUT_NAME = "RustiveDump.exe"
|
|
OUTPUT_BIN = "RustiveDump.bin"
|
|
|
|
# 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)."
|
|
script_runner = "@duckscript"
|
|
script = '''
|
|
features = get_env FEATURES
|
|
if is_empty ${features}
|
|
exec --fail-on-error rustup run ${NIGHTLY_VERSION}-x86_64-pc-windows-gnu cargo rustc --target ${TARGET_GNU} --release
|
|
else
|
|
exec --fail-on-error rustup run ${NIGHTLY_VERSION}-x86_64-pc-windows-gnu cargo rustc --target ${TARGET_GNU} --release --features ${features}
|
|
end
|
|
'''
|
|
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/${OUTPUT_NAME}"]
|
|
|
|
[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 ${OUTPUT_BIN}"
|
|
]
|
|
|
|
[tasks.cargo-build-pic-gnu]
|
|
description = "Compiles the project as PIC for the GNU target."
|
|
script_runner = "@duckscript"
|
|
script = '''
|
|
features = get_env FEATURES
|
|
if is_empty ${features}
|
|
exec --fail-on-error rustup run ${NIGHTLY_VERSION}-x86_64-pc-windows-gnu cargo rustc --target ${TARGET_GNU} --release
|
|
else
|
|
exec --fail-on-error rustup run ${NIGHTLY_VERSION}-x86_64-pc-windows-gnu cargo rustc --target ${TARGET_GNU} --release --features ${features}
|
|
end
|
|
'''
|
|
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/${OUTPUT_NAME}", "${OUTPUT_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."
|
|
script_runner = "@duckscript"
|
|
script = '''
|
|
features = get_env FEATURES
|
|
if is_empty ${features}
|
|
exec --fail-on-error rustup run ${NIGHTLY_VERSION}-x86_64-pc-windows-msvc cargo rustc --target ${TARGET_MSVC} --release
|
|
else
|
|
exec --fail-on-error rustup run ${NIGHTLY_VERSION}-x86_64-pc-windows-msvc cargo rustc --target ${TARGET_MSVC} --release --features ${features}
|
|
end
|
|
'''
|
|
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/${OUTPUT_NAME}"]
|
|
|
|
[tasks.objcopy-msvc]
|
|
description = "Converts the MSVC binary to a .bin file using objcopy."
|
|
command = "objcopy"
|
|
args = ["-O", "binary", "target/${TARGET_MSVC}/release/${OUTPUT_NAME}", "${OUTPUT_BIN}"]
|