Skip to content

Commit 606f55c

Browse files
Merge pull request #302 from pjotrp/main
Guix static build for wfmash. Fixing tests and working on guix instructions/scripts
2 parents 643af3e + 45c34b8 commit 606f55c

6 files changed

+71
-47
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ build
3030
.\#*
3131
src/common/WFA2-lib/bin/
3232
src/wfmash_git_version.hpp
33+
src/common/wflign/src/wflign_git_version.hpp
3334

3435
test/
3536
.idea/

CMakeLists.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ if (BUILD_DEPS)
8787
ExternalProject_Add(htslib
8888
URL https://github.com/samtools/htslib/releases/download/1.20/htslib-1.20.tar.bz2
8989
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/htslib
90-
CONFIGURE_COMMAND autoreconf -i && ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/htslib --disable-libcurl --disable-s3
90+
CONFIGURE_COMMAND autoreconf -i && ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/htslib --disable-libcurl --disable-s3
9191
BUILD_COMMAND $(MAKE)
9292
INSTALL_COMMAND $(MAKE) install
9393
BUILD_IN_SOURCE 1
@@ -171,11 +171,12 @@ target_link_libraries(wfmash
171171
Threads::Threads
172172
)
173173

174+
# This is to disable tests defined in CTestCustom.cmake:
174175
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR})
175176

176177
add_test(
177178
NAME wfmash-test
178-
COMMAND ./build/bin/wfmash data/LPA.subset.fa.gz -p 80 -n 5 -t 8
179+
COMMAND wfmash data/LPA.subset.fa.gz -p 80 -n 5 -t 8
179180
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
180181

181182
install(TARGETS wfmash DESTINATION bin)

CTestCustom.cmake

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
CTestCustom.cmake
2-
3-
1+
# Disable tests for the following modules:
2+
set(CTEST_CUSTOM_TESTS_IGNORE
3+
wfa2lib
4+
)

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,10 @@ This will install the `wfmash` binary and any required libraries to the default
208208

209209
#### Tests
210210

211-
To build and run tests:
211+
To build and run tests, change to build directory and
212212

213213
```sh
214-
cmake --build build --target test
214+
ctest .
215215
```
216216

217217
#### Notes for distribution
@@ -262,6 +262,8 @@ If you have `guix`:
262262
guix build -f guix.scm
263263
```
264264

265+
To build guix in a development container, see the instructions in the header of [guix.scm](./guix.scm).
266+
265267
#### Docker and Singularity images with nix
266268

267269
Nix is also able to build an Docker image, which can then be loaded by Docker and converted to a Singularity image.

guix-static.scm

+42-20
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,28 @@
1010
;;
1111
;; mkdir build
1212
;; cd build
13-
;; cmake ..
13+
;; cmake -DBUILD_STATIC=1 ..
1414
;; make
1515
;;
1616
;; For the tests you may need /usr/bin/env. Inside the container:
1717
;;
1818
;; mkdir -p /usr/bin ; ln -s $GUIX_ENVIRONMENT/bin/env /usr/bin/env
1919
;;
20-
;; by Pjotr Prins (c) 2023
20+
;; by Pjotr Prins (c) 2023-2024
2121

2222
(use-modules
2323
((guix licenses) #:prefix license:)
24+
(guix build-system cmake)
25+
(guix download)
2426
(guix gexp)
25-
(guix packages)
2627
(guix git-download)
27-
(guix build-system cmake)
28-
; (guix gexp)
28+
(guix packages)
2929
(guix utils)
3030
(gnu packages algebra)
3131
(gnu packages base)
3232
(gnu packages bioinformatics)
3333
(gnu packages build-tools)
3434
(gnu packages compression)
35-
; (gnu packages curl)
3635
(gnu packages gcc)
3736
(gnu packages jemalloc)
3837
(gnu packages llvm)
@@ -45,12 +44,31 @@
4544
(ice-9 popen)
4645
(ice-9 rdelim))
4746

47+
(define-public libdeflate-static
48+
(package
49+
(inherit libdeflate)
50+
(name "libdeflate-static")
51+
(version "1.19")
52+
(arguments
53+
(list #:configure-flags
54+
#~(list "-DLIBDEFLATE_BUILD_STATIC_LIB=YES"
55+
"-DLIBDEFLATE_BUILD_TESTS=YES")))))
56+
4857
;; A minimal version of htslib that does not depend on curl and openssl. This
4958
;; reduces the number of higher order dependencies in static linking.
5059
(define-public htslib-static
5160
(package
5261
(inherit htslib)
5362
(name "htslib-static")
63+
(version "1.19")
64+
(source (origin
65+
(method url-fetch)
66+
(uri (string-append
67+
"https://github.com/samtools/htslib/releases/download/"
68+
version "/htslib-" version ".tar.bz2"))
69+
(sha256
70+
(base32
71+
"0dh79lwpspwwfbkmllrrhbk8nkvlfc5b5ib4d0xg5ld79w6c8lc7"))))
5472
(arguments
5573
(substitute-keyword-arguments (package-arguments htslib)
5674
((#:configure-flags flags ''())
@@ -66,32 +84,36 @@
6684
(define-public wfmash-git
6785
(package
6886
(name "wfmash-git")
69-
(version (git-version "0.10.7" "HEAD" %git-commit))
87+
(version (git-version "0.21" "HEAD" %git-commit))
7088
(source (local-file %source-dir #:recursive? #t))
7189
(build-system cmake-build-system)
90+
(arguments
91+
`(#:configure-flags
92+
,#~(list "-DBUILD_STATIC=1" "-DCMAKE_INSTALL_RPATH=") ; force cmake static build and do not rewrite RPATH
93+
#:tests? #f)) ; disable tests until I fix finding the binary wfmash
7294
(inputs
7395
`(
74-
;; ("clang" ,clang) ; add this to test clang builds
75-
;; ("lld" ,lld) ; add this to test clang builds
96+
("bzip2-static" ,bzip2 "static") ; libz2 part of htslib for static builds
97+
("coreutils" ,coreutils) ; for echo and env in tests
7698
("gcc" ,gcc-12)
77-
("gsl-static" ,gsl-static)
99+
("git" ,git)
78100
("gmp" ,gmp)
101+
("gsl-static" ,gsl "static")
102+
("gsl" ,gsl)
103+
("htslib-static" ,htslib-static)
104+
("jemalloc" ,jemalloc)
105+
("libdeflate-static" ,libdeflate-static)
79106
("make" ,gnu-make)
80107
("pkg-config" ,pkg-config)
81-
("jemalloc" ,jemalloc)
82-
("htslib" ,htslib-static)
83-
("git" ,git)
84-
; ("bc" ,bc) ; for tests
85-
("coreutils" ,coreutils) ; for echo and env in tests
86-
; ("curl" ,curl)
87-
; ("parallel" ,parallel) ; for wfmash-parallel
88-
("bzip2-static" ,bzip2 "static") ; libz2 part of htslib for static builds
89108
("xz-static" ,xz "static") ; for static builds
90109
("zlib-static" ,zlib "static")))
91110
(synopsis "wfmash")
92111
(description
93-
"wfmash.")
112+
"wfmash is an aligner for pangenomes that combines efficient homology
113+
mapping with base-level alignment. It uses MashMap to find approximate
114+
mappings between sequences, then applies WFA (Wave Front Alignment) to
115+
obtain base-level alignments.")
94116
(home-page "https://github.com/waveygang/wfmash")
95117
(license license:expat)))
96118

97-
wfmash-git
119+
wfmash-git

guix.scm

+17-20
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
;; mkdir build
1313
;; cd build
1414
;; cmake ..
15-
;; make
15+
;; make -j 12
1616
;;
1717
;; For the tests you may need /usr/bin/env. Inside the container:
1818
;;
@@ -22,18 +22,16 @@
2222

2323
(use-modules
2424
((guix licenses) #:prefix license:)
25+
(guix build-system cmake)
2526
(guix gexp)
26-
(guix packages)
2727
(guix git-download)
28-
(guix build-system cmake)
29-
; (guix gexp)
28+
(guix packages)
3029
(guix utils)
3130
(gnu packages algebra)
3231
(gnu packages base)
3332
(gnu packages bioinformatics)
3433
(gnu packages build-tools)
3534
(gnu packages compression)
36-
; (gnu packages curl)
3735
(gnu packages gcc)
3836
(gnu packages jemalloc)
3937
(gnu packages llvm)
@@ -54,32 +52,31 @@
5452
(define-public wfmash-git
5553
(package
5654
(name "wfmash-git")
57-
(version (git-version "0.10.7" "HEAD" %git-commit))
55+
(version (git-version "0.21" "HEAD" %git-commit))
5856
(source (local-file %source-dir #:recursive? #t))
5957
(build-system cmake-build-system)
58+
(arguments
59+
`(#:tests? #f)) ; disable tests until I fix finding the binary wfmash
6060
(inputs
6161
`(
62-
;; ("clang" ,clang) ; add this to test clang builds
63-
;; ("lld" ,lld) ; add this to test clang builds
62+
("bzip2" ,bzip2)
63+
("coreutils" ,coreutils) ; for echo and env in tests
6464
("gcc" ,gcc-12)
65-
("gsl" ,gsl)
65+
("git" ,git)
6666
("gmp" ,gmp)
67+
("gsl" ,gsl)
68+
("htslib" ,htslib)
69+
("libdeflate" ,libdeflate)
6770
("make" ,gnu-make)
6871
("pkg-config" ,pkg-config)
69-
("jemalloc" ,jemalloc)
70-
("htslib" ,htslib)
71-
("git" ,git)
72-
; ("bc" ,bc) ; for tests
73-
("coreutils" ,coreutils) ; for echo and env in tests
74-
; ("curl" ,curl)
75-
; ("parallel" ,parallel) ; for wfmash-parallel
76-
("bzip2" ,bzip2)
7772
("xz" ,xz)
78-
("zlib" ,zlib)
79-
("libdeflate" ,libdeflate)))
73+
("zlib" ,zlib)))
8074
(synopsis "wfmash")
8175
(description
82-
"wfmash.")
76+
"wfmash is an aligner for pangenomes that combines efficient homology
77+
mapping with base-level alignment. It uses MashMap to find approximate
78+
mappings between sequences, then applies WFA (Wave Front Alignment) to
79+
obtain base-level alignments.")
8380
(home-page "https://github.com/waveygang/wfmash")
8481
(license license:expat)))
8582

0 commit comments

Comments
 (0)