Browse Source

Patch to build Proton with minimal dependencies.

Closes #2279.  Configures CMake to enable C++11, build static libaries
and only build cpp bindings with minimal dependencies. Documentation,
examples, tests and other language bindings are no longer built.
CMake will no longer try to find commands and packages which are not
required for building the target.
v1.0.9-lin
Simon 7 years ago
parent
commit
b9f6e40c9c
  1. 16
      depends/packages/proton.mk
  2. 288
      depends/patches/proton/minimal-build.patch

16
depends/packages/proton.mk

@ -3,23 +3,15 @@ $(package)_version=0.17.0
$(package)_download_path=http://apache.cs.utah.edu/qpid/proton/$($(package)_version)
$(package)_file_name=qpid-proton-$($(package)_version).tar.gz
$(package)_sha256_hash=6ffd26d3d0e495bfdb5d9fefc5349954e6105ea18cc4bb191161d27742c5a01a
$(package)_dependencies=
$(package)_patches=minimal-build.patch
define $(package)_preprocess_cmds
sed -i '1i set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")' proton-c/bindings/cpp/CMakeLists.txt && \
sed -i '1i set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")' examples/cpp/CMakeLists.txt && \
sed -i '1i set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")' CMakeLists.txt && \
sed -i.old 's/qpid-proton SHARED/qpid-proton STATIC/' proton-c/CMakeLists.txt && \
sed -i.old 's/SASL/_DO_NOT_BUILD_SASL_/' proton-c/CMakeLists.txt && \
sed -i.old 's/qpid-proton-core SHARED/qpid-proton-core STATIC/' proton-c/CMakeLists.txt && \
sed -i.old 's/find_package(OpenSSL)/#find_package(OpenSSL)/' proton-c/CMakeLists.txt && \
sed -i.old 's/qpid-proton-cpp SHARED/qpid-proton-cpp STATIC/' proton-c/bindings/cpp/CMakeLists.txt && \
sed -i.old 's/DEFAULT_GO ON/DEFAULT_GO OFF/' proton-c/bindings/CMakeLists.txt && \
mkdir build
patch -p1 < $($(package)_patch_dir)/minimal-build.patch && \
mkdir -p build/proton-c/src
endef
define $(package)_config_cmds
cd build; cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=/ -DSYSINSTALL_BINDINGS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_PYTHON=OFF -DBUILD_PHP=OFF -DBUILD_JAVA=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DDEFAULT_GO=OFF
cd build; cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_INSTALL_PREFIX=/ -DSYSINSTALL_BINDINGS=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_PYTHON=OFF -DBUILD_PHP=OFF -DBUILD_JAVA=OFF -DBUILD_PERL=OFF -DBUILD_RUBY=OFF -DBUILD_JAVASCRIPT=OFF -DBUILD_GO=OFF
endef
define $(package)_build_cmds

288
depends/patches/proton/minimal-build.patch

@ -0,0 +1,288 @@
From 03f5fc0826115edbfca468261b70c0daf627f488 Mon Sep 17 00:00:00 2001
From: Simon <simon@bitcartel.com>
Date: Thu, 27 Apr 2017 17:15:59 -0700
Subject: [PATCH] Enable C++11, build static library and cpp bindings with minimal dependencies.
---
CMakeLists.txt | 13 +++++++------
examples/cpp/CMakeLists.txt | 1 +
proton-c/CMakeLists.txt | 32 +++++++++++++++----------------
proton-c/bindings/CMakeLists.txt | 6 +++---
proton-c/bindings/cpp/CMakeLists.txt | 24 +++++++++++------------
proton-c/bindings/cpp/docs/CMakeLists.txt | 2 +-
proton-c/docs/api/CMakeLists.txt | 2 +-
7 files changed, 41 insertions(+), 39 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b538ffd..4a5e787 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,14 +18,15 @@
#
cmake_minimum_required (VERSION 2.8.7)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
project (Proton C)
# Enable C++ now for examples and bindings subdirectories, but make it optional.
enable_language(CXX OPTIONAL)
# Enable testing
-enable_testing()
-include (CTest)
+#enable_testing()
+#include (CTest)
# Pull in local cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/Modules/")
@@ -141,7 +142,7 @@ set (BINDINGS_DIR ${LIB_INSTALL_DIR}/proton/bindings)
set (SYSINSTALL_BINDINGS OFF CACHE BOOL "If SYSINSTALL_BINDINGS is OFF then proton bindings will be installed underneath ${BINDINGS_DIR} and each user will need to modify their interpreter configuration to load the appropriate binding. If SYSINSTALL_BINDINGS is ON, then each language interpreter will be queried for the appropriate directory and proton bindings will be installed and available system wide with no additional per user configuration.")
-set (BINDING_LANGS PERL PHP PYTHON RUBY)
+#set (BINDING_LANGS PERL PHP PYTHON RUBY)
foreach (LANG ${BINDING_LANGS})
set (SYSINSTALL_${LANG} OFF CACHE BOOL "Install ${LANG} bindings into interpreter specified location.")
@@ -156,10 +157,10 @@ set (PROTON_SHARE ${SHARE_INSTALL_DIR}/proton-${PN_VERSION})
# End of variables used during install
# Check for valgrind here so tests under proton-c/ and examples/ can use it.
-find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
+#find_program(VALGRIND_EXE valgrind DOC "Location of the valgrind program")
mark_as_advanced (VALGRIND_EXE)
-option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
+#option(ENABLE_VALGRIND "Use valgrind to detect run-time problems" ON)
if (ENABLE_VALGRIND)
if (NOT VALGRIND_EXE)
message(STATUS "Can't locate the valgrind command; no run-time error detection")
@@ -171,7 +172,7 @@ if (ENABLE_VALGRIND)
endif (ENABLE_VALGRIND)
add_subdirectory(proton-c)
-add_subdirectory(examples)
+#add_subdirectory(examples)
install (FILES LICENSE README.md
DESTINATION ${PROTON_SHARE})
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 304d899..f4877b4 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -17,6 +17,7 @@
# under the License.
#
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(ProtonCpp REQUIRED)
include_directories(${ProtonCpp_INCLUDE_DIRS})
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 8edb661..dc7b99c 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -22,24 +22,24 @@ include(CheckSymbolExists)
include(soversion.cmake)
-add_custom_target(docs)
-add_custom_target(doc DEPENDS docs)
+#add_custom_target(docs)
+#add_custom_target(doc DEPENDS docs)
# Set the default SSL/TLS implementation
-find_package(OpenSSL)
+#find_package(OpenSSL)
find_package(PythonInterp REQUIRED)
-find_package(SWIG)
+#find_package(SWIG)
# FindSwig.cmake "forgets" make its outputs advanced like a good citizen
mark_as_advanced(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION)
# See if Cyrus SASL is available
-find_library(CYRUS_SASL_LIBRARY sasl2)
-find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include)
-find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
+#find_library(CYRUS_SASL_LIBRARY sasl2)
+#find_path(CYRUS_SASL_INCLUDE_DIR sasl/sasl.h PATH_SUFFIXES include)
+#find_package_handle_standard_args(CyrusSASL DEFAULT_MSG CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
mark_as_advanced(CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
# Find saslpasswd2 executable to generate test config
-find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing")
+#find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing")
mark_as_advanced(SASLPASSWD_EXE)
if(WIN32 AND NOT CYGWIN)
@@ -315,8 +315,8 @@ pn_absolute_install_dir(EXEC_PREFIX "." ${CMAKE_INSTALL_PREFIX})
pn_absolute_install_dir(LIBDIR ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
-add_subdirectory(docs/api)
-add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
+#add_subdirectory(docs/api)
+#add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
# for full source distribution:
set (qpid-proton-platform-all
@@ -507,7 +507,7 @@ if (BUILD_WITH_CXX)
endif (BUILD_WITH_CXX)
add_library (
- qpid-proton-core SHARED
+ qpid-proton-core STATIC
${qpid-proton-core}
${qpid-proton-layers}
${qpid-proton-platform}
@@ -527,7 +527,7 @@ set_target_properties (
)
add_library(
- qpid-proton SHARED
+ qpid-proton STATIC
# Proton Core
${qpid-proton-core}
${qpid-proton-layers}
@@ -629,7 +629,7 @@ install (FILES
# c tests:
-add_subdirectory(src/tests)
+#add_subdirectory(src/tests)
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
# No change needed for windows already use correct separator
@@ -712,7 +712,7 @@ if (BUILD_PYTHON)
endif (BUILD_PYTHON)
-find_program(RUBY_EXE "ruby")
+#find_program(RUBY_EXE "ruby")
if (RUBY_EXE AND BUILD_RUBY)
set (rb_root "${pn_test_root}/ruby")
set (rb_src "${CMAKE_CURRENT_SOURCE_DIR}/bindings/ruby")
@@ -751,8 +751,8 @@ if (RUBY_EXE AND BUILD_RUBY)
else (DEFAULT_RUBY_TESTING)
message(STATUS "Skipping Ruby tests: missing dependencies")
endif (DEFAULT_RUBY_TESTING)
-else (RUBY_EXE)
- message (STATUS "Cannot find ruby, skipping ruby tests")
+#else (RUBY_EXE)
+# message (STATUS "Cannot find ruby, skipping ruby tests")
endif()
mark_as_advanced (RUBY_EXE RSPEC_EXE)
diff --git a/proton-c/bindings/CMakeLists.txt b/proton-c/bindings/CMakeLists.txt
index 6b88384..d1a50a5 100644
--- a/proton-c/bindings/CMakeLists.txt
+++ b/proton-c/bindings/CMakeLists.txt
@@ -19,14 +19,14 @@
# Add bindings that do not require swig here - the directory name must be the same as the binding name
# See below for swig bindings
-set(BINDINGS javascript cpp go)
+set(BINDINGS cpp)
# Prerequisites for javascript.
#
# It uses a C/C++ to JavaScript cross-compiler called emscripten (https://github.com/kripken/emscripten). Emscripten takes C/C++
# and compiles it into a highly optimisable subset of JavaScript called asm.js (http://asmjs.org/) that can be
# aggressively optimised and run at near-native speed (usually between 1.5 to 10 times slower than native C/C++).
-find_package(Emscripten)
+#find_package(Emscripten)
if (EMSCRIPTEN_FOUND)
set (DEFAULT_JAVASCRIPT ON)
endif (EMSCRIPTEN_FOUND)
@@ -37,7 +37,7 @@ if (CMAKE_CXX_COMPILER)
endif (CMAKE_CXX_COMPILER)
# Prerequisites for Go
-find_program(GO_EXE go)
+#find_program(GO_EXE go)
mark_as_advanced(GO_EXE)
if (GO_EXE)
if(WIN32)
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 0cc4024..796fe29 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include(cpp.cmake) # Compiler checks
include_directories(
@@ -89,7 +89,7 @@ set_source_files_properties (
COMPILE_FLAGS "${LTO}"
)
-add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source})
+add_library(qpid-proton-cpp STATIC ${qpid-proton-cpp-source})
target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton)
@@ -120,8 +120,8 @@ endif (MSVC)
install (DIRECTORY "include/proton" DESTINATION ${INCLUDE_INSTALL_DIR} FILES_MATCHING PATTERN "*.hpp")
-add_subdirectory(docs)
-add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp)
+#add_subdirectory(docs)
+#add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp)
# Pkg config file
configure_file(
@@ -171,12 +171,12 @@ macro(add_cpp_test test)
endif ()
endmacro(add_cpp_test)
-add_cpp_test(codec_test)
+#add_cpp_test(codec_test)
#add_cpp_test(engine_test)
-add_cpp_test(thread_safe_test)
-add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
-add_cpp_test(message_test)
-add_cpp_test(scalar_test)
-add_cpp_test(value_test)
-add_cpp_test(container_test)
-add_cpp_test(url_test)
+#add_cpp_test(thread_safe_test)
+#add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
+#add_cpp_test(message_test)
+#add_cpp_test(scalar_test)
+#add_cpp_test(value_test)
+#add_cpp_test(container_test)
+#add_cpp_test(url_test)
diff --git a/proton-c/bindings/cpp/docs/CMakeLists.txt b/proton-c/bindings/cpp/docs/CMakeLists.txt
index d512d15..8576867 100644
--- a/proton-c/bindings/cpp/docs/CMakeLists.txt
+++ b/proton-c/bindings/cpp/docs/CMakeLists.txt
@@ -17,7 +17,7 @@
# under the License.
#
-find_package(Doxygen)
+#find_package(Doxygen)
if (DOXYGEN_FOUND)
configure_file (
diff --git a/proton-c/docs/api/CMakeLists.txt b/proton-c/docs/api/CMakeLists.txt
index 7756e48..71ebb93 100644
--- a/proton-c/docs/api/CMakeLists.txt
+++ b/proton-c/docs/api/CMakeLists.txt
@@ -17,7 +17,7 @@
# under the License.
#
-find_package(Doxygen)
+#find_package(Doxygen)
if (DOXYGEN_FOUND)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/user.doxygen.in
${CMAKE_CURRENT_BINARY_DIR}/user.doxygen)
--
2.7.4
Loading…
Cancel
Save