@@ -98,6 +98,7 @@ RECIPE_MAINTAINER:pn-cdrtools-native = "Yi Zhao <yi.zhao@windriver.com>"
RECIPE_MAINTAINER:pn-chrpath = "Yi Zhao <yi.zhao@windriver.com>"
RECIPE_MAINTAINER:pn-cmake = "Unassigned <unassigned@yoctoproject.org>"
RECIPE_MAINTAINER:pn-cmake-native = "Unassigned <unassigned@yoctoproject.org>"
+RECIPE_MAINTAINER:pn-cmocka = "Unassigned <unassigned@yoctoproject.org>"
RECIPE_MAINTAINER:pn-connman = "Changhyeok Bae <changhyeok.bae@gmail.com>"
RECIPE_MAINTAINER:pn-connman-conf = "Ross Burton <ross.burton@arm.com>"
RECIPE_MAINTAINER:pn-connman-gnome = "Ross Burton <ross.burton@arm.com>"
@@ -569,6 +570,7 @@ RECIPE_MAINTAINER:pn-ovmf = "Unassigned <unassigned@yoctoproject.org>"
RECIPE_MAINTAINER:pn-ovmf-shell-image = "Unassigned <unassigned@yoctoproject.org>"
RECIPE_MAINTAINER:pn-p11-kit = "Alexander Kanavin <alex.kanavin@gmail.com>"
RECIPE_MAINTAINER:pn-package-index = "Ross Burton <ross.burton@arm.com>"
+RECIPE_MAINTAINER:pn-pam-wrapper = "Markus Volk <f_l_k@t-online.de>"
RECIPE_MAINTAINER:pn-pango = "Ross Burton <ross.burton@arm.com>"
RECIPE_MAINTAINER:pn-parted = "Hongxu Jia <hongxu.jia@windriver.com>"
RECIPE_MAINTAINER:pn-patch = "Hongxu Jia <hongxu.jia@windriver.com>"
new file mode 100644
@@ -0,0 +1,43 @@
+DESCRIPTION = "cmocka is an elegant unit testing framework for C with support for mock \
+objects. It only requires the standard C library, works on a range of computing \
+platforms (including embedded) and with different compilers."
+HOMEPAGE = "https://cmocka.org/"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+SRCREV = "a01cc69ee9536f90e57c61a198f2d1944d3d4313"
+PV .= "+git"
+SRC_URI = "git://git.cryptomilk.org/projects/cmocka.git;protocol=https;branch=stable-1.1 \
+ file://0001-include-Check-for-previous-declaration-of-uintptr_t.patch \
+ file://run-ptest \
+ "
+
+S = "${WORKDIR}/git"
+
+inherit cmake ptest
+
+EXTRA_OECMAKE += "${@bb.utils.contains('PTEST_ENABLED', '1', '-DCMAKE_BUILD_TYPE=Debug -DUNIT_TESTING=ON', '', d)}"
+# Use -Wl,wrap linker flag, which does not work with LTO
+LTO = ""
+
+do_install:append () {
+ install -d ${D}${libdir}/${BPN}/example
+ install -d ${D}${libdir}/${BPN}/example/mock/chef_wrap
+ install -d ${D}${libdir}/${BPN}/example/mock/uptime
+
+ install -m 0755 ${B}/example/*_test ${D}/${libdir}/${BPN}/example
+ install -m 0755 ${B}/example/mock/chef_wrap/waiter_test_wrap ${D}/${libdir}/${BPN}/example/mock/chef_wrap
+ install -m 0755 ${B}/example/mock/uptime/uptime ${D}/${libdir}/${BPN}/example/mock/uptime
+ install -m 0755 ${B}/example/mock/uptime/test_uptime ${D}/${libdir}/${BPN}/example/mock/uptime
+ install -m 0644 ${B}/example/mock/uptime/libproc_uptime.so ${D}/${libdir}/${BPN}/example/mock/libproc_uptime.so
+}
+
+do_install_ptest () {
+ install -d ${D}${PTEST_PATH}/tests
+ install -m 0755 ${B}/tests/test_* ${D}${PTEST_PATH}/tests
+}
+
+PACKAGE_BEFORE_PN += "${PN}-examples"
+
+FILES:${PN}-examples = "${libdir}/${BPN}/example"
new file mode 100644
@@ -0,0 +1,43 @@
+From a54e035f802e79e3292d8ad39a14bd7c060eb7b1 Mon Sep 17 00:00:00 2001
+From: Breno Leitao <breno.leitao@gmail.com>
+Date: Tue, 21 Mar 2023 21:58:28 -0700
+Subject: [PATCH] include: Check for previous declaration of uintptr_t
+
+Adding a extra check before declaring uintptr_t. Currently musl uses
+macro __DEFINED_uintptr_t once it defines uintptr_t type. Checking
+this macro before defining it, and, defining it when uintptr_t is
+defined.
+
+Taken from Alpine
+
+Upstream-Status: Pending
+Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ include/cmocka.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/include/cmocka.h b/include/cmocka.h
+index a21d965..f540793 100644
+--- a/include/cmocka.h
++++ b/include/cmocka.h
+@@ -121,7 +121,7 @@ typedef uintmax_t LargestIntegralType;
+ ((LargestIntegralType)(value))
+
+ /* Smallest integral type capable of holding a pointer. */
+-#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(HAVE_UINTPTR_T)
++#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(HAVE_UINTPTR_T) && !defined(__DEFINED_uintptr_t)
+ # if defined(_WIN32)
+ /* WIN32 is an ILP32 platform */
+ typedef unsigned int uintptr_t;
+@@ -147,6 +147,7 @@ typedef uintmax_t LargestIntegralType;
+
+ # define _UINTPTR_T
+ # define _UINTPTR_T_DEFINED
++# define __DEFINED_uintptr_t
+ #endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
+
+ /* Perform an unsigned cast to uintptr_t. */
+--
+2.40.0
+
new file mode 100644
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+cd tests
+for i in `ls *`; do
+ if [ ./$i ] ; then
+ echo "PASS: $i"
+ else
+ echo "FAIL: $i"
+ fi
+done
new file mode 100644
@@ -0,0 +1,49 @@
+From 15733e45935dbef71b6c4547cd3a905014793aed Mon Sep 17 00:00:00 2001
+From: Markus Volk <f_l_k@t-online.de>
+Date: Fri, 29 Nov 2024 13:49:16 +0100
+Subject: [PATCH] pamwrapper: add ${pc_sysrootdir} to pc files
+
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+
+Upstream-Status: Inappropriate [oe-specific]
+---
+ libpamtest.pc.cmake | 2 +-
+ pam_wrapper-config.cmake.in | 4 ++--
+ pam_wrapper.pc.cmake | 4 ++--
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/libpamtest.pc.cmake b/libpamtest.pc.cmake
+index 6726d76..9cee8bf 100644
+--- a/libpamtest.pc.cmake
++++ b/libpamtest.pc.cmake
+@@ -1,4 +1,4 @@
+ Name: libpamtest
+ Description: A helper library for PAM testing
+ Version: @APPLICATION_VERSION@
+-Libs: @CMAKE_INSTALL_FULL_LIBDIR@/libpamtest.so
++Libs: ${pc_sysrootdir}@CMAKE_INSTALL_FULL_LIBDIR@/libpamtest.so
+diff --git a/pam_wrapper-config.cmake.in b/pam_wrapper-config.cmake.in
+index d89e9a4..6ff00d7 100644
+--- a/pam_wrapper-config.cmake.in
++++ b/pam_wrapper-config.cmake.in
+@@ -1,2 +1,2 @@
+-set(PAM_WRAPPER_LIBRARY @CMAKE_INSTALL_FULL_LIBDIR@/@PAM_WRAPPER_LIB@)
+-set(PAM_WRAPPER_MODULE_DIR @CMAKE_INSTALL_FULL_LIBDIR@/@PROJECT_NAME@)
++set(PAM_WRAPPER_LIBRARY ${pc_sysrootdir}@CMAKE_INSTALL_FULL_LIBDIR@/@PAM_WRAPPER_LIB@)
++set(PAM_WRAPPER_MODULE_DIR ${pc_sysrootdir}@CMAKE_INSTALL_FULL_LIBDIR@/@PROJECT_NAME@)
+diff --git a/pam_wrapper.pc.cmake b/pam_wrapper.pc.cmake
+index 7ebe607..f722781 100644
+--- a/pam_wrapper.pc.cmake
++++ b/pam_wrapper.pc.cmake
+@@ -1,6 +1,6 @@
+-modules=@CMAKE_INSTALL_FULL_LIBDIR@/pam_wrapper
++modules=${pc_sysrootdir}@CMAKE_INSTALL_FULL_LIBDIR@/pam_wrapper
+
+ Name: @PROJECT_NAME@
+ Description: The pam_wrapper library
+ Version: @PROJECT_VERSION@
+-Libs: @CMAKE_INSTALL_FULL_LIBDIR@/@PAM_WRAPPER_LIB@
++Libs: ${pc_sysrootdir}@CMAKE_INSTALL_FULL_LIBDIR@/@PAM_WRAPPER_LIB@
+--
+2.47.0
+
new file mode 100644
@@ -0,0 +1,23 @@
+SUMMARY = "A tool to test PAM applications and PAM modules"
+HOMEPAGE = "https://gitlab.com/cwrap/pam_wrapper"
+LICENSE = "GPL-3.0-only"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=d32239bcb673463ab874e80d47fae504"
+
+SRCREV = "f140952e99bb0682bc6da7858f6ca25b70fab86c"
+SRC_URI = " \
+ git://gitlab.com/cwrap/pam_wrapper.git;protocol=https;branch=master \
+ file://0001-pamwrapper-add-pc_sysrootdir-to-pc-files.patch \
+"
+S = "${WORKDIR}/git"
+
+inherit cmake pkgconfig python3targetconfig
+
+EXTRA_OECMAKE += "-DPAM_LIBRARY=${libdir}/libpam.so.0"
+
+DEPENDS += "cmocka libpam"
+
+FILES:${PN} += "${libdir}"
+
+RDEPENDS:${PN} += "python3-core libpython3"
+
@@ -8,7 +8,6 @@ HOMEPAGE = "https://github.com/GNOME/libsecret"
BUGTRACKER = "https://gitlab.gnome.org/GNOME/libsecret/issues"
LIC_FILES_CHKSUM = "file://COPYING;md5=23c2a5e0106b99d75238986559bb5fc6"
-
inherit gnomebase gi-docgen vala gobject-introspection manpages
DEPENDS += "glib-2.0 libgcrypt gettext-native"
@@ -17,7 +16,9 @@ SRC_URI[archive.sha256sum] = "163d08d783be6d4ab9a979ceb5a4fecbc1d9660d3c34168c58
GTKDOC_MESON_OPTION = 'gtk_doc'
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
PACKAGECONFIG[manpages] = "-Dmanpage=true,-Dmanpage=false,libxslt-native xmlto-native"
+PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam pam-wrapper"
# http://errors.yoctoproject.org/Errors/Details/20228/
ARM_INSTRUCTION_SET:armv4 = "arm"
pam module has been ported from gnome-keyring to libsecret [https://gitlab.gnome.org/GNOME/libsecret/-/commit/9a37dc839a9be1670afeb647d9f82b6ef1cd0893] Add a PACKAGECONFIG for pam and enable it if pam is in DISTRO_FEATURES Add a recipe for pam_wrapper, needed to build the tests [https://gitlab.com/cwrap/pam_wrapper] Import cmocka recipe from meta-oe [https://git.openembedded.org/meta-openembedded/tree/meta-oe/recipes-test/cmocka/cmocka_1.1.7.bb] (From OE-Core rev: 3ef7f9650df0d99cd3a25ad470ac67aed1351d11) Signed-off-by: Markus Volk <f_l_k@t-online.de> --- meta/conf/distro/include/maintainers.inc | 2 + meta/recipes-devtools/cmocka/cmocka_1.1.7.bb | 43 ++++++++++++++++ ...or-previous-declaration-of-uintptr_t.patch | 43 ++++++++++++++++ meta/recipes-devtools/cmocka/files/run-ptest | 10 ++++ ...rapper-add-pc_sysrootdir-to-pc-files.patch | 49 +++++++++++++++++++ .../pam-wrapper/pam-wrapper_1.1.7.bb | 23 +++++++++ .../libsecret/libsecret_0.21.4.bb | 3 +- 7 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/cmocka/cmocka_1.1.7.bb create mode 100644 meta/recipes-devtools/cmocka/files/0001-include-Check-for-previous-declaration-of-uintptr_t.patch create mode 100644 meta/recipes-devtools/cmocka/files/run-ptest create mode 100644 meta/recipes-devtools/pam-wrapper/pam-wrapper/0001-pamwrapper-add-pc_sysrootdir-to-pc-files.patch create mode 100644 meta/recipes-devtools/pam-wrapper/pam-wrapper_1.1.7.bb