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

Change default pkgconfig directory on FreeBSD #4410

Merged
merged 1 commit into from
Nov 5, 2019

Conversation

sghctoma
Copy link
Contributor

Hey,

FreeBSD uses ${PREFIX}/libdata/pkgconfig as default pkgconf search path for non-base libraries, so I think it would be appropriate for Meson to default to that directory too. This commit makes necessary changes for this.

FreeBSD uses ${PREFIX}/libdata/pkgconfig as default pkgconf search path
for non-base libraries. This commit makes that directory the default
install_dir in the pkgconfig module on FreeBSD.
@nirbheek
Copy link
Member

What are non-base libraries defined as? Do base libraries also use pkg-config?

@nirbheek
Copy link
Member

Test failure is unrelated, and can be fixed by rebasing after #4408 is merged.

@sghctoma
Copy link
Contributor Author

Base is the system you get when you install FreeBSD. Everything you install after (from ports, packages, or otherwise) is non-base.
Yes, there are some base libraries that use pkgconf, but that is irrelevant here, because everything you build and install with Meson is non-base by definition.

@nirbheek
Copy link
Member

Is that because a base project will always use hand-rolled Makefiles or something else? Just trying to understand and document the situation so we can revisit it if needed.

@sghctoma
Copy link
Contributor Author

Something like that :) FreeBSD itself is the base project. It is a self-contained entity in the sense that it consists of the kernel and a userland, and both are built using only software in the base system.
In other words, Meson would have to deal with base libraries only if the FreeBSD project would decide that Meson should be part of the base system.

Does this makes sense? I'm sorry if I'm not explaining this right, it's just that the distinction between base and non-base is so natural to me after using FreeBSD for a decade, that I don't really know how to explain it effectively.

@nirbheek
Copy link
Member

Makes sense, thanks. I guess we can revisit this if FreeBSD decides to use Meson in its base system.

@jpakkane
Copy link
Member

Rather than checking if it is being built on FreeBSD, shouldn't we check if it is being built for FreeBSD? Otherwise cross compiling either to or from FreeBSD would put the .pc file in the wrong place.

Granted this would only be a problem for projects that cross compile between FreeBSD and some other platform and would need to produce .pc files for that. It seems unlikely but maybe there are people around who need that?

@lantw44
Copy link
Contributor

lantw44 commented Oct 24, 2018

It is correct that both FreeBSD base and ports put .pc files in libdata/pkgconfig, but I am not sure whether we should do it in meson by default. It is correct that we should find ways to minimize the number of patches and workarounds in FreeBSD ports, but sometimes it seems to me that it is FreeBSD ports that decide to do things differently. I never see a build system or a project which makes libdata/pkgconfig the default when building for FreeBSD. Even the pkg-config implementation used in FreeBSD ports, pkgconf, defaults to ${PREFIX}/lib/pkgconfig and ${PREFIX}/share/pkgconfig when --with-pkg-config-dir is not specified.

I think the better way to resolve the problem is to support --pkgconfigdir (or even better, --libpkgconfigdir and --sharepkgconfigdir, to distinguish between two kinds of .pc files) in meson. Users who don't pass --pkgconfigdir get the default path of pkg-config, and FreeBSD ports can use --pkgconfigdir libdata/pkgconfig like what Mk/Uses/meson.mk already does for man pages. If pkgconfigdir is added, developers will be encouraged to switch to it and hardcoding lib/pkgconfig can trigger a warning.

In case you don't know the rule of man pages and info pages on FreeBSD, it is that FreeBSD ports require all ports to install man pages in ${PREFIX}/man (instead of share/man) and info pages in ${PREFIX}/info (instead of share/info. This rule doesn't apply to FreeBSD base, and FreeBSD base uses /usr/share/man and /usr/share/info. However, the rule of libdata/pkgconfig applies to both FreeBSD base and ports and /usr/libdata/pkgconfig does exist on a clean installation.

@dcbaker
Copy link
Member

dcbaker commented Oct 24, 2018

We've run into this before with all of the BSDs, that no one here is knowledgeable enough to know for sure what the right thing to do is. Maybe we should just go to the appropriate mailing list for FreeBSD and ask the FreeBSD devs what they would like meson to do in these cases?

@emersion
Copy link
Contributor

Any progress on this?

@Peter2121
Copy link

Please, merge it.
All meson based builds need hacks to work correctly on FreeBSD.
BTW, autotools manages it correctly.

@jpakkane
Copy link
Member

jpakkane commented Nov 4, 2019

I know nothing about BSDs but I'm fine merging this, if only to break things so people will file bugs telling how things should have been done.

@Peter2121
Copy link

I know nothing about BSDs but I'm fine merging this, if only to break things so people will file bugs telling how things should have been done.

I know nothing about Meson ;)
But if the effect of this commit is limited to FreeBSD (it seems) - I don't think people will file bugs. The Meson's default directory for pc files ($libdir/pkgconfig) does not exist in FreeBSD, nobody knows about it and no software comes to search pc files in it (and if it comes - it must be fixed). So, anyway, changing the path to $prefix/libdata/pkgconfig will do the things better under FreeBSD.
Thank you!

@jpakkane jpakkane merged commit aba8792 into mesonbuild:master Nov 5, 2019
lantw44 added a commit to lantw44/meson that referenced this pull request Dec 14, 2019
Since mesonbuild#4410 changes the
installation directory of pkg-config files on FreeBSD, it is no longer
possible for a portable script, such as JHBuild, to use the same
directory layout on different platforms. Projects not using Meson's
pkgconfig module are likely to keep installing pkg-config files into
lib/pkgconfig, so we end up having both libdata/pkgconfig and
lib/pkgconfig on FreeBSD. Unless JHBuild wants to patch build files for
other build systems or manually move files after installation like what
FreeBSD ports currently do, we will have a mixed directory layout when
using a custom prefix on FreeBSD.

Instead of hard-coding the path of pkg-config files, provide options
for users to override the default values. JHBuild can just set
'--libpkgconfigdir lib/pkgconfig --sharepkgconfigdir share/pkgconfig'
to keep its existing behavior like what it already does to disable
Debian-style multiarch with '--libdir lib'. Projects not using Meson's
pkgconfig module are also encouraged to use these options to ensure a
consistent directory layout.
lantw44 added a commit to lantw44/meson that referenced this pull request Dec 14, 2019
Since mesonbuild#4410 changes the
installation directory of pkg-config files on FreeBSD, it is no longer
possible for a portable script, such as JHBuild, to use the same
directory layout on different platforms. Projects not using Meson's
pkgconfig module are likely to keep installing pkg-config files into
lib/pkgconfig, so we end up having both libdata/pkgconfig and
lib/pkgconfig on FreeBSD. Unless JHBuild wants to patch build files for
other build systems or manually move files after installation like what
FreeBSD ports currently do, we will have a mixed directory layout when
using a custom prefix on FreeBSD.

Instead of hard-coding the path of pkg-config files, provide options
for users to override the default values. JHBuild can just set
'--libpkgconfigdir lib/pkgconfig --sharepkgconfigdir share/pkgconfig'
to keep its existing behavior like what it already does to disable
Debian-style multiarch with '--libdir lib'. Projects not using Meson's
pkgconfig module are also encouraged to use these options to ensure a
consistent directory layout.
lantw44 added a commit to lantw44/meson that referenced this pull request Dec 14, 2019
Since mesonbuild#4410 changes the
installation directory of pkg-config files on FreeBSD, it is no longer
possible for a portable script, such as JHBuild, to use the same
directory layout on different platforms. Projects not using Meson's
pkgconfig module are likely to keep installing pkg-config files into
lib/pkgconfig, so we end up having both libdata/pkgconfig and
lib/pkgconfig on FreeBSD. Unless JHBuild wants to patch build files for
other build systems or manually move files after installation like what
FreeBSD ports currently do, we will have a mixed directory layout when
using a custom prefix on FreeBSD.

Instead of hard-coding the path of pkg-config files, provide options
for users to override the default values. JHBuild can just set
'--libpkgconfigdir lib/pkgconfig --sharepkgconfigdir share/pkgconfig'
to keep its existing behavior like what it already does to disable
Debian-style multiarch with '--libdir lib'. Projects not using Meson's
pkgconfig module are also encouraged to use these options to ensure a
consistent directory layout.
lantw44 added a commit to lantw44/meson that referenced this pull request Dec 14, 2019
Since mesonbuild#4410 changes the
installation directory of pkg-config files on FreeBSD, it is no longer
possible for a portable script, such as JHBuild, to use the same
directory layout on different platforms. Projects not using Meson's
pkgconfig module are likely to keep installing pkg-config files into
lib/pkgconfig, so we end up having both libdata/pkgconfig and
lib/pkgconfig on FreeBSD. Unless JHBuild wants to patch build files for
other build systems or manually move files after installation like what
FreeBSD ports currently do, we will have a mixed directory layout when
using a custom prefix on FreeBSD.

Instead of hard-coding the path of pkg-config files, provide options
for users to override the default values. JHBuild can just set
'--libpkgconfigdir lib/pkgconfig --sharepkgconfigdir share/pkgconfig'
to keep its existing behavior like what it already does to disable
Debian-style multiarch with '--libdir lib'. Projects not using Meson's
pkgconfig module are also encouraged to use these options to ensure a
consistent directory layout.
lantw44 added a commit to lantw44/meson that referenced this pull request Dec 14, 2019
Since mesonbuild#4410 changes the
installation directory of pkg-config files on FreeBSD, it is no longer
possible for a portable script, such as JHBuild, to use the same
directory layout on different platforms. Projects not using Meson's
pkgconfig module are likely to keep installing pkg-config files into
lib/pkgconfig, so we end up having both libdata/pkgconfig and
lib/pkgconfig on FreeBSD. Unless JHBuild wants to patch build files for
other build systems or manually move files after installation like what
FreeBSD ports currently do, we will have a mixed directory layout when
using a custom prefix on FreeBSD.

Instead of hard-coding the path of pkg-config files, provide options
for users to override the default values. JHBuild can just set
'--libpkgconfigdir lib/pkgconfig --sharepkgconfigdir share/pkgconfig'
to keep its existing behavior like what it already does to disable
Debian-style multiarch with '--libdir lib'. Projects not using Meson's
pkgconfig module are also encouraged to use these options to ensure a
consistent directory layout.
lantw44 added a commit to lantw44/meson that referenced this pull request Dec 25, 2019
Since mesonbuild#4410 changes the
installation directory of pkg-config files on FreeBSD, it is no longer
possible for a portable script, such as JHBuild, to use the same
directory layout on different platforms. Projects not using Meson's
pkgconfig module are likely to keep installing pkg-config files into
lib/pkgconfig, so we end up having both libdata/pkgconfig and
lib/pkgconfig on FreeBSD. Unless JHBuild wants to patch build files for
other build systems or manually move files after installation like what
FreeBSD ports currently do, we will have a mixed directory layout when
using a custom prefix on FreeBSD.

Instead of hard-coding the path of pkg-config files, provide options
for users to override the default values. JHBuild can just set
'--libpkgconfigdir lib/pkgconfig --sharepkgconfigdir share/pkgconfig'
to keep its existing behavior like what it already does to disable
Debian-style multiarch with '--libdir lib'. Projects not using Meson's
pkgconfig module are also encouraged to use these options to ensure a
consistent directory layout.
lantw44 added a commit to lantw44/meson that referenced this pull request Dec 28, 2019
Since mesonbuild#4410 changes the
installation directory of pkg-config files on FreeBSD, it is no longer
possible for a portable script, such as JHBuild, to use the same
directory layout on different platforms. Projects not using Meson's
pkgconfig module are likely to keep installing pkg-config files into
lib/pkgconfig, so we end up having both libdata/pkgconfig and
lib/pkgconfig on FreeBSD. Unless JHBuild wants to patch build files for
other build systems or manually move files after installation like what
FreeBSD ports currently do, we will have a mixed directory layout when
using a custom prefix on FreeBSD.

Instead of hard-coding the path of pkg-config files, provide options
for users to override the default values. JHBuild can just set
'--libpkgconfigdir lib/pkgconfig --sharepkgconfigdir share/pkgconfig'
to keep its existing behavior like what it already does to disable
Debian-style multiarch with '--libdir lib'. Projects not using Meson's
pkgconfig module are also encouraged to use these options to ensure a
consistent directory layout.
@xclaesse
Copy link
Member

But if the effect of this commit is limited to FreeBSD (it seems) - I don't think people will file bugs.

That turned to be wrong: #6343

BTW, autotools manages it correctly.

What does autotools exactly?

gnomesysadmins pushed a commit to GNOME/jhbuild that referenced this pull request Jan 14, 2020
Meson 0.53 is now able to use PKG_CONFIG_PATH to sort library paths.
Therefore, the local patch included in JHBuild can be dropped.

mesonbuild/meson#4271
mesonbuild/meson#4325

Meson 0.53 changes the installation path of .pc files from lib/pkgconfig
to libdata/pkgconfig on FreeBSD without providing any way to override
the behavior. While it can be an improvement of usability on FreeBSD
because FreeBSD configures its pkgconf to use libdata/pkgconfig instead
of the upstream default lib/pkgconfig and share/pkgconfig, it can also
be a problem for JHBuild. JHBuild does not change the directory layout
depending on the platform, and doing so can confuse the user and make
the environment messy. Therefore, revert the change until there is a
better way to choose the default installation path.

mesonbuild/meson#4410
mesonbuild/meson#6343
gnomesysadmins pushed a commit to GNOME/jhbuild that referenced this pull request Jan 19, 2020
Meson 0.53 is now able to use PKG_CONFIG_PATH to sort library paths.
Therefore, the local patch included in JHBuild can be dropped.

mesonbuild/meson#4271
mesonbuild/meson#4325

Meson 0.53 changes the installation path of .pc files from lib/pkgconfig
to libdata/pkgconfig on FreeBSD without providing any way to override
the behavior. While it can be an improvement of usability on FreeBSD
because FreeBSD configures its pkgconf to use libdata/pkgconfig instead
of the upstream default lib/pkgconfig and share/pkgconfig, it can also
be a problem for JHBuild. JHBuild does not change the directory layout
depending on the platform, and doing so can confuse the user and make
the environment messy. Therefore, revert the change until there is a
better way to choose the default installation path.

mesonbuild/meson#4410
mesonbuild/meson#6343
bradleysepos pushed a commit to f3ndot/HandBrake that referenced this pull request Mar 10, 2020
bradleysepos pushed a commit to HandBrake/HandBrake that referenced this pull request Mar 10, 2020
…ctory.

Breaking upstream commit requires this. See:

- mesonbuild/meson#4410
- mesonbuild/meson@aba8792
- mesonbuild/meson#6343

Fixes #2662.

(cherry picked from commit f77ca8d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants