guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 44895f73e73269245a3860981fc33e5e94c2e799
Author: Murilo <[email protected]>
AuthorDate: Tue Dec 30 13:00:55 2025 -0300
gnu: Add unity-test.
* gnu/packages/check.scm (unity-test): New variable.
* gnu/packages/patches/unity-test-set-subdir-correctly.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
Change-Id: I2d5c88f20df3902513990a5fcf0cbe88b31e2eee
Modified-by: John Kehayias <[email protected]>
Signed-off-by: John Kehayias <[email protected]>
---
gnu/local.mk | 1 +
gnu/packages/check.scm | 46 ++++++++++++++++++++++
.../patches/unity-test-set-subdir-correctly.patch | 30 ++++++++++++++
3 files changed, 77 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index 5d130aa7ce..eb92804975 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2413,6 +2413,7 @@ dist_patch_DATA =
\
%D%/packages/patches/ucx-tcp-iface-ioctl.patch \
%D%/packages/patches/uftrace-fix-tests.patch \
%D%/packages/patches/ultrastar-deluxe-no-freesans.patch \
+ %D%/packages/patches/unity-test-set-subdir-correctly.patch \
%D%/packages/patches/ungoogled-chromium-extension-search-path.patch \
%D%/packages/patches/ungoogled-chromium-RUNPATH.patch \
%D%/packages/patches/ungoogled-chromium-system-nspr.patch \
diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index a18102b5e8..b2cf63a4ec 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -58,6 +58,7 @@
;;; Copyright © 2025 Nicolas Graves <[email protected]>
;;; Copyright © 2025 nomike Postmann <[email protected]>
;;; Copyright © 2025 Josep Bigorra <[email protected]>
+;;; Copyright © 2025 Murilo <[email protected]>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -109,6 +110,7 @@
#:use-module (gnu packages python-web)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages python-science)
+ #:use-module (gnu packages ruby)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages time)
@@ -3431,6 +3433,50 @@ of advanced library and language features, which means
it should be easily
portable to just about any platform.")
(license license:expat)))
+(define-public unity-test
+ (package
+ (name "unity-test")
+ (version "2.6.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/ThrowTheSwitch/Unity")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1s0jj9f2zav49mn9ib90idcmb6hq93aczbqysn5hj6binjmrnjw3"))
+ (patches (search-patches
"unity-test-set-subdir-correctly.patch"))))
+ (build-system meson-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "-Dsupport_double=true")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'patch-source-shebangs 'patch-more-shebangs
+ (lambda _
+ (substitute* '("auto/unity_test_summary.rb")
+ (("/usr/bin/ruby")
+ (string-append #$(this-package-input "ruby")
+ "/bin/ruby")))
+ (substitute* '("auto/stylize_as_junit.py"
+ "auto/unity_test_summary.py")
+ (("#! python3")
+ (string-append #$(this-package-input "python")
+ "/bin/python3")))))
+ (add-after 'install 'install-extra
+ (lambda _
+ (for-each (lambda (x)
+ (install-file x
+ (string-append #$output
"/share/unity-test")))
+ (find-files "../source/auto")))))))
+ (native-inputs (list pkg-config))
+ (inputs (list python ruby))
+ (home-page "https://github.com/ThrowTheSwitch/Unity")
+ (synopsis "Simple unit testing for C")
+ (description "This package provides a unit testing framework built for C,
+with a focus on working with embedded toolchains.")
+ (license license:expat)))
+
(define-public libfaketime
(package
(name "libfaketime")
diff --git a/gnu/packages/patches/unity-test-set-subdir-correctly.patch
b/gnu/packages/patches/unity-test-set-subdir-correctly.patch
new file mode 100644
index 0000000000..689343d963
--- /dev/null
+++ b/gnu/packages/patches/unity-test-set-subdir-correctly.patch
@@ -0,0 +1,30 @@
+From 4c8dab0edd16ce6a4b7b628430de1cd42d03f31a Mon Sep 17 00:00:00 2001
+From: Ross Smyth <[email protected]>
+Date: Mon, 10 Mar 2025 16:00:38 -0400
+Subject: [PATCH] Fix meson pkg-config generation
+
+The pkg-config file does not include the subdir
+in its build flags, so files will fail to find the
+Unity headers.
+---
+ meson.build | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 6585129c..9489aef4 100644
+--- a/meson.build
++++ b/meson.build
+@@ -64,10 +64,10 @@ unity_dep = declare_dependency(
+ if not meson.is_subproject()
+ pkg = import('pkgconfig')
+ pkg.generate(
+- name: meson.project_name(),
++ unity_lib,
+ version: meson.project_version(),
+- libraries: [ unity_lib ],
+- description: 'C Unit testing framework.'
++ subdirs: 'unity',
++ extra_cflags: unity_args,
+ )
+ endif
+