aboutsummaryrefslogtreecommitdiff
path: root/gn/packages/riscv.scm
blob: 2e6da2cf093c9d326acd341ba52f900a4cc895ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
;;;
;;; Commentary:
;;;
;;; This module is a temporary staging ground for Guix packages ported
;;; to RISC-V. They should be contributed upstream at the earliest.
;;;

;;;
;;; Code:
;;;

(define-module (gn packages riscv)
  #:use-module (gnu packages autotools)
  #:use-module ((gnu packages bioinformatics) #:prefix guix:)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages jemalloc)
  #:use-module ((gnu packages maths) #:prefix guix:)
  #:use-module (guix build-system cmake)
  #:use-module (guix build-system gnu)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils))

(define-public htslib
  (package
    (inherit guix:htslib)
    (name "htslib")
    (inputs
     `(("bzip2" ,bzip2)
       ("xz" ,xz)
       ,@(package-inputs guix:htslib)))))

(define-public gsl
  (package
    (inherit guix:gsl)
    (name "gsl")
    (arguments
     (substitute-keyword-arguments (package-arguments guix:gsl)
       ((#:configure-flags _) `(list))
       ((#:phases phases '%standard-phases)
        `(modify-phases ,phases
           (add-after 'unpack 'force-bootstrap
             (lambda _
               (delete-file "configure")))))))
    (native-inputs
     `(("autoconf" ,autoconf)
       ("automake" ,automake)
       ("libtool" ,libtool)))))

(define-public atomic-queue
  (package
    (name "atomic-queue")
    (version "1.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/max0x7ba/atomic_queue")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0ssff73wlvrsk2nma99dmvm0ijyzfr54jk37kxgpb694r7ajc90l"))))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (delete 'build)
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (copy-recursively "include/atomic_queue"
                               (string-append (assoc-ref outputs "out")
                                              "/include/atomic_queue")))))))
    (home-page "https://github.com/max0x7ba/atomic_queue")
    (synopsis "C++ lockless queue")
    (description "@code{atomic-queue} provides C++14
multiple-producer-multiple-consumer lockless queues based on a circular buffer
with std::atomic.  The maximum queue size must be set at compile time. And,
there are no OS-blocking push/pop functions, thus making it suitable for
ultra-low latency applications.")
    (license license:expat)))

(define-public wfmash
  (let ((version "0.7.0")
        (commit "50a68f0d8c372e720d73e7fc9d90a0d0a4e54ef8")
        (package-revision "25"))
    (package
      (name "wfmash")
      (version (string-append version "+" (string-take commit 7) "-" package-revision))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/ekg/wfmash.git")
                      (commit commit)
                      (recursive? #f)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "1xf742sxn7xvrcmn67zk9rv8zxl9nb9f72hbw8khdlz1qj3n00vp"))
                (modules '((guix build utils)))
                (snippet '(begin
                            (delete-file-recursively "src/common/atomic_queue")
                            (substitute* "src/align/include/computeAlignments.hpp"
                              (("\"common/atomic_queue/atomic_queue.h\"")
                               "<atomic_queue/atomic_queue.h>"))))))
      (build-system cmake-build-system)
      (arguments
       `(#:configure-flags '("-DBUILD_SHARED_LIBS=OFF")
         #:phases
         (modify-phases
             %standard-phases
           (add-after 'unpack 'remove-x86-specific-compile-flags
             (lambda _
               (substitute* (list "CMakeLists.txt"
                                  "src/common/wflign/CMakeLists.txt"
                                  "src/common/wflign/deps/WFAv2/CMakeLists.txt"
                                  "src/common/wflign/deps/wflambdav2/CMakeLists.txt")
                 (("-mcx16") ""))
               (substitute* (list "CMakeLists.txt"
                                  "src/common/wflign/CMakeLists.txt"
                                  "src/common/wflign/deps/WFAv2/CMakeLists.txt"
                                  "src/common/wflign/deps/wflambdav2/CMakeLists.txt")
                 (("-march=native") ""))
               (substitute* "src/common/dset64.hpp"
                 (("#error \"wfmash can only be built on an x86_64 machine \\(64-bit Intel/AMD\\)\"")
                  ""))))
           ;; This stashes our build version in the executable
           (add-after 'unpack 'set-version
             (lambda _
               (mkdir "include")
               (with-output-to-file "include/wfmash_git_version.hpp"
                 (lambda ()
                   (format #t "#define WFMASH_GIT_VERSION \"~a\"~%" version)))
               #t))
           (delete 'check))
         #:make-flags (list (string-append "CC=" ,(cc-for-target))
                            (string-append "CXX=" ,(cxx-for-target)))))
      (inputs (list atomic-queue
                    gsl
                    htslib
                    jemalloc
                    zlib))
      (synopsis "base-accurate DNA sequence alignments using WFA and mashmap2")
      (description "wfmash is a fork of MashMap that implements
base-level alignment using the wavefront alignment algorithm WFA. It
completes an alignment module in MashMap and extends it to enable
multithreaded operation. A single command-line interface simplfies
usage. The PAF output format is harmonized and made equivalent to that
in minimap2, and has been validated as input to seqwish.")
      (home-page "https://github.com/ekg/wfmash")
      (license license:expat))))