[Mesa-dev] [PATCH] meson: Add Haiku platform support v3
Dylan Baker
dylan at pnwbakers.com
Fri Feb 16 22:34:05 UTC 2018
Quoting Emil Velikov (2018-02-16 14:21:52)
> On 16 February 2018 at 22:12, Dylan Baker <dylan at pnwbakers.com> wrote:
> > Quoting Emil Velikov (2018-02-16 13:55:06)
> >> On 16 February 2018 at 19:28, Dylan Baker <dylan at pnwbakers.com> wrote:
> >> > Quoting Alexander von Gluck IV (2018-02-16 11:08:33)
> >> >> February 16, 2018 11:49 AM, "Emil Velikov" <emil.l.velikov at gmail.com> wrote:
> >> >> > Hi Alexander,
> >> >> >
> >> >> > Did you drop the ball on the autotools patches? I could re-spin them
> >> >> > but have no way to test.
> >> >>
> >> >> I've been focused on meson since it's the future.
> >> >> Feel free to re-spin them if you have the bandwidth.
> >> >>
> >> >> > There's a couple of comments inline, but nothing major.
> >> >> >
> >> >> > On 16 February 2018 at 00:32, Alexander von Gluck IV
> >> >> > <kallisti5 at unixzen.com> wrote:
> >> >> >
> >> >> >> --- a/meson.build
> >> >> >> +++ b/meson.build
> >> >> >>
> >> >> >> gl_priv_libs = []
> >> >> >> -if dep_thread.found()
> >> >> >> +if dep_thread.found() and host_machine.system() != 'haiku'
> >> >> >> gl_priv_libs += ['-lpthread', '-pthread']
> >> >> >> endif
> >> >> >
> >> >> > There's a bug report/fix in Meson for this one right?
> >> >> > Please mention the ticket number of Meson version where the fix
> >> >> > landed. Thus way one can drop this when we bump the Meson requirement.
> >> >>
> >> >> I did a bump of Meson on my Haiku build system and still saw the same
> >> >> incorrect searching for -lpthread issues. I think there are places where
> >> >> -lpthread -pthread were specified without looking at dep_thread.found()
> >> >> though which could be at play. (see below)
> >> >
> >> > dep_pthread.found() returns true on anything that has pthreads, so for us that
> >> > means anything except windows (non-cygwin windows). I think this is the right
> >> > way to handle this, haiku does have pthreads, they're just not a separate
> >> > library. macOS has some weird pthreads stuff too, and this is how we handle
> >> > macOS.
> >> >
> >> Could swear I read your reply somewhere which said that we can as
> >> Meson to provide the correct flags - be that -lpthread or others.
> >> Yet we're doing the completely opposite thing here.
> >>
> >> Did I misunderstand you or ?
> >>
> >> -Emil
> >
> > What I said was that adding `dependency('threads')` to a target, ala
> > mylib = library(
> > 'mylib',
> > 'mylib.c',
> > dependencies : dependency('threads'),
> > )
> >
> > Will always (as of 0.44 when I fixed Haiku) do the right thing.
> >
> > The problem is that haiku *does* have pthreads, it just doesn't have a pthreads
> > library. So the dep returns found because there are pthreads, it just doesn't
> > add any -l, -L, or -I arguments because none are necessary.
> >
> Right. Using -lpthread (notice the L) is kind of wrong and incomplete.
> -pthread is sufficient and the "right thing to do". Modulo the odd
> platform (msvc, maybe suncc and maybe haiku) that wants to use
> something else ;-)
>
> As you mentioned meson has dependency('threads') - which we can
> transcribe and use in the pkg-config files, right?
>
> -Emil
One of the guys at redhat or fedora (not sure, maybe both) did some work in 0.45
so that pkg.generate will actually walk up the dependency graph of the libraries
you pass to the pkg.generate(libraries : ) argument, and generate the correct
Requires, Requires.private, and Libs for you. Until we can depend on that though
we'll have to manage the addition of -pthreads and -lpthreads ourselves (it's
-pthreads for cc/cxx and -lpthreads for ld, right, or is just -pthreads for
both? I can never remember which)
Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180216/2021d919/attachment-0001.sig>
More information about the mesa-dev
mailing list