From 05b0e923b235f50dcb31171637335d19f2ac0689 Mon Sep 17 00:00:00 2001 From: Bob Chen Date: Wed, 13 Nov 2024 01:36:00 +0800 Subject: [PATCH] Update openssl and curl version for 'PHOTON_BUILD_DEPENDENCIES' option --- .github/workflows/ci.linux.arm.yml | 13 +++++------- CMake/build-from-src.cmake | 32 ++++++++++-------------------- CMakeLists.txt | 11 +++++----- examples/CMakeLists.txt | 3 +++ 4 files changed, 23 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.linux.arm.yml b/.github/workflows/ci.linux.arm.yml index 59d0eb0c..dd948a4f 100644 --- a/.github/workflows/ci.linux.arm.yml +++ b/.github/workflows/ci.linux.arm.yml @@ -50,17 +50,14 @@ jobs: - uses: actions/checkout@v4 - name: Build run: | - dnf -q -y install git gcc-c++ cmake gcc-toolset-9-gcc-c++ openssl-devel libcurl-devel - dnf -q -y install autoconf automake libtool + dnf -q -y install git gcc-c++ cmake gcc-toolset-9-gcc-c++ source /opt/rh/gcc-toolset-9/enable cmake -B build -D CMAKE_BUILD_TYPE=Debug \ - -D PHOTON_ENABLE_ECOSYSTEM=ON \ + -D PHOTON_BUILD_DEPENDENCIES=ON \ -D PHOTON_BUILD_TESTING=ON \ + -D PHOTON_ENABLE_ECOSYSTEM=ON \ -D PHOTON_ENABLE_SASL=OFF \ -D PHOTON_ENABLE_FUSE=OFF \ -D PHOTON_ENABLE_URING=ON \ - -D PHOTON_ENABLE_EXTFS=OFF \ - -D PHOTON_BUILD_DEPENDENCIES=ON \ - -D PHOTON_OPENSSL_SOURCE="" \ - -D PHOTON_CURL_SOURCE="" - cmake --build build -j $(nproc) -- VERBOSE=1 + -D PHOTON_ENABLE_EXTFS=OFF + cmake --build build -j $(nproc) diff --git a/CMake/build-from-src.cmake b/CMake/build-from-src.cmake index d1b12e4a..9e55c4e7 100644 --- a/CMake/build-from-src.cmake +++ b/CMake/build-from-src.cmake @@ -82,12 +82,12 @@ function(build_from_src [dep]) ExternalProject_Add( openssl URL ${PHOTON_OPENSSL_SOURCE} - URL_MD5 bad68bb6bd9908da75e2c8dedc536b29 + URL_MD5 3f76825f195e52d4b10c70040681a275 UPDATE_DISCONNECTED ON BUILD_IN_SOURCE ON - CONFIGURE_COMMAND ./config -fPIC --prefix=${BINARY_DIR} --openssldir=${BINARY_DIR} shared - BUILD_COMMAND make -j 1 # https://github.com/openssl/openssl/issues/5762#issuecomment-376622684 - INSTALL_COMMAND make -j 1 install + CONFIGURE_COMMAND ./config -fPIC --prefix=${BINARY_DIR} --openssldir=${BINARY_DIR} no-shared + BUILD_COMMAND $(MAKE) + INSTALL_COMMAND $(MAKE) install LOG_CONFIGURE ON LOG_BUILD ON LOG_INSTALL ON @@ -104,26 +104,14 @@ function(build_from_src [dep]) ExternalProject_Add( curl URL ${PHOTON_CURL_SOURCE} - URL_MD5 a66270f11e3fbfad709600bbd1686704 - UPDATE_DISCONNECTED ON - BUILD_IN_SOURCE ON - CONFIGURE_COMMAND autoreconf -i COMMAND ./configure --with-ssl=${OPENSSL_ROOT_DIR} - --without-libssh2 --enable-static --enable-shared=no --enable-optimize - --disable-manual --without-libidn - --disable-ftp --disable-file --disable-ldap --disable-ldaps - --disable-rtsp --disable-dict --disable-telnet --disable-tftp - --disable-pop3 --disable-imap --disable-smb --disable-smtp - --disable-gopher --without-nghttp2 --enable-http --disable-verbose - --with-pic=PIC --prefix=${BINARY_DIR} - BUILD_COMMAND $(MAKE) - INSTALL_COMMAND $(MAKE) install - DEPENDS openssl - LOG_CONFIGURE ON - LOG_BUILD ON - LOG_INSTALL ON + URL_MD5 1211d641ae670cebce361ab6a7c6acff + CMAKE_ARGS -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR} -DCMAKE_INSTALL_PREFIX=${BINARY_DIR} + -DBUILD_SHARED_LIBS=OFF -DHTTP_ONLY=ON -DBUILD_CURL_EXE=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON ) + add_dependencies(curl openssl) set(CURL_INCLUDE_DIRS ${BINARY_DIR}/include PARENT_SCOPE) - set(CURL_LIBRARIES ${BINARY_DIR}/lib/libcurl.a PARENT_SCOPE) + set(CURL_LIBRARIES ${BINARY_DIR}/lib64/libcurl.a PARENT_SCOPE) endif () list(APPEND actually_built ${dep}) diff --git a/CMakeLists.txt b/CMakeLists.txt index b2f6d252..6ac2a882 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,8 +31,8 @@ option(PHOTON_ENABLE_ECOSYSTEM "enable ecosystem" OFF) option(PHOTON_BUILD_DEPENDENCIES "" OFF) set(PHOTON_AIO_SOURCE "https://pagure.io/libaio/archive/libaio-0.3.113/libaio-0.3.113.tar.gz" CACHE STRING "") set(PHOTON_ZLIB_SOURCE "https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.gz" CACHE STRING "") -set(PHOTON_OPENSSL_SOURCE "https://github.com/openssl/openssl/archive/refs/heads/OpenSSL_1_0_2-stable.tar.gz" CACHE STRING "") -set(PHOTON_CURL_SOURCE "https://github.com/curl/curl/archive/refs/tags/curl-7_42_1.tar.gz" CACHE STRING "") +set(PHOTON_OPENSSL_SOURCE "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz" CACHE STRING "") +set(PHOTON_CURL_SOURCE "https://github.com/curl/curl/releases/download/curl-7_88_1/curl-7.88.1.tar.gz" CACHE STRING "") set(PHOTON_URING_SOURCE "https://github.com/axboe/liburing/archive/refs/tags/liburing-2.3.tar.gz" CACHE STRING "") set(PHOTON_FUSE_SOURCE "" CACHE STRING "") set(PHOTON_GSASL_SOURCE "" CACHE STRING "") @@ -353,11 +353,9 @@ else () ) endif () -# Build test cases +# Build examples and test cases if (PHOTON_BUILD_TESTING) - include_directories(photon_static ${GFLAGS_INCLUDE_DIRS} ${GOOGLETEST_INCLUDE_DIRS}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/examples-output) - link_libraries(${GFLAGS_LIBRARIES}) add_subdirectory(examples) include(CTest) @@ -367,7 +365,8 @@ if (PHOTON_BUILD_TESTING) add_library(ci-tools STATIC test/ci-tools.cpp) target_include_directories(ci-tools PRIVATE include) - link_libraries(${GFLAGS_LIBRARIES} ${GOOGLETEST_LIBRARIES} ci-tools) + target_include_directories(photon_shared PUBLIC ${CURL_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS} ${GOOGLETEST_INCLUDE_DIRS}) + target_link_libraries(photon_shared PUBLIC ${CURL_LIBRARIES} ${GFLAGS_LIBRARIES} ${GOOGLETEST_LIBRARIES} ci-tools) add_subdirectory(common/checksum/test) add_subdirectory(common/test) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index cf82f5d3..e2e278ee 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,6 @@ +link_libraries(${GFLAGS_LIBRARIES}) +include_directories(${GFLAGS_INCLUDE_DIRS}) + add_executable(simple-example simple/simple.cpp) target_link_libraries(simple-example PRIVATE photon_static)