diff mbox series

[bug#70161,2/2] gnu: tomlc99: Install pkg-config file.

Message ID 642f39b405faa550087b7ffed9a303bbd7ab089a.1712142989.git.jean@foundation.xyz
State New
Headers show
Series gnu: tomlc99: Update to 1.0-1.5221b3d. | expand

Commit Message

Jean-Pierre De Jesus Diaz April 3, 2024, 11:21 a.m. UTC
* gnu/packages/c.scm (tomlc99) <arguments>: Add phase to install
pkg-config file.

Change-Id: Id09f22912fe7e4dcac6a0377e4a78d3d34346106
---
 gnu/packages/c.scm | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index 6e98c34af6..1b168d2ca8 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -265,16 +265,29 @@  (define-public tomlc99
                                                  #$(cc-for-target))
                                   (string-append "prefix="
                                                  #$output))
-             #:phases #~(modify-phases %standard-phases
-                          (delete 'configure)
-                          (replace 'check
-                            (lambda* (#:key tests? make-flags
-                                      #:allow-other-keys)
-                              (when tests?
-                                (apply invoke
-                                       `("make" "-C" "unittest"
-                                         ,@make-flags))
-                                (invoke "./unittest/t1")))))))
+             #:phases
+             #~(modify-phases %standard-phases
+                 (delete 'configure)
+                 (replace 'check
+                   (lambda* (#:key tests? make-flags
+                             #:allow-other-keys)
+                     (when tests?
+                       (apply invoke
+                              `("make" "-C" "unittest"
+                                ,@make-flags))
+                       (invoke "./unittest/t1"))))
+                 ;; The Makefile checks for libtoml.pc and only installs if
+                 ;; the prefix is /usr/local.
+                 (add-after 'install 'install-pkg-config
+                   (lambda _
+                     (rename-file "libtoml.pc.sample" "libtoml.pc")
+                     (substitute* "libtoml.pc"
+                       (("^prefix=.*")
+                        (string-append "prefix=" #$output "\n")))
+
+                     (let ((pc (string-append #$output "/lib/pkgconfig")))
+                       (mkdir-p pc)
+                       (install-file "libtoml.pc" pc)))))))
       (home-page "https://github.com/cktan/tomlc99")
       (synopsis "TOML library for C")
       (description