Skip to content

Commit

Permalink
Makefile and guix: build default sambamba
Browse files Browse the repository at this point in the history
  • Loading branch information
pjotrp committed Dec 22, 2024
1 parent b1e0b7b commit dba65af
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 62 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
116 changes: 55 additions & 61 deletions guix.scm
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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

0 comments on commit dba65af

Please sign in to comment.