Add CURL and OpenSSL the new way

This commit is contained in:
tamasmeszaros 2021-03-20 16:16:50 +01:00
parent d1cdf80fef
commit 974967640b
5 changed files with 205 additions and 97 deletions

4
deps/CMakeLists.txt vendored
View File

@ -153,6 +153,8 @@ include(MPFR/MPFR.cmake)
include(CGAL/CGAL.cmake)
include(NLopt/NLopt.cmake)
include(TBB/TBB.cmake)
include(OpenSSL/OpenSSL.cmake)
include(CURL/CURL.cmake)
include(wxWidgets/wxWidgets.cmake)
if (NOT "${ZLIB_PKG}" STREQUAL "")
@ -165,7 +167,7 @@ add_dependencies(dep_openvdb dep_TBB)
set(_dep_list
dep_boost
dep_TBB
dep_libcurl
dep_CURL
dep_wxWidgets
dep_cereal
dep_NLopt

73
deps/CURL/CURL.cmake vendored Normal file
View File

@ -0,0 +1,73 @@
set(_curl_platform_flags
-DENABLE_IPV6:BOOL=ON
-DENABLE_VERSIONED_SYMBOLS:BOOL=ON
-DENABLE_THREADED_RESOLVER:BOOL=ON
-DCURL_DISABLE_LDAP:BOOL=ON
-DCURL_DISABLE_LDAPS:BOOL=ON
-DENABLE_MANUAL:BOOL=OFF
-DCURL_DISABLE_RTSP:BOOL=ON
-DCURL_DISABLE_DICT:BOOL=ON
-DCURL_DISABLE_TELNET:BOOL=ON
-DCURL_DISABLE_POP3:BOOL=ON
-DCURL_DISABLE_IMAP:BOOL=ON
-DCURL_DISABLE_SMB:BOOL=ON
-DCURL_DISABLE_SMTP:BOOL=ON
-DCURL_DISABLE_GOPHER:BOOL=ON
-DCMAKE_USE_GSSAPI:BOOL=OFF
-DCMAKE_USE_LIBSSH2:BOOL=OFF
-DUSE_RTMP:BOOL=OFF
-DUSE_NGHTTP2:BOOL=OFF
-DUSE_MBEDTLS:BOOL=OFF
)
if (APPLE)
set(_curl_platform_flags
${_curl_platform_flags}
-DCMAKE_USE_DARWINSSL:BOOL=ON
-DCMAKE_USE_OPENSSL:BOOL=OFF
-DCURL_CA_PATH:STRING=none
)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(_curl_platform_flags
${_curl_platform_flags}
-DCMAKE_USE_OPENSSL:BOOL=ON
-DCURL_CA_PATH:STRING=none
-DCURL_CA_BUNDLE:STRING=none
-DCURL_CA_FALLBACK:BOOL=ON
)
endif ()
if (BUILD_SHARED_LIBS)
set(_curl_static OFF)
else()
set(_curl_static ON)
endif()
prusaslicer_add_cmake_project(CURL
GIT_REPOSITORY https://github.com/curl/curl.git
GIT_TAG curl-7_75_0
DEPENDS ${ZLIB_PKG}
# PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
# ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/curl-mods.patch
CMAKE_ARGS
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCURL_STATICLIB=${_curl_static}
${_curl_platform_flags}
)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_dependencies(dep_CURL dep_OpenSSL)
endif ()
if (MSVC)
add_debug_dep(dep_CURL)
endif ()

32
deps/OpenSSL/OpenSSL.cmake vendored Normal file
View File

@ -0,0 +1,32 @@
include(ProcessorCount)
ProcessorCount(NPROC)
set(_cross_arch "")
set(_cross_comp_prefix_line "")
if (CMAKE_CROSSCOMPILING)
set(_cross_comp_prefix_line "--cross-compile-prefix=${TOOLCHAIN_PREFIX}")
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
set(_cross_arch "linux-aarch64")
elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armhf") # For raspbian
# TODO: verify
set(_cross_arch "linux-armv4")
endif ()
endif ()
ExternalProject_Add(dep_OpenSSL
EXCLUDE_FROM_ALL ON
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0l.tar.gz"
URL_HASH SHA256=e2acf0cf58d9bff2b42f2dc0aee79340c8ffe2c5e45d3ca4533dd5d4f5775b1d
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ./Configure ${_cross_arch}
"--prefix=${DESTDIR}/usr/local"
${_cross_comp_prefix_line}
no-shared
no-ssl3-method
no-dynamic-engine
-Wa,--noexecstack
BUILD_COMMAND make depend && make "-j${NPROC}"
INSTALL_COMMAND make install_sw
)

129
deps/deps-linux.cmake vendored
View File

@ -33,72 +33,73 @@ ExternalProject_Add(dep_boost
INSTALL_COMMAND "" # b2 does that already
)
ExternalProject_Add(dep_libopenssl
EXCLUDE_FROM_ALL 1
URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0l.tar.gz"
URL_HASH SHA256=e2acf0cf58d9bff2b42f2dc0aee79340c8ffe2c5e45d3ca4533dd5d4f5775b1d
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./config
"--prefix=${DESTDIR}/usr/local"
"--libdir=lib"
no-shared
no-ssl3-method
no-dynamic-engine
-Wa,--noexecstack
BUILD_COMMAND make depend && make "-j${NPROC}"
INSTALL_COMMAND make install_sw
)
# ExternalProject_Add(dep_libopenssl
# EXCLUDE_FROM_ALL 1
# URL "https://github.com/openssl/openssl/archive/OpenSSL_1_1_0l.tar.gz"
# URL_HASH SHA256=e2acf0cf58d9bff2b42f2dc0aee79340c8ffe2c5e45d3ca4533dd5d4f5775b1d
# BUILD_IN_SOURCE 1
# CONFIGURE_COMMAND ./config
# "--prefix=${DESTDIR}/usr/local"
# "--libdir=lib"
# no-shared
# no-ssl3-method
# no-dynamic-engine
# -Wa,--noexecstack
# BUILD_COMMAND make depend && make "-j${NPROC}"
# INSTALL_COMMAND make install_sw
# )
ExternalProject_Add(dep_libcurl
EXCLUDE_FROM_ALL 1
DEPENDS dep_libopenssl
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./configure
--enable-static
--disable-shared
"--with-ssl=${DESTDIR}/usr/local"
--with-pic
--enable-ipv6
--enable-versioned-symbols
--enable-threaded-resolver
--with-random=/dev/urandom
# ExternalProject_Add(dep_libcurl
# EXCLUDE_FROM_ALL 1
# DEPENDS dep_libopenssl
# URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
# URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
# BUILD_IN_SOURCE 1
# CONFIGURE_COMMAND ./configure
# --enable-static
# --disable-shared
# "--with-ssl=${DESTDIR}/usr/local"
# --with-pic
# --enable-ipv6
# --enable-versioned-symbols
# --enable-threaded-resolver
# --with-random=/dev/urandom
# CA root certificate paths will be set for openssl at runtime.
--without-ca-bundle
--without-ca-path
--with-ca-fallback # to look for the ssl backend's ca store
# # CA root certificate paths will be set for openssl at runtime.
# --without-ca-bundle
# --without-ca-path
# --with-ca-fallback # to look for the ssl backend's ca store
# --disable-ldap
# --disable-ldaps
# --disable-manual
# --disable-rtsp
# --disable-dict
# --disable-telnet
# --disable-pop3
# --disable-imap
# --disable-smb
# --disable-smtp
# --disable-gopher
# --without-gssapi
# --without-libpsl
# --without-libidn2
# --without-gnutls
# --without-polarssl
# --without-mbedtls
# --without-cyassl
# --without-nss
# --without-axtls
# --without-brotli
# --without-libmetalink
# --without-libssh
# --without-libssh2
# --without-librtmp
# --without-nghttp2
# --without-zsh-functions-dir
# BUILD_COMMAND make "-j${NPROC}"
# INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
# )
--disable-ldap
--disable-ldaps
--disable-manual
--disable-rtsp
--disable-dict
--disable-telnet
--disable-pop3
--disable-imap
--disable-smb
--disable-smtp
--disable-gopher
--without-gssapi
--without-libpsl
--without-libidn2
--without-gnutls
--without-polarssl
--without-mbedtls
--without-cyassl
--without-nss
--without-axtls
--without-brotli
--without-libmetalink
--without-libssh
--without-libssh2
--without-librtmp
--without-nghttp2
--without-zsh-functions-dir
BUILD_COMMAND make "-j${NPROC}"
INSTALL_COMMAND make install "DESTDIR=${DESTDIR}"
)
add_dependencies(dep_openvdb dep_boost)

View File

@ -94,39 +94,39 @@ ExternalProject_Add(dep_cereal
INSTALL_COMMAND ""
)
if (${DEPS_BITS} EQUAL 32)
set(DEP_LIBCURL_TARGET "x86")
else ()
set(DEP_LIBCURL_TARGET "x64")
endif ()
# if (${DEPS_BITS} EQUAL 32)
# set(DEP_LIBCURL_TARGET "x86")
# else ()
# set(DEP_LIBCURL_TARGET "x64")
# endif ()
ExternalProject_Add(dep_libcurl
EXCLUDE_FROM_ALL 1
URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND cd winbuild && nmake /f Makefile.vc mode=static "VC=${DEP_VS_VER}" GEN_PDB=yes DEBUG=no "MACHINE=${DEP_LIBCURL_TARGET}"
INSTALL_COMMAND cd builds\\libcurl-*-release-*-winssl
&& "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
&& "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
)
if (${DEP_DEBUG})
ExternalProject_Get_Property(dep_libcurl SOURCE_DIR)
ExternalProject_Add_Step(dep_libcurl build_debug
DEPENDEES build
DEPENDERS install
COMMAND cd winbuild && nmake /f Makefile.vc mode=static "VC=${DEP_VS_VER}" GEN_PDB=yes DEBUG=yes "MACHINE=${DEP_LIBCURL_TARGET}"
WORKING_DIRECTORY "${SOURCE_DIR}"
)
ExternalProject_Add_Step(dep_libcurl install_debug
DEPENDEES install
COMMAND cd builds\\libcurl-*-debug-*-winssl
&& "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
&& "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
WORKING_DIRECTORY "${SOURCE_DIR}"
)
endif ()
# ExternalProject_Add(dep_libcurl
# EXCLUDE_FROM_ALL 1
# URL "https://curl.haxx.se/download/curl-7.58.0.tar.gz"
# URL_HASH SHA256=cc245bf9a1a42a45df491501d97d5593392a03f7b4f07b952793518d97666115
# BUILD_IN_SOURCE 1
# CONFIGURE_COMMAND ""
# BUILD_COMMAND cd winbuild && nmake /f Makefile.vc mode=static "VC=${DEP_VS_VER}" GEN_PDB=yes DEBUG=no "MACHINE=${DEP_LIBCURL_TARGET}"
# INSTALL_COMMAND cd builds\\libcurl-*-release-*-winssl
# && "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
# && "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
# )
# if (${DEP_DEBUG})
# ExternalProject_Get_Property(dep_libcurl SOURCE_DIR)
# ExternalProject_Add_Step(dep_libcurl build_debug
# DEPENDEES build
# DEPENDERS install
# COMMAND cd winbuild && nmake /f Makefile.vc mode=static "VC=${DEP_VS_VER}" GEN_PDB=yes DEBUG=yes "MACHINE=${DEP_LIBCURL_TARGET}"
# WORKING_DIRECTORY "${SOURCE_DIR}"
# )
# ExternalProject_Add_Step(dep_libcurl install_debug
# DEPENDEES install
# COMMAND cd builds\\libcurl-*-debug-*-winssl
# && "${CMAKE_COMMAND}" -E copy_directory include "${DESTDIR}\\usr\\local\\include"
# && "${CMAKE_COMMAND}" -E copy_directory lib "${DESTDIR}\\usr\\local\\lib"
# WORKING_DIRECTORY "${SOURCE_DIR}"
# )
# endif ()
ExternalProject_Add(dep_qhull
EXCLUDE_FROM_ALL 1