ExZarr.Codecs.CompressionConfig (ExZarr v1.1.0)

View Source

Configuration helper for compression library paths.

Automatically detects library paths based on the platform and supports environment variable overrides for custom installations.

Environment Variables

You can override the automatic detection by setting these environment variables:

  • COMPRESSION_LIB_DIRS - Colon-separated list of library directories
  • HOMEBREW_PREFIX - Override Homebrew installation path (macOS only)

Examples

# Get library directories for linking
ExZarr.Codecs.CompressionConfig.library_dirs()
# => ["/opt/homebrew/opt/zstd/lib", "/opt/homebrew/opt/lz4/lib", ...]

# Get library paths for runtime (rpaths)
ExZarr.Codecs.CompressionConfig.rpath_dirs()
# => ["/opt/homebrew/opt/zstd/lib", "/opt/homebrew/opt/lz4/lib", ...]

# Get static library path
ExZarr.Codecs.CompressionConfig.bzip2_static_lib()
# => "/opt/homebrew/opt/bzip2/lib/libbz2.a"

Platform Support

  • macOS (ARM): Uses /opt/homebrew prefix by default
  • macOS (Intel): Uses /usr/local prefix by default
  • Linux: Uses standard system library paths
  • Custom: Set COMPRESSION_LIB_DIRS environment variable

Summary

Functions

Returns the path to the bzip2 static library.

Returns the Homebrew prefix path.

Returns the list of library directories to use for compilation linking.

Returns the list of library directories to use for runtime rpaths.

Functions

bzip2_static_lib()

Returns the path to the bzip2 static library.

Bzip2 only provides a static library on many systems, so we need the full path.

homebrew_prefix()

Returns the Homebrew prefix path.

Detects automatically based on platform, or uses HOMEBREW_PREFIX env var.

library_dirs()

Returns the list of library directories to use for compilation linking.

This is used by the Zig NIF compiler to find compression libraries.

rpath_dirs()

Returns the list of library directories to use for runtime rpaths.

This is used by the Mix task to add rpaths to the compiled NIF. Includes both ARM and Intel Homebrew paths on macOS for maximum compatibility.