Skip to content

Tags: blackeangel/utils

Tags

v1.0.0-libarchive

Toggle v1.0.0-libarchive's commit message
fix Windows GCC16: extract blake2 from libarchive.a into separate lib…

…blake2

Problem: MinGW ld.exe 16.1.0 (binutils 2.44) compiles every function into
its own COMDAT section (.text$funcname). When archive_blake2s_ref.c.obj and
archive_blake2sp_ref.c.obj are INSIDE libarchive.a, ld.exe eliminates their
COMDAT groups as 'unreferenced externally' BEFORE discovering that
rar5.c.obj (also in libarchive.a) references blake2sp_{init,update,final}.
--whole-archive and -Wl,-u,blake2sp_* both failed to prevent this.

Solution (verified on both platforms before push):
1. Patch libarchive/CMakeLists.txt via FetchContent_Populate+patch to
   remove archive_blake2s_ref.c and archive_blake2sp_ref.c from sources.
2. Compile those two files as a separate 'libblake2' static library with
   -fno-function-sections. This keeps all blake2 functions in a single
   .text section (not per-fn COMDATs), making them visible as normal
   external symbols from the linker's perspective.
3. Link libblake2 into utils on ALL platforms (Windows and Linux/Android)
   since blake2 was removed from libarchive.a everywhere.

Switched from FetchContent_MakeAvailable to FetchContent_Populate +
add_subdirectory (lower-level API) to enable source patching between
download and cmake processing.

Verified with full clean builds before push:
  Linux  (cmake 3.28 native gcc): [17/17] Linking utils     4.9MB ✓
  Windows (mingw-w64-x86_64 cross): [78/78] Linking utils.exe 4.0MB ✓

v01

Toggle v01's commit message
update sdat2img: add Brotli .new.dat.br support

New features vs old version:
- Supports Brotli-compressed input (.new.dat.br) in addition to plain .new.dat
- Brotli mode detected automatically from .br file extension
- Streaming decompression via carry-buffer: constant RAM regardless of image size
- Auto-derive output filename: system.new.dat.br → system.img
- Clean UtilBase interface replacing old Windows-1251 implementation

API fixes:
- BrotliDecoderErrorString(BrotliDecoderGetErrorCode(state)) correct call
- All internal names prefixed s2i_ to avoid ODR conflicts in single binary

include/main.hpp: simplified Sdat2Img class fields
  (transfer_path, input_path, output_path — no longer filesystem::path)

v01-alpha

Toggle v01-alpha's commit message
fix Android link error: duplicate asprintf symbol

asprintf is already in POSIX libc and Android bionic.
src/sparse/asprintf.c is only needed on Windows (MinGW).

- CMakeLists: exclude asprintf.c from build on non-Windows
- append2simg.cpp: guard #include asprintf.h with #ifdef _WIN32