Subject: [bug#49597] [PATCH core-updates 11/15] gnu: Use 'search-input-file' when looking for *.so and *.a.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 16 Jul 2021 17:54:16 +0200

* gnu/packages/bioinformatics.scm (sailfish)[arguments]: Use
'search-input-file' when looking for *.a and *.so.
* gnu/packages/emulators.scm (dolphin-emu): Likewise.
* gnu/packages/engineering.scm (lepton-eda): Likewise.
(pcb): Likewise.
* gnu/packages/golang.scm (go-1.4): Likewise.
(go-1.14): Likewise.
* gnu/packages/haskell.scm (ghc-7): Likewise.
* gnu/packages/irods.scm (irods): Likewise.
* gnu/packages/language.scm (python2-tegaki-pygtk): Likewise.
* gnu/packages/lisp-xyz.scm (sbcl-lzlib): Likewise.
(sbcl-cl-gobject-introspection): Likewise.
(sbcl-cl-ana): Likewise.
(sbcl-cl-libuv): Likewise.
(sbcl-cl-async): Likewise.
(sbcl-mcclim): Likewise.
(sbcl-zstd): Likewise.
(sbcl-cl-opengl): Likewise.
(sbcl-lev): Likewise.
(sbcl-cl-glfw3): Likewise.
* gnu/packages/machine-learning.scm (tensorflow): Likewise.
* gnu/packages/messaging.scm (utox): Likewise.
* gnu/packages/mpi.scm (java-openmpi): Likewise.
* gnu/packages/music.scm (jack-select): Likewise.
* gnu/packages/pascal.scm (fpc): Likewise.
* gnu/packages/python-crypto.scm (python-libnacl): Likewise.
* gnu/packages/python-xyz.scm (python-cairocffi): Likewise.
(python-pyev): Likewise.
(python-pytidylib): Likewise.
* gnu/packages/radio.scm (unixcw): Likewise.
* gnu/packages/rust.scm (rust-1.32): Likewise.
* gnu/packages/security-token.scm (opensc): Likewise.
(python-pyscard): Likewise.
* gnu/packages/selinux.scm (python-setools): Likewise.
* gnu/packages/spice.scm (libcacard): Likewise.
* gnu/packages/telephony.scm (libtgvoip): Likewise.
---
 gnu/packages/bioinformatics.scm   | 12 ++++----
 gnu/packages/emulators.scm        |  3 +-
 gnu/packages/engineering.scm      | 12 ++++----
 gnu/packages/golang.scm           |  4 +--
 gnu/packages/haskell.scm          |  7 ++---
 gnu/packages/irods.scm            |  2 +-
 gnu/packages/language.scm         |  7 +++--
 gnu/packages/lisp-xyz.scm         | 50 +++++++++++--------------------
 gnu/packages/machine-learning.scm | 15 ++++------
 gnu/packages/messaging.scm        |  3 +-
 gnu/packages/mpi.scm              |  3 +-
 gnu/packages/music.scm            |  4 +--
 gnu/packages/pascal.scm           |  6 ++--
 gnu/packages/python-crypto.scm    |  4 +--
 gnu/packages/python-xyz.scm       | 22 +++++---------
 gnu/packages/radio.scm            |  3 +-
 gnu/packages/rust.scm             |  4 +--
 gnu/packages/security-token.scm   |  8 ++---
 gnu/packages/selinux.scm          |  3 +-
 gnu/packages/spice.scm            |  4 +--
 gnu/packages/telephony.scm        |  7 ++---
 21 files changed, 70 insertions(+), 113 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 6adc6a0276..d89e459fa3 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -9481,14 +9481,14 @@ dependency like SeqAn.")
                  inputs
                  (string-append "/include/jellyfish-" ,(package-version jellyfish))))
                (("\\$\\{GAT_SOURCE_DIR\\}/external/install/lib/libjellyfish-2.0.a")
-                (string-append (assoc-ref inputs "jellyfish")
-                               "/lib/libjellyfish-2.0.a"))
+                (search-input-file inputs
+                                   "/lib/libjellyfish-2.0.a"))
                (("\\$\\{GAT_SOURCE_DIR\\}/external/install/lib/libdivsufsort.a")
-                (string-append (assoc-ref inputs "libdivsufsort")
-                               "/lib/libdivsufsort.so"))
+                (search-input-file inputs
+                                   "/lib/libdivsufsort.so"))
                (("\\$\\{GAT_SOURCE_DIR\\}/external/install/lib/libdivsufsort64.a")
-                (string-append (assoc-ref inputs "libdivsufsort")
-                               "/lib/libdivsufsort64.so")))
+                (search-input-file inputs
+                                   "/lib/libdivsufsort64.so")))
              (substitute* "CMakeLists.txt"
                ;; Don't prefer static libs
                (("SET\\(CMAKE_FIND_LIBRARY_SUFFIXES.*") "")
diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index e458d24cab..1e28e50155 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -219,8 +219,7 @@ SuperCPU.")
                       (string-append (assoc-ref inputs "font-wqy-microhei")
                                      "/share/fonts/truetype/wqy-microhei.ttc"))
                      (libvulkan
-                      (string-append (assoc-ref inputs "vulkan-loader")
-                                     "/lib/libvulkan.so")))
+                      (search-input-file inputs "/lib/libvulkan.so")))
                  (chdir "docs")
                  (invoke "bash" "-c" "g++ -O2 $(freetype-config \
 --cflags --libs) gc-font-tool.cpp -o gc-font-tool")
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index c02d07fba1..12087a9e83 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -335,12 +335,10 @@ utilities.")
              (substitute* '("libleptongui/scheme/schematic/ffi/gtk.scm.in"
                             "utils/attrib/lepton-attrib.scm")
                (("@LIBGTK@")
-                (string-append (assoc-ref inputs "gtk")
-                               "/lib/libgtk-3.so")))
+                (search-input-file inputs "/lib/libgtk-3.so")))
              (substitute* '("libleptongui/scheme/schematic/ffi/gobject.scm.in")
                (("@LIBGOBJECT@")
-                (string-append (assoc-ref inputs "glib")
-                               "/lib/libgobject-2.0.so")))
+                (search-input-file inputs "/lib/libgobject-2.0.so")))
              (substitute* "liblepton/scheme/lepton/ffi.scm.in"
                (("@LIBLEPTON@")
                 (string-append (assoc-ref outputs "out")
@@ -351,8 +349,7 @@ utilities.")
                                "/lib/libleptonattrib.so")))
              (substitute* "liblepton/scheme/lepton/log.scm.in"
                (("@LIBGLIB@")
-                (string-append (assoc-ref inputs "glib")
-                               "/lib/libglib-2.0.so")))
+                (search-input-file inputs "/lib/libglib-2.0.so")))
 
              ;; For finding libraries when running tests before installation.
              (setenv "LIBLEPTONGUI"
@@ -437,7 +434,8 @@ features.")))
              ;; fix of the mesa package we wrap the pcb executable such that
              ;; Mesa can find libudev.so.0 through LD_LIBRARY_PATH.
              (let* ((out (assoc-ref outputs "out"))
-                    (path (string-append (assoc-ref inputs "udev") "/lib")))
+                    (path (dirname
+                           (search-input-file inputs "/lib/libudev.so"))))
                (wrap-program (string-append out "/bin/pcb")
                  `("LD_LIBRARY_PATH" ":" prefix (,path))))
              #t))
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 05b135b933..444fb7813f 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -113,7 +113,7 @@
          (add-before 'build 'prebuild
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))
-                    (ld (string-append (assoc-ref inputs "libc") "/lib"))
+                    (ld (dirname (search-input-file inputs "/lib/libc.so")))
                     (loader (car (find-files ld "^ld-linux.+")))
                     (net-base (assoc-ref inputs "net-base"))
                     (tzdata-path
@@ -261,7 +261,7 @@ in the style of communicating sequential processes (@dfn{CSP}).")
            (replace 'prebuild
              (lambda* (#:key inputs outputs #:allow-other-keys)
                (let* ((gcclib (string-append (assoc-ref inputs "gcc:lib") "/lib"))
-                      (ld (string-append (assoc-ref inputs "libc") "/lib"))
+                      (ld (dirname (search-input-file inputs "/lib/libc.so")))
                       (loader (car (find-files ld "^ld-linux.+")))
                       (net-base (assoc-ref inputs "net-base"))
                       (tzdata-path
diff --git a/gnu/packages/haskell.scm b/gnu/packages/haskell.scm
index 09732fc594..0ddaad9d52 100644
--- a/gnu/packages/haskell.scm
+++ b/gnu/packages/haskell.scm
@@ -3,7 +3,7 @@
 ;;; Copyright © 2015 Siniša Biđin <[email-masked]>
 ;;; Copyright © 2015 Paul van der Walt <[email-masked]>
 ;;; Copyright © 2015, 2019 Eric Bavier <[email-masked]>
-;;; Copyright © 2016, 2018, 2019 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2016, 2018, 2019, 2021 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2016, 2017 Nikita <[email-masked]>
 ;;; Copyright © 2016 Efraim Flashner <[email-masked]>
 ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus <[email-masked]>
@@ -246,9 +246,8 @@ top of CLISP.")
                      (gmp-lib (string-append gmp "/lib"))
                      (gmp-include (string-append gmp "/include"))
                      (ncurses-lib
-                      (string-append (assoc-ref inputs "ncurses") "/lib"))
-                     (ld-so (string-append (assoc-ref inputs "libc")
-                                           ,(glibc-dynamic-linker)))
+                      (dirname (search-input-file inputs "/lib/libncurses.so")))
+                     (ld-so (search-input-file inputs ,(glibc-dynamic-linker)))
                      (libtinfo-dir
                       (string-append ghc-bootstrap-prefix
                                      "/lib/ghc-7.8.4/terminfo-0.4.0.0")))
diff --git a/gnu/packages/irods.scm b/gnu/packages/irods.scm
index e82888e7ae..e9ac0d5297 100644
--- a/gnu/packages/irods.scm
+++ b/gnu/packages/irods.scm
@@ -120,7 +120,7 @@
                (("'usr', 'lib', 'irods'") "'lib', 'irods'"))
              (substitute* "scripts/irods/pypyodbc.py"
                (("\"/usr/lib/libodbc.so\"")
-                (string-append (assoc-ref inputs "unixodbc") "/lib/libodbc.so")))))
+                (search-input-file inputs "/lib/libodbc.so")))))
          (add-after 'set-paths 'adjust-CPLUS_INCLUDE_PATH
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((gcc (assoc-ref inputs  "gcc")))
diff --git a/gnu/packages/language.scm b/gnu/packages/language.scm
index 199a0368a9..108aa242f3 100644
--- a/gnu/packages/language.scm
+++ b/gnu/packages/language.scm
@@ -973,10 +973,11 @@ suitable for both the desktop and mobile devices.")
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "tegakigtk/fakekey.py"
                  (("libX11.so.6" so)
-                  (string-append (assoc-ref inputs "libx11") "/lib/" so))
+                  (search-input-file inputs
+                                     (string-append "/lib/" so)))
                  (("libXtst.so.6" so)
-                  (string-append (assoc-ref inputs "libxtst") "/lib/" so)))
-               #t))))))
+                  (search-input-file inputs
+                                     (string-append "/lib/" so))))))))))
     (inputs ; required for sending key strokes
      `(("libx11" ,libx11)
        ("libxtst" ,libxtst)))
diff --git a/gnu/packages/lisp-xyz.scm b/gnu/packages/lisp-xyz.scm
index f2fe9c93d1..dc4f213751 100644
--- a/gnu/packages/lisp-xyz.scm
+++ b/gnu/packages/lisp-xyz.scm
@@ -7202,7 +7202,7 @@ cl-plumbing libraries.")
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "src/lzlib.lisp"
                  (("liblz\\.so")
-                  (string-append (assoc-ref inputs "lzlib") "/lib/liblz.so")))
+                  (search-input-file inputs "/lib/liblz.so")))
                #t)))))
       (synopsis "Common Lisp library for lzip (de)compression")
       (description
@@ -7357,11 +7357,10 @@ function.")
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "src/init.lisp"
                  (("libgobject-2\\.0\\.so")
-                  (string-append (assoc-ref inputs "glib") "/lib/libgobject-2.0.so"))
+                  (search-input-file inputs "/lib/libgobject-2.0.so"))
                  (("libgirepository-1\\.0\\.so")
-                  (string-append (assoc-ref inputs "gobject-introspection")
-                                 "/lib/libgirepository-1.0.so")))
-               #t)))))
+                  (search-input-file inputs
+                                     "/lib/libgirepository-1.0.so"))))))))
       (synopsis "Common Lisp bindings to GObject Introspection")
       (description
        "This library is a bridge between Common Lisp and GObject
@@ -8519,8 +8518,7 @@ sacrificing much in the way of power.")
             (lambda* (#:key inputs #:allow-other-keys)
               (substitute* "hdf-cffi/hdf-cffi.lisp"
                 (("/usr/lib/i386-linux-gnu/hdf5/serial/libhdf5.so")
-                 (string-append (assoc-ref inputs "hdf5")
-                                "/lib/libhdf5.so")))
+                 (search-input-file inputs "/lib/libhdf5.so")))
               (substitute* "gsl-cffi/gsl-cffi.lisp"
                 (("define-foreign-library gsl-cffi" all)
                  (string-append all " (:unix "
@@ -8850,9 +8848,7 @@ has a small codebase that's easy to understand and use.")
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "lib.lisp"
                  (("/usr/lib/libuv.so")
-                  (string-append (assoc-ref inputs "libuv")
-                                 "/lib/libuv.so")))
-               #t))
+                  (search-input-file inputs "/lib/libuv.so")))))
            (add-after 'fix-paths 'fix-system-definition
              (lambda _
                (substitute* "cl-libuv.asd"
@@ -8910,12 +8906,9 @@ has a small codebase that's easy to understand and use.")
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "src/ssl/package.lisp"
                  (("libcrypto\\.so")
-                  (string-append (assoc-ref inputs "openssl")
-                                 "/lib/libcrypto.so"))
+                  (search-input-file inputs "/lib/libcrypto.so"))
                  (("libssl\\.so")
-                  (string-append (assoc-ref inputs "openssl")
-                                 "/lib/libssl.so")))
-               #t)))))
+                  (search-input-file inputs "/lib/libssl.so"))))))))
       (synopsis "Asynchronous operations for Common Lisp")
       (description
        "Cl-async is a library for general purpose, non-blocking programming in
@@ -12144,13 +12137,10 @@ and saving 2-dimensional pixel-based images.")
                                  "/share/fonts/truetype/")))
                (substitute* "Extensions/fontconfig/src/functions.lisp"
                  (("libfontconfig\\.so")
-                  (string-append (assoc-ref inputs "fontconfig")
-                                 "/lib/libfontconfig.so")))
+                  (search-input-file inputs "/lib/libfontconfig.so")))
                (substitute* "Extensions/harfbuzz/src/functions.lisp"
                  (("libharfbuzz\\.so")
-                  (string-append (assoc-ref inputs "harfbuzz")
-                                 "/lib/libharfbuzz.so")))
-               #t))
+                  (search-input-file inputs "/lib/libharfbuzz.so")))))
            (add-after 'unpack 'fix-build
              (lambda _
                ;; The cffi-grovel system does not get loaded automatically,
@@ -14259,9 +14249,7 @@ library are feedforward neural networks trained using backpropagation.")
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "src/libzstd.lisp"
                  (("libzstd\\.so")
-                  (string-append (assoc-ref inputs "zstd-lib")
-                                 "/lib/libzstd.so")))
-               #t)))))
+                  (search-input-file inputs "/lib/libzstd.so"))))))))
       (synopsis "Common Lisp library for Zstandard (de)compression")
       (description
        "This Common Lisp library provides functions for Zstandard
@@ -15827,14 +15815,13 @@ compiled foreign library collection.")
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "gl/library.lisp"
                  (("libGL.so" all)
-                  (string-append (assoc-ref inputs "mesa") "/lib/" all)))
+                  (search-input-file inputs "/lib/libGL.so")))
                (substitute* "glu/library.lisp"
                  (("libGLU.so" all)
-                  (string-append (assoc-ref inputs "glu") "/lib/" all)))
+                  (search-input-file inputs "/lib/libGLU.so")))
                (substitute* "glut/library.lisp"
                  (("libglut.so" all)
-                  (string-append (assoc-ref inputs "freeglut") "/lib/" all)))
-               #t)))))
+                  (search-input-file inputs "/lib/libglut.so"))))))))
       (inputs
        `(("alexandria" ,sbcl-alexandria)
          ("cffi" ,sbcl-cffi)
@@ -16732,9 +16719,8 @@ Common Lisp.")
            (add-after 'unpack 'patch-libev-lib-path
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "src/lev.lisp"
-                 (("libev.so" all)
-                  (string-append (assoc-ref inputs "libev")
-                                        "/lib/" all))))))))
+                 (("libev.so" _)
+                  (search-input-file inputs "/lib/libev.so"))))))))
       (inputs
        `(("cffi" ,sbcl-cffi)
          ("libev" ,libev)))
@@ -17309,8 +17295,8 @@ and even allows the generic visualisation of graphs in this format.")
            (add-after 'unpack 'patch-glfw-lib-path
              (lambda* (#:key inputs #:allow-other-keys)
                (substitute* "glfw-bindings.lisp"
-                 (("libglfw.so.3" all)
-                  (string-append (assoc-ref inputs "glfw") "/lib/" all))))))))
+                 (("libglfw.so.3" _)
+                  (search-input-file inputs "/lib/libglfw.so.3"))))))))
       (inputs
        `(("alexandria" ,sbcl-alexandria)
          ("cffi" ,sbcl-cffi)
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 3f257df832..7d4c637157 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1563,36 +1563,31 @@ Python.")
                  ;; Sqlite
                  (("include\\(sqlite\\)") "")
                  (("\\$\\{sqlite_STATIC_LIBRARIES\\}")
-                  (string-append (assoc-ref inputs "sqlite")
-                                 "/lib/libsqlite3.so"))
+                  (search-input-file inputs "/lib/libsqlite3.so"))
                  (("sqlite_copy_headers_to_destination") "")
 
                  ;; PNG
                  (("include\\(png\\)") "")
                  (("\\$\\{png_STATIC_LIBRARIES\\}")
-                  (string-append (assoc-ref inputs "libpng")
-                                 "/lib/libpng16.so"))
+                  (search-input-file inputs "/lib/libpng16.so"))
                  (("png_copy_headers_to_destination") "")
 
                  ;; JPEG
                  (("include\\(jpeg\\)") "")
                  (("\\$\\{jpeg_STATIC_LIBRARIES\\}")
-                  (string-append (assoc-ref inputs "libjpeg")
-                                 "/lib/libjpeg.so"))
+                  (search-input-file inputs "/lib/libjpeg.so"))
                  (("jpeg_copy_headers_to_destination") "")
 
                  ;; GIF
                  (("include\\(gif\\)") "")
                  (("\\$\\{gif_STATIC_LIBRARIES\\}")
-                  (string-append (assoc-ref inputs "giflib")
-                                 "/lib/libgif.so"))
+                  (search-input-file inputs "/lib/libgif.so"))
                  (("gif_copy_headers_to_destination") "")
 
                  ;; lmdb
                  (("include\\(lmdb\\)") "")
                  (("\\$\\{lmdb_STATIC_LIBRARIES\\}")
-                  (string-append (assoc-ref inputs "lmdb")
-                                 "/lib/liblmdb.so"))
+                  (search-input-file inputs "/lib/liblmdb.so"))
                  (("lmdb_copy_headers_to_destination") "")
 
                  ;; Protobuf
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index 9fd0e70afe..19b4b5be63 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -1540,8 +1540,7 @@ messenger protocol.")
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (substitute* "../source/src/xlib/gtk.c"
                          (("libgtk-3.so")
-                         (string-append (assoc-ref inputs "gtk+")
-                                        "/lib/libgtk-3.so")))))
+                          (search-input-file inputs "/lib/libgtk-3.so")))))
         (add-after 'install 'wrap-program
           (lambda* (#:key inputs outputs #:allow-other-keys)
             (wrap-program (string-append (assoc-ref outputs "out")
diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index af1de10377..b91afc2067 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -348,8 +348,7 @@ software vendors, application developers and computer science researchers.")
                  (lambda* (#:key inputs #:allow-other-keys)
                    (substitute* "ompi/mpi/java/c/Makefile.in"
                      (("\\$\\(top_builddir\\)/ompi/lib@OMPI_LIBMPI_NAME@.la")
-                      (string-append (assoc-ref inputs "openmpi") "/lib/libmpi.la")))
-                   #t))
+                      (search-input-file inputs "/lib/libmpi.la")))))
                (add-after 'install 'strip-jar-timestamps
                  (assoc-ref ant:%standard-phases 'strip-jar-timestamps)))))))
     (synopsis "Java bindings for MPI")))
diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 2ae923d6ad..1935a39e65 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -3044,9 +3044,7 @@ can connect to any JACK port and record the output into a stereo WAV file.")
              ;; Fix reference to dlopened libraries.
              (substitute* "jackselect/alsainfo.py"
                (("libasound.so.2")
-                (string-append (assoc-ref inputs "alsa-lib")
-                               "/lib/libasound.so.2")))
-             #t))
+                (search-input-file inputs "/lib/libasound.so.2")))))
          (replace 'build
            (assoc-ref python:%standard-phases 'build))
          (add-after 'install 'wrap
diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm
index 88bc354269..438134a698 100644
--- a/gnu/packages/pascal.scm
+++ b/gnu/packages/pascal.scm
@@ -150,11 +150,9 @@
                (substitute* "fpcsrc/compiler/systems/t_linux.pas"
                  ;; Point to the current glibc dynamic linker.
                  (("/lib/ld-linux.so.2")
-                  (string-append (assoc-ref inputs "libc")
-                                 ,(glibc-dynamic-linker)))
+                  (search-input-file inputs ,(glibc-dynamic-linker)))
                  (("/lib64/ld-linux-x86-64.so.2")
-                  (string-append (assoc-ref inputs "libc")
-                                 ,(glibc-dynamic-linker)))
+                  (search-input-file inputs ,(glibc-dynamic-linker)))
                  ; TODO: /lib/ld-linux-armhf.so.3
                  ; TODO: /lib/ld-linux-aarch64.so.1
                  ; TODO: /lib64/ld64.so.2
diff --git a/gnu/packages/python-crypto.scm b/gnu/packages/python-crypto.scm
index 3a201e4095..593461c56d 100644
--- a/gnu/packages/python-crypto.scm
+++ b/gnu/packages/python-crypto.scm
@@ -1220,9 +1220,7 @@ none of them have everything that I'd like, so here's one more.  It uses
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "libnacl/__init__.py"
                (("/usr/local/lib/libsodium.so")
-                (string-append (assoc-ref inputs "libsodium")
-                               "/lib/libsodium.so")))
-             #t)))))
+                (search-input-file inputs "/lib/libsodium.so"))))))))
     (native-inputs
      `(("python-pyhamcrest" ,python-pyhamcrest)))
     (inputs
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 512b5be234..344ae01dde 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -6830,22 +6830,16 @@ support for Python 3 and PyPy.  It is based on cffi.")
                (("filenames = \\(library_filename,\\) \\+ filenames")
                 "pass")
                (("libcairo.so.2")
-                (string-append (assoc-ref inputs "cairo")
-                               "/lib/libcairo.so.2")))
+                (search-input-file inputs "/lib/libcairo.so.2")))
              (substitute* "cairocffi/pixbuf.py"
                (("libgdk_pixbuf-2.0.so.0")
-                (string-append (assoc-ref inputs "gdk-pixbuf")
-                               "/lib/libgdk_pixbuf-2.0.so.0"))
+                (search-input-file inputs "/lib/libgdk_pixbuf-2.0.so.0"))
                (("libgobject-2.0.so.0")
-                (string-append (assoc-ref inputs "glib")
-                               "/lib/libgobject-2.0.so.0"))
+                (search-input-file inputs "/lib/libgobject-2.0.so.0"))
                (("libglib-2.0.so.0")
-                (string-append (assoc-ref inputs "glib")
-                               "/lib/libglib-2.0.so.0"))
+                (search-input-file inputs "/lib/libglib-2.0.so.0"))
                (("libgdk-3.so.0")
-                (string-append (assoc-ref inputs "gtk+")
-                               "/lib/libgdk-3.so.0")))
-             #t))
+                (search-input-file inputs "/lib/libgdk-3.so.0")))))
          (add-after 'unpack 'disable-linters
            ;; Their check fails; none of our business.
            (lambda _
@@ -16149,8 +16143,7 @@ Record Format (DWARF).")
        (modify-phases %standard-phases
          (add-after 'unpack 'patch
            (lambda* (#:key inputs #:allow-other-keys)
-             (let ((libev (string-append (assoc-ref inputs "libev")
-                                         "/lib/libev.so.4")))
+             (let ((libev (search-input-file inputs "/lib/libev.so.4")))
                (substitute* "setup.py"
                  (("libev_dll_name = find_library\\(\\\"ev\\\"\\)")
                   (string-append "libev_dll_name = \"" libev "\"")))))))))
@@ -24345,8 +24338,7 @@ be necessary when using @code{cmd}.")
        (modify-phases %standard-phases
          (add-before 'build 'qualify-libtidy
            (lambda* (#:key inputs #:allow-other-keys)
-             (let ((libtidy (string-append (assoc-ref inputs "tidy")
-                                           "/lib/libtidy.so")))
+             (let ((libtidy (search-input-file inputs "/lib/libtidy.so")))
                (substitute* "tidylib/tidy.py"
                  (("ctypes\\.util\\.find_library\\('tidy'\\)")
                   (format #f "'~a'" libtidy)))
diff --git a/gnu/packages/radio.scm b/gnu/packages/radio.scm
index c55cd55ac5..21843a688f 100644
--- a/gnu/packages/radio.scm
+++ b/gnu/packages/radio.scm
@@ -1588,8 +1588,7 @@ methods:
                 "-lncurses"))
              (substitute* "src/libcw/libcw_pa.c"
                (("libpulse-simple.so" all)
-                (string-append (assoc-ref inputs "pulseaudio")
-                               "/lib/" all))))))))
+                (search-input-file inputs "/lib/libpulse-simple.so"))))))))
     (home-page "http://unixcw.sourceforge.net/")
     (synopsis "Morse code library and programs")
     (description
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 2d29c2acd7..faff349565 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -509,8 +509,8 @@ safety and thread safety guarantees.")
                    (("^jemalloc =.*$") "")
                    (("[[]rust[]]") "\n[rust]\njemalloc=true\n"))
                  (setenv "JEMALLOC_OVERRIDE"
-                         (string-append (assoc-ref inputs "jemalloc")
-                                        "/lib/libjemalloc_pic.a")))))))))))
+                         (search-input-file inputs
+                                            "/lib/libjemalloc_pic.a")))))))))))
 
 (define-public rust-1.33
   (let ((base-rust (rust-bootstrapped-package
diff --git a/gnu/packages/security-token.scm b/gnu/packages/security-token.scm
index 2339d20cca..a1fc8b5c6f 100644
--- a/gnu/packages/security-token.scm
+++ b/gnu/packages/security-token.scm
@@ -300,8 +300,8 @@ website for more information about Yubico and the YubiKey.")
          ;; configuration file at runtime.
          (add-after 'unpack 'set-default-libpcsclite.so.1-path
            (lambda* (#:key inputs #:allow-other-keys)
-             (let ((libpcsclite (string-append (assoc-ref inputs "pcsc-lite")
-                                               "/lib/libpcsclite.so.1")))
+             (let ((libpcsclite (search-input-file inputs
+                                                   "/lib/libpcsclite.so.1")))
                (substitute* "configure"
                  (("DEFAULT_PCSC_PROVIDER=\"libpcsclite\\.so\\.1\"")
                   (string-append
@@ -439,8 +439,8 @@ retrieve a YubiKey's serial number, and so forth.")
                (("lib = \"libpcsclite\\.so\\.1\";")
                 (simple-format #f
                                "lib = \"~a\";"
-                               (string-append (assoc-ref inputs "pcsc-lite")
-                                              "/lib/libpcsclite.so.1"))))
+                               (search-input-file inputs
+                                                  "/lib/libpcsclite.so.1"))))
              #t)))))
     (inputs
      `(("pcsc-lite" ,pcsc-lite)))
diff --git a/gnu/packages/selinux.scm b/gnu/packages/selinux.scm
index e7e6289d1c..8a75538d10 100644
--- a/gnu/packages/selinux.scm
+++ b/gnu/packages/selinux.scm
@@ -329,8 +329,7 @@ based on required access.")
          (add-after 'unpack 'set-SEPOL-variable
            (lambda* (#:key inputs #:allow-other-keys)
              (setenv "SEPOL"
-                     (string-append (assoc-ref inputs "libsepol")
-                                    "/lib/libsepol.a"))))
+                     (search-input-file inputs "/lib/libsepol.a"))))
          (add-after 'unpack 'remove-Werror
            (lambda _
              (substitute* "setup.py"
diff --git a/gnu/packages/spice.scm b/gnu/packages/spice.scm
index 76670463d7..5c065151d1 100644
--- a/gnu/packages/spice.scm
+++ b/gnu/packages/spice.scm
@@ -356,8 +356,8 @@ resolution scaling on graphical console window resize.")
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "tests/setup-softhsm2.sh"
                (("\\/usr\\/lib64\\/pkcs11\\/libsofthsm2\\.so")
-                (string-append (assoc-ref inputs "softhsm")
-                               "/lib/softhsm/libsofthsm2.so"))))))))
+                (search-input-file inputs
+                                   "/lib/softhsm/libsofthsm2.so"))))))))
     (propagated-inputs
      `(("glib" ,glib)                   ; Requires: in the pkg-config file
        ("nss" ,nss)))                   ; Requires.private: in the pkg-config
diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
index f75a168948..37ff103c42 100644
--- a/gnu/packages/telephony.scm
+++ b/gnu/packages/telephony.scm
@@ -894,14 +894,11 @@ Initiation Protocol (SIP) and a multimedia framework.")
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "os/linux/AudioPulse.cpp"
                (("libpulse\\.so")
-                (string-append (assoc-ref inputs "pulseaudio")
-                              "/lib/libpulse.so")))
+                (search-input-file inputs "/lib/libpulse.so")))
              (substitute* '("os/linux/AudioInputALSA.cpp"
                             "os/linux/AudioOutputALSA.cpp")
                (("libasound\\.so")
-                (string-append (assoc-ref inputs "alsa-lib")
-                               "/lib/libasound.so")))
-             #t)))))
+                (search-input-file inputs "/lib/libasound.so"))))))))
     (synopsis "VoIP library for Telegram clients")
     (description "A collection of libraries and header files for implementing
 telephony functionality into custom Telegram clients.")
-- 
2.32.0