@@ -7,6 +7,7 @@ project('nix-store', 'cpp',
77 ' debug=true' ,
88 ' optimization=2' ,
99 ' errorlogs=true' , # Please print logs for tests that fail
10+ ' localstatedir=/nix/var' ,
1011 ],
1112 meson_version : ' >= 1.1' ,
1213 license : ' LGPL-2.1-or-later' ,
@@ -324,7 +325,7 @@ fs = import('fs')
324325
325326prefix = get_option (' prefix' )
326327# For each of these paths, assume that it is relative to the prefix unless
327- # it is already an absolute path (which is the default for store-dir, state-dir , and log-dir).
328+ # it is already an absolute path (which is the default for store-dir, localstatedir , and log-dir).
328329path_opts = [
329330 # Meson built-ins.
330331 ' datadir' ,
@@ -334,13 +335,13 @@ path_opts = [
334335 ' libexecdir' ,
335336 # Homecooked Nix directories.
336337 ' store-dir' ,
337- ' state-dir ' ,
338+ ' localstatedir ' ,
338339 ' log-dir' ,
339340]
340341# For your grepping pleasure, this loop sets the following variables that aren't mentioned
341342# literally above:
342343# store_dir
343- # state_dir
344+ # localstatedir
344345# log_dir
345346# profile_dir
346347foreach optname : path_opts
@@ -364,12 +365,12 @@ lsof = find_program('lsof', required : false)
364365
365366# Aside from prefix itself, each of these was made into an absolute path
366367# by joining it with prefix, unless it was already an absolute path
367- # (which is the default for store-dir, state-dir , and log-dir).
368+ # (which is the default for store-dir, localstatedir , and log-dir).
368369cpp_str_defines = {
369370 ' NIX_PREFIX' : prefix,
370371 ' NIX_STORE_DIR' : store_dir,
371372 ' NIX_DATA_DIR' : datadir,
372- ' NIX_STATE_DIR' : state_dir / ' nix' ,
373+ ' NIX_STATE_DIR' : localstatedir / ' nix' ,
373374 ' NIX_LOG_DIR' : log_dir,
374375 ' NIX_CONF_DIR' : sysconfdir / ' nix' ,
375376 ' NIX_MAN_DIR' : mandir,
@@ -421,4 +422,15 @@ install_headers(headers, subdir : 'nix', preserve_path : true)
421422
422423libraries_private = []
423424
425+ extra_pkg_config_variables = {
426+ ' storedir' : get_option (' store-dir' ),
427+ }
428+
429+ # Working around https://github.com/mesonbuild/meson/issues/13584
430+ if host_machine .system() != ' macos'
431+ extra_pkg_config_variables += {
432+ ' localstatedir' : get_option (' localstatedir' ),
433+ }
434+ endif
435+
424436subdir (' build-utils-meson/export' )
0 commit comments