-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
test? ( dev-perl/Test-LeakTrace )"
PATCHES=(
+ "${FILESDIR}/2.11-build_env_ldflags.patch"
"${FILESDIR}/2.11-build_split_htslib_opts.patch"
)
--- /dev/null
+--- a/Build.PL
++++ b/Build.PL
+@@ -107,11 +107,17 @@
+ my $hts_include = $self->config_data('hts_include');
+ my $hts_lib = $self->config_data('hts_lib');
+ my $static = $self->args('static');
++
++ my @env_linker_flags;
++ if ( defined $ENV{LDFLAGS} ) {
++ @env_linker_flags = split qr{\s+}, $ENV{LDFLAGS};
++ }
++
+ $self->include_dirs([$hts_include]);
+ if($static){
+- $self->extra_linker_flags("-L$hts_lib", '-lhts', '-lpthread', '-lz');
++ $self->extra_linker_flags(@env_linker_flags, "-L$hts_lib", '-lhts', '-lpthread', '-lz');
+ }else{
+- $self->extra_linker_flags("-L$hts_lib", "-Wl,-rpath,$hts_lib", '-lhts', '-lpthread', '-lz');
++ $self->extra_linker_flags(@env_linker_flags, "-L$hts_lib", "-Wl,-rpath,$hts_lib", '-lhts', '-lpthread', '-lz');
+ }
+ }
+