|
12 | 12 | endif() |
13 | 13 | include(PHP/BISON) |
14 | 14 |
|
15 | | -if(BISON_FOUND) |
16 | | - php_bison( |
17 | | - zend_ini_parser |
18 | | - zend_ini_parser.y |
19 | | - ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.c |
20 | | - COMPILE_FLAGS "${PHP_BISON_DEFAULT_OPTIONS}" |
21 | | - VERBOSE REPORT_FILE zend_ini_parser.output |
22 | | - DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.h |
23 | | - ) |
| 15 | +php_bison( |
| 16 | + zend_ini_parser |
| 17 | + zend_ini_parser.y |
| 18 | + ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.c |
| 19 | + COMPILE_FLAGS "${PHP_BISON_DEFAULT_OPTIONS}" |
| 20 | + VERBOSE REPORT_FILE zend_ini_parser.output |
| 21 | + DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_parser.h |
| 22 | +) |
24 | 23 |
|
25 | | - php_bison( |
26 | | - zend_language_parser |
27 | | - zend_language_parser.y |
28 | | - ${CMAKE_CURRENT_SOURCE_DIR}/zend_language_parser.c |
29 | | - COMPILE_FLAGS "${PHP_BISON_DEFAULT_OPTIONS}" |
30 | | - VERBOSE REPORT_FILE zend_language_parser.output |
31 | | - DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zend_language_parser.h |
32 | | - ) |
| 24 | +php_bison( |
| 25 | + zend_language_parser |
| 26 | + zend_language_parser.y |
| 27 | + ${CMAKE_CURRENT_SOURCE_DIR}/zend_language_parser.c |
| 28 | + COMPILE_FLAGS "${PHP_BISON_DEFAULT_OPTIONS}" |
| 29 | + VERBOSE REPORT_FILE zend_language_parser.output |
| 30 | + DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR}/zend_language_parser.h |
| 31 | +) |
33 | 32 |
|
34 | | - # Tweak zendparse to be exported through ZEND_API. This has to be revisited |
35 | | - # once bison supports foreign skeletons and that bison version is used. Read |
36 | | - # https://git.savannah.gnu.org/cgit/bison.git/tree/data/README.md for more. |
37 | | - block() |
| 33 | +# Tweak zendparse to be exported through ZEND_API. This has to be revisited |
| 34 | +# once bison supports foreign skeletons and that bison version is used. Read |
| 35 | +# https://git.savannah.gnu.org/cgit/bison.git/tree/data/README.md for more. |
| 36 | +block() |
| 37 | + string( |
| 38 | + CONCAT patch |
| 39 | + "set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})\n" |
| 40 | + [[ |
| 41 | + file(READ "${SOURCE_DIR}/zend_language_parser.h" content) |
38 | 42 | string( |
39 | | - CONCAT patch |
40 | | - "set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})\n" |
41 | | - [[ |
42 | | - file(READ "${SOURCE_DIR}/zend_language_parser.h" content) |
43 | | - string( |
44 | | - REPLACE |
45 | | - "int zendparse" |
46 | | - "ZEND_API int zendparse" |
47 | | - content_2 |
48 | | - "${content}" |
49 | | - ) |
50 | | - if( |
51 | | - NOT content MATCHES "ZEND_API int zendparse" |
52 | | - AND NOT content STREQUAL "${content_2}" |
53 | | - ) |
54 | | - message(STATUS "[Zend] Patching zend_language_parser.h") |
55 | | - file(WRITE "${SOURCE_DIR}/zend_language_parser.h" "${content_2}") |
56 | | - endif() |
57 | | - |
58 | | - file(READ "${SOURCE_DIR}/zend_language_parser.c" content) |
59 | | - string( |
60 | | - REPLACE |
61 | | - "int zendparse" |
62 | | - "ZEND_API int zendparse" |
63 | | - content_2 |
64 | | - "${content}" |
65 | | - ) |
66 | | - if( |
67 | | - NOT content MATCHES "ZEND_API int zendparse" |
68 | | - AND NOT content STREQUAL "${content_2}" |
69 | | - ) |
70 | | - message(STATUS "[Zend] Patching zend_language_parser.c") |
71 | | - file(WRITE "${SOURCE_DIR}/zend_language_parser.c" "${content_2}") |
72 | | - endif() |
73 | | - ]]) |
| 43 | + REPLACE |
| 44 | + "int zendparse" |
| 45 | + "ZEND_API int zendparse" |
| 46 | + content_2 |
| 47 | + "${content}" |
| 48 | + ) |
| 49 | + if( |
| 50 | + NOT content MATCHES "ZEND_API int zendparse" |
| 51 | + AND NOT content STREQUAL "${content_2}" |
| 52 | + ) |
| 53 | + message(STATUS "[Zend] Patching zend_language_parser.h") |
| 54 | + file(WRITE "${SOURCE_DIR}/zend_language_parser.h" "${content_2}") |
| 55 | + endif() |
74 | 56 |
|
75 | | - # Run patch based on whether building or running inside a CMake script. |
76 | | - if(CMAKE_SCRIPT_MODE_FILE) |
77 | | - cmake_language(EVAL CODE "${patch}") |
78 | | - else() |
79 | | - file( |
80 | | - GENERATE |
81 | | - OUTPUT CMakeFiles/PatchLanguageParser.cmake |
82 | | - CONTENT "${patch}" |
83 | | - ) |
84 | | - add_custom_target( |
85 | | - zend_patch_language_parser |
86 | | - COMMAND ${CMAKE_COMMAND} -P CMakeFiles/PatchLanguageParser.cmake |
87 | | - DEPENDS ${BISON_zend_language_parser_OUTPUTS} |
88 | | - VERBATIM |
89 | | - ) |
90 | | - add_dependencies(zend zend_patch_language_parser) |
| 57 | + file(READ "${SOURCE_DIR}/zend_language_parser.c" content) |
| 58 | + string( |
| 59 | + REPLACE |
| 60 | + "int zendparse" |
| 61 | + "ZEND_API int zendparse" |
| 62 | + content_2 |
| 63 | + "${content}" |
| 64 | + ) |
| 65 | + if( |
| 66 | + NOT content MATCHES "ZEND_API int zendparse" |
| 67 | + AND NOT content STREQUAL "${content_2}" |
| 68 | + ) |
| 69 | + message(STATUS "[Zend] Patching zend_language_parser.c") |
| 70 | + file(WRITE "${SOURCE_DIR}/zend_language_parser.c" "${content_2}") |
91 | 71 | endif() |
92 | | - endblock() |
93 | | -endif() |
| 72 | + ]]) |
| 73 | + |
| 74 | + # Run patch based on whether building or running inside a CMake script. |
| 75 | + if(CMAKE_SCRIPT_MODE_FILE) |
| 76 | + cmake_language(EVAL CODE "${patch}") |
| 77 | + else() |
| 78 | + file( |
| 79 | + GENERATE |
| 80 | + OUTPUT CMakeFiles/PatchLanguageParser.cmake |
| 81 | + CONTENT "${patch}" |
| 82 | + ) |
| 83 | + add_custom_target( |
| 84 | + zend_patch_language_parser |
| 85 | + COMMAND ${CMAKE_COMMAND} -P CMakeFiles/PatchLanguageParser.cmake |
| 86 | + DEPENDS ${BISON_zend_language_parser_OUTPUTS} |
| 87 | + VERBATIM |
| 88 | + ) |
| 89 | + add_dependencies(zend zend_patch_language_parser) |
| 90 | + endif() |
| 91 | +endblock() |
94 | 92 |
|
95 | 93 | if( |
96 | 94 | EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zend_ini_scanner.c |
|
0 commit comments