Say, after defining one option in build.zig:
    const options = b.addOptions();
    options.addOption(usize, "digits", 50);
and add it to the library:
    const lib = b.addStaticLibrary("mylib", "src/mylib.zig");
    lib.addOptions("build_options", options);
Then, reference it in src/mylib.zig or the other zig files of this package’s source tree:
    const DIGITS = @import("build_options").digits;
The compiler would complain no package named 'build_options' available within package 'mylib'.