Top Level Namespace

Defined Under Namespace

Classes: UCL

Constant Summary collapse

LIBUCL_DIR =

Vendored libucl (vstakhov's Universal Configuration Language parser), used when no system-wide installation is found. It lives in ext/libucl, a git submodule pinned to a release tag. NOTE: this is not the Debian libucl-dev package, which is an unrelated compression library.

Its sources are compiled straight into this extension rather than built as a separate library: src/ucl_internal.h defines the HAVE_* macros itself when HAVE_CONFIG_H is absent -- upstream calls this the "embedded build" and ships a Makefile.unix for it -- so no configure step is needed, and with it go the download, cmake, and any question of which libucl the linker picks up.

One useful side effect: .include over http/ftp is gated on HAVE_FETCH_H and CURL_H, which the embedded build never defines, so remote includes are compiled out. A system-wide libucl may well have them enabled.

File.join(__dir__, 'libucl').freeze

Instance Method Summary collapse

Instance Method Details

#bundled_libuclObject

The submodule is not populated in a fresh clone, and a gem packaged without it would fail here rather than at git submodule update time.



36
37
38
# File 'ext/extconf.rb', line 36

def bundled_libucl
  File.exist?(File.join(LIBUCL_DIR, 'src', 'ucl_parser.c'))
end

#system_libuclObject

Locate a system-wide libucl: pkg-config first, then the usual prefixes.



27
28
29
30
31
32
# File 'ext/extconf.rb', line 27

def system_libucl
  return true if pkg_config('libucl')

  find_header( 'ucl.h',                 '/opt/include', '/usr/local/include') &&
    find_library('ucl', 'ucl_parser_new', '/opt/lib',     '/usr/local/lib')
end