dev-perl/Bio-DB-HTS: allow explicit specification of htslib directories
authorMarek Szuba <marecki@gentoo.org>
Tue, 1 May 2018 08:45:02 +0000 (09:45 +0100)
committerMarek Szuba <marecki@gentoo.org>
Tue, 1 May 2018 08:45:33 +0000 (09:45 +0100)
Upstream build script takes a single directory as htslib prefix, then
appends "include/htslib" while looking for header files and "lib" while
looking for library. Unsurprisingly, the latter fails to locate the htslib
library on SYMLINK_LIB=no systems.

I have patched the build script to allow both htslib-includedir and
htslib-libdir to be provided explicitly, thus letting the ebuild take
care of choosing the correct libdir name for the specified
architecture/ABI.

Closes: https://bugs.gentoo.org/654460
Package-Manager: Portage-2.3.24, Repoman-2.3.6

dev-perl/Bio-DB-HTS/Bio-DB-HTS-2.10.ebuild
dev-perl/Bio-DB-HTS/files/2.10-build_split_htslib_opts.patch [new file with mode: 0644]

index 1490c3fe5ed1ddf444d721a72eba7fb98413cc6d..0a150300213950e037ecaf4c99856b5a39c68c26 100644 (file)
@@ -23,9 +23,10 @@ DEPEND="${RDEPEND}
 
 PATCHES=(
        "${FILESDIR}/2.10-build_search_for_so.patch"
+       "${FILESDIR}/2.10-build_split_htslib_opts.patch"
 )
 
 src_configure() {
-       local myconf="--htslib=${EPREFIX}/usr"
+       local myconf="--htslib-includedir=${EPREFIX}/usr/include/htslib --htslib-libdir=${EPREFIX}/usr/$(get_libdir)"
        perl-module_src_configure
 }
diff --git a/dev-perl/Bio-DB-HTS/files/2.10-build_split_htslib_opts.patch b/dev-perl/Bio-DB-HTS/files/2.10-build_split_htslib_opts.patch
new file mode 100644 (file)
index 0000000..d68bc54
--- /dev/null
@@ -0,0 +1,48 @@
+--- a/Build.PL
++++ b/Build.PL
+@@ -68,7 +68,13 @@
+     # If either of these are set, we expect to find the htslib files there:
+     # (They're explicitly set by the user, so we shouldn't fall back to
+     # finding another copy somewhere else.)
+-    if (my $dir = $self->args('htslib')) {
++    if (my ($incdir, $libdir) = ($self->args('htslib-includedir'), $self->args('htslib-libdir'))) {
++        return 1 if $self->find_hts_in_split_install_dirs($incdir, $libdir);
++        $self->die_hts_not_found(
++            "--htslib-includedir '$incdir' or --htslib-libdir '$libdir' command line parameters do not contain expected files\n"
++        );
++    }
++    elsif (my $dir = $self->args('htslib')) {
+         return 1 if $self->find_hts_in_build_dir($dir);
+         return 1 if $self->find_hts_in_install_dir($dir);
+         $self->die_hts_not_found(
+@@ -155,6 +161,22 @@
+     }
+ }
++sub find_hts_in_split_install_dirs {
++    my ($self, $hts_include, $hts_lib) = @_;
++
++    chomp($hts_include);
++    chomp($hts_lib);
++
++    if ((-f "$hts_lib/libhts.so" || -f "$hts_lib/libhts.a") && -f "$hts_include/hts.h") {
++        $self->config_data('hts_lib'     => $hts_lib);
++        $self->config_data('hts_include' => $hts_include);
++        return 1;
++    }
++    else {
++        return 0;
++    }
++}
++
+ sub die_hts_not_found {
+     my ($self, $msg) = @_;
+@@ -166,6 +188,7 @@
+ This script will attempt to locate htslib by looking for hts.h and libhts.so/libhts.a in:
++  0. --htslib-includedir and --htslib-libdir command line arguments
+   1. --htslib command line argument
+   2. HTSLIB_DIR environment variable
+   3. --prefix command line argument (which also sets installation location)