Updated packaging install layout, moved some cmake files around.
This commit is contained in:
@ -6,13 +6,16 @@ endif()
|
|||||||
|
|
||||||
message(STATUS "CMake version: ${CMAKE_VERSION}")
|
message(STATUS "CMake version: ${CMAKE_VERSION}")
|
||||||
|
|
||||||
include(macros.cmake)
|
include(${CMAKE_SOURCE_DIR}/cmake/macros.cmake)
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/install_layout.cmake)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
set_variables()
|
set_variables()
|
||||||
set_maxscale_version()
|
set_maxscale_version()
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "/usr/local/mariadb-maxscale" CACHE PATH "Prefix prepended to install directories.")
|
|
||||||
|
set(INSTALL_LAYOUT "STANDALONE" CACHE STRING "Install layout, options are: STANDALONE, RPM, DEB")
|
||||||
|
set_install_layout(${INSTALL_LAYOUT})
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||||
@ -37,6 +40,7 @@ if(NOT CURL_FOUND)
|
|||||||
message(FATAL_ERROR "Failed to locate dependency: libcurl")
|
message(FATAL_ERROR "Failed to locate dependency: libcurl")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_MODULE_DIR}:${MAXSCALE_LIBRARY_DIR})
|
||||||
|
|
||||||
# Make sure the release notes for this release are present if it is a stable one
|
# Make sure the release notes for this release are present if it is a stable one
|
||||||
if(${MAXSCALE_VERSION} MATCHES "-stable")
|
if(${MAXSCALE_VERSION} MATCHES "-stable")
|
||||||
@ -144,7 +148,7 @@ install(FILES ${CMAKE_BINARY_DIR}/ReleaseNotes.txt DESTINATION ${MAXSCALE_SHARE_
|
|||||||
install(FILES ${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt DESTINATION ${MAXSCALE_SHARE_DIR})
|
install(FILES ${CMAKE_BINARY_DIR}/UpgradingToMaxScale110.txt DESTINATION ${MAXSCALE_SHARE_DIR})
|
||||||
install(FILES server/MaxScale_template.cnf DESTINATION ${MAXSCALE_CONFIG_DIR})
|
install(FILES server/MaxScale_template.cnf DESTINATION ${MAXSCALE_CONFIG_DIR})
|
||||||
install(FILES server/MaxScale_BinlogServer_template.cnf DESTINATION ${MAXSCALE_CONFIG_DIR})
|
install(FILES server/MaxScale_BinlogServer_template.cnf DESTINATION ${MAXSCALE_CONFIG_DIR})
|
||||||
install(FILES ${ERRMSG} DESTINATION ${MAXSCALE_LANG_DIR})
|
install(FILES ${ERRMSG} DESTINATION ${MAXSCALE_SHARE_DIR})
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/COPYRIGHT DESTINATION ${MAXSCALE_SHARE_DIR})
|
install(FILES ${CMAKE_SOURCE_DIR}/COPYRIGHT DESTINATION ${MAXSCALE_SHARE_DIR})
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/README DESTINATION ${MAXSCALE_SHARE_DIR})
|
install(FILES ${CMAKE_SOURCE_DIR}/README DESTINATION ${MAXSCALE_SHARE_DIR})
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ${MAXSCALE_SHARE_DIR})
|
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION ${MAXSCALE_SHARE_DIR})
|
||||||
@ -225,7 +229,7 @@ if(PACKAGE)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_target(buildtests
|
add_custom_target(buildtestsx
|
||||||
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N ${CMAKE_SOURCE_DIR}
|
COMMAND ${CMAKE_COMMAND} -DDEPS_OK=Y -DBUILD_TESTS=Y -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} -DWITH_SCRIPTS=N ${CMAKE_SOURCE_DIR}
|
||||||
COMMAND make
|
COMMAND make
|
||||||
COMMENT "Building test suite..." VERBATIM
|
COMMENT "Building test suite..." VERBATIM
|
||||||
|
29
cmake/install_layout.cmake
Normal file
29
cmake/install_layout.cmake
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Set the install layout
|
||||||
|
# Possible values:
|
||||||
|
# STANDALONE - Installs to /usr/local/mariadb-maxscale
|
||||||
|
# RPM - Installs to /usr
|
||||||
|
# DEB - Installs to /usr
|
||||||
|
function(set_install_layout TYPE)
|
||||||
|
|
||||||
|
if(${TYPE} MATCHES "STANDALONE")
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_PREFIX "/usr/local/mariadb-maxscale" CACHE PATH "Prefix prepended to install directories.")
|
||||||
|
|
||||||
|
# RPM and DEB are the same until differences are found
|
||||||
|
elseif(${TYPE} MATCHES "RPM")
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Prefix prepended to install directories.")
|
||||||
|
|
||||||
|
elseif(${TYPE} MATCHES "DEB")
|
||||||
|
|
||||||
|
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Prefix prepended to install directories.")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(MAXSCALE_MODULE_INSTALL lib64/maxscale CACHE PATH "Module installation path")
|
||||||
|
set(MAXSCALE_LIBRARY_INSTALL lib64/maxscale CACHE PATH "Library installation path")
|
||||||
|
set(MAXSCALE_EXECUTABLE_INSTALL bin CACHE PATH "Executable installation path")
|
||||||
|
set(MAXSCALE_SHARE_DIR share/maxscale CACHE PATH "Share file installation path, includes licence and readme files")
|
||||||
|
set(MAXSCALE_DOC_DIR ${MAXSCALE_SHARE_DIR}/doc CACHE PATH "Documentation installation path, text versions only")
|
||||||
|
set(MAXSCALE_CONFIG_DIR ${MAXSCALE_SHARE_DIR}/etc CACHE PATH "Configuration file installation path, example configurations will be placed here")
|
||||||
|
endfunction()
|
@ -74,34 +74,6 @@ macro(set_variables)
|
|||||||
# Build extra tools
|
# Build extra tools
|
||||||
set(BUILD_TOOLS FALSE CACHE BOOL "Build extra utility tools")
|
set(BUILD_TOOLS FALSE CACHE BOOL "Build extra utility tools")
|
||||||
|
|
||||||
# Change installation directories to standard locations for packages
|
|
||||||
if(PACKAGE)
|
|
||||||
set(MAXSCALE_MODULE_INSTALL /lib64/maxscale CACHE PATH "Module installation path")
|
|
||||||
set(MAXSCALE_LIBRARY_INSTALL /lib64/maxscale CACHE PATH "Library installation path")
|
|
||||||
message(STATUS "Installing MaxScale modules to: ${MAXSCALE_MODULE_INSTALL}/")
|
|
||||||
set(MAXSCALE_EXECUTABLE_INSTALL /bin CACHE PATH "Executable installation path")
|
|
||||||
message(STATUS "Installing MaxScale binaries to: ${MAXSCALE_EXECUTABLE_INSTALL}/")
|
|
||||||
set(MAXSCALE_CONFIG_DIR /etc CACHE PATH "Configuration file installation path")
|
|
||||||
set(MAXSCALE_DOC_DIR /usr/share/maxscale/doc CACHE PATH "Documentation installation path")
|
|
||||||
set(MAXSCALE_LOG_DIR /var/log/maxscale CACHE PATH "Log file directory")
|
|
||||||
message(STATUS "MaxScale log directory: ${MAXSCALE_LOG_DIR}/")
|
|
||||||
set(MAXSCALE_CACHE_DIR /var/cache/maxscale CACHE PATH "Service cache file directory")
|
|
||||||
set(MAXSCALE_LANG_DIR /var/cache/maxscale CACHE PATH "Language file directory(errmsg.sys)")
|
|
||||||
set(MAXSCALE_SHARE_DIR /usr/share/maxscale CACHE PATH "Share file installation path")
|
|
||||||
set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_MODULE_DIR}:${MAXSCALE_LIBRARY_DIR})
|
|
||||||
else()
|
|
||||||
message(STATUS "Installing MaxScale to: ${CMAKE_INSTALL_PREFIX}/")
|
|
||||||
set(MAXSCALE_MODULE_INSTALL lib64/maxscale CACHE PATH "Module installation path")
|
|
||||||
set(MAXSCALE_LIBRARY_INSTALL lib64/maxscale CACHE PATH "Library installation path")
|
|
||||||
set(MAXSCALE_EXECUTABLE_INSTALL bin CACHE PATH "Executable installation path")
|
|
||||||
set(MAXSCALE_CONFIG_DIR etc CACHE PATH "Configuration file installation path")
|
|
||||||
set(MAXSCALE_DOC_DIR doc CACHE PATH "Documentation installation path")
|
|
||||||
set(MAXSCALE_LOG_DIR log CACHE PATH "Log file directory")
|
|
||||||
set(MAXSCALE_CACHE_DIR cache CACHE PATH "Service cache file directory")
|
|
||||||
set(MAXSCALE_LANG_DIR cache CACHE PATH "Log file directory")
|
|
||||||
set(MAXSCALE_SHARE_DIR . CACHE PATH "Share file installation path")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(check_deps)
|
macro(check_deps)
|
@ -1,5 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
mkdir -p /var/log/maxscale
|
||||||
|
mkdir -p /var/cache/maxscale
|
||||||
|
mkdir -p /var/run/maxscale
|
||||||
cp @CMAKE_INSTALL_PREFIX@/maxscale /etc/init.d/
|
cp @CMAKE_INSTALL_PREFIX@/maxscale /etc/init.d/
|
||||||
cp @CMAKE_INSTALL_PREFIX@/maxscale.conf /etc/ld.so.conf.d/
|
cp @CMAKE_INSTALL_PREFIX@/maxscale.conf /etc/ld.so.conf.d/
|
||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
install(FILES nagios/check_maxscale_monitors.pl DESTINATION plugins/nagios)
|
install(FILES nagios/check_maxscale_monitors.pl DESTINATION ${MAXSCALE_SHARE_DIR}/plugins/nagios)
|
||||||
install(FILES nagios/check_maxscale_resources.pl DESTINATION plugins/nagios)
|
install(FILES nagios/check_maxscale_resources.pl DESTINATION ${MAXSCALE_SHARE_DIR}/plugins/nagios)
|
||||||
install(FILES nagios/check_maxscale_threads.pl DESTINATION plugins/nagios)
|
install(FILES nagios/check_maxscale_threads.pl DESTINATION ${MAXSCALE_SHARE_DIR}/plugins/nagios)
|
||||||
install(FILES nagios/maxscale_commands.cfg DESTINATION plugins/nagios)
|
install(FILES nagios/maxscale_commands.cfg DESTINATION ${MAXSCALE_SHARE_DIR}/plugins/nagios)
|
||||||
install(FILES nagios/server1.cfg DESTINATION plugins/nagios)
|
install(FILES nagios/server1.cfg DESTINATION ${MAXSCALE_SHARE_DIR}/plugins/nagios)
|
||||||
|
@ -1276,6 +1276,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
moduledir = tmp_path;
|
moduledir = tmp_path;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
if(handle_path_arg(&tmp_path,optarg,NULL,true,true))
|
if(handle_path_arg(&tmp_path,optarg,NULL,true,true))
|
||||||
{
|
{
|
||||||
@ -1739,7 +1740,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if(cachedir == NULL)
|
if(cachedir == NULL)
|
||||||
cachedir = strdup(default_cachedir);
|
cachedir = strdup(default_cachedir);
|
||||||
|
|
||||||
if(langdir == NULL)
|
if(langdir == NULL)
|
||||||
langdir = strdup(default_langdir);
|
langdir = strdup(default_langdir);
|
||||||
if(moduledir == NULL)
|
if(moduledir == NULL)
|
||||||
@ -1780,11 +1780,13 @@ int main(int argc, char **argv)
|
|||||||
"Configuration file : %s\n"
|
"Configuration file : %s\n"
|
||||||
"Log directory : %s\n"
|
"Log directory : %s\n"
|
||||||
"Data directory : %s\n"
|
"Data directory : %s\n"
|
||||||
"Module directory : %s\n\n",
|
"Module directory : %s\n"
|
||||||
|
"Service cache : %s\n\n",
|
||||||
cnf_file_path,
|
cnf_file_path,
|
||||||
logdir,
|
logdir,
|
||||||
datadir,
|
datadir,
|
||||||
moduledir);
|
moduledir,
|
||||||
|
cachedir);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGIF(LM,
|
LOGIF(LM,
|
||||||
@ -1806,6 +1808,10 @@ int main(int argc, char **argv)
|
|||||||
(skygw_log_write_flush(LOGFILE_MESSAGE,
|
(skygw_log_write_flush(LOGFILE_MESSAGE,
|
||||||
"Module directory: %s",
|
"Module directory: %s",
|
||||||
moduledir)));
|
moduledir)));
|
||||||
|
LOGIF(LM,
|
||||||
|
(skygw_log_write_flush(LOGFILE_MESSAGE,
|
||||||
|
"Service cache: %s",
|
||||||
|
cachedir)));
|
||||||
|
|
||||||
/*< Update the server options */
|
/*< Update the server options */
|
||||||
for (i = 0; server_options[i]; i++)
|
for (i = 0; server_options[i]; i++)
|
||||||
@ -1882,7 +1888,7 @@ int main(int argc, char **argv)
|
|||||||
if (!config_load(cnf_file_path))
|
if (!config_load(cnf_file_path))
|
||||||
{
|
{
|
||||||
char* fprerr = "Failed to load MaxScale configuration "
|
char* fprerr = "Failed to load MaxScale configuration "
|
||||||
"file. Exiting.";
|
"file. Exiting. See the error log for details.";
|
||||||
print_log_n_stderr(false, !daemon_mode, fprerr, fprerr, 0);
|
print_log_n_stderr(false, !daemon_mode, fprerr, fprerr, 0);
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <housekeeper.h>
|
#include <housekeeper.h>
|
||||||
#include <resultset.h>
|
#include <resultset.h>
|
||||||
|
#include <gw.h>
|
||||||
|
|
||||||
/** Defined in log_manager.cc */
|
/** Defined in log_manager.cc */
|
||||||
extern int lm_enabled_logfiles_bitmask;
|
extern int lm_enabled_logfiles_bitmask;
|
||||||
@ -112,7 +113,7 @@ SERVICE *service;
|
|||||||
return NULL;
|
return NULL;
|
||||||
if ((service->router = load_module(router, MODULE_ROUTER)) == NULL)
|
if ((service->router = load_module(router, MODULE_ROUTER)) == NULL)
|
||||||
{
|
{
|
||||||
char* home = get_maxscale_home();
|
char* home = get_moduledir();
|
||||||
char* ldpath = getenv("LD_LIBRARY_PATH");
|
char* ldpath = getenv("LD_LIBRARY_PATH");
|
||||||
|
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
@ -120,12 +121,13 @@ SERVICE *service;
|
|||||||
"Error : Unable to load %s module \"%s\".\n\t\t\t"
|
"Error : Unable to load %s module \"%s\".\n\t\t\t"
|
||||||
" Ensure that lib%s.so exists in one of the "
|
" Ensure that lib%s.so exists in one of the "
|
||||||
"following directories :\n\t\t\t "
|
"following directories :\n\t\t\t "
|
||||||
"- %s/modules\n\t\t\t - %s",
|
"- %s/modules\n%s%s",
|
||||||
MODULE_ROUTER,
|
MODULE_ROUTER,
|
||||||
router,
|
router,
|
||||||
router,
|
router,
|
||||||
home,
|
home,
|
||||||
ldpath)));
|
ldpath?"\t\t\t - ":"",
|
||||||
|
ldpath?ldpath:"")));
|
||||||
free(service);
|
free(service);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user