From 75e7ac35ed2149dc135a6950fd0e7098f1ca2b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 18 May 2017 11:51:37 +0300 Subject: [PATCH] MXS-1220: Always build libmicrohttpd This allows MaxScale to use the PATCH functionality that's only in the newer versions of the library. It also removes some of the problems that exist with older systems that don't support all of the options. --- CMakeLists.txt | 2 ++ .../Building-MaxScale-from-Source-Code.md | 8 +++++--- cmake/BuildMicroHttpd.cmake | 10 ++++++++++ server/core/CMakeLists.txt | 4 +++- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 cmake/BuildMicroHttpd.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index aa3b9c413..11a55902e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,8 @@ if(NOT JANSSON_FOUND) include(cmake/BuildJansson.cmake) endif() +include(cmake/BuildMicroHttpd.cmake) + include_directories(${JANSSON_INCLUDE_DIR}) # You can find the variables set by this in the FindCURL.cmake file diff --git a/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md b/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md index 632ba8799..2cb45ab0b 100644 --- a/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md +++ b/Documentation/Getting-Started/Building-MaxScale-from-Source-Code.md @@ -24,6 +24,7 @@ other packages in addition to these. git gcc gcc-c++ ncurses-devel bison flex glibc-devel cmake libgcc perl make \ libtool openssl openssl-devel libcurl-devel pcre-devel tcl tcl-devel \ systemtap-sdt-devel libuuid libuuid-devel sqlite sqlite-devel +gnutls gcrypt ``` You can install the packages with the following commands. @@ -32,7 +33,7 @@ You can install the packages with the following commands. sudo yum install git gcc gcc-c++ ncurses-devel bison flex glibc-devel cmake \ libgcc perl make libtool openssl openssl-devel libcurl-devel pcre-devel \ tcl tcl-devel systemtap-sdt-devel libuuid libuuid-devel sqlite sqlite-devel \ - libmicrohttpd-devel + gnutls gcrypt ``` ### Required packages on Ubuntu and Debian systems @@ -42,7 +43,8 @@ require other packages in addition to these. ``` git build-essential libssl-dev ncurses-dev bison flex cmake perl libtool \ -libcurl4-openssl-dev libpcre3-dev tlc tcl-dev uuid uuid-dev sqlite3-dev libmicrohttpd-dev +libcurl4-openssl-dev libpcre3-dev tlc tcl-dev uuid uuid-dev sqlite3-dev +libgnutls30 libgcrypt20 ``` You can install the packages with the following command. @@ -50,7 +52,7 @@ You can install the packages with the following command. ``` sudo apt-get install git build-essential libssl-dev ncurses-dev bison flex \ cmake perl libtool libcurl4-openssl-dev libpcre3-dev tcl tcl-dev uuid \ - uuid-dev libsqlite3-dev libmicrohttpd-dev + uuid-dev libsqlite3-dev libgnutls30 libgcrypt20 ``` ## Preparing the MariaDB MaxScale build diff --git a/cmake/BuildMicroHttpd.cmake b/cmake/BuildMicroHttpd.cmake new file mode 100644 index 000000000..bd2fcd8e2 --- /dev/null +++ b/cmake/BuildMicroHttpd.cmake @@ -0,0 +1,10 @@ +ExternalProject_Add(libmicrohttpd + URL http://ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-0.9.54.tar.gz + SOURCE_DIR ${CMAKE_BINARY_DIR}/libmicrohttpd/ + CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/libmicrohttpd//configure --prefix=${CMAKE_BINARY_DIR}/libmicrohttpd/ --enable-shared --with-pic + BINARY_DIR ${CMAKE_BINARY_DIR}/libmicrohttpd/ + BUILD_COMMAND make + INSTALL_COMMAND make install) + +include_directories(${CMAKE_BINARY_DIR}/libmicrohttpd/include/) +set(MICROHTTPD_LIBRARIES ${CMAKE_BINARY_DIR}/libmicrohttpd/lib/libmicrohttpd.a) diff --git a/server/core/CMakeLists.txt b/server/core/CMakeLists.txt index 78db4c51a..7ef6a6f32 100644 --- a/server/core/CMakeLists.txt +++ b/server/core/CMakeLists.txt @@ -74,7 +74,9 @@ target_link_libraries(maxscale-common rt m stdc++ - microhttpd + gnutls + gcrypt + ${MICROHTTPD_LIBRARIES} ) add_dependencies(maxscale-common pcre2 connector-c)