public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/mstflint] rawhide: use system libs instead of bundled ones
@ 2026-08-12  8:06 Michal Schmidt
  0 siblings, 0 replies; only message in thread
From: Michal Schmidt @ 2026-08-12  8:06 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/mstflint
            Branch : rawhide
            Commit : a5962fa93576d3a6acc61f930bfad61d9bf4993c
            Author : Michal Schmidt <mschmidt@redhat.com>
            Date   : 2026-08-10T19:50:28+02:00
            Stats  : +180/-4 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/mstflint/c/a5962fa93576d3a6acc61f930bfad61d9bf4993c?branch=rawhide

            Log:
            use system libs instead of bundled ones

Unbundle iniparser and sqlite unconditionally.

On Fedora, unbundle jsoncpp and muParser too.
On RHEL/ELN, they are not in the content set, so keep bundling.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2513486

---
diff --git a/0010-mlxconfig-don-t-include-sqlite3.h-via-hardcoded-ext_.patch b/0010-mlxconfig-don-t-include-sqlite3.h-via-hardcoded-ext_.patch
new file mode 100644
index 0000000..6b1fa7d
--- /dev/null
+++ b/0010-mlxconfig-don-t-include-sqlite3.h-via-hardcoded-ext_.patch
@@ -0,0 +1,45 @@
+From 006d2e6d6e75c6b21c26d7adfc3c3803ae7f4451 Mon Sep 17 00:00:00 2001
+From: Michal Schmidt <mschmidt@redhat.com>
+Date: Mon, 10 Aug 2026 13:50:43 +0200
+Subject: [PATCH 1/2] mlxconfig: don't include sqlite3.h via hardcoded ext_libs
+ path
+
+Use <sqlite3.h> instead of <ext_libs/sqlite/sqlite3.h>. The include
+path is already set by SQLITE_CFLAGS, whether it points to the bundled
+copy or comes from pkg-config.
+
+Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
+---
+ mlxconfig/mlxcfg_db_manager.cpp | 2 +-
+ mlxconfig/mlxcfg_db_manager.h   | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/mlxconfig/mlxcfg_db_manager.cpp b/mlxconfig/mlxcfg_db_manager.cpp
+index 5d8561af2dae..2d18bcaf9c99 100644
+--- a/mlxconfig/mlxcfg_db_manager.cpp
++++ b/mlxconfig/mlxcfg_db_manager.cpp
+@@ -44,7 +44,7 @@
+ #include <assert.h>
+ #include <algorithm>
+ 
+-#include <ext_libs/sqlite/sqlite3.h>
++#include <sqlite3.h>
+ #include "mlxcfg_db_manager.h"
+ #include "mlxcfg_utils.h"
+ #include <memory>
+diff --git a/mlxconfig/mlxcfg_db_manager.h b/mlxconfig/mlxcfg_db_manager.h
+index 69eb87c8f516..051685839834 100644
+--- a/mlxconfig/mlxcfg_db_manager.h
++++ b/mlxconfig/mlxcfg_db_manager.h
+@@ -47,7 +47,7 @@
+ #include "mlxcfg_tlv.h"
+ #include "mlxcfg_param.h"
+ #include "mlxcfg_configuration.h"
+-#include <ext_libs/sqlite/sqlite3.h>
++#include <sqlite3.h>
+ 
+ enum SPLITBY
+ {
+-- 
+2.55.0
+

diff --git a/0011-configure.ac-use-pkg-config-to-detect-libraries.patch b/0011-configure.ac-use-pkg-config-to-detect-libraries.patch
new file mode 100644
index 0000000..e751d70
--- /dev/null
+++ b/0011-configure.ac-use-pkg-config-to-detect-libraries.patch
@@ -0,0 +1,100 @@
+From 42e131268c86a04c7ab33b88386bf21920dad038 Mon Sep 17 00:00:00 2001
+From: Michal Schmidt <mschmidt@redhat.com>
+Date: Mon, 10 Aug 2026 10:59:58 +0200
+Subject: [PATCH 2/2] configure.ac: use pkg-config to detect libraries
+
+The AC_SEARCH_LIBS check for jsoncpp searched for a nonexistent "JSON"
+symbol, so it never found the system library.
+
+Switch iniparser, jsoncpp, muparser, and sqlite3 detection to
+PKG_CHECK_MODULES, falling back to the bundled copies when pkg-config
+fails.
+
+Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
+---
+ configure.ac | 61 ++++++++++++++++++++++++----------------------------
+ 1 file changed, 28 insertions(+), 33 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index a53a9b5e4b95..a275a9c62908 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -714,47 +714,42 @@ AC_SUBST(TOOLS_CRYPTO)
+ AM_CONDITIONAL(ENABLE_OPENSSL, [test "x$enable_openssl" = "xyes"])
+ AM_CONDITIONAL(ENABLE_CS, [test  "x$enable_cs" = "xyes" || test "x$enable_openssl" = "xyes"])
+ 
+-AC_CHECK_HEADERS(iniparser.h, INIPARSER_SYSTEM_AVAILABLE="yes", INIPARSER_SYSTEM_AVAILABLE="no")
+-if test "$INIPARSER_SYSTEM_AVAILABLE" = "yes"; then
+-    AC_SEARCH_LIBS([iniparser_load], [iniparser],
+-        [INIPARSER_SYSTEM_AVAILABLE="yes"],
+-        [INIPARSER_SYSTEM_AVAILABLE="no"]
+-    )
+-fi
+-
+-if test "$INIPARSER_SYSTEM_AVAILABLE" = "no"; then
+-    INIPARSER_CFLAGS='-I$(top_srcdir)/ext_libs/iniParser'
+-    AC_SUBST(INIPARSER_CFLAGS)
+-    INIPARSER_LIBS='$(top_builddir)/ext_libs/iniParser/libiniparser.la'
+-    AC_SUBST(INIPARSER_LIBS)
+-fi
+-
++PKG_CHECK_MODULES([INIPARSER], [iniparser],
++    [INIPARSER_SYSTEM_AVAILABLE="yes"],
++    [INIPARSER_SYSTEM_AVAILABLE="no"
++     INIPARSER_CFLAGS='-I$(top_srcdir)/ext_libs/iniParser'
++     INIPARSER_LIBS='$(top_builddir)/ext_libs/iniParser/libiniparser.la'
++     AC_SUBST(INIPARSER_CFLAGS)
++     AC_SUBST(INIPARSER_LIBS)])
+ AM_CONDITIONAL([USE_LOCAL_INIPARSER], [test "$INIPARSER_SYSTEM_AVAILABLE" = no])
+ AS_IF([test "x$INIPARSER_SYSTEM_AVAILABLE" = "xyes" ], [
+     CXXFLAGS="$CXXFLAGS -DHAVE_INI_PARSER"])
+ 
+-AC_SEARCH_LIBS([JSON], [jsoncpp], [JSON_SYSTEM_AVAILABLE="yes"],[
+-    JSON_SYSTEM_AVAILABLE="no"
+-    JSON_CFLAGS='-I$(top_srcdir)/ext_libs/json'
+-    AC_SUBST(JSON_CFLAGS)
+-    JSON_LIBS='$(top_builddir)/ext_libs/json/libjson.la'
+-    AC_SUBST(JSON_LIBS)])
++PKG_CHECK_MODULES([JSON], [jsoncpp],
++    [JSON_SYSTEM_AVAILABLE="yes"],
++    [JSON_SYSTEM_AVAILABLE="no"
++     JSON_CFLAGS='-I$(top_srcdir)/ext_libs/json'
++     JSON_LIBS='$(top_builddir)/ext_libs/json/libjson.la'
++     AC_SUBST(JSON_CFLAGS)
++     AC_SUBST(JSON_LIBS)])
+ AM_CONDITIONAL([USE_LOCAL_JSON], [test "$JSON_SYSTEM_AVAILABLE" = no])
+ 
+-AC_SEARCH_LIBS([mupCreateVar], [muparser], [MUPARSER_SYSTEM_AVAILABLE="yes"],[
+-    MUPARSER_SYSTEM_AVAILABLE="no"
+-    MUPARSER_CFLAGS='-I$(top_srcdir)/ext_libs/muparser'
+-    AC_SUBST(MUPARSER_CFLAGS)
+-    MUPARSER_LIBS='$(top_builddir)/ext_libs/muparser/libmuparser.la'
+-    AC_SUBST(MUPARSER_LIBS)])
++PKG_CHECK_MODULES([MUPARSER], [muparser],
++    [MUPARSER_SYSTEM_AVAILABLE="yes"],
++    [MUPARSER_SYSTEM_AVAILABLE="no"
++     MUPARSER_CFLAGS='-I$(top_srcdir)/ext_libs/muparser'
++     MUPARSER_LIBS='$(top_builddir)/ext_libs/muparser/libmuparser.la'
++     AC_SUBST(MUPARSER_CFLAGS)
++     AC_SUBST(MUPARSER_LIBS)])
+ AM_CONDITIONAL([USE_LOCAL_MUPARSER], [test "$MUPARSER_SYSTEM_AVAILABLE" = no])
+ 
+-AC_SEARCH_LIBS([sqlite3_initialize], [sqlite3], [SQLITE_SYSTEM_AVAILABLE="yes"],[
+-    SQLITE_SYSTEM_AVAILABLE="no"
+-    SQLITE_CFLAGS='-I$(top_srcdir)/ext_libs/sqlite'
+-    AC_SUBST(SQLITE_CFLAGS)
+-    SQLITE_LIBS='$(top_builddir)/ext_libs/sqlite/libsqlite3.la'
+-    AC_SUBST(SQLITE_LIBS)])
++PKG_CHECK_MODULES([SQLITE], [sqlite3],
++    [SQLITE_SYSTEM_AVAILABLE="yes"],
++    [SQLITE_SYSTEM_AVAILABLE="no"
++     SQLITE_CFLAGS='-I$(top_srcdir)/ext_libs/sqlite'
++     SQLITE_LIBS='$(top_builddir)/ext_libs/sqlite/libsqlite3.la'
++     AC_SUBST(SQLITE_CFLAGS)
++     AC_SUBST(SQLITE_LIBS)])
+ AM_CONDITIONAL([USE_LOCAL_SQLITE], [test "$SQLITE_SYSTEM_AVAILABLE" = no])
+ 
+ CFLAGS="$CFLAGS -DMST_UL"
+-- 
+2.55.0
+

diff --git a/mstflint.spec b/mstflint.spec
index 371255e..255a7c2 100644
--- a/mstflint.spec
+++ b/mstflint.spec
@@ -12,13 +12,35 @@ License:	(GPL-2.0-only OR Linux-OpenIB) AND BSD-3-Clause AND MIT AND blessing
 Url:		https://github.com/Mellanox/%{name}
 Source0: 	https://github.com/Mellanox/%{name}/releases/download/v%{version}-1/%{name}-%{version}-1.tar.gz
 
+# jsoncpp and muParser are not in the RHEL/ELN content set, so we must
+# bundle them there. On Fedora, use the system libraries.
+%if !0%{?rhel}
+%bcond_with bundled_jsoncpp
+%bcond_with bundled_muparser
+%else
+%bcond_without bundled_jsoncpp
+%bcond_without bundled_muparser
+%endif
+
 BuildRequires:	make
 BuildRequires:	libstdc++-devel, zlib-devel, libibmad-devel, gcc-c++, gcc
-BuildRequires:  libcurl-devel, boost-devel, libxml2-devel
-BuildRequires:  openssl-devel
-BuildRequires:  expat-devel
+BuildRequires:	libcurl-devel, boost-devel, libxml2-devel
+BuildRequires:	openssl-devel
+BuildRequires:	expat-devel
+BuildRequires:	iniparser-devel
+BuildRequires:	sqlite-devel
+%if %{without bundled_jsoncpp}
+BuildRequires:	jsoncpp-devel
+%else
+Provides:	bundled(jsoncpp)
+%endif
+%if %{without bundled_muparser}
+BuildRequires:	muParser-devel
+%else
+Provides:	bundled(muParser)
+%endif
 %if %{__remake_config}
-BuildRequires:  libtool, autoconf, automake
+BuildRequires:	libtool, autoconf, automake
 %endif
 Obsoletes:	openib-mstflint <= 1.4 openib-tvflash <= 0.9.2 tvflash <= 0.9.0
 ExcludeArch:	s390 %{arm} %{ix86}
@@ -27,6 +49,9 @@ Requires:	python3
 %patchlist
 # https://github.com/Mellanox/mstflint/pull/1831
 0001-mtcr-fix-segfault-in-pciconf-open-when-VSEC-is-not-f.patch
+# fix build with system libraries, https://github.com/Mellanox/mstflint/pull/1848
+0010-mlxconfig-don-t-include-sqlite3.h-via-hardcoded-ext_.patch
+0011-configure.ac-use-pkg-config-to-detect-libraries.patch
 
 %description
 This package contains firmware update tool, vpd dump and register dump tools
@@ -35,6 +60,12 @@ for network adapters based on Mellanox Technologies chips.
 %prep
 %autosetup -p1 -n %{name}-%{version}
 
+# Make sure system libraries are used where possible. Delete the bundled
+# sources. Exception: Keep */Makefile.am files because Makefiles are listed
+# as AC_CONFIG_FILES in configure.ac unconditionally.
+%global _unbundle_libs iniParser,sqlite%{!?with_bundled_jsoncpp:,json}%{!?with_bundled_muparser:,muparser}
+find ext_libs/{%{_unbundle_libs}} -depth -mindepth 1 -name Makefile.am -prune -o -delete
+
 find . -type f -perm /a+x \( -name '*.[ch]' -o -name '*.cpp' \) -exec chmod a-x '{}' '+'
 
 %build

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-12  8:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-12  8:06 [rpms/mstflint] rawhide: use system libs instead of bundled ones Michal Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox