Skip to content

Commit 4912961

Browse files
committed
Add zstd option for mainline to work
1 parent 582a9ae commit 4912961

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

CMakeLists.txt

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@ ExternalProject_Add(
2323
)
2424
set(ZLIB_STATIC_LIB ${ZLIB_INSTALL_DIR}/lib/libz.a)
2525

26+
# Install zstd
27+
#
28+
# renovate: datasource=github-tags depName=facebook/zstd
29+
set(ZSTD_VERSION 1.5.6)
30+
set(ZSTD_URL https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz)
31+
set(ZSTD_INSTALL_DIR ${CMAKE_BINARY_DIR}/zstd-install)
32+
33+
ExternalProject_Add(
34+
zstd_external
35+
URL ${ZSTD_URL}
36+
PREFIX ${CMAKE_BINARY_DIR}/zstd
37+
SOURCE_SUBDIR build/cmake
38+
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${ZSTD_INSTALL_DIR} -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_STATIC=ON
39+
BUILD_COMMAND $(MAKE)
40+
INSTALL_COMMAND $(MAKE) install
41+
BUILD_IN_SOURCE 0
42+
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
43+
)
44+
set(ZSTD_STATIC_LIB ${ZSTD_INSTALL_DIR}/lib/libzstd.a)
45+
2646
# For the memory sanitizer build, turn off OpenSSL as it causes bugs we can't
2747
# affect (see 16697, 17624)
2848
if(NOT (DEFINED ENV{SANITIZER} AND "$ENV{SANITIZER}" STREQUAL "memory"))
@@ -113,6 +133,7 @@ set(NGHTTP2_CONFIGURE_COMMAND
113133
--enable-static
114134
--disable-threads
115135
--enable-lib-only
136+
--with-zlib=${ZLIB_INSTALL_DIR}
116137
${NGHTTP2_OPENSSL_OPTION}
117138
)
118139

@@ -171,7 +192,6 @@ else()
171192
set(CURL_SSL_OPTION "--without-ssl")
172193
endif()
173194

174-
set(CURL_NGHTTP2_OPTION "--with-nghttp2=${NGHTTP2_INSTALL_DIR}")
175195
set(CURL_CONFIGURE_COMMAND
176196
autoreconf -fi &&
177197
./configure
@@ -186,7 +206,9 @@ set(CURL_CONFIGURE_COMMAND
186206
--without-libpsl
187207
--with-random=/dev/null
188208
${CURL_SSL_OPTION}
189-
${CURL_NGHTTP2_OPTION}
209+
--with-zlib=${ZLIB_INSTALL_DIR}
210+
--with-nghttp2=${NGHTTP2_INSTALL_DIR}
211+
--with-zstd=${ZSTD_INSTALL_DIR}
190212
)
191213

192214
set(CURL_POST_INSTALL_COMMAND
@@ -232,7 +254,7 @@ endif()
232254
set(CURL_STATIC_LIB ${CURL_INSTALL_DIR}/lib/libcurl.a)
233255

234256
# Add dependencies for curl
235-
add_dependencies(curl_external nghttp2_external ${OPENSSL_DEP} zlib_external)
257+
add_dependencies(curl_external nghttp2_external ${OPENSSL_DEP} zlib_external zstd_external)
236258

237259
# Now it's time for the main targets!
238260
#
@@ -276,6 +298,7 @@ set(COMMON_LINK_LIBS
276298
${NGHTTP2_STATIC_LIB}
277299
${OPENSSL_STATIC_LIB}
278300
${ZLIB_STATIC_LIB}
301+
${ZSTD_STATIC_LIB}
279302
${LIB_FUZZING_ENGINE}
280303
pthread
281304
m

scripts/VERSIONS

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)