Added variables that are used when installing instead of relative paths.

This commit is contained in:
Markus Makela
2015-04-25 06:53:59 +03:00
parent eec053924c
commit df9bc65430
17 changed files with 122 additions and 100 deletions

View File

@ -18,15 +18,15 @@ if(WITH_TCMALLOC)
endif()
target_link_libraries(maxscale ${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 bin)
install(TARGETS maxscale DESTINATION ${MAXSCALE_EXECUTABLE_INSTALL})
add_executable(maxkeys maxkeys.c secrets.c utils.c)
target_link_libraries(maxkeys log_manager utils pthread crypt crypto)
install(TARGETS maxkeys DESTINATION bin)
install(TARGETS maxkeys DESTINATION ${MAXSCALE_EXECUTABLE_INSTALL})
add_executable(maxpasswd maxpasswd.c secrets.c utils.c)
target_link_libraries(maxpasswd log_manager utils pthread crypt crypto)
install(TARGETS maxpasswd DESTINATION bin)
install(TARGETS maxpasswd DESTINATION ${MAXSCALE_EXECUTABLE_INSTALL})
if(BUILD_TESTS)
add_subdirectory(test)

View File

@ -113,16 +113,6 @@ static char* server_options[] = {
const int num_elements = (sizeof(server_options) / sizeof(char *)) - 1;
const char* default_cnf_fname = "MaxScale.cnf";
const char* default_configdir = "/etc/";
const char* default_logdir = "/var/log/maxscale/";
const char* default_datadir = "/var/lib/maxscale/";
const char* default_moduledir = "/lib64/maxscale/modules/";
const char* default_cachedir = "/var/cache/maxscale/";
const char* default_langdir = "/usr/share/mysql/english/";
const char* default_piddir = "/var/run/maxscale/";
static char* server_groups[] = {
"embedded",
"server",
@ -1752,7 +1742,8 @@ int main(int argc, char **argv)
if(langdir == NULL)
langdir = strdup(default_langdir);
if(moduledir == NULL)
moduledir = strdup(default_moduledir);
/**
* Set a data directory for the mysqld library, we use
* a unique directory name to avoid clauses if multiple
@ -1786,33 +1777,35 @@ int main(int argc, char **argv)
if (!daemon_mode)
{
fprintf(stderr,
//"Home directory : %s"
"Configuration file : %s"
"\nLog directory : %s"
"\nData directory : %s\n\n",
//home_dir,
"Configuration file : %s\n"
"Log directory : %s\n"
"Data directory : %s\n"
"Module directory : %s\n\n",
cnf_file_path,
logdir,
datadir);
datadir,
moduledir);
}
/*
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"Home directory : %s",
home_dir)));
*/
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"Data directory : %s",
datadir)));
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"Log directory : %s/",
logdir)));
LOGIF(LM, (skygw_log_write_flush(
LOGFILE_MESSAGE,
"Configuration file : %s",
cnf_file_path)));
LOGIF(LM,
(skygw_log_write_flush(
LOGFILE_MESSAGE,
"Configuration file: %s",
cnf_file_path)));
LOGIF(LM,
(skygw_log_write_flush(
LOGFILE_MESSAGE,
"Log directory: %s/",
logdir)));
LOGIF(LM,
(skygw_log_write_flush(
LOGFILE_MESSAGE,
"Data directory: %s",
datadir)));
LOGIF(LM,
(skygw_log_write_flush(LOGFILE_MESSAGE,
"Module directory: %s",
moduledir)));
/*< Update the server options */
for (i = 0; server_options[i]; i++)
@ -2211,4 +2204,4 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
}
return 1;
}
}

View File

@ -147,7 +147,6 @@ MODULE_INFO *mod_info = NULL;
if (access(fname, F_OK) == -1)
{
//home = get_maxscale_home ();
snprintf(fname, MAXPATHLEN+1,"%s/lib%s.so", get_moduledir(), module);
if (access(fname, F_OK) == -1)

View File

@ -1,3 +1,5 @@
#ifndef _GW_HG
#define _GW_HG
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
@ -16,9 +18,19 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdbool.h>
/** Default file locations */
static const char* default_cnf_fname = "MaxScale.cnf";
static const char* default_configdir = "/etc/";
static const char* default_logdir = "/var/log/maxscale/";
static const char* default_datadir = "/var/cache/maxscale/";
static const char* default_moduledir = "/lib64/maxscale/";
static const char* default_cachedir = "/var/cache/maxscale/";
static const char* default_langdir = "/usr/share/mysql/english/"; /*< This is where the MariaDB
* server installs errmsg.sys */
static const char* default_piddir = "/var/run/maxscale/";
#define EXIT_FAILURE 1
// network buffer is 32K
@ -65,4 +77,5 @@ int gw_write(DCB *dcb, const void *buf, size_t nbytes);
int gw_getsockerrno(int fd);
int parse_bindconfig(char *, unsigned short, struct sockaddr_in *);
int setipaddress(struct in_addr *, char *);
char* get_moduledir();
char* get_moduledir();
#endif

View File

@ -3,41 +3,41 @@ if(BUILD_RABBITMQ)
include_directories(${RABBITMQ_HEADERS})
add_library(mqfilter SHARED mqfilter.c)
target_link_libraries(mqfilter query_classifier log_manager utils ${RABBITMQ_LIBRARIES})
install(TARGETS mqfilter DESTINATION modules)
install(TARGETS mqfilter DESTINATION ${MAXSCALE_MODULE_INSTALL})
endif()
add_library(regexfilter SHARED regexfilter.c)
target_link_libraries(regexfilter log_manager utils)
install(TARGETS regexfilter DESTINATION modules)
install(TARGETS regexfilter DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(testfilter SHARED testfilter.c)
target_link_libraries(testfilter log_manager utils)
install(TARGETS testfilter DESTINATION modules)
install(TARGETS testfilter DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(qlafilter SHARED qlafilter.c)
target_link_libraries(qlafilter log_manager utils)
install(TARGETS qlafilter DESTINATION modules)
install(TARGETS qlafilter DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(tee SHARED tee.c)
target_link_libraries(tee log_manager utils)
install(TARGETS tee DESTINATION modules)
install(TARGETS tee DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(topfilter SHARED topfilter.c)
target_link_libraries(topfilter log_manager utils)
install(TARGETS topfilter DESTINATION modules)
install(TARGETS topfilter DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(dbfwfilter SHARED dbfwfilter.c)
target_link_libraries(dbfwfilter log_manager utils query_classifier)
install(TARGETS dbfwfilter DESTINATION modules)
install(TARGETS dbfwfilter DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(namedserverfilter SHARED namedserverfilter.c)
target_link_libraries(namedserverfilter log_manager utils)
install(TARGETS namedserverfilter DESTINATION modules)
install(TARGETS namedserverfilter DESTINATION ${MAXSCALE_MODULE_INSTALL})
if(BUILD_SLAVELAG)
add_library(slavelag SHARED slavelag.c)
target_link_libraries(slavelag log_manager utils query_classifier)
install(TARGETS slavelag DESTINATION modules)
install(TARGETS slavelag DESTINATION ${MAXSCALE_MODULE_INSTALL})
endif()
if(BUILD_TOOLS)

View File

@ -1,4 +1,4 @@
add_library(hintfilter SHARED hintfilter.c hintparser.c)
set_target_properties(hintfilter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib)
target_link_libraries(hintfilter ssl log_manager utils)
install(TARGETS hintfilter DESTINATION modules)
install(TARGETS hintfilter DESTINATION ${MAXSCALE_MODULE_INSTALL})

View File

@ -1,16 +1,16 @@
add_library(mysqlmon SHARED mysql_mon.c)
target_link_libraries(mysqlmon log_manager utils)
install(TARGETS mysqlmon DESTINATION modules)
install(TARGETS mysqlmon DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(galeramon SHARED galera_mon.c)
target_link_libraries(galeramon log_manager utils)
install(TARGETS galeramon DESTINATION modules)
install(TARGETS galeramon DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(ndbclustermon SHARED ndbcluster_mon.c)
target_link_libraries(ndbclustermon log_manager utils)
install(TARGETS ndbclustermon DESTINATION modules)
install(TARGETS ndbclustermon DESTINATION ${MAXSCALE_MODULE_INSTALL})
if(BUILD_MMMON)
add_library(mmmon SHARED mm_mon.c)
target_link_libraries(mmmon log_manager utils)
install(TARGETS mmmon DESTINATION modules)
install(TARGETS mmmon DESTINATION ${MAXSCALE_MODULE_INSTALL})
endif()

View File

@ -1,27 +1,27 @@
add_library(MySQLClient SHARED mysql_client.c mysql_common.c)
target_link_libraries(MySQLClient log_manager utils)
install(TARGETS MySQLClient DESTINATION modules)
install(TARGETS MySQLClient DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(MySQLBackend SHARED mysql_backend.c mysql_common.c)
target_link_libraries(MySQLBackend log_manager utils)
install(TARGETS MySQLBackend DESTINATION modules)
install(TARGETS MySQLBackend DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(telnetd SHARED telnetd.c)
target_link_libraries(telnetd log_manager utils)
install(TARGETS telnetd DESTINATION modules)
install(TARGETS telnetd DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(HTTPD SHARED httpd.c)
target_link_libraries(HTTPD log_manager utils)
install(TARGETS HTTPD DESTINATION modules)
install(TARGETS HTTPD DESTINATION ${MAXSCALE_MODULE_INSTALL})
if(BUILD_TESTS)
add_library(testprotocol SHARED testprotocol.c)
install(TARGETS testprotocol DESTINATION modules)
install(TARGETS testprotocol DESTINATION ${MAXSCALE_MODULE_INSTALL})
endif()
add_library(maxscaled SHARED maxscaled.c)
target_link_libraries(maxscaled log_manager utils)
install(TARGETS maxscaled DESTINATION modules)
install(TARGETS maxscaled DESTINATION ${MAXSCALE_MODULE_INSTALL})

View File

@ -2,28 +2,28 @@ if(BUILD_TESTS)
add_subdirectory(test)
add_library(testroute SHARED testroute.c)
target_link_libraries(testroute log_manager utils)
install(TARGETS testroute DESTINATION modules)
install(TARGETS testroute DESTINATION ${MAXSCALE_MODULE_INSTALL})
endif()
add_library(schemarouter SHARED schemarouter/schemarouter.c)
target_link_libraries(schemarouter log_manager utils query_classifier)
install(TARGETS schemarouter DESTINATION modules)
install(TARGETS schemarouter DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(shardrouter SHARED schemarouter/shardrouter.c)
target_link_libraries(shardrouter log_manager utils query_classifier)
install(TARGETS shardrouter DESTINATION modules)
install(TARGETS shardrouter DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(readconnroute SHARED readconnroute.c)
target_link_libraries(readconnroute log_manager utils)
install(TARGETS readconnroute DESTINATION modules)
install(TARGETS readconnroute DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(debugcli SHARED debugcli.c debugcmd.c)
target_link_libraries(debugcli log_manager utils)
install(TARGETS debugcli DESTINATION modules)
install(TARGETS debugcli DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_library(cli SHARED cli.c debugcmd.c)
target_link_libraries(cli log_manager utils)
install(TARGETS cli DESTINATION modules)
install(TARGETS cli DESTINATION ${MAXSCALE_MODULE_INSTALL})
add_subdirectory(readwritesplit)
add_subdirectory(schemarouter/test)

View File

@ -1,4 +1,4 @@
add_library(binlogrouter SHARED blr.c blr_master.c blr_cache.c blr_slave.c blr_file.c)
set_target_properties(binlogrouter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib)
set_target_properties(binlogrouter PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_MODULE_INSTALL}:${MAXSCALE_LIBRARY_INSTALL})
target_link_libraries(binlogrouter ssl pthread log_manager)
install(TARGETS binlogrouter DESTINATION modules)
install(TARGETS binlogrouter DESTINATION ${MAXSCALE_MODULE_INSTALL})

View File

@ -1,4 +1,4 @@
add_library(maxinfo SHARED maxinfo.c maxinfo_parse.c maxinfo_error.c maxinfo_exec.c)
set_target_properties(maxinfo PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${CMAKE_INSTALL_PREFIX}/lib)
set_target_properties(maxinfo PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_RPATH}:${MAXSCALE_MODULE_INSTALL}:MAXSCALE_LIBRARY_INSTALL)
target_link_libraries(maxinfo pthread log_manager)
install(TARGETS maxinfo DESTINATION modules)
install(TARGETS maxinfo DESTINATION ${MAXSCALE_MODULE_INSTALL})

View File

@ -1,6 +1,6 @@
add_library(readwritesplit SHARED readwritesplit.c)
target_link_libraries(readwritesplit ssl pthread log_manager utils query_classifier)
install(TARGETS readwritesplit DESTINATION modules)
install(TARGETS readwritesplit DESTINATION ${MAXSCALE_MODULE_INSTALL})
if(BUILD_TESTS)
add_subdirectory(test)
endif()