htslib: add variants (#44501)

Signed-off-by: Teague Sterling <teaguesterling@gmail.com>
This commit is contained in:
Teague Sterling 2024-06-23 23:34:10 -07:00 committed by GitHub
parent 57b83e5fb2
commit cc6dcdcab9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,18 +42,23 @@ class Htslib(AutotoolsPackage):
"libcurl", "libcurl",
default=True, default=True,
description="Enable libcurl-based support for http/https/etc URLs," description="Enable libcurl-based support for http/https/etc URLs,"
" for versions >= 1.3. This also enables S3 and GCS support.", " for versions >= 1.3. This also enables S3 and GCS support by default.",
) )
variant( variant(
"libdeflate", "libdeflate",
default=True, default=True,
description="use libdeflate for faster crc and deflate algorithms", description="use libdeflate for faster crc and deflate algorithms",
) )
variant("gcs", default=True, description="enable gcs url support", when="@1.5:+libcurl")
variant("s3", default=True, description="enable s3 url support", when="@1.5:+libcurl")
variant("plugins", default=False, description="enable support for separately compiled plugins")
variant("pic", default=True, description="Compile with PIC support")
depends_on("zlib-api") depends_on("zlib-api")
depends_on("bzip2", when="@1.4:") depends_on("bzip2", when="@1.4:")
depends_on("xz", when="@1.4:") depends_on("xz", when="@1.4:")
depends_on("curl", when="@1.3:+libcurl") depends_on("curl", when="@1.3:+libcurl")
depends_on("openssl", when="+s3")
depends_on("libdeflate", when="@1.8:+libdeflate") depends_on("libdeflate", when="@1.8:+libdeflate")
depends_on("m4", when="@1.2") depends_on("m4", when="@1.2")
@ -76,6 +81,11 @@ def url_for_version(self, version):
url = "https://github.com/samtools/htslib/releases/download/{0}/htslib-{0}.tar.bz2" url = "https://github.com/samtools/htslib/releases/download/{0}/htslib-{0}.tar.bz2"
return url.format(version.dotted) return url.format(version.dotted)
def flag_handler(self, name, flags):
if name == "cflags" and self.spec.satisfies("+pic"):
flags.append(self.compiler.cc_pic_flag)
return (flags, None, None)
def configure_args(self): def configure_args(self):
spec = self.spec spec = self.spec
args = [] args = []
@ -83,6 +93,11 @@ def configure_args(self):
if spec.satisfies("@1.3:"): if spec.satisfies("@1.3:"):
args.extend(self.enable_or_disable("libcurl")) args.extend(self.enable_or_disable("libcurl"))
if spec.satisfies("@1.5:"):
args.extend(self.enable_or_disable("s3"))
args.extend(self.enable_or_disable("gcs"))
args.extend(self.enable_or_disable("plugins"))
if spec.satisfies("@1.8:"): if spec.satisfies("@1.8:"):
args.extend(self.enable_or_disable("libdeflate")) args.extend(self.enable_or_disable("libdeflate"))