Subject: [PATCH 3/5] gnu: portmidi: Install pkg-config file.

From: Kei Kebreau <[email-masked]>
Date: Wed, 9 Dec 2020 17:13:31 -0500

* gnu/packages/music.scm (portmidi)[arguments]: Add 'install-pkg-config phase.
---
 gnu/packages/music.scm | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 2f75c39dd8..fa58ddd236 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -2406,8 +2406,26 @@ main purpose is to liberate raw audio rendering from audio and MIDI drivers.")
              (let* ((out (assoc-ref outputs "out"))
                     (lib (string-append out "/lib")))
                (with-directory-excursion lib
-                 (symlink "libportmidi.so" "libporttime.so")))
-             #t)))))
+                 (symlink "libportmidi.so" "libporttime.so")))))
+         (add-after 'install 'install-pkg-config
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (pkg-config-dir (string-append out "/lib/pkgconfig")))
+               (mkdir-p pkg-config-dir)
+               (with-output-to-file (string-append pkg-config-dir "/portmidi.pc")
+                 (lambda _
+                   (format #t
+                           "prefix=~@*~a~@
+                           libdir=${prefix}/lib~@
+                           includedir=${prefix}/include~@
+
+                           Name: portmidi~@
+                           Description:~@
+                           Version: ~a~@
+                           Libs: -L${libdir} -lportmidi~@
+                           Cflags: -I${includedir}~%"
+                           out
+                           ,version)))))))))
     (inputs
      `(("alsa-lib" ,alsa-lib)))
     (native-inputs
-- 
2.29.2