Skip to content

Building

YadeWira edited this page Oct 18, 2026 · 11 revisions

Building

Free Pascal 3.2.2 (other 3.2.x should work).

./build.sh                    # out/syc, out/sylzbench
./build.sh -Twin64            # Windows x86-64, needs FPC's win64 units
./build.sh -dSYLZ_PUREPASCAL  # no assembler: the Pascal paths only

build.sh passes its arguments to fpc. Units go to out/units.

Assembler paths

On x86-64, src/sylz.pas uses two assembler routines (the decoder's fast loop, level 1's compressor), for both the SysV (Linux) and Microsoft x64 (Win64) calling conventions. Everywhere else, or with -dSYLZ_PUREPASCAL, the Pascal versions run. At run time SylzUseAsm := False switches to the Pascal paths; sylzbench does that with SYLZ_NOASM=1. Both paths give the same results, and the two level-1 compressors the same bytes.

Tests

fpc -O3 -Fusrc -FUout/units -FEout tests/sylzfuzz.pas
out/sylzfuzz 3000 SAMPLE-FILES...

Per case: random, small-alphabet, periodic, run-heavy, long-match or real-file input (slices of the sample files), any level; roundtrip; compress again with the other code path and compare bytes; decode four corrupted copies and a truncated one, and decode into a buffer one byte short. All buffers sit flush against a PROT_NONE guard page, so any out-of-bounds access faults. Linux only.

Tools

  • out/sylzbench [-l LEVELS] [-t SECONDS] FILE... — in-memory benchmark. SYLZ_DUMP=prefix writes each compressed block to prefix.LEVEL.
  • bench/sylzstats.pas — literal/match/offset histograms and repeat-offset rates of a dumped block.

Legacy Rust

cd legacy/rust
cargo build --release
cargo +1.77.2 build --release --target i686-pc-windows-gnu   # Windows 7 32-bit

Clone this wiki locally