Page MenuHomeFreeBSD

pkgconf: import into the base system
ClosedPublic

Authored by khorben on Apr 15 2026, 11:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 18, 3:20 PM
Unknown Object (File)
Mon, May 18, 3:15 PM
Unknown Object (File)
Mon, May 18, 2:06 AM
Unknown Object (File)
Mon, May 18, 2:02 AM
Unknown Object (File)
Sun, May 17, 5:04 AM
Unknown Object (File)
Sun, May 17, 5:01 AM
Unknown Object (File)
Sat, May 16, 5:01 PM
Unknown Object (File)
Sat, May 16, 5:00 PM

Details

Summary

This introduces the following option:

  • MK_PKGCONF: determines if pkgconf and bomtool should be built

Sponsored by: Alpha-Omega, The FreeBSD Foundation

Test Plan
$ make buildworld
$ sudo make installworld
$ /usr/bin/pkgconf --version
2.5.1
$ /usr/bin/pkgconf --cflags --libs zlib
-L/lib -lz

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This depends on the vendor import from D56373.

This patch adds /usr/local/etc/pkgconfig/personality.d to -DPERSONALITY_PATH in lib/libpkgconfig/Makefile, as requested by bapt at https://ron-dev.freebsd.org/FreeBSD/src/pulls/9.

lib/libpkgconf/Makefile
20

it would be better to use ${LOCALBASE} for this, rather than hardcoding /usr/local.

etc/mtree/BSD.usr.dist
29

what is creating the libpkgconf-dev package? it appears from lib/libpkgconfig/Makefile that you are putting this in the pkgconf package, not libpkgconf.

This update addresses feedback from bapt, more precisely:

  • Moves the option definition for MK_PKGCONF from share/mk/bsd.opts.mk to share/mk/src.opts.mk
  • Uses ${LOCALBASE} to refer to /usr/local
  • Documents the WITH_PKGCONF and WITHOUT_PKGCONF options
  • Sets pkgconf's files as obsolete when installing WITHOUT_PKGCONF.

Thanks!

etc/mtree/BSD.usr.dist
29

I thought this is the place that creates the libpkgconf-dev package; I used prior art to implement this, and haven't been able to verify this part as I haven't been able to convert my systems to pkgbase for testing yet (https://github.com/FreeBSDFoundation/pkgbasify/issues/46). Glad for any pointers.

lib/libpkgconf/Makefile
20

I think this solves it; is it the right way?
bapt also reported this at https://ron-dev.freebsd.org/FreeBSD/src/pulls/9 btw.

etc/mtree/BSD.usr.dist
29

packages are created implicitly by putting things in them, so when you say PACKAGE=foo in a Makefile, you get a foo package. you can also create packages in mtree, but this is almost always wrong, because a package that only contains a directory isn't normally useful. (i.e., you still include the package tag, but it should reference a package that is already created somewhere else.)

right now, your Makefile will give you pkgconf, pkgconf-dev, and pkgconf-dbg. since the development files are in pkgconf-dev, that's probably also what you want to put in mtree.

if you want the runtime libraries to be in a different package, you can set LIB_PACKAGE= in the libpkgconf Makefile to create pkgconf-lib. whether this is a good idea depends on the package... if you expect a lot of things to link to libpkgconfig, it's useful to put it in its own package, but if the only thing likely to use it is pkgconf itself, there's no point.

lib/libpkgconf/Makefile
20

yep, this looks fine.

this is also missing package definitions in release/packages/ucl, so it will break the package build. you can copy an existing ucl file and modify it as appropriate; usually all you need is a comment and a description.

let me know if you want me to test the package build.

This addresses feedback from ivy, moving /usr/include/pkgconf into the pkgconf-dev package.
It also adds the files in /usr/include/pkgconf to the list of obsolete files when disabling the pkgconf option.

etc/mtree/BSD.usr.dist
29

Thanks for clarifying! I also think it should go into the pkgconf-dev package instead.

Approved by: philip (mentor)

Thanks Pierre :)

This revision is now accepted and ready to land.Apr 21 2026, 11:31 PM
This revision was automatically updated to reflect the committed changes.

What is the relationship of this type of change to use of ${PREFIX} when ports install themselves and it is not the /usr/local default value? (There is also a linux compatibility related standard default for PREFIX and folks can specify things like /opt .) There was a later change to use /usr/local/ when LOCALBASE was undefined.

But in response to that last change there is now from eduardo@freebsd.org :

This change doens't honour PREFIX when it is set to other path than
default "/usr/local/"

(Due to the message Nuno picked to reply to I ended up listed as the "To:", des and the lists Cc:'d.)

I figured I could at least ask the question here of the folks involved in the original review so that the question is not completely lost.

What is the relationship of this type of change to use of ${PREFIX} when ports install themselves and it is not the /usr/local default value? (There is also a linux compatibility related standard default for PREFIX and folks can specify things like /opt .) There was a later change to use /usr/local/ when LOCALBASE was undefined.

But in response to that last change there is now from eduardo@freebsd.org :

This change doens't honour PREFIX when it is set to other path than
default "/usr/local/"

(Due to the message Nuno picked to reply to I ended up listed as the "To:", des and the lists Cc:'d.)

I figured I could at least ask the question here of the folks involved in the original review so that the question is not completely lost.

I missed these messages, thanks for mentioning them here.

Systems with a different PREFIX than /usr/local should install pkgconf for themselves, as was the case before. Make sure that path has precedence over /usr/bin in such cases.

Let me know if that's not an acceptable situation, and we can look for a better solution.

Systems with a different PREFIX than /usr/local should install pkgconf for themselves, as was the case before. Make sure that path has precedence over /usr/bin in such cases.

Systems with a different PREFIX than /usr/local need to run a world built with LOCALBASE set to the correct value.

arrowd added inline comments.
lib/libpkgconf/Makefile
19

I wonder if it is allowed to compile-in the LOCALBASE value anywhere into base. This makes it impossible to later adjust sysctl user.localbase and build packages for such a system without also recompiling base.

lib/libpkgconf/Makefile
19
# sysctl -W user
user.localbase: /usr/local

# sysctl -T user
user.localbase: /usr/local

I'd never noticed that. It does not look to me like the ports tree references user.localbase ( grep -r scan used, starting at / ). But the system does in various places.

lib/libpkgconf/Makefile
19

I used lib/libpam/libpam/Makefile, which does CFLAGS+= -DLOCALBASE=\"${LOCALBASE:U/usr/local}\", as inspiration when preparing the import of pkgconf. It looks like it is used to locate the configuration files and modules for OpenPAM there.

I did not know about the user.localbase sysctl either; we could consider modifying pkgconf to use e.g., getlocalbase(3) from libutil to detect the right path at run-time.

Another option would be to not install pkgconf anymore, and restrict it to being a build tool until a better solution can be found.

lib/libpkgconf/Makefile
19

Using getlocalbase(3) at runtime would be ideal but is not a trivial change. Take a look at how certctl(8) does it.