From d82c9e7f2a2f4a59c4e80e7219f57b82dcb87b5d Mon Sep 17 00:00:00 2001 From: Alex Leute <36964815+alex391@users.noreply.github.com> Date: Fri, 19 Jul 2024 03:42:58 -0400 Subject: usearch: new version (#45308) * usearch: new versison Manual download no longer reqired for @12: --- .../usearch/0001-Don-t-statically-link.patch | 26 ++++++++++++++ .../repos/builtin/packages/usearch/package.py | 40 +++++++++++++++++----- 2 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 var/spack/repos/builtin/packages/usearch/0001-Don-t-statically-link.patch diff --git a/var/spack/repos/builtin/packages/usearch/0001-Don-t-statically-link.patch b/var/spack/repos/builtin/packages/usearch/0001-Don-t-statically-link.patch new file mode 100644 index 0000000000..f591259663 --- /dev/null +++ b/var/spack/repos/builtin/packages/usearch/0001-Don-t-statically-link.patch @@ -0,0 +1,26 @@ +From 8df3df8574522ec75c085d35f7c42a65dfe16cf4 Mon Sep 17 00:00:00 2001 +From: Alex C Leute +Date: Thu, 18 Jul 2024 14:39:35 -0400 +Subject: [PATCH] Don't statically link + +--- + src/Makefile | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/src/Makefile b/src/Makefile +index e849853..b796f52 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -15,9 +15,6 @@ CXXFLAGS := $(CFLAGS) -DNDEBUG -pthread -O3 -ffast-math -march=native --std=c++1 + + UNAME_S := $(shell uname -s) + LDFLAGS := $(LDFLAGS) -O3 -pthread -lpthread +-ifeq ($(UNAME_S),Linux) +- LDFLAGS += -static +-endif + + HDRS = \ + accepter.h \ +-- +2.43.5 + diff --git a/var/spack/repos/builtin/packages/usearch/package.py b/var/spack/repos/builtin/packages/usearch/package.py index 6ce96241bc..300a13b688 100644 --- a/var/spack/repos/builtin/packages/usearch/package.py +++ b/var/spack/repos/builtin/packages/usearch/package.py @@ -8,28 +8,52 @@ import os from spack.package import * -class Usearch(Package): +class Usearch(MakefilePackage): """USEARCH is a unique sequence analysis tool with thousands of users world-wide. - Note: A manual download is required for USEARCH. - Spack will search your current directory for the download file. - Alternatively, add this file to a mirror so that Spack can find it. - For instructions on how to set up a mirror, see + Note: A manual download is required for USEARCH when @:11.0.667. Spack + will search your current directory for the download file. Alternatively, + add this file to a mirror so that Spack can find it. For instructions on + how to set up a mirror, see https://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "https://www.drive5.com/usearch/" + url = "https://github.com/rcedgar/usearch12/archive/refs/tags/v12.0-beta1.tar.gz" maintainers("snehring") - manual_download = True + build_directory = "src" + version( + "12.0-beta1", sha256="dbb06e4733801dab1c405616880261bd885ab171dfdb1d44e8ede48d739cdc43" + ) version("11.0.667", sha256="1be0faa1380100296029064e4cf9665d723d43f03c794da444c5b1a6b6799ac2") version("10.0.240", sha256="297ba03cb5bdc60c9727b7949cc08bfeecad8b290c2844b5ad011f72a7e1399c") + with when("@12:"): + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("ccache", type="build") + + patch("0001-Don-t-statically-link.patch", when="@12:") + + @property + def manual_download(self): + return self.spec.satisfies("@:11.0.667") + def url_for_version(self, version): - return "file://{0}/usearch{1}_i86linux32.gz".format(os.getcwd(), version) + if version <= Version("11.0.667"): + return "file://{0}/usearch{1}_i86linux32.gz".format(os.getcwd(), version) + return super().url_for_version(version) + + def build(self, spec, prefix): + if not self.spec.satisfies("@:11.0.667"): + super().build(spec, prefix) def install(self, spec, prefix): mkdirp(prefix.bin) - install("usearch{0}_i86linux32".format(self.version), prefix.bin.usearch) + if self.spec.satisfies("@:11.0.667"): + install("usearch{0}_i86linux32".format(self.version), prefix.bin.usearch) + else: + install("bin/usearch{0}".format(self.version.up_to(1)), prefix.bin.usearch) set_executable(prefix.bin.usearch) -- cgit v1.2.3-70-g09d2