MINIFICPP-449 Add cURL external project build with static linking This closes #296.
Signed-off-by: Marc Parisi <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/commit/ea6bc178 Tree: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/tree/ea6bc178 Diff: http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/diff/ea6bc178 Branch: refs/heads/master Commit: ea6bc178cf63d7436f44fd3f814e7a1c1422ec18 Parents: 253a1b7 Author: Andrew I. Christianson <[email protected]> Authored: Thu Mar 22 15:49:50 2018 -0400 Committer: Marc Parisi <[email protected]> Committed: Wed Apr 11 12:45:20 2018 -0400 ---------------------------------------------------------------------- CMakeLists.txt | 3 + LICENSE | 26 + cmake/curl/dummy/FindCURL.cmake | 18 + extensions/http-curl/CMakeLists.txt | 50 +- thirdparty/curl/include/curl/curl.h | 2774 +++++++++++++++++++++ thirdparty/curl/include/curl/curlver.h | 77 + thirdparty/curl/include/curl/easy.h | 102 + thirdparty/curl/include/curl/mprintf.h | 50 + thirdparty/curl/include/curl/multi.h | 441 ++++ thirdparty/curl/include/curl/stdcheaders.h | 33 + thirdparty/curl/include/curl/system.h | 473 ++++ thirdparty/curl/include/curl/typecheck-gcc.h | 696 ++++++ 12 files changed, 4740 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ea6bc178/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index a88310e..7264404 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ 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_SYSTEM_UUID "Instructs the build system to search for and use an UUID library available in the host system" ON) +option(USE_SYSTEM_CURL "Instructs the build system to search for and use a cURL library available in the host system" ON) include(FeatureSummary) include(ExternalProject) @@ -91,9 +92,11 @@ if(NOT USE_SYSTEM_OPENSSL) 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(OPENSSL_FOUND "YES") http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ea6bc178/LICENSE ---------------------------------------------------------------------- diff --git a/LICENSE b/LICENSE index baa4e9f..f49f6cf 100644 --- a/LICENSE +++ b/LICENSE @@ -1227,6 +1227,32 @@ code can be traced back to its original author, and all of those authors have public domain dedications on file. So the SQLite code base is clean and is uncontaminated with licensed code from other projects. +This product bundles cURL which is available under a MIT/X derivate license +license: + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1996 - 2018, Daniel Stenberg, [email protected], and many +contributors, see the THANKS file. + +All rights reserved. + +Permission to use, copy, modify, and distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of a copyright holder shall not be +used in advertising or otherwise to promote the sale, use or other dealings in +this Software without prior written authorization of the copyright holder. + This product bundles RapidJSON: Tencent is pleased to support the open source community by making RapidJSON available. http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ea6bc178/cmake/curl/dummy/FindCURL.cmake ---------------------------------------------------------------------- diff --git a/cmake/curl/dummy/FindCURL.cmake b/cmake/curl/dummy/FindCURL.cmake new file mode 100644 index 0000000..3a7e214 --- /dev/null +++ b/cmake/curl/dummy/FindCURL.cmake @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Dummy cURL find for when we use bundled version http://git-wip-us.apache.org/repos/asf/nifi-minifi-cpp/blob/ea6bc178/extensions/http-curl/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/extensions/http-curl/CMakeLists.txt b/extensions/http-curl/CMakeLists.txt index bea1195..14d4193 100644 --- a/extensions/http-curl/CMakeLists.txt +++ b/extensions/http-curl/CMakeLists.txt @@ -17,6 +17,50 @@ # under the License. # +if(NOT USE_SYSTEM_CURL) + message("Using bundled cURL") + + set(CURL_C_FLAGS "-I${OPENSSL_INCLUDE_DIR}") + set(CURL_CXX_FLAGS "${CURL_C_FLAGS}") + + ExternalProject_Add( + curl-external + GIT_REPOSITORY "https://github.com/curl/curl.git" + GIT_TAG "4d6bd91ab33328c6d27eddc32e064defc02dc4fd" # Version 7.59.0 + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/curl-src" + CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/thirdparty/curl-install" + -DBUILD_CURL_EXE=OFF + -DBUILD_TESTING=OFF + -DCURL_STATICLIB=ON + -DHTTP_ONLY=ON + -DCURL_DISABLE_CRYPTO_AUTH=ON + -DHAVE_GLIBC_STRERROR_R=1 + -DHAVE_GLIBC_STRERROR_R__TRYRUN_OUTPUT="" + -DHAVE_POSIX_STRERROR_R=0 + -DHAVE_POSIX_STRERROR_R__TRYRUN_OUTPUT="" + -DHAVE_POLL_FINE_EXITCODE=0 + -DHAVE_FSETXATTR_5=0 + -DHAVE_FSETXATTR_5__TRYRUN_OUTPUT="" + "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/ssl" + "-DCMAKE_C_FLAGS=${CURL_C_FLAGS}" + "-DCMAKE_CXX_FLAGS=${CURL_CXX_FLAGS}" + BUILD_BYPRODUCTS "thirdparty/curl-install/lib/libcurl.a" + ) + + if(NOT USE_SYSTEM_OPENSSL) + 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}/thirdparty/curl-install/lib/libcurl.a") + set_target_properties(curl PROPERTIES INTERFACE_LINK_LIBRARIES ${OPENSSL_LIBRARIES}) + add_dependencies(curl curl-external) + set(CURL_FOUND "YES") + set(CURL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/curl/include") + set(CURL_LIBRARIES curl) +endif() + find_package(CURL REQUIRED) set(CMAKE_EXE_LINKER_FLAGS "-Wl,--export-all-symbols") @@ -42,9 +86,9 @@ if(CMAKE_THREAD_LIBS_INIT) endif() if (CURL_FOUND) - include_directories(${CURL_INCLUDE_DIRS}) - target_link_libraries (minifi-http-curl ${CURL_LIBRARIES}) -endif(CURL_FOUND) + include_directories(${CURL_INCLUDE_DIRS}) + target_link_libraries(minifi-http-curl ${CURL_LIBRARIES}) +endif () # Include UUID find_package(UUID REQUIRED)
