~ruther/guix-local

46e56eb001751d127c38a7a4f5a23dc4cc214453 — Maxim Cournoyer 3 years ago 0d5746e
gnu: Add orangeduck-mpc.

* gnu/packages/c.scm (orangeduck-mpc): New variable.
* gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
3 files changed, 75 insertions(+), 1 deletions(-)

M gnu/local.mk
M gnu/packages/c.scm
A gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch
M gnu/local.mk => gnu/local.mk +1 -0
@@ 1632,6 1632,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/openssl-3.0-c-rehash-in.patch		\
  %D%/packages/patches/opentaxsolver-file-browser-fix.patch     \
  %D%/packages/patches/open-zwave-hidapi.patch			\
  %D%/packages/patches/orangeduck-mpc-fix-pkg-config.patch	\
  %D%/packages/patches/orpheus-cast-errors-and-includes.patch	\
  %D%/packages/patches/osip-CVE-2017-7853.patch			\
  %D%/packages/patches/ots-no-include-missing-file.patch	\

M gnu/packages/c.scm => gnu/packages/c.scm +49 -1
@@ 9,7 9,7 @@
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com>
;;; Copyright © 2020, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com>
;;; Copyright © 2021 David Dashyan <mail@davie.li>
;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>


@@ 1145,6 1145,54 @@ Telemetry Transport (MQTT) publish-subscribe messaging protocol.")
    (home-page "https://microsoft.github.io/mimalloc/")
    (license license:expat)))

;;; The package is named orangeduck-mpc to differentiate it from GNU mpc.
(define-public orangeduck-mpc
  ;; The last release lacks an 'install' target.
  (let ((commit "7c910e9303833c349f7432188ff77f2745254df2")
        (revision "0"))
    (package
      (name "orangeduck-mpc")
      (version (git-version "0.9.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/orangeduck/mpc")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "01a4vcxdnz0fbn90c9zc3jzklyqqvp9sfjpjwpq0f5r0l2pp37ad"))
                (patches
                 (search-patches "orangeduck-mpc-fix-pkg-config.patch"))))
      (build-system gnu-build-system)
      (arguments
       (list #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
                                  (string-append "PREFIX=" #$output))
             #:phases #~(modify-phases %standard-phases
                          (add-after 'unpack 'patch-Makefile
                            (lambda _
                              (substitute* "Makefile"
                                ;; Do not attempt to alter the permissions,
                                ;; otherwise 'install' would error with
                                ;; "cannot stat [...] Permission denied"
                                ;; errors.
                                (("\\s\\-m[0-9]{3}\\s")
                                 " "))))
                          (delete 'configure))))
      (home-page "https://github.com/orangeduck/mpc")
      (synopsis "Parser Combinator library for C ")
      (description "@code{mpc} is a lightweight Parser Combinator library for C.
@code{mpc} can help with tasks such as:
@itemize
@item Building a new programming language
@item Building a new data format
@item Parsing an existing programming language
@item Parsing an existing data format
@item Embedding a Domain Specific Language
@item Implementing Greenspun's Tenth Rule.
@end itemize")
      (license license:bsd-2))))

;;; Factored out of the ck package so that it can be adjusted and called on
;;; the host side easily, without impacting the package definition.
(define (gnu-triplet->ck-machine target)

A gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch => gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch +25 -0
@@ 0,0 1,25 @@
Upstream status: https://github.com/orangeduck/mpc/pull/160

diff --git a/Makefile b/Makefile
index 7719acc..fe798c5 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@ EXAMPLESEXE = $(EXAMPLES:.c=)
 
 .PHONY: all check clean libs $(DIST)/$(PROJ).pc
 
-all: $(EXAMPLESEXE) check
+all: $(EXAMPLESEXE) check libs $(DIST)/$(PROJ).pc
 
 $(DIST):
 	$(MKDIR) $(DIST)
@@ -65,7 +65,8 @@ install: all
 	install -m755 -t $(DESTDIR)$(PREFIX)/lib $(DIST)/lib*
 	install -m644 -t $(DESTDIR)$(PREFIX)/share/$(PROJ) $(PROJ).c $(PROJ).h
 	install -m644 $(PROJ).h $(DESTDIR)$(PREFIX)/include/$(PROJ).h
-	install -m644 $(PROJ).pc $(DESTDIR)$(PREFIX)/lib/pkgconfig/$(PROJ).pc
+	install -m644 $(DIST)/$(PROJ).pc \
+	  $(DESTDIR)$(PREFIX)/lib/pkgconfig/$(PROJ).pc
 
 uninstall:
 	rm -rf -- \