Subject: [bug#61148] [PATCH 2/5] gnu: tabixpp: Update to 1.1.2.

From: Efraim Flashner <[email-masked]>
Date: Sun, 29 Jan 2023 15:12:35 +0200

* gnu/packages/bioinformatics.scm (tabixpp): Update to 1.1.2.
[source]: Add snippet to keep library name the same.
[arguments]: Adjust the make-flags to find htslib. Enable the tests.
Remove custom 'build-libraries phase, it is built by default now. Add a
phase to symlink the shared library to a generic .so name. Don't
override the 'install phase. Add a phase after 'install to create a
pkg-config file.
---
 gnu/packages/bioinformatics.scm | 60 ++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 5cea726f8e..fa0a6c0dd6 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -4,7 +4,7 @@
 ;;; Copyright © 2015, 2016, 2018, 2019, 2020 Pjotr Prins <[email-masked]>
 ;;; Copyright © 2015 Andreas Enge <[email-masked]>
 ;;; Copyright © 2016, 2020, 2021 Roel Janssen <[email-masked]>
-;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021, 2022 Efraim Flashner <[email-masked]>
+;;; Copyright © 2016-2023 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2016, 2020, 2022 Marius Bakke <[email-masked]>
 ;;; Copyright © 2016, 2018 Raoul Bonnal <[email-masked]>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <[email-masked]>
@@ -15640,7 +15640,7 @@ (define-public tbsp
 (define-public tabixpp
   (package
    (name "tabixpp")
-   (version "1.1.0")
+   (version "1.1.2")
    (source (origin
              (method git-fetch)
              (uri (git-reference
@@ -15648,43 +15648,47 @@ (define-public tabixpp
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
-              (base32 "1k2a3vbq96ic4lw72iwp5s3mwwc4xhdffjj584yn6l9637q9j1yd"))
+              (base32 "00aqs147yn8zcvxims5njwxqsbnlbjv7lnmiwqy80bfdcbhljkqf"))
              (modules '((guix build utils)))
              (snippet
               #~(begin
-                  (delete-file-recursively "htslib")))))
+                  (delete-file-recursively "htslib")
+                  ;; Keep it named tabixpp.
+                  (substitute* "Makefile"
+                    (("libtabix") "libtabixpp"))))))
    (build-system gnu-build-system)
-   (inputs
-    (list bzip2 htslib xz zlib))
    (arguments
     (list #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
                                (string-append "CXX=" #$(cxx-for-target))
+                               (string-append "AR=" #$(ar-for-target))
                                "HTS_HEADERS="
-                               (string-append "HTS_LIB="
-                                              (search-input-file %build-inputs
-                                                                 "/lib/libhts.a"))
-                               "INCLUDES=")
-          #:tests? #f ; There are no tests to run.
+                               "HTS_LIB="
+                               (string-append
+                                 "INCLUDES= -I"
+                                 (search-input-directory %build-inputs
+                                                         "include/htslib"))
+                               (string-append
+                                 "LIBPATH= -L. -L"
+                                 (dirname
+                                   (search-input-file %build-inputs
+                                                      "/lib/libhts.a")))
+                               (string-append "PREFIX=" #$output)
+                               "DESTDIR=")
+          #:test-target "test"
           #:phases
           #~(modify-phases %standard-phases
               (delete 'configure) ; There is no configure phase.
-              ;; Build shared and static libraries.
-              (add-after 'build 'build-libraries
-                (lambda* (#:key inputs #:allow-other-keys)
-                  (invoke #$(cxx-for-target)
-                          "-shared" "-o" "libtabixpp.so" "tabix.o" "-lhts")
-                  (invoke #$(ar-for-target) "rcs" "libtabixpp.a" "tabix.o")))
-              (replace 'install
+              (add-after 'install 'symlink-shared-library
+                (lambda* (#:key outputs #:allow-other-keys)
+                  (with-directory-excursion
+                    (string-append (assoc-ref outputs "out") "/lib")
+                    (symlink "libtabixpp.so.1" "libtabixpp.so"))))
+              (add-after 'install 'make-pkg-config-file
                 (lambda* (#:key outputs #:allow-other-keys)
                   (let* ((out (assoc-ref outputs "out"))
-                         (lib (string-append out "/lib"))
-                         (bin (string-append out "/bin")))
-                    (install-file "tabix++" bin)
-                    (install-file "libtabixpp.so" lib)
-                    (install-file "libtabixpp.a" lib)
-                    (install-file "tabix.hpp" (string-append out "/include"))
-                    (mkdir-p (string-append lib "/pkgconfig"))
-                    (with-output-to-file (string-append lib "/pkgconfig/tabixpp.pc")
+                         (pkgconfig (string-append out "/lib/pkgconfig")))
+                    (mkdir-p pkgconfig)
+                    (with-output-to-file (string-append pkgconfig "/tabixpp.pc")
                       (lambda _
                         (format #t "prefix=~a~@
                           exec_prefix=${prefix}~@
@@ -15692,12 +15696,14 @@ (define-public tabixpp
                           includedir=${prefix}/include~@
                           ~@
                           ~@
-                          Name: libtabixpp~@
+                          Name: tabixpp~@
                           Version: ~a~@
                           Description: C++ wrapper around tabix project~@
                           Libs: -L${libdir} -ltabixpp~@
                           Cflags: -I${includedir}~%"
                                 out #$version)))))))))
+   (inputs
+    (list bzip2 curl htslib xz zlib))
    (home-page "https://github.com/ekg/tabixpp")
    (synopsis "C++ wrapper around tabix project")
    (description "This is a C++ wrapper around the Tabix project which abstracts
-- 
Efraim Flashner   <[email-masked]>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted