removed manual UBUNTU flag and renamed it to DEB_LIKE and made it automated

This commit is contained in:
Markus Makela 2014-09-18 15:50:58 +03:00
parent b6ab18166e
commit 942174e94f
3 changed files with 62 additions and 49 deletions

View File

@ -80,12 +80,11 @@ add_subdirectory(query_classifier)
add_subdirectory(server)
add_subdirectory(client)
file(GLOB DOCS Documentation/*.pdf)
if( NOT ( (DEFINED INSTALL_SYSTEM_FILES) AND ( NOT ( INSTALL_SYSTEM_FILES ) ) ) )
install(FILES maxscale.conf DESTINATION /etc/ld.so.conf.d/ PERMISSIONS WORLD_EXECUTE WORLD_READ)
if(UBUNTU)
if(DEB_BASED)
message(STATUS "Ubuntu: Y")
install(FILES etc/ubuntu/init.d/maxscale DESTINATION /etc/init.d/ PERMISSIONS WORLD_EXECUTE)
else()

15
README
View File

@ -188,16 +188,15 @@ All the parameters affecting CMake can be found in 'macros.cmake'. This file als
Variables controlling the CMake build process:
INSTALL_DIR=<path> Installation directory
BUILD_TYPE=[None|Debug|Release] Type of the build, defaults to Release (optimized)
INSTALL_DIR=<path> Installation directory
BUILD_TYPE=[None|Debug|Release] Type of the build, defaults to Release (optimized)
INSTALL_SYSTEM_FILES=[Y|N] Install startup scripts and ld configuration files
EMBEDDED_LIB=<path> Path to the embedded library, filename included
MYSQL_DIR=<path> Path to MySQL headers
EMBEDDED_LIB=<path> Path to the embedded library, filename included
MYSQL_DIR=<path> Path to MySQL headers
STATIC_EMBEDDED=[Y|N] Link the static or the dynamic verson of the library
GCOV=[Y|N] Generate gcov output
BUILD_TESTS=[Y|N] Build tests
UBUNTU=[Y|N] Install Ubuntu specific startup scripts
DEBUG_OUTPUT=[Y|N] Produce debugging output when configuring CMake
GCOV=[Y|N] Generate gcov output
BUILD_TESTS=[Y|N] Build tests
DEBUG_OUTPUT=[Y|N] Produce debugging output when configuring CMake
\section Running Running MaxScale

View File

@ -65,7 +65,7 @@ macro(check_deps)
set(DEPS_ERROR TRUE)
set(FAILED_DEPS "${FAILED_DEPS} lib${lib}")
elseif(DEBUG_OUTPUT)
message(STATUS "Library was found at: ${lib${lib}}")
message(STATUS "Library was found at: ${lib${lib}}")
endif()
endforeach()
@ -76,49 +76,64 @@ macro(check_deps)
endmacro()
macro(check_dirs)
# Find the MySQL headers if they were not defined
if(NOT ( DEFINED MYSQL_DIR ) )
find_path(MYSQL_DIR mysql.h PATH_SUFFIXES mysql mariadb)
if(${MYSQL_DIR} STREQUAL "MYSQL_DIR-NOTFOUND")
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
elseif(DEBUG_OUTPUT)
message(STATUS "Using MySQL headers found at: ${MYSQL_DIR}")
# Find the MySQL headers if they were not defined
if(NOT ( DEFINED MYSQL_DIR ) )
find_path(MYSQL_DIR mysql.h PATH_SUFFIXES mysql mariadb)
if(${MYSQL_DIR} STREQUAL "MYSQL_DIR-NOTFOUND")
message(FATAL_ERROR "Fatal Error: MySQL headers were not found.")
elseif(DEBUG_OUTPUT)
message(STATUS "Using MySQL headers found at: ${MYSQL_DIR}")
endif()
endif()
endif()
# Find the errmsg.sys file if it was not defied
if( NOT ( DEFINED ERRMSG ) )
find_file(ERRMSG errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql ${CUSTOM_ERRMSG} PATH_SUFFIXES english)
if(${ERRMSG} STREQUAL "ERRMSG-NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found.")
elseif(DEBUG_OUTPUT)
message(STATUS "Using errmsg.sys found at: ${ERRMSG}")
# Find the errmsg.sys file if it was not defied
if( NOT ( DEFINED ERRMSG ) )
find_file(ERRMSG errmsg.sys PATHS /usr/share/mysql /usr/local/share/mysql ${CUSTOM_ERRMSG} PATH_SUFFIXES english)
if(${ERRMSG} STREQUAL "ERRMSG-NOTFOUND")
message(FATAL_ERROR "Fatal Error: The errmsg.sys file was not found.")
elseif(DEBUG_OUTPUT)
message(STATUS "Using errmsg.sys found at: ${ERRMSG}")
endif()
endif()
endif()
# Find the embedded mysql library
if(STATIC_EMBEDDED)
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
find_library(EMBEDDED_LIB_STATIC libmysqld.a PATH_SUFFIXES mysql mariadb)
set(EMBEDDED_LIB ${EMBEDDED_LIB_STATIC})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
else()
# Find the embedded mysql library
if(STATIC_EMBEDDED)
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
find_library(EMBEDDED_LIB_STATIC libmysqld.a PATH_SUFFIXES mysql mariadb)
set(EMBEDDED_LIB ${EMBEDDED_LIB_STATIC})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
else()
find_library(EMBEDDED_LIB_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb)
set(EMBEDDED_LIB ${EMBEDDED_LIB_DYNAMIC})
endif()
# Inform the user about the embedded library
if( (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_STATIC-NOTFOUND") OR (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_DYNAMIC-NOTFOUND"))
message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DEMBEDDED_LIB=<path to library>")
else()
get_filename_component(EMBEDDED_LIB ${EMBEDDED_LIB} REALPATH)
message(STATUS "Using embedded library: ${EMBEDDED_LIB}")
endif()
# Check which init.d script to install
find_file(RPM_FNC functions PATHS /etc/rc.d/init.d)
if(${RPM_FNC} MATCHES "RPM_FNC-NOTFOUND")
find_file(DEB_FNC init-functions PATHS /lib/lsb)
if(${DEB_FNC MATCHES} "DEB_FNC-NOTFOUND")
message(FATAL_ERROR "Cannot find required init-functions in /lib/lsb/ or /etc/rc.d/init.d/, please confirm that your system files are OK.")
else()
set(DEB_BASED TRUE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
endif()
else()
set(DEB_BASED FALSE CACHE BOOL "If init.d script uses /lib/lsb/init-functions instead of /etc/rc.d/init.d/functions.")
endif()
find_library(EMBEDDED_LIB_DYNAMIC mysqld PATH_SUFFIXES mysql mariadb)
set(EMBEDDED_LIB ${EMBEDDED_LIB_DYNAMIC})
endif()
# Inform the user about the embedded library
if( (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_STATIC-NOTFOUND") OR (${EMBEDDED_LIB} STREQUAL "EMBEDDED_LIB_DYNAMIC-NOTFOUND"))
message(FATAL_ERROR "Library not found: libmysqld. If your install of MySQL is in a non-default location, please provide the location with -DEMBEDDED_LIB=<path to library>")
else()
get_filename_component(EMBEDDED_LIB ${EMBEDDED_LIB} REALPATH)
message(STATUS "Using embedded library: ${EMBEDDED_LIB}")
endif()
set(DEPS_OK TRUE CACHE BOOL "If all the dependencies were found.")
set(DEPS_OK TRUE CACHE BOOL "If all the dependencies were found.")
endmacro()