public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Carlo B." <carlo.bramini@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Mingw pkg-config not working
Date: Thu, 26 Mar 2020 14:07:55 +0100	[thread overview]
Message-ID: <CADt9576AyQPB+CZ2ZbvOUaV9siV7UZDxhw9hRkzYbadHVuwUWw@mail.gmail.com> (raw)
In-Reply-To: <9f22993d-13d1-de2e-74ff-e9d08ec504ed@dronecode.org.uk>

[-- Attachment #1: Type: text/plain, Size: 2616 bytes --]

Hello,
I implemented the solution to this problem as a patch to
pkgconf.cygport as requested.
I attached small patch to this email, which resolved the troubles with
CMake and Meson.
I hope that you will find it useful and  some developers will gently
apply the correction to fix the issue.

Thank you very much for your time and your support.
Sincerely,

Carlo Bramini.

Il giorno sab 22 feb 2020 alle ore 18:47 Jon Turney
<jon.turney@dronecode.org.uk> ha scritto:
>
> On 20/02/2020 11:06, Carlo B. wrote:
> [...]
> > x86_64-w64-mingw32-pkg-config are emulated with a shell script, for
> > example the one for i686 is:
> >
> > #!/bin/sh
> > exec pkgconf --personality=i686-w64-mingw32 $@
> >
> > But while this solution mostly works when you exec it from the command
> > line, it makes impossible to detect the presence of the tool from
> > meson and cmake build systems.
> > If you try to do this on the bash prompt, you get:
> >
> > $ i686-w64-mingw32-pkg-config --version
> > pkgconf: --version specified with other options or module names,
> > assuming --modversion.
> > Please specify at least one package name on the command line.
> >
> > and this is exactly what happens with those build systems (and perhaps
> > others, I don't know): it tries to call pkg-config with "--version"
> > and it executes the above script that calls pkgconf. But sadly, the
> > presence of the "--personality" option makes the process to fail,
> > because the "--version" is currently allowed only when no other
> > options are added.
> > And, for this reason, meson and cmake fail the detection of the tool.
> >
> > I have also filed an issue here for pkgconf:
> > https://todo.sr.ht/~kaniini/pkgconf/10
> > because the solution is actually to ignore the presence of the
> > "--personality" option when the "--version" is written, but
> > unfortunately I have not received any feedback.
> >
> > So, I'm also writing here, with the hope that you could find a solution.
> [...]
>
> Thanks for reporting this issue.
>
> I guess the alternative to fixing pkgconf would be to modify those
> wrapper scripts to detect when the parameters are just '--version' (or
> equivalent) and not use --personality in that case?
>
> These wrapper scripts are specific to cygwin (generated by the cygport,
> see [1])
>
> It's possible other distros have more sophisticated wrapper scripts,
> which avoid this problem?
>
> If you do write or discover some improved wrapper scripts, a patch to
> [1] to update them would be appreciated.
>
> [1]
> https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/pkgconf.git;a=blob;f=pkgconf.cygport#l84

[-- Attachment #2: pkgconf.cygport.patch --]
[-- Type: application/octet-stream, Size: 395 bytes --]

diff --git a/pkgconf.cygport b/pkgconf.cygport
index 994ad2a..2d81dbc 100644
--- a/pkgconf.cygport
+++ b/pkgconf.cygport
@@ -83,7 +83,11 @@ SystemLibraryPaths: /usr/${mgw}/sys-root/mingw/lib
 _EOF
 		cat > ${D}/usr/bin/${mgw}-pkg-config <<_EOF
 #!/bin/sh
+if [ "$#" -eq 1 ] && [ "$1" == "--version" ]; then
+exec pkgconf --version
+else
 exec pkgconf --personality=${mgw} \$@
+fi
 _EOF
 	done
 

  parent reply	other threads:[~2020-03-26 13:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 11:06 Carlo B.
2020-02-22 17:47 ` Jon Turney
2020-02-27 16:20   ` Carlo B.
2020-03-26 13:07   ` Carlo B. [this message]
2020-04-05 13:51     ` Carlo B.
2020-04-06 16:43       ` Yaakov Selkowitz
2020-04-08 19:46         ` Carlo B.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADt9576AyQPB+CZ2ZbvOUaV9siV7UZDxhw9hRkzYbadHVuwUWw@mail.gmail.com \
    --to=carlo.bramini@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).