Add patches for Doxygen and GObject introspection to improve compatibility with Yacc

This commit is contained in:
2026-07-17 07:45:45 -05:00
parent 4f914253b7
commit 94aeb45fa6
3 changed files with 122 additions and 33 deletions
+60
View File
@@ -0,0 +1,60 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,8 +256,9 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_ALLOW_KEYWORD_MACROS=")
endif()
endif()
+find_program(BISON_EXECUTABLE NAMES bison byacc yacc)
find_package(BISON REQUIRED)
-if(BISON_VERSION VERSION_LESS 2.7)
+if(BISON_VERSION AND BISON_VERSION VERSION_LESS 2.7)
message(SEND_ERROR "Doxygen requires at least bison version 2.7 (installed: ${BISON_VERSION})")
endif()
find_package(Threads)
--- a/deps/libmscgen/CMakeLists.txt
+++ b/deps/libmscgen/CMakeLists.txt
@@ -30,6 +30,7 @@
mscgen_ps_out.c
mscgen_null_out.c
${GENERATED_SRC}/mscgen_language.cpp
+${GENERATED_SRC}/mscgen_language.h
${GENERATED_SRC}/mscgen_lexer.cpp
${GENERATED_SRC}/mscgen_lexer.l.h
mscgen_api.c
@@ -44,4 +45,5 @@
BISON_TARGET(mscgen_language
mscgen_language.y
${GENERATED_SRC}/mscgen_language.cpp
+ DEFINES_FILE ${GENERATED_SRC}/mscgen_language.h
COMPILE_FLAGS "${YACC_FLAGS}")
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -182,7 +182,8 @@
BISON_TARGET(constexp
${CMAKE_CURRENT_LIST_DIR}/constexp.y
${GENERATED_SRC}/ce_parse.cpp
- COMPILE_FLAGS "${YACC_FLAGS}")
+ DEFINES_FILE ${GENERATED_SRC}/ce_parse.hpp
+ COMPILE_FLAGS "${YACC_FLAGS} -p constexpYY")
if(enable_coverage)
add_custom_command(
--- a/src/constexp.y
+++ b/src/constexp.y
@@ -22,6 +22,8 @@
#include <stdio.h>
#include <stdlib.h>
+#define YYSTACKDATA constexpYYSTACKDATA
+
int constexpYYerror(yyscan_t yyscanner, const char *s)
{
struct constexpYY_state* yyextra = constexpYYget_extra(yyscanner);
@@ -33,7 +35,6 @@
%}
-%define api.prefix {constexpYY}
%define api.pure full
%lex-param {yyscan_t yyscanner}
%parse-param {yyscan_t yyscanner}
@@ -1,30 +1,3 @@
diff --git a/test/run-test.sh b/test/run-test.sh
index 9b3c91c..73c0d3e 100644
--- a/test/run-test.sh
+++ b/test/run-test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# fontconfig/test/run-test.sh
#
# Copyright © 2000 Keith Packard
@@ -84,11 +84,11 @@ fstat() {
ret=$(stat -c "$fmt" "$fn")
else
# BSD
- if [ "x$fmt" == "x%Y" ]; then
+ if [ "x$fmt" = "x%Y" ]; then
ret=$(stat -f "%m" "$fn")
- elif [ "x$fmt" == "x%y" ]; then
+ elif [ "x$fmt" = "x%y" ]; then
ret=$(stat -f "%Sm" -t "%F %T %z" "$fn")
- elif [ "x$fmt" == "x%n %s %y %z" ]; then
+ elif [ "x$fmt" = "x%n %s %y %z" ]; then
ret=$(stat -f "%SN %z %Sm %Sc" -t "%F %T %z" "$fn")
else
echo "E: Unknown format"
diff --git a/test/run-test-map.sh b/test/run-test-map.sh
index 869d7b2..c634bb8 100755
--- a/test/run-test-map.sh
+++ b/test/run-test-map.sh
@@ -1,4 +1,4 @@
@@ -33,7 +6,7 @@ index 869d7b2..c634bb8 100755
# fontconfig/test/run-test-cache-map.sh
#
# Copyright © 2018 Keith Packard
@@ -41,9 +41,8 @@ EXPECTED="out-map.expected"
@@ -41,9 +41,8 @@
FCLIST=../fc-list/fc-list$EXEEXT
FCCACHE=../fc-cache/fc-cache$EXEEXT
@@ -45,16 +18,33 @@ index 869d7b2..c634bb8 100755
fi
FONT1=$TESTDIR/4x6.pcf
diff --git a/test/wrapper-script.sh b/test/wrapper-script.sh
index 94dcb85..ae68c6d 100755
--- a/test/run-test.d/remap-flatpak.sh
+++ b/test/run-test.d/remap-flatpak.sh
@@ -83,13 +83,13 @@
$BWRAP --bind / / --ro-bind "$TESTCACHE2DIR" /usr/lib/fontconfig/cache --ro-bind "$TESTFONT2DIR" /usr/share/fonts --bind "$TESTBUILD2DIR" /usr/share/fontconfig --ro-bind "$TESTRUNDIR" "$TESTRUNDIR" --ro-bind "$TESTCACHE1DIR" "$TESTRUNDIR"/fonts-cache --ro-bind "$TESTFONT1DIR" "$TESTRUNDIR"/fonts --dev-bind /dev /dev --setenv FONTCONFIG_FILE "$TESTBUILD2DIR"/bind-fonts.conf ls $(sed 's/:file=//' "$TESTRESULT3") > /dev/null
# Check the amount of cache files
-if [ $(ls "$TESTCACHE1DIR"|wc -l) == 2 ]; then : ; else
+if [ "$(ls "$TESTCACHE1DIR" | wc -l)" -eq 2 ]; then : ; else
echo "*** Test failed: $TEST"
echo "Too much cache files created at host cache dir."
ls "$TESTCACHE1DIR"
exit 1
fi
-if [ $(ls "$TESTCACHE2DIR"|wc -l) == 2 ]; then : ; else
+if [ "$(ls "$TESTCACHE2DIR" | wc -l)" -eq 2 ]; then : ; else
echo "*** Test failed: $TEST"
echo "Too much cache files created at runtime cache dir."
ls "$TESTCACHE2DIR"
--- a/test/wrapper-script.sh
+++ b/test/wrapper-script.sh
@@ -1,20 +1,24 @@
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! /bin/sh
CC=${CC:-gcc}
set -e
@@ -7,16 +7,20 @@
case "$1" in
*.exe)
export WINEPATH=$(${CC} -print-sysroot)/mingw/bin
@@ -69,7 +59,7 @@ index 94dcb85..ae68c6d 100755
+ esac
+ done)
+ cd "$mingw_path" || exit 1
+ if [ "$(dirname -- "$1")" = "." ]; then
+ if [ "$(dirname "$1")" = "." ]; then
+ /usr/bin/env wine "$fccwd/$1"
else
- /usr/bin/env wine $@
@@ -0,0 +1,39 @@
--- a/giscanner/meson.build
+++ b/giscanner/meson.build
@@ -55,12 +55,12 @@
subdir('doctemplates/mallard')
flex = find_program('flex', 'win_flex')
-bison = find_program('bison', 'win_bison')
+yacc = find_program('yacc', 'bison', 'win_bison')
scannerparser = custom_target('scannerparser',
input: 'scannerparser.y',
output: ['scannerparser.c', 'scannerparser.h'],
- command: [bison, '@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@']
+ command: [yacc, '-d', '-o', '@OUTPUT0@', '@INPUT@']
)
--- a/giscanner/scannerparser.y
+++ b/giscanner/scannerparser.y
@@ -250,7 +250,7 @@
%}
-%define parse.error verbose
+%error-verbose
%union {
char *str;
GList *list;
@@ -266,8 +266,8 @@
%lex-param { GISourceScanner* scanner }
%token <str> BASIC_TYPE
-%token <str> IDENTIFIER "identifier"
-%token <str> TYPEDEF_NAME "typedef-name"
+%token <str> IDENTIFIER
+%token <str> TYPEDEF_NAME
%token INTEGER FLOATING BOOLEAN CHARACTER STRING