From fad79643fa607a65a01661ce3cde5916ff515034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Tue, 9 Dec 2025 14:16:19 +0100 Subject: [PATCH] Use pkg-config instead of papi_version_check --- .../check-papi-version-with-pkgconfig.patch | 67 ++++++++++++++++++ pkgs/nanos6/default.nix | 7 +- .../check-papi-version-with-pkgconfig.patch | 68 +++++++++++++++++++ pkgs/nosv/default.nix | 1 + 4 files changed, 138 insertions(+), 5 deletions(-) create mode 100644 pkgs/nanos6/check-papi-version-with-pkgconfig.patch create mode 100644 pkgs/nosv/check-papi-version-with-pkgconfig.patch diff --git a/pkgs/nanos6/check-papi-version-with-pkgconfig.patch b/pkgs/nanos6/check-papi-version-with-pkgconfig.patch new file mode 100644 index 0000000..c3dc8a4 --- /dev/null +++ b/pkgs/nanos6/check-papi-version-with-pkgconfig.patch @@ -0,0 +1,67 @@ +diff --git a/m4/papi.m4 b/m4/papi.m4 +--- a/m4/papi.m4 ++++ b/m4/papi.m4 +@@ -24,12 +24,13 @@ AC_DEFUN([AC_CHECK_PAPI], + else + PKG_CHECK_MODULES( + [papi], +- [papi], ++ [papi >= 5.6.0], + [ + AC_MSG_CHECKING([the PAPI installation prefix]) + AC_MSG_RESULT([retrieved from pkg-config]) + papi_CPPFLAGS="${papi_CFLAGS}" + ac_use_papi=yes ++ ac_papi_version_correct=yes + ], [ + AC_MSG_CHECKING([the PAPI installation prefix]) + AC_MSG_RESULT([not available]) +@@ -67,27 +68,29 @@ AC_DEFUN([AC_CHECK_PAPI], + fi + + if test x"${ac_use_papi}" = x"yes" ; then +- if test x"${ac_cv_use_papi_prefix}" != x"" ; then +- papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version +- else +- papiBinary=papi_version +- fi +- papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'` ++ if test x"${ac_papi_version_correct}" != x"yes" ; then ++ if test x"${ac_cv_use_papi_prefix}" != x"" ; then ++ papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version ++ else ++ papiBinary=papi_version ++ fi ++ papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'` + +- AX_COMPARE_VERSION( +- [[${papiVersion}]], +- [[ge]], +- [[5.6.0]], +- [[ac_papi_version_correct=yes]], +- [[ac_papi_version_correct=no]] +- ) ++ AX_COMPARE_VERSION( ++ [[${papiVersion}]], ++ [[ge]], ++ [[5.6.0]], ++ [[ac_papi_version_correct=yes]], ++ [[ac_papi_version_correct=no]] ++ ) + +- if test x"${ac_papi_version_correct}" != x"yes" ; then +- AC_MSG_ERROR([PAPI version must be >= 5.6.0.]) +- ac_use_papi=no +- else +- AC_MSG_CHECKING([if the PAPI version >= 5.6.0.]) +- AC_MSG_RESULT([${ac_papi_version_correct}]) ++ if test x"${ac_papi_version_correct}" != x"yes" ; then ++ AC_MSG_ERROR([PAPI version must be >= 5.6.0.]) ++ ac_use_papi=no ++ else ++ AC_MSG_CHECKING([if the PAPI version >= 5.6.0.]) ++ AC_MSG_RESULT([${ac_papi_version_correct}]) ++ fi + fi + fi + diff --git a/pkgs/nanos6/default.nix b/pkgs/nanos6/default.nix index c2210e9..8157fdf 100644 --- a/pkgs/nanos6/default.nix +++ b/pkgs/nanos6/default.nix @@ -96,17 +96,14 @@ in separateDebugInfo = true; strictDeps = true; + patches = [ ./check-papi-version-with-pkgconfig.patch ]; nativeBuildInputs = [ autoconf automake libtool pkg-config - - # TODO: papi_version is needed for configure: - # ./configure: line 27378: papi_version: command not found - # This probably breaks cross-compilation - ] ++ lib.optionals enablePapi [ papi ]; + ]; buildInputs = [ boost diff --git a/pkgs/nosv/check-papi-version-with-pkgconfig.patch b/pkgs/nosv/check-papi-version-with-pkgconfig.patch new file mode 100644 index 0000000..a270034 --- /dev/null +++ b/pkgs/nosv/check-papi-version-with-pkgconfig.patch @@ -0,0 +1,68 @@ +diff --git a/m4/papi.m4 b/m4/papi.m4 +index de905848..fa3db9a1 100644 +--- a/m4/papi.m4 ++++ b/m4/papi.m4 +@@ -24,12 +24,13 @@ AC_DEFUN([AC_CHECK_PAPI], + else + PKG_CHECK_MODULES( + [papi], +- [papi], ++ [papi >= 5.6.0], + [ + AC_MSG_CHECKING([the PAPI installation prefix]) + AC_MSG_RESULT([retrieved from pkg-config]) + papi_CFLAGS="${papi_CFLAGS}" + ac_use_papi=yes ++ ac_papi_version_correct=yes + ], [ + AC_MSG_CHECKING([the PAPI installation prefix]) + AC_MSG_RESULT([not available]) +@@ -67,27 +68,29 @@ AC_DEFUN([AC_CHECK_PAPI], + fi + + if test x"${ac_use_papi}" = x"yes" ; then +- if test x"${ac_cv_use_papi_prefix}" != x"" ; then +- papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version +- else +- papiBinary=papi_version +- fi +- papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'` ++ if test x"${ac_papi_version_correct}" != x"yes" ; then ++ if test x"${ac_cv_use_papi_prefix}" != x"" ; then ++ papiBinary=${ac_cv_use_papi_prefix}/bin/papi_version ++ else ++ papiBinary=papi_version ++ fi ++ papiVersion=`$papiBinary | sed 's/[[^0-9.]]*\([[0-9.]]*\).*/\1/'` + +- AX_COMPARE_VERSION( +- [[${papiVersion}]], +- [[ge]], +- [[5.6.0]], +- [[ac_papi_version_correct=yes]], +- [[ac_papi_version_correct=no]] +- ) ++ AX_COMPARE_VERSION( ++ [[${papiVersion}]], ++ [[ge]], ++ [[5.6.0]], ++ [[ac_papi_version_correct=yes]], ++ [[ac_papi_version_correct=no]] ++ ) + +- if test x"${ac_papi_version_correct}" != x"yes" ; then +- AC_MSG_ERROR([PAPI version must be >= 5.6.0.]) +- ac_use_papi=no +- else +- AC_MSG_CHECKING([if the PAPI version >= 5.6.0.]) +- AC_MSG_RESULT([${ac_papi_version_correct}]) ++ if test x"${ac_papi_version_correct}" != x"yes" ; then ++ AC_MSG_ERROR([PAPI version must be >= 5.6.0.]) ++ ac_use_papi=no ++ else ++ AC_MSG_CHECKING([if the PAPI version >= 5.6.0.]) ++ AC_MSG_RESULT([${ac_papi_version_correct}]) ++ fi + fi + fi + diff --git a/pkgs/nosv/default.nix b/pkgs/nosv/default.nix index 9dcd33d..cfb271c 100644 --- a/pkgs/nosv/default.nix +++ b/pkgs/nosv/default.nix @@ -47,6 +47,7 @@ in dontStrip = true; separateDebugInfo = true; strictDeps = true; + patches = [ ./check-papi-version-with-pkgconfig.patch ]; configureFlags = [ "--with-ovni=${ovni}" "CACHELINE_WIDTH=${toString cacheline}"