File: fix-FTBFS-on-mipsel-and-m68k-src-solid-predicate_parser.c.patch

package info (click to toggle)
solid 5.116.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,420 kB
  • sloc: cpp: 19,542; xml: 464; lex: 111; yacc: 83; sh: 14; makefile: 5
file content (52 lines) | stat: -rw-r--r-- 2,254 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: James Cowgill <jcowgill@debian.org>
Date: Wed, 30 Nov 2016 15:50:47 +0100
Subject: fix FTBFS on mipsel and m68k - src/solid/predicate_parser.c: No such
 file or directory

In src/solid/CMakeLists.txt, the parser is generated using bison_target
which uses add_custom_command under the hood. The output file is then
added to the list of sources creating a file-level dependency from the
KF5Solid target to the bison/flex generation command. However, the list
of sources is later used as part of the KF5Solid_static target. Since
file-level dependencies cannot cross between targets, the bison
generation happens twice completely independently as part of the two
targets. If you are very unlucky, the generation in one target can
happen at the same time as the compilation of the parser in the other
target causing a collision.

This patch should fix that by putting the generation in a
separate target and manually adding a dependency on it. This forces the
parser to be generated before anything is compiled.
---
 src/solid/CMakeLists.txt         | 2 ++
 src/solid/devices/CMakeLists.txt | 1 +
 2 files changed, 3 insertions(+)

--- a/src/solid/CMakeLists.txt
+++ b/src/solid/CMakeLists.txt
@@ -9,6 +9,7 @@ endif()
 set(solid_LIB_SRCS ${solid_LIB_SRCS} ${solid_QM_LOADER})
 
 add_library(KF5Solid  ${solid_LIB_SRCS})
+add_dependencies(KF5Solid SolidParserTarget)
 set(solid_BUILD_INCLUDE_DIRS
     ${CMAKE_CURRENT_BINARY_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR}/..
@@ -102,6 +103,7 @@ install(TARGETS KF5Solid EXPORT KF5Solid
 
 if (BUILD_TESTING)
   add_library(KF5Solid_static STATIC ${solid_LIB_SRCS})
+  add_dependencies(KF5Solid_static SolidParserTarget)
   set_target_properties(KF5Solid_static PROPERTIES COMPILE_FLAGS -DSOLID_STATIC_DEFINE=1)
 
   target_link_libraries(KF5Solid_static PUBLIC Qt${QT_MAJOR_VERSION}::Core)
--- a/src/solid/devices/CMakeLists.txt
+++ b/src/solid/devices/CMakeLists.txt
@@ -101,6 +101,7 @@ flex_target(SolidLexer
 )
 add_flex_bison_dependency(SolidLexer SolidParser)
 list(APPEND solid_LIB_SRCS ${BISON_SolidParser_OUTPUTS} ${FLEX_SolidLexer_OUTPUTS})
+add_custom_target(SolidParserTarget DEPENDS ${BISON_SolidParser_OUTPUTS} ${FLEX_SolidLexer_OUTPUTS})
 
 include(CheckIncludeFiles)
 include(CheckFunctionExists)