summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-31 15:07:00 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-04-14 15:11:52 -0400
commit46e56eb001751d127c38a7a4f5a23dc4cc214453 (patch)
treed11e7b22d5659d552a640633bef6d548d5101918
parent0d5746ee7ca337dcc82553ca6dd794b04bb6563d (diff)
downloadguix-46e56eb001751d127c38a7a4f5a23dc4cc214453.tar.gz
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.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/c.scm50
-rw-r--r--gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch25
3 files changed, 75 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index e9c8ddf6a3..3c188cf1f7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -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	\
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index b2f16613dd..96b4e904f7 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -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)
diff --git a/gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch b/gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch
new file mode 100644
index 0000000000..f6155517d1
--- /dev/null
+++ b/gnu/packages/patches/orangeduck-mpc-fix-pkg-config.patch
@@ -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 -- \