Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please search the same paths for GIR XML that GObject-Introspection does #44

Open
smcv opened this issue Jan 16, 2024 · 0 comments
Open
Assignees

Comments

@smcv
Copy link

smcv commented Jan 16, 2024

It looks as though cppgir searches for GIR XML (.gir files) in these locations (on Unix), highest-priority first:

  1. directories explicitly given as command-line options
  2. d + /gir-1.0 for each colon-delimited d in $XDG_DATA_DIRS, with fallback as per the XDG basedir spec

with some alternatives to (2) on Windows and macOS.

GObject-Introspection since 1.78.x (https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/258) searches more directories than that:

  1. directories explicitly given as command-line options
  2. each colon-delimited path in $GI_GIR_PATH (semicolon-delimited on Windows)
  3. g_get_user_data_dir() + /gir-1.0 as per the XDG basedir spec
  4. d + /gir-1.0 for each colon-delimited d in g_get_system_data_dirs() as per the XDG basedir spec
  5. a path specified when GObject-Introspection was compiled, which defaults to $datadir/gir-1.0 but is something architecture-dependent like $libdir/gir-1.0 in some OS distributions
  6. $datadir/gir-1.0
  7. on Unix only, a hard-coded fallback to /usr/share/gir-1.0

All the tools in the GObject-Introspection ecosystem should agree on which directories to search, so I think gir-to-d should match GObject-Introspection's behaviour (although it would be fine to continue to implement the XDG basedir spec locally).

For (5), the way I would do it in C/C++ code would be to have a compile-time option that defaults to either ${datadir}/gir-1.0 or $($PKG_CONFIG --variable=girdir gobject-introspection-1.0), and then pass that into the build of the C/C++ code via -D - but I don't know the D language, so I don't know what is its equivalent, if any. Some distributions will want to override this path at build-time, so it's important for that to be possible.

If it's difficult to implement some of these search paths, then the next best thing would be for gir-to-d to implement some of them, and leave the others (for example (5)) for distributions to patch in if they find that they need to.

References:

@MikeWey MikeWey self-assigned this Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants