This is an automated email from the ASF dual-hosted git repository. jeremydyer pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 7b2137c0f25ef68f2e9f7c612f8b30464c166583 Author: Marc Parisi <[email protected]> AuthorDate: Mon Mar 11 12:21:49 2019 -0400 MINIFICPP-762: Update static linkings. Download and build dependencies that we can't guarantee on platforms --- .travis.yml | 5 + CMakeLists.txt | 157 +++++++++++++-------- README.md | 2 + bootstrap.sh | 10 ++ bstrp_functions.sh | 19 ++- centos.sh | 4 +- cmake/BuildTests.cmake | 5 +- cmake/ssl/FindOpenSSL.cmake | 28 ++++ controller/CMakeLists.txt | 7 +- docker/Dockerfile | 2 +- extensions/coap/tests/CMakeLists.txt | 8 +- extensions/expression-language/CMakeLists.txt | 1 + extensions/http-curl/CMakeLists.txt | 14 +- extensions/http-curl/tests/CMakeLists.txt | 12 +- extensions/libarchive/CMakeLists.txt | 18 +-- extensions/mqtt/CMakeLists.txt | 7 +- extensions/pcap/CMakeLists.txt | 9 +- libminifi/CMakeLists.txt | 4 +- libminifi/src/processors/GetTCP.cpp | 4 + libminifi/test/archive-tests/CMakeLists.txt | 8 +- libminifi/test/civetweb-tests/CMakeLists.txt | 4 +- libminifi/test/script-tests/CMakeLists.txt | 12 +- main/CMakeLists.txt | 33 +++-- nanofi/CMakeLists.txt | 4 +- rheldistro.sh | 2 +- thirdparty/date/CMakeLists.txt | 6 +- .../libarchive-3.3.2/libarchive/CMakeLists.txt | 20 +-- 27 files changed, 250 insertions(+), 155 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6e6c08d..063ffbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,6 +60,11 @@ matrix: - docker script: - ./bootstrap.sh -e -t && cd build && make docker + - os: linux + dist: trusty + sudo: required + script: + - ./bootstrap.sh -e -t && cd build && cmake -DUSE_SHARED_LIBS= .. && make -j2 VERBOSE=1 && sudo make test ARGS="-j2 --output-on-failure" - os: osx osx_image: xcode8.3 env: diff --git a/CMakeLists.txt b/CMakeLists.txt index 058b992..e79a30f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,31 +23,39 @@ set(PROJECT_NAME "nifi-minifi-cpp") set(PROJECT_VERSION_MAJOR 0) set(PROJECT_VERSION_MINOR 6) set(PROJECT_VERSION_PATCH 0) + +include(CMakeDependentOption) +include(CheckIncludeFile) +include(FeatureSummary) +include(ExternalProject) + option(SKIP_TESTS "Skips building all tests." OFF) + option(PORTABLE "Instructs the compiler to remove architecture specific optimizations" ON) -option(USE_SYSTEM_OPENSSL "Instructs the build system to search for and use an SSL library available in the host system" ON) + +option(USE_SHARED_LIBS "Builds using shared libraries" ON) + +option(ENABLE_PYTHON "Instructs the build system to enable building shared objects for the python lib" OFF) + +cmake_dependent_option(STATIC_BUILD "Attempts to statically link as many dependencies as possible." ON "NOT ENABLE_PYTHON; NOT USE_SHARED_LIBS" OFF) + +cmake_dependent_option(USE_SYSTEM_OPENSSL "Instructs the build system to search for and use an SSL library available in the host system" ON "NOT STATIC_BUILD" OFF) + option(OPENSSL_OFF "Disables OpenSSL" OFF) option(ENABLE_OPS "Enable Operations/zlib Tools" ON) -option(USE_SYSTEM_UUID "Instructs the build system to search for and use an UUID library available in the host system" OFF) +option(USE_SYSTEM_UUID "Instructs the build system to search for and use a UUID library available in the host system" OFF) + option(ENABLE_JNI "Instructs the build system to enable the JNI extension" OFF) -option(USE_SYSTEM_CURL "Instructs the build system to search for and use a cURL library available in the host system" ON) -option(BUILD_SHARED_LIBS "Build yaml cpp shared lib" OFF) -if (WIN32) -option(USE_SYSTEM_ZLIB "Instructs the build system to search for and use a zlib library available in the host system" OFF) -else() -option(USE_SYSTEM_ZLIB "Instructs the build system to search for and use a zlib library available in the host system" ON) -endif() -option(ENABLE_PYTHON "Instructs the build system to enable building shared objects for the python lib" OFF) -option(USE_SYSTEM_BZIP2 "Instructs the build system to search for and use a bzip2 library available in the host system" ON) -option(BUILD_ROCKSDB "Instructs the build system to use RocksDB from the third party directory" ON) -option(FORCE_WINDOWS "Instructs the build system to force Windows builds when WIN32 is specified" OFF) +cmake_dependent_option(USE_SYSTEM_CURL "Instructs the build system to search for and use a cURL library available in the host system" ON "NOT STATIC_BUILD" OFF) -include(CheckIncludeFile) -include(FeatureSummary) -include(ExternalProject) +option(BUILD_SHARED_LIBS "Build yaml cpp shared lib" OFF) +cmake_dependent_option(USE_SYSTEM_ZLIB "Instructs the build system to search for and use a zlib library available in the host system" ON "NOT STATIC_BUILD" OFF) +option(USE_SYSTEM_BZIP2 "Instructs the build system to search for and use a bzip2 library available in the host system" ON) +option(BUILD_ROCKSDB "Instructs the build system to use RocksDB from the third party directory" ON) +option(FORCE_WINDOWS "Instructs the build system to force Windows builds when WIN32 is specified" OFF) if (OPENSSL_ROOT_DIR ) set(OPENSSL_PASSTHROUGH "-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR}") @@ -175,7 +183,21 @@ endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") if (OPENSSL_OFF STREQUAL "OFF") - if(USE_SYSTEM_OPENSSL STREQUAL "OFF") + if(USE_SYSTEM_OPENSSL) + + # Set the right openssl root path + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl/") + elseif(NOT WIN32) + set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu") + else() + #set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu") + endif() + + # Include OpenSSL + find_package (OpenSSL REQUIRED) + + else() message("Using bundled LibreSSL") set(BUILD_ARGS "") if (WIN32) @@ -184,10 +206,12 @@ if (OPENSSL_OFF STREQUAL "OFF") ExternalProject_Add( libressl-portable GIT_REPOSITORY "https://github.com/libressl-portable/portable.git" - GIT_TAG "190bd346e75575b9436a2e9e14b28618f0234e1b" + GIT_TAG "4ea2a01a0d2cc889e95316f51c7a36f8f158df44" SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-src" CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install" + "-DLIBRESSL_APPS=OFF" + "-DLIBRESSL_TESTS=OFF" "${BUILD_ARGS}" PATCH_COMMAND ./autogen.sh ) @@ -196,43 +220,28 @@ if (OPENSSL_OFF STREQUAL "OFF") add_library(crypto STATIC IMPORTED) set_target_properties(crypto PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/lib/libcrypto.a") add_dependencies(crypto libressl-portable) + add_library(ssl STATIC IMPORTED) set_target_properties(ssl PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/lib/libssl.a") set_target_properties(ssl PROPERTIES INTERFACE_LINK_LIBRARIES crypto) add_dependencies(ssl libressl-portable) + add_library(tls STATIC IMPORTED) set_target_properties(tls PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/lib/libtls.a") set_target_properties(tls PROPERTIES INTERFACE_LINK_LIBRARIES crypto) add_dependencies(tls libressl-portable) + + set(LIBRESSL_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libressl/" CACHE STRING "" FORCE) + set(LIBRESSL_BIN_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/" CACHE STRING "" FORCE) - set(OPENSSL_FOUND "YES") - set(OPENSSL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libressl/include") - set(OPENSSL_LIBRARIES tls ssl crypto) - else() - # Set the right openssl root path - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl/") - elseif(NOT WIN32) - set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu") - else() - #set(OPENSSL_ROOT_DIR "/usr/lib/x86_64-linux-gnu") - endif() - - # Include OpenSSL - if (NOT OPENSSL_FORCE_SHARED) - set(OPENSSL_USE_STATIC_LIBS TRUE) - endif() - find_package (OpenSSL REQUIRED) - - - - if (OPENSSL_FOUND) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENSSL_SUPPORT") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_SUPPORT") - endif() + set(OPENSSL_FOUND "YES" CACHE STRING "" FORCE) + set(OPENSSL_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libressl/include" CACHE STRING "" FORCE) + set(OPENSSL_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/lib/libtls.a" "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/lib/libssl.a" "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/libressl-install/lib/libcrypto.a" CACHE STRING "" FORCE) endif() if (OPENSSL_FOUND) include_directories(${OPENSSL_INCLUDE_DIR}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENSSL_SUPPORT") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_SUPPORT") MESSAGE("OpenSSL found at ${OPENSSL_LIBRARIES}") else () message( FATAL_ERROR "OpenSSL was not found. Please install OpenSSL" ) @@ -240,7 +249,7 @@ endif (OPENSSL_FOUND) else() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ssl") endif() -if(USE_SYSTEM_ZLIB STREQUAL "OFF") +if(NOT USE_SYSTEM_ZLIB) message("Using bundled zlib") if (WIN32) @@ -268,9 +277,9 @@ if(USE_SYSTEM_ZLIB STREQUAL "OFF") add_dependencies(z zlib-external) set(ZLIB_FOUND "YES" CACHE STRING "" FORCE) set(ZLIB_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/zlib/include" CACHE STRING "" FORCE) - set(ZLIB_LIBRARIES z CACHE STRING "" FORCE) - set(ZLIB_LIBRARY z CACHE STRING "" FORCE) - set(ZLIB_LIBRARY z CACHE STRING "" FORCE) + set(ZLIB_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE) + set(ZLIB_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE) + set(ZLIB_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE) message("ZLIBV LIBR is ${ZLIB_LIBRARIES}") else() find_package (ZLIB REQUIRED) @@ -306,6 +315,15 @@ if(NOT DISABLE_CURL AND (NOT USE_SYSTEM_CURL)) set(CURL_C_FLAGS "-I${OPENSSL_INCLUDE_DIR}") set(CURL_CXX_FLAGS "${CURL_C_FLAGS}") + +get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) + +if ("${LIB64}" STREQUAL "TRUE" AND (NOT WIN32 AND NOT APPLE)) + set(LIBSUFFIX 64) +else() + set(LIBSUFFIX "") +endif() + if (WIN32) if (CMAKE_BUILD_TYPE MATCHES RelWithDebInfo OR CMAKE_BUILD_TYPE MATCHES Release) set(BYPRODUCT "thirdparty/curl-install/lib/libcurl.lib") @@ -313,7 +331,7 @@ if(NOT DISABLE_CURL AND (NOT USE_SYSTEM_CURL)) set(BYPRODUCT "thirdparty/curl-install/lib/libcurl-d.lib") endif() else() - set(BYPRODUCT "thirdparty/curl-install/lib/libcurl.a") + set(BYPRODUCT "thirdparty/curl-install/lib${LIBSUFFIX}/libcurl.a") endif() if (WIN32) @@ -324,14 +342,16 @@ if(NOT DISABLE_CURL AND (NOT USE_SYSTEM_CURL)) ExternalProject_Add( curl-external GIT_REPOSITORY "https://github.com/curl/curl.git" - GIT_TAG "4d6bd91ab33328c6d27eddc32e064defc02dc4fd" # Version 7.59.0 + GIT_TAG "f3294d9d86e6a7915a967efff2842089b8b0d071" # Version 7.64.0 SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/curl-src" CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS} "-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/thirdparty/curl-install" -DBUILD_CURL_EXE=OFF -DBUILD_TESTING=OFF - -DCURL_STATICLIB=ON + -DBUILD_SHARED_LIBS=OFF -DHTTP_ONLY=ON + -DLIBRESSL_BIN_DIR=${LIBRESSL_BIN_DIR} + -DLIBRESSL_SRC_DIR=${LIBRESSL_SRC_DIR} -DCURL_DISABLE_CRYPTO_AUTH=ON -DHAVE_GLIBC_STRERROR_R=1 -DHAVE_GLIBC_STRERROR_R__TRYRUN_OUTPUT="" @@ -347,13 +367,15 @@ if(NOT DISABLE_CURL AND (NOT USE_SYSTEM_CURL)) BUILD_BYPRODUCTS "thirdparty/${BYPRODUCT}" ) - if(USE_SYSTEM_OPENSSL STREQUAL "OFF") + if(NOT USE_SYSTEM_OPENSSL OR USE_SYSTEM_OPENSSL STREQUAL "OFF") add_dependencies(curl-external libressl-portable) endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/curl/dummy") add_library(curl STATIC IMPORTED) set_target_properties(curl PROPERTIES IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}") + + if (OPENSSL_FOUND) if (NOT WIN32) set_target_properties(curl PROPERTIES INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBRARIES}) @@ -362,8 +384,10 @@ if(NOT DISABLE_CURL AND (NOT USE_SYSTEM_CURL)) add_dependencies(curl curl-external) set(CURL_FOUND "YES") set(CURL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/curl/include") - set(CURL_LIBRARY curl CACHE STRING "" FORCE) + set(CURL_LIBRARY "${CMAKE_CURRENT_BINARY_DIR}/${BYPRODUCT}" CACHE STRING "" FORCE) set(CURL_LIBRARIES ${CURL_LIBRARY} CACHE STRING "" FORCE) + else() + message("Using System cURL") endif() if (CURL_FOUND) @@ -406,6 +430,10 @@ if (DISABLE_EXPRESSION_LANGUAGE) else() include_directories("extensions/expression-language/impl") createExtension(EXPRESSION-LANGUAGE-EXTENSIONS "EXPRESSION LANGUAGE EXTENSIONS" "This enables NiFi expression language" "extensions/expression-language" "${TEST_DIR}/expression-language-tests") + if(NOT USE_SYSTEM_CURL) + message("minifi-expression-language-extensions will depend on curl-external") + add_dependencies(minifi-expression-language-extensions curl-external) + endif() endif() if(BOOTSTRAP) @@ -425,10 +453,18 @@ execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" add_subdirectory(libminifi) +if(NOT USE_SYSTEM_OPENSSL OR USE_SYSTEM_OPENSSL STREQUAL "OFF") + add_dependencies(minifi libressl-portable) +endif() + #### EXTENSIONS option(DISABLE_CURL "Disables libCurl Properties." OFF) if ((DISABLE_CURL STREQUAL "OFF" OR NOT DISABLE_CURL) AND NOT DISABLE_CIVET) createExtension(HTTP-CURL "HTTP CURL" "This enables RESTProtocol, InvokeHTTP, and the HTTPClient for Site to Site" "extensions/http-curl" "extensions/http-curl/tests/") + if(NOT USE_SYSTEM_CURL) + message("minifi-http-curl will depend on curl-external") + add_dependencies(minifi-http-curl curl-external) + endif() endif() option(DISABLE_CIVET "Disables CivetWeb components." OFF) @@ -436,11 +472,6 @@ if (NOT DISABLE_CIVET) createExtension(CIVETWEB CIVETWEB "This enables ListenHTTP" "extensions/civetweb" "${TEST_DIR}/civetweb-tests") endif() -if (NOT DISABLE_CURL AND NOT DISABLE_CONTROLLER) - add_subdirectory(thirdparty/cxxopts) - add_subdirectory(controller) -endif() - ## Add the rocks DB extension if (NOT ROCKSDB_FOUND OR BUILD_ROCKSDB) set(BUILD_RD "TRUE") @@ -468,6 +499,9 @@ endif() option(ENABLE_COAP "Enables the CoAP extension." OFF) if (ENABLE_ALL OR ENABLE_COAP STREQUAL "ON") createExtension(COAP-EXTENSION "COAP EXTENSIONS" "Enables LibCOAP Functionality." "extensions/coap" "extensions/coap/tests/") + if( NOT DISABLE_CURL) + add_dependencies(minifi-coap minifi-http-curl) + endif() endif() if (WIN32) @@ -543,6 +577,15 @@ endif() add_subdirectory(main) add_subdirectory(nanofi) +add_dependencies(nanofi minifiexe) + +if (NOT DISABLE_CURL AND NOT DISABLE_CONTROLLER) + add_subdirectory(thirdparty/cxxopts) + add_subdirectory(controller) + add_dependencies(minificontroller minifiexe) +endif() + + if (NOT DISABLE_CURL) if (ENABLE_PYTHON) if (NOT WIN32) diff --git a/README.md b/README.md index c104d60..5a2a7a4 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,8 @@ $ sudo make install Finally, it is required to add the `-lrt` compiler flag by using the `-DCMAKE_CXX_FLAGS=-lrt` flag when invoking cmake. +On all distributions please use -DUSE_SHARED_LIBS=OFF to statically link zlib, libcurl, and OpenSSL. + #### SLES SLES 11 requires manual installation of the SDK using the following link: https://www.novell.com/support/kb/doc.php?id=7015337 diff --git a/bootstrap.sh b/bootstrap.sh index 4f78721..7b34e16 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -282,6 +282,9 @@ TESTS_DISABLED=${FALSE} add_disabled_option SQLITE_ENABLED ${FALSE} "ENABLE_SQLITE" +USE_SHARED_LIBS=${TRUE} + + # Since the following extensions have limitations on add_disabled_option BUSTACHE_ENABLED ${FALSE} "ENABLE_BUSTACHE" "2.6" ${TRUE} @@ -415,6 +418,13 @@ build_cmake_command(){ # user may have disabled tests previously, so let's force them to be re-enabled CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DSKIP_TESTS= " fi + + if [ "${USE_SHARED_LIBS}" = "${TRUE}" ]; then + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DUSE_SHARED_LIBS=ON " + else + CMAKE_BUILD_COMMAND="${CMAKE_BUILD_COMMAND} -DUSE_SHARED_LIBS= " + fi + if [ "${PORTABLE_BUILD}" = "${TRUE}" ]; then diff --git a/bstrp_functions.sh b/bstrp_functions.sh index e7e0255..aecffe6 100755 --- a/bstrp_functions.sh +++ b/bstrp_functions.sh @@ -93,6 +93,7 @@ save_state(){ echo_state_variable BUILD_IDENTIFIER echo_state_variable BUILD_DIR echo_state_variable TESTS_DISABLED + echo_state_variable USE_SHARED_LIBS for option in "${OPTIONS[@]}" ; do echo_state_variable $option done @@ -264,6 +265,7 @@ show_supported_features() { echo "1. Disable Tests ...............$(print_feature_status TESTS_DISABLED)" echo "2. Enable all extensions" echo "3. Enable JNI Support ..........$(print_feature_status JNI_ENABLED)" + echo "4. Use Shared Dependency Links .$(print_feature_status USE_SHARED_LIBS)" echo "P. Continue with these options" if [ "$GUIDED_INSTALL" = "${TRUE}" ]; then echo "R. Return to Main Menu" @@ -290,19 +292,30 @@ read_feature_options(){ j) ToggleFeature TENSORFLOW_ENABLED ;; k) ToggleFeature BUSTACHE_ENABLED ;; l) ToggleFeature MQTT_ENABLED ;; - m) ToggleFeature SQLLITE_ENABLED ;; - n) ToggleFeature PYTHON_ENABLED ;; + m) ToggleFeature SQLITE_ENABLED ;; + n) if [ "$USE_SHARED_LIBS" = "${TRUE}" ]; then + ToggleFeature PYTHON_ENABLED + else + echo -e "${RED}Please ensure static linking is enabled for Python Support...${NO_COLOR}" && sleep 2 + fi + ;; o) ToggleFeature COAP_ENABLED ;; 1) ToggleFeature TESTS_DISABLED ;; 2) EnableAllFeatures ;; 3) ToggleFeature JNI_ENABLED;; + 4) if [ "$PYTHON_ENABLED" = "${FALSE}" ]; then + ToggleFeature USE_SHARED_LIBS + else + echo -e "${RED}Python support must be disabled before changing this value...${NO_COLOR}" && sleep 2 + fi + ;; p) FEATURES_SELECTED="true" ;; r) if [ "$GUIDED_INSTALL" = "${TRUE}" ]; then MENU="main" fi ;; q) exit 0;; - *) echo -e "${RED}Please enter an option A-P or 1-3...${NO_COLOR}" && sleep 2 + *) echo -e "${RED}Please enter an option A-P or 1-4...${NO_COLOR}" && sleep 2 esac } diff --git a/centos.sh b/centos.sh index 00d4095..ebe9fe2 100644 --- a/centos.sh +++ b/centos.sh @@ -70,7 +70,7 @@ install_bison() { install_libusb() { if [ "$OS_MAJOR" = "6" ]; then - sudo yum -y install libtool libudev-devel + sudo yum -y install libtool libudev-devel patch # git clone --branch v1.0.18 https://github.com/libusb/libusb.git git clone https://github.com/libusb/libusb.git pushd libusb @@ -110,7 +110,7 @@ bootstrap_cmake(){ build_deps(){ # Install epel-release so that cmake3 will be available for installation - COMMAND="sudo yum -y install gcc gcc-c++ libuuid libuuid-devel" + COMMAND="sudo yum -y install gcc gcc-c++ libuuid libuuid-devel libtool patch" INSTALLED=() for option in "${OPTIONS[@]}" ; do option_value="${!option}" diff --git a/cmake/BuildTests.cmake b/cmake/BuildTests.cmake index 796f626..c57c0b3 100644 --- a/cmake/BuildTests.cmake +++ b/cmake/BuildTests.cmake @@ -39,7 +39,6 @@ function(appendIncludes testName) target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/thirdparty/catch") target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/thirdparty/spdlog-20170710/include") target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/thirdparty/yaml-cpp-yaml-cpp-0.5.3/include") - target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/thirdparty/libarchive-3.3.2/libarchive") target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/include") target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/libminifi/include/") target_include_directories(${testName} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/libminifi/include/c2/protocols") @@ -75,7 +74,8 @@ function(createTests testName) target_include_directories(${testName} BEFORE PRIVATE "${Boost_INCLUDE_DIRS}") endif() target_link_libraries(${testName} ${CMAKE_DL_LIBS} ${SPD_LIB} ${TEST_BASE_LIB}) - target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT} ${OPENSSL_LIBRARIES} core-minifi yaml-cpp) + target_link_libraries(${testName} ${CMAKE_THREAD_LIBS_INIT} core-minifi yaml-cpp) + #${OPENSSL_LIBRARIES} if (NOT excludeBase) if (APPLE) target_link_libraries (${testName} -Wl,-all_load minifi) @@ -83,6 +83,7 @@ function(createTests testName) target_link_libraries (${testName} -Wl,--whole-archive minifi -Wl,--no-whole-archive) endif () endif() + add_dependencies(${testName} minifiexe nanofi) if (Boost_FOUND) target_link_libraries(${testName} ${Boost_SYSTEM_LIBRARY}) target_link_libraries(${testName} ${Boost_FILESYSTEM_LIBRARY}) diff --git a/cmake/ssl/FindOpenSSL.cmake b/cmake/ssl/FindOpenSSL.cmake index 1897a2b..392b47a 100644 --- a/cmake/ssl/FindOpenSSL.cmake +++ b/cmake/ssl/FindOpenSSL.cmake @@ -16,3 +16,31 @@ # under the License. # Dummy OpenSSL find for when we use bundled version + +set(OPENSSL_FOUND "YES" CACHE STRING "" FORCE) +set(OPENSSL_INCLUDE_DIR "${LIBRESSL_SRC_DIR}/include" CACHE STRING "" FORCE) +set(OPENSSL_CRYPTO_LIBRARY "${LIBRESSL_BIN_DIR}/lib/libcrypto.a" CACHE STRING "" FORCE) +set(OPENSSL_SSL_LIBRARY "${LIBRESSL_BIN_DIR}/lib/libssl.a" CACHE STRING "" FORCE) +set(OPENSSL_LIBRARIES "${LIBRESSL_BIN_DIR}/lib/libtls.a" ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} CACHE STRING "" FORCE) + + if(NOT TARGET OpenSSL::Crypto ) + add_library(OpenSSL::Crypto UNKNOWN IMPORTED) + set_target_properties(OpenSSL::Crypto PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") + + set_target_properties(OpenSSL::Crypto PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}") + + endif() + + if(NOT TARGET OpenSSL::SSL + ) + add_library(OpenSSL::SSL UNKNOWN IMPORTED) + set_target_properties(OpenSSL::SSL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}") + set_target_properties(OpenSSL::SSL PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${OPENSSL_SSL_LIBRARY}") + + endif() \ No newline at end of file diff --git a/controller/CMakeLists.txt b/controller/CMakeLists.txt index f00f6be..6b6c8bc 100644 --- a/controller/CMakeLists.txt +++ b/controller/CMakeLists.txt @@ -64,7 +64,10 @@ include_directories(${OPENSSL_INCLUDE_DIR}) endif(OPENSSL_FOUND) # Link against minifi, yaml-cpp, civetweb-cpp, uuid, openssl, jsoncpp and rocksdb -target_link_libraries(minificontroller core-minifi) +target_link_libraries(minificontroller minifi ${DL}) + + +add_dependencies(minificontroller minifi) if (APPLE) target_link_libraries (minificontroller -Wl,-all_load minifi) @@ -84,11 +87,13 @@ if (APPLE) get_property(extensions GLOBAL PROPERTY EXTENSION-OPTIONS) foreach(EXTENSION ${extensions}) message("Linking against ${EXTENSION}") + add_dependencies(minificontroller ${EXTENSION}) target_link_libraries (minificontroller -Wl,-all_load ${EXTENSION}) endforeach() else () get_property(extensions GLOBAL PROPERTY EXTENSION-OPTIONS) foreach(EXTENSION ${extensions}) + add_dependencies(minificontroller ${EXTENSION}) target_link_libraries (minificontroller -Wl,--whole-archive ${EXTENSION} -Wl,--no-whole-archive) endforeach() endif () diff --git a/docker/Dockerfile b/docker/Dockerfile index cf0a5ab..62d3a01 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -74,7 +74,7 @@ ENV MINIFI_HOME $MINIFI_BASE_DIR/nifi-minifi-cpp-$MINIFI_VERSION RUN cd $MINIFI_BASE_DIR \ && mkdir build \ && cd build \ - && cmake -DOPENSSL_FORCE_SHARED=true -DDISABLE_JEMALLOC=ON -DSKIP_TESTS=true -DENABLE_JNI=ON .. \ + && cmake -DOPENSSL_FORCE_SHARED=true -DDISABLE_JEMALLOC=ON -DSTATIC_BUILD= -DSKIP_TESTS=true -DENABLE_JNI=ON .. \ && make -j8 package \ && tar -xzvf $MINIFI_BASE_DIR/build/nifi-minifi-cpp-$MINIFI_VERSION-bin.tar.gz -C $MINIFI_BASE_DIR diff --git a/extensions/coap/tests/CMakeLists.txt b/extensions/coap/tests/CMakeLists.txt index df97e82..94ac5b1 100644 --- a/extensions/coap/tests/CMakeLists.txt +++ b/extensions/coap/tests/CMakeLists.txt @@ -22,6 +22,7 @@ file(GLOB CURL_INTEGRATION_TESTS "*.cpp") SET(CURL_INT_TEST_COUNT 0) +if (NOT DISABLE_CURL) FOREACH(testfile ${CURL_INTEGRATION_TESTS}) get_filename_component(testfilename "${testfile}" NAME_WE) add_executable("${testfilename}" "${testfile}") @@ -43,9 +44,9 @@ FOREACH(testfile ${CURL_INTEGRATION_TESTS}) target_include_directories(${testfilename} BEFORE PRIVATE ./include) createTests("${testfilename}") if (APPLE) - target_link_libraries ("${testfilename}" -Wl,-all_load minifi-http-curl minifi-coap minifi-civet-extensions) + target_link_libraries ("${testfilename}" -Wl,-all_load ${ZLIB_LIBRARY} ${OPENSSL_LIBRARIES} minifi-http-curl minifi-coap minifi-civet-extensions) else () - target_link_libraries ("${testfilename}" -Wl,--whole-archive minifi-http-curl minifi-coap minifi-civet-extensions -Wl,--no-whole-archive) + target_link_libraries ("${testfilename}" -Wl,--whole-archive ${ZLIB_LIBRARY} ${OPENSSL_LIBRARIES} minifi-http-curl minifi-coap minifi-civet-extensions -Wl,--no-whole-archive) endif() MATH(EXPR CURL_INT_TEST_COUNT "${CURL_INT_TEST_COUNT}+1") ENDFOREACH() @@ -53,3 +54,6 @@ ENDFOREACH() message("-- Finished building ${CURL_INT_TEST_COUNT} CoAP integration test file(s)...") add_test(NAME CoapC2VerifyHeartbeat COMMAND CoapC2VerifyHeartbeat "${TEST_RESOURCES}/CoapC2VerifyServe.yml" "${TEST_RESOURCES}/" "http://localhost:9888/geturl") +else() +message("-- CoAP tests rely on minifi-http-curl, so they will not be built...") +endif() \ No newline at end of file diff --git a/extensions/expression-language/CMakeLists.txt b/extensions/expression-language/CMakeLists.txt index 314f503..483c807 100644 --- a/extensions/expression-language/CMakeLists.txt +++ b/extensions/expression-language/CMakeLists.txt @@ -56,6 +56,7 @@ target_link_libraries(minifi-expression-language-extensions ${LIBMINIFI} tz) target_link_libraries(minifi-expression-language-extensions ${LIBMINIFI} ${UUID_LIBRARIES}) if (NOT DISABLE_CURL) + find_package(CURL REQUIRED) include_directories(${CURL_INCLUDE_DIRS}) target_link_libraries(minifi-expression-language-extensions ${CURL_LIBRARIES}) diff --git a/extensions/http-curl/CMakeLists.txt b/extensions/http-curl/CMakeLists.txt index df3d0cb..ccec972 100644 --- a/extensions/http-curl/CMakeLists.txt +++ b/extensions/http-curl/CMakeLists.txt @@ -25,7 +25,7 @@ include_directories(protocols client processors sitetosite) file(GLOB SOURCES "*.cpp" "protocols/*.cpp" "client/*.cpp" "processors/*.cpp" "sitetosite/*.cpp") if (USE_CURL_NSS) - message("okay use nss") + message("Using NSS") add_definitions(-DUSE_CURL_NSS) endif() @@ -46,7 +46,7 @@ if (CURL_FOUND) set_target_properties(minifi-http-curl PROPERTIES LINK_FLAGS "${LINK_FLAGS} /WHOLEARCHIVE:${CURL_LIBRARY}") else() - target_link_libraries(minifi-http-curl ${CURL_LIBRARIES}) + target_link_libraries(minifi-http-curl ${CURL_LIBRARIES}) endif() endif () @@ -73,7 +73,6 @@ message("${OPENSSL_LIBRARIES}") if (WIN32) if (OPENSSL_LIB MATCHES "\\.lib$" OR OPENSSL_LIB MATCHES "\\.dll$" ) message( FATAL "Including ${OPENSSL_LIB}") - target_link_libraries (minifi-http-curl ${OPENSSL_LIB}) set_target_properties(minifi-http-curl PROPERTIES LINK_FLAGS "${LINK_FLAGS} /WHOLEARCHIVE:${OPENSSL_LIB}") endif() endif() @@ -85,10 +84,11 @@ elseif (APPLE) LINK_FLAGS "-Wl,-all_load" ) else () - target_link_libraries(minifi-http-curl ${OPENSSL_LIBRARIES}) - set_target_properties(minifi-http-curl PROPERTIES - LINK_FLAGS "-Wl,--whole-archive" - ) + message("${OPENSSL_LIBRARIES}") + foreach(OPENSSL_LIB ${OPENSSL_LIBRARIES}) + #target_link_libraries (minifi-http-curl ${OPENSSL_LIB} ) + target_link_libraries (minifi-http-curl ${OPENSSL_LIB}) + endforeach() endif () SET (HTTP-CURL minifi-http-curl PARENT_SCOPE) diff --git a/extensions/http-curl/tests/CMakeLists.txt b/extensions/http-curl/tests/CMakeLists.txt index 9b9a537..fd66412 100644 --- a/extensions/http-curl/tests/CMakeLists.txt +++ b/extensions/http-curl/tests/CMakeLists.txt @@ -38,9 +38,9 @@ FOREACH(testfile ${CURL_UNIT_TESTS}) createTests("${testfilename}") target_link_libraries(${testfilename} ${CATCH_MAIN_LIB}) if (APPLE) - target_link_libraries ("${testfilename}" -Wl,-all_load minifi-http-curl minifi-civet-extensions) + target_link_libraries ("${testfilename}" -Wl,-all_load ${ZLIB_LIBRARY} ${OPENSSL_LIBRARIES} minifi-http-curl minifi-civet-extensions) else () - target_link_libraries ("${testfilename}" -Wl,--whole-archive minifi-http-curl minifi-civet-extensions -Wl,--no-whole-archive) + target_link_libraries ("${testfilename}" -Wl,--whole-archive ${ZLIB_LIBRARY} ${OPENSSL_LIBRARIES} minifi-http-curl minifi-civet-extensions -Wl,--no-whole-archive) endif() MATH(EXPR CURL_INT_TEST_COUNT "${CURL_INT_TEST_COUNT}+1") ENDFOREACH() @@ -58,12 +58,12 @@ FOREACH(testfile ${CURL_INTEGRATION_TESTS}) target_include_directories(${testfilename} BEFORE PRIVATE "../sitetosite/") target_include_directories(${testfilename} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/extensions/civetweb/") target_include_directories(${testfilename} BEFORE PRIVATE ./include) - createTests("${testfilename}") - if (APPLE) - target_link_libraries ("${testfilename}" -Wl,-all_load minifi-http-curl minifi-civet-extensions) + if (APPLE) + target_link_libraries ("${testfilename}" -Wl,-all_load ${ZLIB_LIBRARY} ${OPENSSL_LIBRARIES} minifi-http-curl minifi-civet-extensions) else () - target_link_libraries ("${testfilename}" -Wl,--whole-archive minifi-http-curl minifi-civet-extensions -Wl,--no-whole-archive) + target_link_libraries ("${testfilename}" -Wl,--whole-archive ${ZLIB_LIBRARY} ${OPENSSL_LIBRARIES} minifi-http-curl minifi-civet-extensions -Wl,--no-whole-archive) endif() + createTests("${testfilename}") MATH(EXPR CURL_INT_TEST_COUNT "${CURL_INT_TEST_COUNT}+1") ENDFOREACH() diff --git a/extensions/libarchive/CMakeLists.txt b/extensions/libarchive/CMakeLists.txt index 63201c1..bc4798f 100644 --- a/extensions/libarchive/CMakeLists.txt +++ b/extensions/libarchive/CMakeLists.txt @@ -36,19 +36,11 @@ endif() # Include UUID -find_package(UUID REQUIRED) -target_link_libraries(minifi-archive-extensions ${LIBMINIFI} ${UUID_LIBRARIES}) -find_package(OpenSSL REQUIRED) -include_directories(${OPENSSL_INCLUDE_DIR}) -target_link_libraries(minifi-archive-extensions ${CMAKE_DL_LIBS} ) -if (LibArchive_FOUND AND NOT BUILD_LIBARCHIVE) - target_link_libraries(minifi-archive-extensions ${LibArchive_LIBRARIES} ) -else() - target_link_libraries(minifi-archive-extensions archive_static ) -endif() -find_package(ZLIB REQUIRED) -include_directories(${ZLIB_INCLUDE_DIRS}) -target_link_libraries (minifi-archive-extensions ${ZLIB_LIBRARIES}) +target_link_libraries(minifi-archive-extensions ${LIBMINIFI}) +target_link_libraries(minifi-archive-extensions archive_static ) +#find_package(ZLIB REQUIRED) +#include_directories(${ZLIB_INCLUDE_DIRS}) +#target_link_libraries (minifi-archive-extensions ${ZLIB_LIBRARIES}) if (WIN32) set_target_properties(minifi-archive-extensions PROPERTIES LINK_FLAGS "/WHOLEARCHIVE" diff --git a/extensions/mqtt/CMakeLists.txt b/extensions/mqtt/CMakeLists.txt index 75e23c1..b3dae46 100644 --- a/extensions/mqtt/CMakeLists.txt +++ b/extensions/mqtt/CMakeLists.txt @@ -43,14 +43,9 @@ target_link_libraries(minifi-mqtt-extensions ${CMAKE_DL_LIBS} ) if (MQTT_FOUND AND NOT BUILD_MQTT) target_link_libraries(minifi-mqtt-extensions ${MQTT_LIBRARIES} ) else() - target_link_libraries(minifi-mqtt-extensions paho-mqtt3a-static ) - target_link_libraries(minifi-mqtt-extensions paho-mqtt3c-static ) - target_link_libraries(minifi-mqtt-extensions paho-mqtt3as-static ) target_link_libraries(minifi-mqtt-extensions paho-mqtt3cs-static ) endif() -find_package(ZLIB REQUIRED) -include_directories(${ZLIB_INCLUDE_DIRS}) -target_link_libraries (minifi-mqtt-extensions ${ZLIB_LIBRARIES}) + if (WIN32) set_target_properties(minifi-mqtt-extensions PROPERTIES LINK_FLAGS "/WHOLEARCHIVE" diff --git a/extensions/pcap/CMakeLists.txt b/extensions/pcap/CMakeLists.txt index dd48dcd..e2234a5 100644 --- a/extensions/pcap/CMakeLists.txt +++ b/extensions/pcap/CMakeLists.txt @@ -76,15 +76,8 @@ else () target_link_libraries (minifi-pcap ${PCAPPLUSPLUS_LIB_DIR}/libPcap++.a ${PCAPPLUSPLUS_LIB_DIR}/libPacket++.a ${PCAPPLUSPLUS_LIB_DIR}/libCommon++.a ${PCAP_LIBRARIES}) endif () -# Include UUID -find_package(UUID REQUIRED) -target_link_libraries(minifi-pcap ${LIBMINIFI} ${UUID_LIBRARIES}) -find_package(OpenSSL REQUIRED) -include_directories(${OPENSSL_INCLUDE_DIR}) +target_link_libraries(minifi-pcap ${LIBMINIFI} ) target_link_libraries(minifi-pcap ${CMAKE_DL_LIBS} ) -find_package(ZLIB REQUIRED) -include_directories(${ZLIB_INCLUDE_DIRS}) -target_link_libraries (minifi-pcap ${ZLIB_LIBRARIES}) SET (PCAP-EXTENSION minifi-pcap PARENT_SCOPE) register_extension(minifi-pcap) diff --git a/libminifi/CMakeLists.txt b/libminifi/CMakeLists.txt index e4bf6c0..313ef98 100644 --- a/libminifi/CMakeLists.txt +++ b/libminifi/CMakeLists.txt @@ -152,7 +152,7 @@ endif() SET (LIBMINIFI core-minifi PARENT_SCOPE) -if (ENABLE_PYTHON) +if (ENABLE_PYTHON AND NOT STATIC_BUILD) #### shared add_library(core-minifi-shared SHARED ${SOURCES}) @@ -191,4 +191,4 @@ endif() set_property(TARGET core-minifi-shared PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET minifi-shared PROPERTY POSITION_INDEPENDENT_CODE ON) #endif() -endif(ENABLE_PYTHON) \ No newline at end of file +endif(ENABLE_PYTHON AND NOT STATIC_BUILD) \ No newline at end of file diff --git a/libminifi/src/processors/GetTCP.cpp b/libminifi/src/processors/GetTCP.cpp index 1d1d344..026a291 100644 --- a/libminifi/src/processors/GetTCP.cpp +++ b/libminifi/src/processors/GetTCP.cpp @@ -256,6 +256,10 @@ void GetTCP::onTrigger(const std::shared_ptr<core::ProcessContext> &context, con std::unique_ptr<io::Socket> socket = ssl_service_ != nullptr ? stream_factory_->createSecureSocket(hostAndPort.at(0), std::stoi(hostAndPort.at(1)), ssl_service_) : stream_factory_->createSocket(hostAndPort.at(0), std::stoi(hostAndPort.at(1))); + if (!socket) { + logger_->log_error("Could not create socket during initialization for %s", endpoint); + continue; + } socket->setNonBlocking(); if (socket->initialize() != -1) { logger_->log_debug("Enqueueing socket into ring buffer %s:%s", hostAndPort.at(0), hostAndPort.at(1)); diff --git a/libminifi/test/archive-tests/CMakeLists.txt b/libminifi/test/archive-tests/CMakeLists.txt index 1514a1e..ca8810e 100644 --- a/libminifi/test/archive-tests/CMakeLists.txt +++ b/libminifi/test/archive-tests/CMakeLists.txt @@ -25,13 +25,13 @@ FOREACH(testfile ${ARCHIVE_INTEGRATION_TESTS}) add_executable("${testfilename}" "${testfile}" "${TEST_DIR}/archive-tests/util/ArchiveTests.cpp") target_include_directories(${testfilename} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/extensions/libarchive") target_include_directories(${testfilename} BEFORE PRIVATE "${CMAKE_SOURCE_DIR}/thirdparty/libarchive-3.3.2/libarchive") - createTests("${testfilename}") - target_link_libraries(${testfilename} ${CATCH_MAIN_LIB}) if (APPLE) - target_link_libraries (${testfilename} -Wl,-all_load minifi-archive-extensions) + target_link_libraries (${testfilename} ${ZLIB_LIBRARIES} -Wl,-all_load minifi-archive-extensions) else () - target_link_libraries (${testfilename} -Wl,--whole-archive minifi-archive-extensions -Wl,--no-whole-archive) + target_link_libraries (${testfilename} ${ZLIB_LIBRARIES} -Wl,--whole-archive minifi-archive-extensions -Wl,--no-whole-archive) endif () + createTests("${testfilename}") + target_link_libraries(${testfilename} ${CATCH_MAIN_LIB}) MATH(EXPR EXTENSIONS_TEST_COUNT "${EXTENSIONS_TEST_COUNT}+1") add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR}) ENDFOREACH() diff --git a/libminifi/test/civetweb-tests/CMakeLists.txt b/libminifi/test/civetweb-tests/CMakeLists.txt index 9a6d894..bb2c866 100644 --- a/libminifi/test/civetweb-tests/CMakeLists.txt +++ b/libminifi/test/civetweb-tests/CMakeLists.txt @@ -27,9 +27,9 @@ FOREACH(testfile ${CIVETWEB_INTEGRATION_TESTS}) target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/thirdparty/civetweb-1.10/include") if (APPLE) - target_link_libraries (${testfilename} -Wl,-all_load minifi-civet-extensions minifi-http-curl) + target_link_libraries (${testfilename} -Wl,-all_load ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi-civet-extensions minifi-http-curl) else () - target_link_libraries (${testfilename} -Wl,--whole-archive minifi-civet-extensions minifi-http-curl -Wl,--no-whole-archive) + target_link_libraries (${testfilename} -Wl,--whole-archive ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES} minifi-civet-extensions minifi-http-curl -Wl,--no-whole-archive) endif () createTests("${testfilename}") diff --git a/libminifi/test/script-tests/CMakeLists.txt b/libminifi/test/script-tests/CMakeLists.txt index a485e32..f46783f 100644 --- a/libminifi/test/script-tests/CMakeLists.txt +++ b/libminifi/test/script-tests/CMakeLists.txt @@ -30,16 +30,16 @@ SET(EXTENSIONS_TEST_COUNT 0) FOREACH(testfile ${EXECUTESCRIPT_PYTHON_INTEGRATION_TESTS}) get_filename_component(testfilename "${testfile}" NAME_WE) add_executable("${testfilename}" "${testfile}") - createTests("${testfilename}") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/script") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/script/python") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/thirdparty/pybind11/include") add_definitions(-DPYTHON_SUPPORT) if (APPLE) - target_link_libraries ("${testfilename}" -Wl,-all_load minifi-script-extensions ) + target_link_libraries ("${testfilename}" -Wl,-all_load ${ZLIB_LIBRARIES} minifi-script-extensions ) else () - target_link_libraries ("${testfilename}" -Wl,--whole-archive minifi-script-extensions -Wl,--no-whole-archive) + target_link_libraries ("${testfilename}" -Wl,--whole-archive ${ZLIB_LIBRARIES} minifi-script-extensions -Wl,--no-whole-archive) endif() + createTests("${testfilename}") MATH(EXPR EXTENSIONS_TEST_COUNT "${EXTENSIONS_TEST_COUNT}+1") add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR}) ENDFOREACH() @@ -47,16 +47,16 @@ ENDFOREACH() FOREACH(testfile ${EXECUTESCRIPT_LUA_INTEGRATION_TESTS}) get_filename_component(testfilename "${testfile}" NAME_WE) add_executable("${testfilename}" "${testfile}") - createTests("${testfilename}") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/script") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/extensions/script/lua") target_include_directories(${testfilename} PRIVATE BEFORE "${CMAKE_SOURCE_DIR}/thirdparty/sol2-2.17.5") add_definitions(-DLUA_SUPPORT) if (APPLE) - target_link_libraries ("${testfilename}" -Wl,-all_load minifi-script-extensions ) + target_link_libraries ("${testfilename}" -Wl,-all_load ${ZLIB_LIBRARIES} minifi-script-extensions ) else () - target_link_libraries ("${testfilename}" -Wl,--whole-archive minifi-script-extensions -Wl,--no-whole-archive) + target_link_libraries ("${testfilename}" -Wl,--whole-archive ${ZLIB_LIBRARIES} minifi-script-extensions -Wl,--no-whole-archive) endif() + createTests("${testfilename}") MATH(EXPR EXTENSIONS_TEST_COUNT "${EXTENSIONS_TEST_COUNT}+1") add_test(NAME "${testfilename}" COMMAND "${testfilename}" WORKING_DIRECTORY ${TEST_DIR}) ENDFOREACH() diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 53455dd..821126f 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -82,6 +82,24 @@ else() # set_target_properties(minifiexe PROPERTIES LINK_FLAGS "/WHOLEARCHIVE:core-minifi") endif () +# Include OpenSSL +if (OPENSSL_FOUND) + if (NOT USE_SYSTEM_OPENSSL) + if (APPLE) + target_link_libraries(minifiexe -Wl,-all_load ${OPENSSL_LIBRARIES}) + elseif(NOT WIN32) + target_link_libraries(minifiexe -Wl,--whole-archive ${OPENSSL_LIBRARIES} -Wl,--no-whole-archive) + else() + target_link_libraries(minifiexe ${OPENSSL_LIBRARIES}) + endif() + else() + target_link_libraries(minifiexe ${OPENSSL_LIBRARIES}) + endif() + include_directories(${OPENSSL_INCLUDE_DIR}) +endif(OPENSSL_FOUND) + +add_dependencies(minifiexe minifi) + if (APPLE) target_link_libraries (minifiexe -Wl,-all_load minifi) @@ -100,13 +118,6 @@ if (WIN32) target_link_libraries(minifiexe semaphore) endif() -# Include OpenSSL -if (OPENSSL_FOUND) - target_link_libraries(minifiexe ${OPENSSL_LIBRARIES}) - include_directories(${OPENSSL_INCLUDE_DIR}) -endif(OPENSSL_FOUND) - - if (APPLE) @@ -114,16 +125,18 @@ if (APPLE) foreach(EXTENSION ${extensions}) message("Linking MiNiFiMain against ${EXTENSION}") target_link_libraries (minifiexe -Wl,-all_load ${EXTENSION}) + add_dependencies(minifiexe ${EXTENSION}) endforeach() else () get_property(extensions GLOBAL PROPERTY EXTENSION-OPTIONS) foreach(EXTENSION ${extensions}) if (WIN32) target_link_libraries (minifiexe ${EXTENSION}) - set(WIN32_ARCHIVES "${WIN32_ARCHIVES} /WHOLEARCHIVE:${EXTENSION}") - #set_target_properties(minifiexe PROPERTIES LINK_FLAGS "${LINK_FLAGS} /WHOLEARCHIVE:${EXTENSION}") - else() + set(WIN32_ARCHIVES "${WIN32_ARCHIVES} /WHOLEARCHIVE:${EXTENSION}") + add_dependencies(minifiexe ${EXTENSION}) + else() target_link_libraries (minifiexe -Wl,--whole-archive ${EXTENSION} -Wl,--no-whole-archive) + add_dependencies(minifiexe ${EXTENSION}) endif() endforeach() endif () diff --git a/nanofi/CMakeLists.txt b/nanofi/CMakeLists.txt index 53e2c92..14b4a56 100644 --- a/nanofi/CMakeLists.txt +++ b/nanofi/CMakeLists.txt @@ -74,7 +74,7 @@ if(WIN32) set_target_properties(nanofi PROPERTIES LINK_FLAGS "${WIN32_ARCHIVES}") endif() -if (ENABLE_PYTHON) +if (ENABLE_PYTHON AND NOT STATIC_BUILD) add_library(nanofi-shared SHARED ${NANOFI_SOURCES}) @@ -94,7 +94,7 @@ endif() set_property(TARGET nanofi-shared PROPERTY POSITION_INDEPENDENT_CODE ON) -endif(ENABLE_PYTHON) +endif(ENABLE_PYTHON AND NOT STATIC_BUILD) if (NOT DISABLE_CURL) add_subdirectory(examples) diff --git a/rheldistro.sh b/rheldistro.sh index 3151e43..7e8b362 100644 --- a/rheldistro.sh +++ b/rheldistro.sh @@ -67,7 +67,7 @@ install_bison() { } bootstrap_cmake(){ - sudo yum -y install wget + sudo yum -y install wget patch wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm sudo yum -y install epel-release-latest-7.noarch.rpm sudo yum -y install cmake3 diff --git a/thirdparty/date/CMakeLists.txt b/thirdparty/date/CMakeLists.txt index 54382a0..0569daa 100644 --- a/thirdparty/date/CMakeLists.txt +++ b/thirdparty/date/CMakeLists.txt @@ -9,10 +9,10 @@ find_package( Threads REQUIRED ) # Override by setting on CMake command line. set( CMAKE_CXX_STANDARD 14 CACHE STRING "The C++ standard whose features are requested.") -option( USE_SYSTEM_TZ_DB "Use the operating system's timezone database" OFF ) +option( USE_SYSTEM_TZ_DB "Use the operating system's timezone database" ON ) option( USE_TZ_DB_IN_DOT "Save the timezone database in the current folder" OFF ) -option( BUILD_SHARED_LIBS "Build a shared version of library" ON ) -option( ENABLE_DATE_TESTING "Enable unit tests" ON ) +option( BUILD_SHARED_LIBS "Build a shared version of library" OFF ) +option( ENABLE_DATE_TESTING "Enable unit tests" OFF ) function( print_option OPT ) if ( NOT DEFINED PRINT_OPTION_CURR_${OPT} OR ( NOT PRINT_OPTION_CURR_${OPT} STREQUAL ${OPT} ) ) diff --git a/thirdparty/libarchive-3.3.2/libarchive/CMakeLists.txt b/thirdparty/libarchive-3.3.2/libarchive/CMakeLists.txt index 7eb9235..0534c05 100644 --- a/thirdparty/libarchive-3.3.2/libarchive/CMakeLists.txt +++ b/thirdparty/libarchive-3.3.2/libarchive/CMakeLists.txt @@ -224,9 +224,9 @@ ELSEIF(ARCHIVE_ACL_SUNOS) ENDIF() # Libarchive is a shared library -ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) -TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) -SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) +#ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) +#TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) +#SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) # archive_static is a static library ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) @@ -237,17 +237,3 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS IF(NOT WIN32 OR CYGWIN) SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) ENDIF(NOT WIN32 OR CYGWIN) - -IF(ENABLE_INSTALL) - # How to install the libraries - INSTALL(TARGETS archive archive_static - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - INSTALL_MAN(${libarchive_MANS}) - INSTALL(FILES ${include_HEADERS} DESTINATION include) -ENDIF() - -IF(ENABLE_TEST) -add_subdirectory(test) -ENDIF()
