From dba65af68708859203338caa04ac62265fcebeab Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sun, 22 Dec 2024 11:07:47 +0100 Subject: [PATCH] Makefile and guix: build default sambamba --- Makefile | 3 +- guix.scm | 116 ++++++++++++++++++++++++++----------------------------- 2 files changed, 57 insertions(+), 62 deletions(-) diff --git a/Makefile b/Makefile index 4ae3318..b67ff89 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,7 @@ endif BIOD_PATH=./BioD:./BioD/contrib/msgpack-d/src DFLAGS = -wi -I. -I$(BIOD_PATH) -g -J. LDFLAGS = -L=-flto=full +PREFIX = /usr/local # DLIBS = $(LIBRARY_PATH)/libphobos2-ldc.a $(LIBRARY_PATH)/libdruntime-ldc.a # DLIBS_DEBUG = $(LIBRARY_PATH)/libphobos2-ldc-debug.a $(LIBRARY_PATH)/libdruntime-ldc-debug.a @@ -117,7 +118,7 @@ debug-strip: pgo-static: static debug-strip install: - install -m 0755 $(OUT) $(prefix)/bin + install -m 0755 $(OUT) $(PREFIX)/bin clean: clean-d rm -f profile.data diff --git a/guix.scm b/guix.scm index 9a75eb0..89a8476 100644 --- a/guix.scm +++ b/guix.scm @@ -1,11 +1,10 @@ -;; To get a development container (inside emacs shell will work) +;; To build sambamba using a recent Guix: ;; -;; guix shell -C -D -f guix.scm -- bash --init-file <(echo "ln -s /bin/sh /bin/bash") +;; guix build -f guix.scm ;; -;; For the tests you may need /usr/bin/env. In a container create it with -;; -;; mkdir -p /usr/bin ; ln -s $GUIX_ENVIRONMENT/bin/env /usr/bin/env +;; To get a development container (inside emacs shell will work!) ;; +;; guix shell -C -D -F -f guix.scm (use-modules (srfi srfi-1) @@ -14,91 +13,86 @@ ((guix licenses) #:prefix license:) (guix packages) (guix utils) - (guix download) + ;; (guix download) (guix git-download) (guix build-system gnu) (guix gexp) (gnu packages base) + (gnu packages bash) (gnu packages bioinformatics) ; for samtools in sambamba (gnu packages build-tools) ; for meson (gnu packages compression) - (gnu packages curl) + ;; (gnu packages curl) (gnu packages dlang) (gnu packages gcc) (gnu packages pkg-config) - (gnu packages perl) + ;; (gnu packages perl) (gnu packages python) - (gnu packages ninja) - (gnu packages ruby) + ;; (gnu packages ninja) + ;; (gnu packages ruby) (gnu packages tls) (gnu packages version-control) ) -#! - (use-modules - (guix build-system cmake) - (guix utils) - (gnu packages base) - (gnu packages compression) - (gnu packages build-tools) - (gnu packages commencement) ; gcc-toolchain - (gnu packages curl) - (gnu packages datastructures) - (gnu packages gdb) - (gnu packages gcc) - (gnu packages jemalloc) - (gnu packages libffi) - (gnu packages mpi) - (gnu packages python) - (gnu packages python-xyz) - (gnu packages pkg-config) - (gnu packages tls) -) - -!# - (define %source-dir (dirname (current-filename))) (define %git-commit (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f 2" OPEN_READ))) (define-public sambamba-git + "singleobj -wi -I. -I./BioD:./BioD/contrib/msgpack-d/src -g -J. -O3 -release -enable-inlining -boundscheck=off" (package (name "sambamba-git") (version (git-version "1.0.0" "HEAD" %git-commit)) (source (local-file %source-dir #:recursive? #t)) - (build-system gnu-build-system) - (outputs '("out" ; disable all checks for speed - "debug")) - (inputs - `(("samtools" ,samtools) ; for pileup - ("bcftools" ,bcftools) ; for pileup - ("meson" ,meson) ; for testing meson build system - ("ninja" ,ninja) - ("pkg-config" ,pkg-config) - ("lz4" ,lz4) - ("lz4-static" ,lz4 "static") - ("zlib-static" ,zlib "static") - ("zlib" ,zlib) ; also for the static build we need the includes - ; ("zstd-lib" ,zstd "static") - ; ("zstd" ,zstd "lib") ; same + (build-system gnu-build-system) + (arguments + `(;; #:tests? #f ;; we'll run tests + #:make-flags + (list + "VERBOSE=1" + (string-append "CC=" ,(cc-for-target)) + (string-append "PREFIX=" %output)) + #:phases + (modify-phases %standard-phases + (delete 'configure) ; no configure script + (add-before 'check 'patch-tests + (lambda _ + (substitute* "contrib/shunit2-2.0.3/shunit2" + (("/bin/sh") (which "sh"))))) + (add-before 'install 'make-bin-dir + (lambda _ + (mkdir-p (string-append %output "/bin")))) + ))) + (outputs '("out" ; disable all checks for speed + "debug")) + (inputs + `(("samtools" ,samtools) ; for pileup + ("bcftools" ,bcftools) ; for pileup + ;; ("meson" ,meson) ; for testing meson build system + ;; ("ninja" ,ninja) + ("pkg-config" ,pkg-config) + ("lz4-static" ,lz4 "static") + ("lz4" ,lz4) + ("zlib-static" ,zlib "static") + ("zlib" ,zlib) ; also for the static build we need the includes + ;; ("zstd-lib" ,zstd "static") + ;; ("zstd" ,zstd "lib") ; same + )) + (native-inputs + `(("ldc" ,ldc) + ("bash-minimal" ,bash-minimal) ; for sh in shunit2 + ("python" ,python) ; Needed for building htslib and sambamba + ("which" ,which) )) - (native-inputs - `(("ldc" ,ldc) - ("coreutils" ,coreutils) ; for env - ; ("perl" ,perl) ; Needed for building htslib - ; ("ruby" ,ruby) ; Needed for building htslib - ("python" ,python) ; Needed for building htslib and sambamba - ("gcc" ,gcc) - ("which" ,which))) - (home-page "https://github.com/lomereiter/sambamba") - (synopsis "Fast tool for working with SAM and BAM files written in D.") - (description - "Sambamba is a high performance modern robust and fast + (home-page "https://github.com/BioD/sambamba") + (synopsis "Fast tool for working with SAM and BAM files written in D.") + (description + "Sambamba is a high performance modern robust and fast tool (and library), written in the D programming language, for working with SAM and BAM files. Current parallelised functionality is an important subset of samtools functionality, including view, index, sort, markdup, and depth.") - (license license:gpl2+))) + (license license:gpl2+))) sambamba-git