From d726b77698ed806fb84e482fb40202548095fbe1 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 9 Jan 2024 15:35:15 +0100 Subject: [PATCH] Fix build with GCC 14 --- hplip-hpaio-gcc14.patch | 114 ++++++++++++++++++++++++++++++++++++++++ hplip.spec | 8 ++- 2 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 hplip-hpaio-gcc14.patch diff --git a/hplip-hpaio-gcc14.patch b/hplip-hpaio-gcc14.patch new file mode 100644 index 0000000..f7d195e --- /dev/null +++ b/hplip-hpaio-gcc14.patch @@ -0,0 +1,114 @@ +diff --git a/scan/sane/hpaio.c b/scan/sane/hpaio.c +index 57d1dde..3475929 100644 +--- a/scan/sane/hpaio.c ++++ b/scan/sane/hpaio.c +@@ -379,7 +379,7 @@ extern SANE_Status sane_hpaio_get_devices(const SANE_Device ***deviceList, SANE_ + ResetDeviceList(&DeviceList); + DevDiscovery(localOnly); + *deviceList = (const SANE_Device **)DeviceList; +- SANE_Device*** devList; ++ const SANE_Device*** devList; + orblite_get_devices(devList, localOnly); + + return SANE_STATUS_GOOD; +diff --git a/scan/sane/orblite.c b/scan/sane/orblite.c +index 2eb7aba..4eaa468 100644 +--- a/scan/sane/orblite.c ++++ b/scan/sane/orblite.c +@@ -64,28 +64,28 @@ SANE_Option_Descriptor DefaultOrbOptions[] = { + SANE_NAME_SCAN_TL_X, SANE_TITLE_SCAN_TL_X, SANE_DESC_SCAN_TL_X, // name, title, desc + SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeLeft // constraint_type, constraint ++ SANE_CONSTRAINT_RANGE, (const SANE_Char**)&SANE_rangeLeft // constraint_type, constraint + }, + + { + SANE_NAME_SCAN_TL_Y, SANE_TITLE_SCAN_TL_Y, SANE_DESC_SCAN_TL_Y, // name, title, desc + SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeTop // constraint_type, constraint ++ SANE_CONSTRAINT_RANGE, (const SANE_Char**)&SANE_rangeTop // constraint_type, constraint + }, + + { + SANE_NAME_SCAN_BR_X, SANE_TITLE_SCAN_BR_X, SANE_DESC_SCAN_BR_X, // name, title, desc + SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeRight // constraint_type, constraint ++ SANE_CONSTRAINT_RANGE, (const SANE_Char**)&SANE_rangeRight // constraint_type, constraint + }, + + { + SANE_NAME_SCAN_BR_Y, SANE_TITLE_SCAN_BR_Y, SANE_DESC_SCAN_BR_Y, // name, title, desc + SANE_TYPE_FIXED, SANE_UNIT_MM, sizeof(SANE_Fixed),// type, unit, size + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_RANGE, (SANE_Char**)&SANE_rangeBottom // constraint_type, constraint ++ SANE_CONSTRAINT_RANGE, (const SANE_Char**)&SANE_rangeBottom // constraint_type, constraint + }, + + // optResolution, // resolution group +@@ -93,7 +93,7 @@ SANE_Option_Descriptor DefaultOrbOptions[] = { + SANE_NAME_SCAN_RESOLUTION, SANE_TITLE_SCAN_RESOLUTION, SANE_DESC_SCAN_RESOLUTION, // name, title, desc + SANE_TYPE_INT, SANE_UNIT_DPI, sizeof(SANE_Word), // type, unit, size, + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_WORD_LIST, (SANE_Char**)SANE_resolutions // constraint type, constraint ++ SANE_CONSTRAINT_WORD_LIST, (const SANE_Char**)SANE_resolutions // constraint type, constraint + }, + + // optMode, // color/depth group +@@ -101,7 +101,7 @@ SANE_Option_Descriptor DefaultOrbOptions[] = { + SANE_NAME_SCAN_MODE, SANE_TITLE_SCAN_MODE, SANE_DESC_SCAN_MODE, // name, title, desc + SANE_TYPE_STRING, SANE_UNIT_NONE, 256, // type, unit, size, + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_STRING_LIST, (SANE_Char**)SANE_modes // constraint type, constraint ++ SANE_CONSTRAINT_STRING_LIST, (const SANE_Char**)SANE_modes // constraint type, constraint + }, + + // optSource, +@@ -109,7 +109,7 @@ SANE_Option_Descriptor DefaultOrbOptions[] = { + SANE_NAME_SCAN_SOURCE, SANE_TITLE_SCAN_SOURCE, SANE_DESC_SCAN_SOURCE, // name, title, desc + SANE_TYPE_STRING, SANE_UNIT_NONE, 256, // type, unit, size, + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_STRING_LIST, (SANE_Char**)SANE_sources // constraint type, constraint ++ SANE_CONSTRAINT_STRING_LIST, (const SANE_Char**)SANE_sources // constraint type, constraint + }, + + // optPaperSize, +@@ -117,7 +117,7 @@ SANE_Option_Descriptor DefaultOrbOptions[] = { + SANE_NAME_PAPER_SIZE, SANE_TITLE_PAPER_SIZE, SANE_DESC_PAPER_SIZE, // name, title, desc + SANE_TYPE_STRING, SANE_UNIT_NONE, 256, // type, unit, size, + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_STRING_LIST, (SANE_Char**)SANE_paper_sizes // constraint type, constraint ++ SANE_CONSTRAINT_STRING_LIST, (const SANE_Char**)SANE_paper_sizes // constraint type, constraint + }, + + // optPaperSize, +@@ -125,7 +125,7 @@ SANE_Option_Descriptor DefaultOrbOptions[] = { + SANE_NAME_PAPER_SIZE, SANE_TITLE_PAPER_SIZE, SANE_DESC_PAPER_SIZE, // name, title, desc + SANE_TYPE_INT, SANE_UNIT_DPI, sizeof(SANE_Word), // type, unit, size, + SANE_CAP_SOFT_SELECT | SANE_CAP_SOFT_DETECT, // cap(ability) +- SANE_CONSTRAINT_WORD_LIST, (SANE_Char**)SANE_resolutions // constraint type, constraint ++ SANE_CONSTRAINT_WORD_LIST, (const SANE_Char**)SANE_resolutions // constraint type, constraint + }, + #ifdef NOTDEF + // default template +@@ -274,6 +274,7 @@ orblite_open (SANE_String_Const devicename, SANE_Handle * handle) + SANE_Auth_Callback authorize; + const SANE_Device *** device_list; + SANE_Bool local_only; ++ void * temp_handle; + + + // Allocate handle, set all handle values to zero +@@ -305,7 +306,9 @@ orblite_open (SANE_String_Const devicename, SANE_Handle * handle) + if (stat != SANE_STATUS_GOOD) + return stat; + +- stat = g_handle->bb_orblite_open(devicename, &g_handle); ++ temp_handle = g_handle; ++ stat = g_handle->bb_orblite_open(devicename, &temp_handle); ++ g_handle = temp_handle; + if (stat == SANE_STATUS_GOOD) + *handle = g_handle; + diff --git a/hplip.spec b/hplip.spec index c81a746..4dbb361 100644 --- a/hplip.spec +++ b/hplip.spec @@ -235,7 +235,9 @@ Patch69: hplip-no-readfp.patch # fix SyntaxWarning from python3.12 # https://bugs.launchpad.net/hplip/+bug/2029480 Patch70: hplip-use-raw-strings.patch -Patch71: hplip-hpaio-c99.patch +# FTBFS GCC 14 +# https://bugs.launchpad.net/hplip/+bug/2048780 +Patch71: hplip-hpaio-gcc14.patch %if 0%{?fedora} || 0%{?rhel} <= 8 # mention hplip-gui if you want to have GUI @@ -590,7 +592,9 @@ done # fix warnings # upstream https://bugs.launchpad.net/hplip/+bug/2029480 %patch -P 70 -p1 -b .raw-strings -%patch -P 71 -p1 -b .hpaio-c99 +# FTBFS GCC 14 +# https://bugs.launchpad.net/hplip/+bug/2048780 +%patch -P 71 -p1 -b .hpaio-gcc14 # Fedora specific patches now, don't put a generic patches under it %if 0%{?fedora} || 0%{?rhel} <= 8