Skip to content

Commit

Permalink
Try each pkg-config query separatedly if returned list doesn't match …
Browse files Browse the repository at this point in the history
…query length

MinGW's pkg-config returns only one version even if queried for
multiple libraries.
  • Loading branch information
jasagredo committed Jul 19, 2023
1 parent 2564b54 commit 4b87276
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ readPkgConfigDb verbosity progdb = handle ioErrorHandler $ do
(pkgVersions, _errs, exitCode) <-
getProgramInvocationOutputAndErrors verbosity
(programInvocation pkgConfig ("--modversion" : pkgNames))
case exitCode of
ExitSuccess -> (return . pkgConfigDbFromList . zip pkgNames) (lines pkgVersions)
-- if there's a single broken pc file the above fails, so we fall back into calling it individually
_ -> do
info verbosity ("call to pkg-config --modversion on all packages failed. Falling back to querying pkg-config individually on each package")
pkgConfigDbFromList . catMaybes <$> mapM (getIndividualVersion pkgConfig) pkgNames
if exitCode == ExitSuccess && length pkgNames == length pkgList
then (return . pkgConfigDbFromList . zip pkgNames) (lines pkgVersions)
else -- if there's a single broken pc file the above fails, so we fall back into calling it individually
do
info verbosity ("call to pkg-config --modversion on all packages failed. Falling back to querying pkg-config individually on each package")
pkgConfigDbFromList . catMaybes <$> mapM (getIndividualVersion pkgConfig) pkgNames
where
-- For when pkg-config invocation fails (possibly because of a
-- too long command line).
Expand Down

0 comments on commit 4b87276

Please sign in to comment.