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

pkgconf compatible --personality argument, or a superior replacement #15

Open
dcbaker opened this issue Feb 28, 2024 · 0 comments
Open
Labels
enhancement New feature or request pkg-config compat

Comments

@dcbaker
Copy link
Collaborator

dcbaker commented Feb 28, 2024

pkgconf has a --personality flag, that simplifies using it for cross compiling compared to the way this has to be done with pkg-config by setting $PKG_CONFIG_LIBDIR and $PKG_CONFIG_PATH. Having such an option, and/or a better option that allows the same behavior would be good

My vision here is that cps-config can iterate on a format and implementation of a personality schema, and then propose that tested schema back to CPS as a supplementary schema.

I'd like to flesh this out a bit more, pkgconf has an extension for setting personalities, which allows for more elegant cross compilation than what pkg-config does, which is setting PKG_CONFIG_LIBDIR=/path/to/cross/lib/ and hoping that everything works.

The format pkgconf supports is described here, but for a short overview:

Triplet : i686-pc-linux-gnu  # the gnu-style triplet
SysrootDir: /cross/i686-pc-linux-gnu
DefaultSearchPaths: /cross/i686-pc-linux-gnu/lib/pkgconfig \
  /cross/i686-linux-gnu/share/pkgconfig
SystemIncludePaths: /cross/i686-pc-linux-gnu/include
SystemLibraryPaths: /cross/i686-pc-linux-gnu/lib

This all seems pretty reasonable for the way pkgconf works. for cps-config I'm envisioning:

{
  "schema_version": "<number>",
  "isa": "<string>",
  "kernel": "<string>",
  "sys_root": "<string>",
  "libdir": "<string>"
}
  • I've picked "isa" and "kernel" since those match the CPS "platform::package" keys, and they have the same meaning.
  • "schema_version" is the version of the schema in in the personality file itself, I would expect this to be an unsigned int of some size, which is incremented each time the schema is changed, though it might make sense to use an "X.Y" string value to allow for backward compatible changes
  • "sys_root" points to the root of the cross compilation environment.
  • libdir is the library directory to use inside the sys_root. This is necessary since it's possible that it's not the same as the host

There's a couple of things here I'm not sure about:

  • mounting a sys_root is a pretty common way to cross compile on Linux, but does that make sense for other platforms, particularly Windows and MacOS?
  • Some systems have ways to install non-native libraries on the build system (debian has its lib/i686-pc-linux-gnu [for example]) directories, NixOS allows installing libraries and using the environment variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pkg-config compat
Projects
None yet
Development

No branches or pull requests

1 participant