@@ -173,6 +173,31 @@ ExternalProject_Add(
173173)
174174set (LIBIDN2_STATIC_LIB ${LIBIDN2_INSTALL_DIR} /lib/libidn2.a)
175175
176+ # Install librtmp only if using OpenSSL
177+ if (TARGET openssl_external)
178+ set (LIBRTMP_URL git://git.ffmpeg.org/rtmpdump)
179+ set (LIBRTMP_INSTALL_DIR ${CMAKE_BINARY_DIR} /librtmp-install )
180+
181+ ExternalProject_Add(
182+ librtmp_external
183+ GIT_REPOSITORY ${LIBRTMP_URL}
184+ GIT_SHALLOW 1
185+ PREFIX ${CMAKE_BINARY_DIR} /librtmp
186+ SOURCE_SUBDIR librtmp
187+ CONFIGURE_COMMAND ""
188+ BUILD_COMMAND ${CMAKE_SOURCE_DIR} /scripts/build_rtmp.sh <SOURCE_DIR> ${LIBRTMP_INSTALL_DIR} ${OPENSSL_INSTALL_DIR} ${ZLIB_INSTALL_DIR}
189+ INSTALL_COMMAND $(MAKE) prefix =${LIBRTMP_INSTALL_DIR} SHARED= install
190+ BUILD_IN_SOURCE 1
191+ DOWNLOAD_EXTRACT_TIMESTAMP TRUE
192+ )
193+ set (LIBRTMP_STATIC_LIB ${LIBRTMP_INSTALL_DIR} /lib/librtmp.a)
194+ set (LIBRTMP_DEP librtmp_external)
195+ else ()
196+ message (STATUS "Not building librtmp as OpenSSL is not enabled" )
197+ set (LIBRTMP_STATIC_LIB "" )
198+ set (LIBRTMP_DEP "" )
199+ endif ()
200+
176201# Install GDB if GDBMODE is set
177202set (GDB_VERSION 13.2)
178203set (GDB_URL https://ftp.gnu.org/gnu/gdb/gdb-${GDB_VERSION} .tar.gz)
@@ -203,6 +228,7 @@ add_custom_target(deps
203228 nghttp2_external
204229 zstd_external
205230 libidn2_external
231+ ${LIBRTMP_DEP}
206232 ${GDB_DEP}
207233)
208234
@@ -236,6 +262,7 @@ set(CURL_CONFIGURE_COMMAND
236262 --with-nghttp2=${NGHTTP2_INSTALL_DIR}
237263 --with-zstd=${ZSTD_INSTALL_DIR}
238264 --with-libidn2=${LIBIDN2_INSTALL_DIR}
265+ --with-librtmp=${LIBRTMP_INSTALL_DIR}
239266)
240267
241268set (CURL_POST_INSTALL_COMMAND
@@ -260,6 +287,8 @@ if (DEFINED ENV{CURL_SOURCE_DIR})
260287 BUILD_IN_SOURCE 1
261288 )
262289else ()
290+ # Use the tag from curl-container as it's semver and reasonably up to date.
291+ # renovate: datasource=github-tags depName=curl/curl-container
263292 set (CURL_VERSION 8.14.1)
264293 message (STATUS "Building curl from downloaded source, version ${CURL_VERSION} " )
265294 # The URL needs dots replaced with underscores for curl's release naming convention.
@@ -285,6 +314,7 @@ set(CURL_DEPS
285314 zlib_external
286315 zstd_external
287316 libidn2_external
317+ ${LIBRTMP_DEP}
288318)
289319
290320# Add dependencies for curl
@@ -330,6 +360,7 @@ set(COMMON_FLAGS -g -DCURL_DISABLE_DEPRECATION)
330360set (COMMON_LINK_LIBS
331361 ${CURL_LIB_DIR} /libcurl.a
332362 ${NGHTTP2_STATIC_LIB}
363+ ${LIBRTMP_STATIC_LIB}
333364 ${OPENSSL_STATIC_LIB}
334365 ${ZLIB_STATIC_LIB}
335366 ${ZSTD_STATIC_LIB}
@@ -364,35 +395,27 @@ add_curl_fuzzer(curl_fuzzer_https HTTPS)
364395add_curl_fuzzer(curl_fuzzer_imap IMAP)
365396add_curl_fuzzer(curl_fuzzer_mqtt MQTT)
366397add_curl_fuzzer(curl_fuzzer_pop3 POP3)
398+ add_curl_fuzzer(curl_fuzzer_rtmp RTMP)
367399add_curl_fuzzer(curl_fuzzer_rtsp RTSP)
368400add_curl_fuzzer(curl_fuzzer_smb SMB)
369401add_curl_fuzzer(curl_fuzzer_smtp SMTP)
370402add_curl_fuzzer(curl_fuzzer_tftp TFTP)
371403add_curl_fuzzer(curl_fuzzer_ws WS)
372404
373- # BUFQ fuzzer
374- add_executable (curl_fuzzer_bufq fuzz_bufq.cc)
375- target_compile_options (curl_fuzzer_bufq PRIVATE ${COMMON_FLAGS} )
376- target_include_directories (curl_fuzzer_bufq PRIVATE ${CURL_INCLUDE_DIRS} )
377- target_link_libraries (curl_fuzzer_bufq PRIVATE ${COMMON_LINK_LIBS} )
378- target_link_options (curl_fuzzer_bufq PRIVATE ${COMMON_LINK_OPTIONS} )
379- add_dependencies (curl_fuzzer_bufq ${FUZZ_DEPS} )
380-
381- # URL fuzzer
382- add_executable (fuzz_url fuzz_url.cc)
383- target_compile_options (fuzz_url PRIVATE ${COMMON_FLAGS} )
384- target_include_directories (fuzz_url PRIVATE ${CURL_INCLUDE_DIRS} )
385- target_link_libraries (fuzz_url PRIVATE ${COMMON_LINK_LIBS} )
386- target_link_options (fuzz_url PRIVATE ${COMMON_LINK_OPTIONS} )
387- add_dependencies (fuzz_url ${FUZZ_DEPS} )
388-
389- # Unit test fuzzer
390- add_executable (curl_fuzzer_fnmatch fuzz_fnmatch.cc)
391- target_compile_options (curl_fuzzer_fnmatch PRIVATE ${COMMON_FLAGS} )
392- target_include_directories (curl_fuzzer_fnmatch PRIVATE ${CURL_INCLUDE_DIRS} )
393- target_link_libraries (curl_fuzzer_fnmatch PRIVATE ${COMMON_LINK_LIBS} )
394- target_link_options (curl_fuzzer_fnmatch PRIVATE ${COMMON_LINK_OPTIONS} )
395- add_dependencies (curl_fuzzer_fnmatch ${FUZZ_DEPS} )
405+ # Helper macro to define a fuzzer target with source files
406+ macro (add_curl_fuzzer_sources name sources )
407+ add_executable (${name} ${sources} )
408+ target_compile_options (${name} PRIVATE ${COMMON_FLAGS} )
409+ target_include_directories (${name} PRIVATE ${CURL_INCLUDE_DIRS} )
410+ target_link_libraries (${name} PRIVATE ${COMMON_LINK_LIBS} )
411+ target_link_options (${name} PRIVATE ${COMMON_LINK_OPTIONS} )
412+ add_dependencies (${name} ${FUZZ_DEPS} )
413+ endmacro ()
414+
415+ # Add single file fuzzers
416+ add_curl_fuzzer_sources(curl_fuzzer_bufq fuzz_bufq.cc)
417+ add_curl_fuzzer_sources(fuzz_url fuzz_url.cc)
418+ add_curl_fuzzer_sources(curl_fuzzer_fnmatch fuzz_fnmatch.cc)
396419
397420# Create a custom target for all fuzzers
398421add_custom_target (fuzz
@@ -407,6 +430,7 @@ add_custom_target(fuzz
407430 curl_fuzzer_imap
408431 curl_fuzzer_mqtt
409432 curl_fuzzer_pop3
433+ curl_fuzzer_rtmp
410434 curl_fuzzer_rtsp
411435 curl_fuzzer_smb
412436 curl_fuzzer_smtp
0 commit comments