The old way of using pkgconfig in Build.PL has got a few shortcomings:
instead of retrieving both libdir and includedir, it only retrieves
the former and transforms it into what it expects includedir to be
(assuming in the process that libdir is .../lib and not e.g.
.../lib64) - i.e. does the same as for all other ways of specifying
location of htslib;
it directly accesses variables in htslib.pc instead of using --cflags
and --libs, which is the recommended way;
it works by running the pkg-config executable so extending this would
likely require processing the output of this command;
it still checks for the presence of hts.h and libhts.a/so, even
though pkgconfig is supposed to return valid locations.
This commit adds an alternative implementation of pkgconfig-based
detection of htslib which retrieves both includedir and libdir, uses
--cflags and --libs instead of accessing variables directly, and which
avoids custom implementation of the handling of pkg-config output by
using an existing Perl module designed for that purpose. It also extends
set_include_and_compiler_flags() to handle the scenario of $hts_include
and $hts_lib being empty, which is the case when --cflags/--libs are
used and htslib has been installed to a standard prefix such as /usr.
In order to retain backward compatibility, for the time being the new
implementation is only invoked after all earlier attempts of locating
htslib - including the old way of invoking pkg-config - have failed.
Will leave it to the maintainers to decide whether to move this
implementation up in the queue and/or retire any old detection modes.
Note that this adds an optional build-time dependency on
ExtUtils::PkgConfig.
The old way of using pkgconfig in Build.PL has got a few shortcomings:
This commit adds an alternative implementation of pkgconfig-based detection of htslib which retrieves both includedir and libdir, uses --cflags and --libs instead of accessing variables directly, and which avoids custom implementation of the handling of pkg-config output by using an existing Perl module designed for that purpose. It also extends set_include_and_compiler_flags() to handle the scenario of $hts_include and $hts_lib being empty, which is the case when --cflags/--libs are used and htslib has been installed to a standard prefix such as /usr.
In order to retain backward compatibility, for the time being the new implementation is only invoked after all earlier attempts of locating htslib - including the old way of invoking pkg-config - have failed. Will leave it to the maintainers to decide whether to move this implementation up in the queue and/or retire any old detection modes.
Note that this adds an optional build-time dependency on ExtUtils::PkgConfig.