Skip to content

Commit 1f8dda9

Browse files
committed
List all public headers manually
Although might seem cumbersome, this provides better handling and changes in the future as many headers aren't part of the public API. This now also installs some missing generated headers by Bison and RE2C to match the upstream directory tree.
1 parent d00e842 commit 1f8dda9

File tree

8 files changed

+254
-39
lines changed

8 files changed

+254
-39
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ trim_trailing_whitespace = false
2626
[COMMIT_EDITMSG]
2727
max_line_length = 80
2828

29-
[{CMakeLists.txt,*.{cmake,cmake.in}}]
29+
[{CMakeLists.{txt,txt.in},*.{cmake,cmake.in}}]
3030
indent_size = 2

cmake/Zend/CMakeLists.txt

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ mark_as_advanced(ZEND_MAX_EXECUTION_TIMERS)
8181
add_library(zend OBJECT)
8282
add_library(Zend::Zend ALIAS zend)
8383

84-
file(GLOB _zend_headers ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
85-
# Exclude Windows header and specify it below separately.
86-
list(FILTER _zend_headers EXCLUDE REGEX ".*zend_config\\.w32\\.h$")
87-
8884
target_sources(
8985
zend
9086
PRIVATE
@@ -180,8 +176,102 @@ target_sources(
180176
PUBLIC
181177
FILE_SET HEADERS
182178
FILES
183-
${_zend_headers}
179+
zend_alloc_sizes.h
180+
zend_alloc.h
181+
zend_API.h
182+
zend_arena.h
183+
zend_ast.h
184+
zend_atomic.h
185+
zend_attributes_arginfo.h
186+
zend_attributes.h
187+
zend_bitset.h
188+
zend_build.h
189+
zend_builtin_functions_arginfo.h
190+
zend_builtin_functions.h
191+
zend_call_stack.h
192+
zend_closures_arginfo.h
193+
zend_closures.h
194+
zend_compile.h
184195
$<$<PLATFORM_ID:Windows>:zend_config.w32.h>
196+
zend_constants_arginfo.h
197+
zend_constants.h
198+
zend_cpuinfo.h
199+
zend_dtrace.h
200+
zend_enum_arginfo.h
201+
zend_enum.h
202+
zend_errors.h
203+
zend_exceptions_arginfo.h
204+
zend_exceptions.h
205+
zend_execute.h
206+
zend_extensions.h
207+
zend_fibers_arginfo.h
208+
zend_fibers.h
209+
zend_float.h
210+
zend_gc.h
211+
zend_gdb.h
212+
zend_generators_arginfo.h
213+
zend_generators.h
214+
zend_globals_macros.h
215+
zend_globals.h
216+
zend_hash.h
217+
zend_highlight.h
218+
zend_hrtime.h
219+
zend_inheritance.h
220+
zend_ini_parser.h
221+
zend_ini_scanner_defs.h
222+
zend_ini_scanner.h
223+
zend_ini.h
224+
zend_interfaces_arginfo.h
225+
zend_interfaces.h
226+
zend_istdiostream.h
227+
zend_iterators.h
228+
zend_language_parser.h
229+
zend_language_scanner_defs.h
230+
zend_language_scanner.h
231+
zend_list.h
232+
zend_llist.h
233+
zend_long.h
234+
zend_map_ptr.h
235+
zend_max_execution_timer.h
236+
zend_mmap.h
237+
zend_modules.h
238+
zend_multibyte.h
239+
zend_multiply.h
240+
zend_object_handlers.h
241+
zend_objects_API.h
242+
zend_objects.h
243+
zend_observer.h
244+
zend_operators.h
245+
zend_portability.h
246+
zend_ptr_stack.h
247+
zend_range_check.h
248+
zend_signal.h
249+
zend_smart_str_public.h
250+
zend_smart_str.h
251+
zend_smart_string_public.h
252+
zend_smart_string.h
253+
zend_sort.h
254+
zend_stack.h
255+
zend_stream.h
256+
zend_string.h
257+
zend_strtod_int.h
258+
zend_strtod.h
259+
zend_system_id.h
260+
zend_type_info.h
261+
zend_types.h
262+
zend_variables.h
263+
zend_virtual_cwd.h
264+
zend_vm_def.h
265+
zend_vm_execute.h
266+
zend_vm_handlers.h
267+
zend_vm_opcodes.h
268+
zend_vm_trace_handlers.h
269+
zend_vm_trace_lines.h
270+
zend_vm_trace_map.h
271+
zend_vm.h
272+
zend_weakrefs_arginfo.h
273+
zend_weakrefs.h
274+
zend.h
185275
Optimizer/zend_call_graph.h
186276
Optimizer/zend_cfg.h
187277
Optimizer/zend_dfg.h

cmake/ext/gd/CMakeLists.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ target_sources(
139139
PUBLIC
140140
FILE_SET HEADERS
141141
FILES
142+
gd_arginfo.h
143+
gd_compat.h
142144
php_gd.h
143145
)
144146

145147
if(NOT EXT_GD_EXTERNAL)
146-
file(GLOB _php_gd_libgd_headers ${CMAKE_CURRENT_SOURCE_DIR}/libgd/*.h)
147-
148148
target_sources(
149149
php_gd
150150
PRIVATE
@@ -191,7 +191,21 @@ if(NOT EXT_GD_EXTERNAL)
191191
PUBLIC
192192
FILE_SET HEADERS
193193
FILES
194-
${_php_gd_libgd_headers}
194+
libgd/bmp.h
195+
libgd/gd_errors.h
196+
libgd/gd_intern.h
197+
libgd/gd_io.h
198+
libgd/gd_tga.h
199+
libgd/gd.h
200+
libgd/gdcache.h
201+
libgd/gdfontg.h
202+
libgd/gdfontl.h
203+
libgd/gdfontmb.h
204+
libgd/gdfonts.h
205+
libgd/gdfontt.h
206+
libgd/gdhelpers.h
207+
libgd/jisx0208.h
208+
libgd/wbmp.h
195209
)
196210

197211
set(HAVE_GD_BUNDLED 1 CACHE INTERNAL "Whether the bundled libgd is used")

cmake/ext/mysqlnd/CMakeLists.txt

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ else()
5050
add_library(php_mysqlnd)
5151
endif()
5252

53-
file(GLOB _php_mysqlnd_headers ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
54-
# Exclude Windows header and specify it below separately.
55-
list(FILTER _php_mysqlnd_headers EXCLUDE REGEX ".*config-win\\.h$")
56-
5753
target_sources(
5854
php_mysqlnd
5955
PRIVATE
@@ -82,8 +78,33 @@ target_sources(
8278
PUBLIC
8379
FILE_SET HEADERS
8480
FILES
85-
${_php_mysqlnd_headers}
8681
$<$<PLATFORM_ID:Windows>:config-win.h>
82+
mysql_float_to_double.h
83+
mysqlnd_alloc.h
84+
mysqlnd_auth.h
85+
mysqlnd_block_alloc.h
86+
mysqlnd_charset.h
87+
mysqlnd_commands.h
88+
mysqlnd_connection.h
89+
mysqlnd_debug.h
90+
mysqlnd_enum_n_def.h
91+
mysqlnd_ext_plugin.h
92+
mysqlnd_libmysql_compat.h
93+
mysqlnd_plugin.h
94+
mysqlnd_portability.h
95+
mysqlnd_priv.h
96+
mysqlnd_protocol_frame_codec.h
97+
mysqlnd_ps.h
98+
mysqlnd_read_buffer.h
99+
mysqlnd_result_meta.h
100+
mysqlnd_result.h
101+
mysqlnd_reverse_api.h
102+
mysqlnd_statistics.h
103+
mysqlnd_structs.h
104+
mysqlnd_vio.h
105+
mysqlnd_wireprotocol.h
106+
mysqlnd.h
107+
php_mysqlnd.h
87108
)
88109

89110
target_compile_definitions(php_mysqlnd PRIVATE ZEND_ENABLE_STATIC_TSRMLS_CACHE=1)

cmake/ext/pcre/CMakeLists.txt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,6 @@ else()
111111
message(STATUS "Using bundled PCRE library")
112112

113113
block()
114-
file(GLOB headers ${CMAKE_CURRENT_SOURCE_DIR}/pcre2lib/*.h)
115-
116-
# Exclude PCRE2 library config.h header as it uses the
117-
# HAVE_PCRE_VALGRIND_SUPPORT provided via compile definition by generator
118-
# expressions (not available in the PHP configuration headers). It isn't
119-
# required to use public headers. Perhaps more could be filtered and synced
120-
# with upstream PCRE installed headers.
121-
list(FILTER headers EXCLUDE REGEX ".*config\\.h$")
122-
123114
target_sources(
124115
php_pcre
125116
PRIVATE
@@ -153,7 +144,18 @@ else()
153144
PUBLIC
154145
FILE_SET HEADERS
155146
FILES
156-
${headers}
147+
# Exclude PCRE2 library config.h header as it uses the
148+
# HAVE_PCRE_VALGRIND_SUPPORT provided via compile definition by
149+
# generator expressions (not available in the PHP configuration
150+
# headers). It isn't required to use public headers. Perhaps more
151+
# could be filtered and synced with upstream PCRE installed headers.
152+
#pcre2lib/config.h
153+
pcre2lib/pcre2_internal.h
154+
pcre2lib/pcre2_intmodedep.h
155+
pcre2lib/pcre2_jit_neon_inc.h
156+
pcre2lib/pcre2_jit_simd_inc.h
157+
pcre2lib/pcre2_ucp.h
158+
pcre2lib/pcre2.h
157159
)
158160
endblock()
159161

cmake/ext/standard/CMakeLists.txt

Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ add_feature_info(
3434

3535
add_library(php_standard STATIC)
3636

37-
file(GLOB _php_standard_headers ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
38-
# Exclude Windows header and specify it below separately.
39-
list(FILTER _php_standard_headers EXCLUDE REGEX ".*winver\\.h$")
40-
4137
target_sources(
4238
php_standard
4339
PRIVATE
@@ -112,7 +108,69 @@ target_sources(
112108
PUBLIC
113109
FILE_SET HEADERS
114110
FILES
115-
${_php_standard_headers}
111+
base64.h
112+
basic_functions_arginfo.h
113+
basic_functions.h
114+
crc32_x86.h
115+
crc32.h
116+
credits_ext.h
117+
credits_sapi.h
118+
credits.h
119+
crypt_blowfish.h
120+
crypt_freesec.h
121+
css.h
122+
datetime.h
123+
dir_arginfo.h
124+
dl_arginfo.h
125+
dl.h
126+
exec.h
127+
file_arginfo.h
128+
file.h
129+
flock_compat.h
130+
fsock.h
131+
head.h
132+
html_tables.h
133+
html.h
134+
info.h
135+
md5.h
136+
pack.h
137+
pageinfo.h
138+
php_array.h
139+
php_assert.h
140+
php_browscap.h
141+
php_crypt_r.h
142+
php_crypt.h
143+
php_dir.h
144+
php_dns.h
145+
php_ext_syslog.h
146+
php_filestat.h
147+
php_fopen_wrappers.h
148+
php_http.h
149+
php_image.h
150+
php_incomplete_class.h
151+
php_lcg.h
152+
php_mail.h
153+
php_math.h
154+
php_mt_rand.h
155+
php_net.h
156+
php_password.h
157+
php_rand.h
158+
php_random.h
159+
php_smart_string_public.h
160+
php_smart_string.h
161+
php_standard.h
162+
php_string.h
163+
php_uuencode.h
164+
php_var.h
165+
php_versioning.h
166+
proc_open.h
167+
quot_print.h
168+
scanf.h
169+
sha1.h
170+
streamsfuncs.h
171+
url_scanner_ex.h
172+
url.h
173+
user_filters_arginfo.h
116174
$<$<PLATFORM_ID:Windows>:winver.h>
117175
)
118176

cmake/main/CMakeLists.txt

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ include(FeatureSummary)
33
add_library(php_main STATIC)
44
add_library(PHP::main ALIAS php_main)
55

6-
file(GLOB_RECURSE _php_main_headers ${CMAKE_CURRENT_SOURCE_DIR}/*.h)
7-
86
target_sources(
97
php_main
108
PRIVATE
@@ -46,11 +44,46 @@ target_sources(
4644
streams/xp_socket.c
4745
strlcat.c
4846
strlcpy.c
49-
${PHP_BINARY_DIR}/main/build-defs.h
5047
PUBLIC
5148
FILE_SET HEADERS
5249
FILES
53-
${_php_main_headers}
50+
fastcgi.h
51+
fopen_wrappers.h
52+
http_status_codes.h
53+
main_arginfo.h
54+
php_compat.h
55+
php_content_types.h
56+
php_getopt.h
57+
php_globals.h
58+
php_ini_builder.h
59+
php_ini.h
60+
php_main.h
61+
php_memory_streams.h
62+
php_network.h
63+
php_odbc_utils.h
64+
php_open_temporary_file.h
65+
php_output.h
66+
php_reentrancy.h
67+
php_scandir.h
68+
php_streams.h
69+
php_syslog.h
70+
php_ticks.h
71+
php_variables.h
72+
php_version.h
73+
php.h
74+
rfc1867.h
75+
SAPI.h
76+
snprintf.h
77+
spprintf.h
78+
streams/php_stream_context.h
79+
streams/php_stream_filter_api.h
80+
streams/php_stream_glob_wrapper.h
81+
streams/php_stream_mmap.h
82+
streams/php_stream_plain_wrapper.h
83+
streams/php_stream_transport.h
84+
streams/php_stream_userspace.h
85+
streams/php_streams_int.h
86+
streams/userspace_arginfo.h
5487
# A separate file set so binary dir can also be created within a source dir.
5588
PUBLIC
5689
FILE_SET HEADERS
@@ -87,12 +120,9 @@ target_link_libraries(
87120
# Link publicly for PHP SAPIs.
88121
PUBLIC
89122
PHP::configuration
123+
$<$<TARGET_EXISTS:PHP::win32>:PHP::win32>
90124
)
91125

92-
if(TARGET PHP::win32)
93-
target_link_libraries(php_main PUBLIC PHP::win32)
94-
endif()
95-
96126
# Add DTrace.
97127
if(PHP_DTRACE)
98128
message(CHECK_START "Checking for DTrace support")

0 commit comments

Comments
 (0)