PCRE2 is now statically linked

Since the PCRE2 library was always going to be a part of MaxScale, there was
no real reason to have it as a shared library apart from smaller binaries.
This commit is contained in:
Markus Makela
2015-12-17 23:03:22 +02:00
parent e305a88e0e
commit 080a9ebc9d
6 changed files with 16 additions and 21 deletions

View File

@ -1,23 +1,18 @@
# Build the PCRE2 library from source # Build the PCRE2 library from source
# #
# This will add a 'pcre2' target to CMake which will generate the libpcre2-8.so # This will add a 'pcre2' target to CMake which will generate the libpcre2-8.a
# dynamic library and the pcre2.h header. If your target requires PCRE2 you # static library and the pcre2.h header. If your target requires PCRE2 you
# need to add a dependeny on the 'pcre2' target by adding add_dependencies(<target> pcre2) # need to add a dependeny on the 'pcre2' target by adding add_dependencies(<target> pcre2)
# to the CMakeLists.txt # to the CMakeLists.txt. You don't need to link against the pcre2 library
# because the static symbols will be in MaxScale.
include(ExternalProject) include(ExternalProject)
set(PCRE2_ROOT_DIR ${CMAKE_SOURCE_DIR}/pcre2/) ExternalProject_Add(pcre2 SOURCE_DIR ${CMAKE_SOURCE_DIR}/pcre2/
set(PCRE2_BUILD_DIR ${CMAKE_BINARY_DIR}/pcre2/) CMAKE_ARGS -DBUILD_SHARED_LIBS=N -DPCRE2_BUILD_PCRE2GREP=N -DPCRE2_BUILD_TESTS=N
set(PCRE2_LIBRARIES ${CMAKE_BINARY_DIR}/pcre2/libpcre2-8.so BINARY_DIR ${CMAKE_BINARY_DIR}/pcre2/
${CMAKE_BINARY_DIR}/pcre2/libpcre2-8.so.1.0.0
CACHE STRING "PCRE2 dynamic libraries" FORCE)
ExternalProject_Add(pcre2 SOURCE_DIR ${PCRE2_ROOT_DIR}
CMAKE_ARGS -DBUILD_SHARED_LIBS=Y -DPCRE2_BUILD_PCRE2GREP=N -DPCRE2_BUILD_TESTS=N
BINARY_DIR ${PCRE2_BUILD_DIR}
BUILD_COMMAND make BUILD_COMMAND make
INSTALL_COMMAND "") INSTALL_COMMAND "")
include_directories(${CMAKE_BINARY_DIR}/pcre2/) include_directories(${CMAKE_BINARY_DIR}/pcre2/)
install(PROGRAMS ${PCRE2_LIBRARIES} DESTINATION ${MAXSCALE_LIBDIR}) set(PCRE2_LIBRARIES ${CMAKE_BINARY_DIR}/pcre2/libpcre2-8.a CACHE INTERNAL "")

View File

@ -8,7 +8,7 @@ else()
endif() endif()
endif() endif()
add_executable(canonizer canonizer.c ${CMAKE_SOURCE_DIR}/server/core/random_jkiss.c) add_executable(canonizer canonizer.c ${CMAKE_SOURCE_DIR}/server/core/random_jkiss.c)
target_link_libraries(canonizer pthread query_classifier z dl ssl aio crypt crypto rt m ${EMBEDDED_LIB} fullcore stdc++) target_link_libraries(canonizer ${PCRE2_LIBRARIES} utils pthread query_classifier z dl ssl aio crypt crypto rt m ${EMBEDDED_LIB} fullcore stdc++)
add_test(NAME Internal-TestCanonicalQuery COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/canontest.sh add_test(NAME Internal-TestCanonicalQuery COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/canontest.sh
${CMAKE_CURRENT_BINARY_DIR}/test.log ${CMAKE_CURRENT_BINARY_DIR}/test.log
${CMAKE_CURRENT_SOURCE_DIR}/input.sql ${CMAKE_CURRENT_SOURCE_DIR}/input.sql

View File

@ -5,7 +5,7 @@ if(BUILD_TESTS OR BUILD_TOOLS)
elseif(WITH_TCMALLOC) elseif(WITH_TCMALLOC)
target_link_libraries(fullcore ${TCMALLOC_LIBRARIES}) target_link_libraries(fullcore ${TCMALLOC_LIBRARIES})
endif() endif()
target_link_libraries(fullcore ${CURL_LIBRARIES} utils log_manager pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++) target_link_libraries(fullcore ${CURL_LIBRARIES} utils ${PCRE2_LIBRARIES} log_manager pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ssl aio rt crypt dl crypto inih z m stdc++)
add_dependencies(fullcore pcre2) add_dependencies(fullcore pcre2)
endif() endif()
@ -22,15 +22,15 @@ elseif(WITH_TCMALLOC)
target_link_libraries(maxscale ${TCMALLOC_LIBRARIES}) target_link_libraries(maxscale ${TCMALLOC_LIBRARIES})
endif() endif()
target_link_libraries(maxscale ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++) target_link_libraries(maxscale ${LZMA_LINK_FLAGS} ${PCRE2_LIBRARIES} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} ${CURL_LIBRARIES} log_manager utils ssl aio pthread crypt dl crypto inih z rt m stdc++)
install(TARGETS maxscale DESTINATION ${MAXSCALE_BINDIR}) install(TARGETS maxscale DESTINATION ${MAXSCALE_BINDIR})
add_executable(maxkeys maxkeys.c spinlock.c secrets.c utils.c gwdirs.c random_jkiss.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc) add_executable(maxkeys maxkeys.c spinlock.c secrets.c utils.c gwdirs.c random_jkiss.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc)
target_link_libraries(maxkeys utils pthread crypt crypto) target_link_libraries(maxkeys utils pthread crypt crypto ${PCRE2_LIBRARIES})
install(TARGETS maxkeys DESTINATION ${MAXSCALE_BINDIR}) install(TARGETS maxkeys DESTINATION ${MAXSCALE_BINDIR})
add_executable(maxpasswd maxpasswd.c spinlock.c secrets.c utils.c gwdirs.c random_jkiss.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc) add_executable(maxpasswd maxpasswd.c spinlock.c secrets.c utils.c gwdirs.c random_jkiss.c ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc)
target_link_libraries(maxpasswd utils pthread crypt crypto) target_link_libraries(maxpasswd utils pthread crypt crypto ${PCRE2_LIBRARIES})
install(TARGETS maxpasswd DESTINATION ${MAXSCALE_BINDIR}) install(TARGETS maxpasswd DESTINATION ${MAXSCALE_BINDIR})
if(BUILD_TESTS) if(BUILD_TESTS)

View File

@ -11,7 +11,7 @@ if(BUILD_RABBITMQ)
endif() endif()
add_library(regexfilter SHARED regexfilter.c) add_library(regexfilter SHARED regexfilter.c)
target_link_libraries(regexfilter log_manager ${PCRE2_LIBRARIES}) target_link_libraries(regexfilter log_manager)
add_dependencies(regexfilter pcre2) add_dependencies(regexfilter pcre2)
set_target_properties(regexfilter PROPERTIES VERSION "1.1.0") set_target_properties(regexfilter PROPERTIES VERSION "1.1.0")
install(TARGETS regexfilter DESTINATION ${MAXSCALE_LIBDIR}) install(TARGETS regexfilter DESTINATION ${MAXSCALE_LIBDIR})

View File

@ -20,7 +20,7 @@ add_executable(maxbinlogcheck maxbinlogcheck.c blr_file.c blr_cache.c blr_master
${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/server/core/externcmd.c) ${CMAKE_SOURCE_DIR}/log_manager/log_manager.cc ${CMAKE_SOURCE_DIR}/server/core/externcmd.c)
target_link_libraries(maxbinlogcheck utils ssl pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} aio rt crypt dl crypto inih z m stdc++ ${CURL_LIBRARIES}) target_link_libraries(maxbinlogcheck utils ssl pthread ${LZMA_LINK_FLAGS} ${EMBEDDED_LIB} ${PCRE_LINK_FLAGS} aio rt crypt dl crypto inih z m stdc++ ${CURL_LIBRARIES} ${PCRE2_LIBRARIES})
install(TARGETS maxbinlogcheck DESTINATION bin) install(TARGETS maxbinlogcheck DESTINATION bin)

View File

@ -1,3 +1,3 @@
add_library(utils skygw_utils.cc ../server/core/atomic.c) add_library(utils skygw_utils.cc ../server/core/atomic.c)
target_link_libraries(utils stdc++ ${PCRE2_LIBRARIES}) target_link_libraries(utils stdc++)
add_dependencies(utils pcre2) add_dependencies(utils pcre2)