diff --git a/0001-Fix-build-error-when-sys-io.h-is-ot-available.patch b/0001-Fix-build-error-when-sys-io.h-is-ot-available.patch new file mode 100644 index 0000000..5b5b9f4 --- /dev/null +++ b/0001-Fix-build-error-when-sys-io.h-is-ot-available.patch @@ -0,0 +1,69 @@ +From 478099cf46e577c91c9a932d07e4fd6eb83f14d2 Mon Sep 17 00:00:00 2001 +From: Richard Hughes +Date: Wed, 6 Oct 2021 16:50:24 +0100 +Subject: [PATCH] Fix build error when sys/io.h is ot available + +--- + meson.build | 3 +++ + plugins/flashrom/fu-flashrom-cmos.c | 10 +++++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 547eb64a..7557cd4a 100644 +--- a/meson.build ++++ b/meson.build +@@ -314,6 +314,9 @@ endif + if cc.has_header('sys/socket.h') + conf.set('HAVE_SOCKET_H', '1') + endif ++if cc.has_header('sys/io.h') ++ conf.set('HAVE_IO_H', '1') ++endif + if cc.has_header('linux/ethtool.h') + conf.set('HAVE_ETHTOOL_H', '1') + endif +diff --git a/plugins/flashrom/fu-flashrom-cmos.c b/plugins/flashrom/fu-flashrom-cmos.c +index 490f0240..77f2cc65 100644 +--- a/plugins/flashrom/fu-flashrom-cmos.c ++++ b/plugins/flashrom/fu-flashrom-cmos.c +@@ -5,10 +5,13 @@ + */ + #include "config.h" + ++#ifdef HAVE_IO_H + #include ++#endif + + #include "fu-flashrom-cmos.h" + ++#ifdef HAVE_IO_H + static gboolean + fu_flashrom_cmos_write(guint8 addr, guint8 val) + { +@@ -29,10 +32,12 @@ fu_flashrom_cmos_write(guint8 addr, guint8 val) + /* Check the read value against the written */ + return (tmp == val); + } ++#endif + + gboolean + fu_flashrom_cmos_reset(GError **error) + { ++#ifdef HAVE_IO_H + /* Call ioperm() to grant us access to ports 0x70 and 0x71 */ + if (ioperm(RTC_BASE_PORT, 2, TRUE) < 0) { + g_set_error_literal(error, +@@ -50,6 +55,9 @@ fu_flashrom_cmos_reset(GError **error) + } + + /* success */ +- + return TRUE; ++#else ++ g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "no support"); ++ return FALSE; ++#endif + } +-- +2.32.0 + diff --git a/fwupd.spec b/fwupd.spec index 847347f..706a471 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -50,6 +50,9 @@ License: LGPLv2+ URL: https://github.com/fwupd/fwupd Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz +# backported from upstream +Patch0: 0001-Fix-build-error-when-sys-io.h-is-ot-available.patch + BuildRequires: gettext BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: libxmlb-devel >= %{libxmlb_version}