Skip to content

Commit fbd075c

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
2 parents 2508b43 + d7210f2 commit fbd075c

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

cmake/cmake/Configuration.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,6 @@ set(PHP_POSTGRESQL_MIN_VERSION 10.0)
206206
# Minimum required version for the zlib dependency.
207207
set(PHP_ZLIB_MIN_VERSION 1.2.11)
208208

209-
# Minimum required version for the BZip2 dependency.
210-
set(PHP_BZIP2_MIN_VERSION 1.0.0)
211-
212209
# Additional metadata for external packages to avoid duplication.
213210
set_package_properties(
214211
BZip2

cmake/ext/bz2/CMakeLists.txt

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,34 +73,43 @@ target_compile_definitions(
7373
$<$<AND:$<PLATFORM_ID:Windows>,$<IN_LIST:$<TARGET_PROPERTY:TYPE>,MODULE_LIBRARY;SHARED_LIBRARY>>:PHP_BZ2_EXPORTS>
7474
)
7575

76-
find_package(BZip2 ${PHP_BZIP2_MIN_VERSION})
76+
find_package(BZip2 1.0.0)
7777
set_package_properties(
7878
BZip2
7979
PROPERTIES
8080
TYPE REQUIRED
8181
PURPOSE "Necessary to enable the bz2 extension."
8282
)
8383

84-
# Link with PUBLIC scope if include directories are on non-standard places.
85-
target_link_libraries(php_ext_bz2 PUBLIC BZip2::BZip2)
86-
8784
# Minimum version sanity check.
8885
if(TARGET BZip2::BZip2)
8986
cmake_push_check_state(RESET)
9087
set(CMAKE_REQUIRED_LIBRARIES BZip2::BZip2)
9188

92-
check_symbol_exists(BZ2_bzerror bzlib.h _PHP_HAVE_BZ2_BZERROR)
93-
94-
if(NOT _PHP_HAVE_BZ2_BZERROR)
89+
# bzip versions 1.0.1 and earlier required <stdio.h> to be included before
90+
# bzlib.h, to have FILE definition. In 1.0.4, minor version (4) has been
91+
# updated in the bzlib.h header. BZ2_bzerror() is available as of 1.0.0.
92+
block()
93+
set(headers "bzlib.h")
94+
if(BZip2_VERSION VERSION_LESS 1.0.4)
95+
list(PREPEND headers "stdio.h")
96+
endif()
97+
check_symbol_exists(BZ2_bzerror "${headers}" PHP_EXT_BZ2_SANITY_CHECK)
98+
endblock()
99+
100+
if(NOT PHP_EXT_BZ2_SANITY_CHECK)
95101
message(
96102
FATAL_ERROR
97-
"BZip2 package is not working as expected. The bz2 extension requires "
98-
"BZip2 library (libbzip2) version ${PHP_BZIP2_MIN_VERSION} or later."
103+
"ext/bz2 sanity check failed: BZ2_bzerror() could not be found. "
104+
"BZip2 library (libbzip2) version 1.0.0 or later is required."
99105
)
100106
endif()
101107
cmake_pop_check_state()
102108
endif()
103109

110+
# Link with PUBLIC scope if include directories are on non-standard places.
111+
target_link_libraries(php_ext_bz2 PUBLIC BZip2::BZip2)
112+
104113
set(HAVE_BZ2 TRUE)
105114

106115
configure_file(cmake/config.h.in config.h)

0 commit comments

Comments
 (0)