summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2010-01-24 16:23:16 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2010-01-24 16:23:16 +0100
commitc827968a2df5ad35e64cea0116abf862776cef26 (patch)
treec43eba4b5b19fd0edbb74db874eadf3a2a91f9c7 /scripts
parent80f57fb2524bfd451c603bce92ad061d85b42aae (diff)
downloadmariadb-git-c827968a2df5ad35e64cea0116abf862776cef26.tar.gz
Handle different installation layouts.
using cmake option INSTALL_LAYOUT=STANDALONE would produce the layout as in tar.gz or zip packages. INSTALL_LAYOUT=UNIX will produce unixish install layout (with mysqld being in sbin subdirectory , libs in lib/mysql etc). This layout is used for RPM packages. Subtle differences in both packages unfortunately lead to the need to recompile MySQL to use with other package type - as otherwise for example default plugins or data directories would be wrong set. There are numerous other variables that allow fine-tuning packaging layout. (INSTALL_BINDIR, INSTALL_LIBDIR , INSTALL_PLUGINDIR etc). This options are different from autotools as they do not expect full paths to directories, but only subdirectory of CMAKE_INSTALL_PREFIX. There are 2 special options that expect full directory paths - MYSQL_DATADIR that defines default MYSQL data directory (autotools equivalent is --localstatedir) - SYSCONFDIR can be added to search my.cnf search path (autotools equivalent is --sysconfdir)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/CMakeLists.txt76
-rw-r--r--scripts/mysqld_safe.sh7
2 files changed, 41 insertions, 42 deletions
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 0b574fc0621..44de52f254f 100755
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -66,7 +66,7 @@ INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
- DESTINATION share
+ DESTINATION ${INSTALL_MYSQLSHAREDIR}
)
# TCMalloc hacks
@@ -137,13 +137,23 @@ ENDIF(UNIX)
# i.e. makes access relative the current directory. This matches
# the documentation, so better not change this.
-SET(prefix .)
-SET(bindir ./bin)
-SET(sbindir ./bin)
-SET(scriptdir ./bin)
-SET(libexecdir ./bin)
-SET(pkgdatadir ./share)
-SET(localstatedir ./data)
+IF(INSTALL_LAYOUT MATCHES "STANDALONE")
+ SET(prefix ".")
+ELSE()
+ SET(prefix "${CMAKE_INSTALL_PREFIX}")
+ENDIF()
+
+SET(bindir ${prefix}/${INSTALL_BINDIR})
+SET(sbindir ${prefix}/${INSTALL_SBINDIR})
+SET(scriptdir ${prefix}/${INSTALL_BINDIR})
+SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
+SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+IF(INSTALL_LAYOUT MATCHES "STANDALONE")
+ SET(localstatedir ${prefix}/data)
+ELSE()
+ SET(localstatedir ${MYSQL_DATADIR})
+ENDIF()
+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY)
@@ -158,15 +168,16 @@ INSTALL(FILES
SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(sysconfdir ${prefix})
-SET(bindir ${prefix}/bin)
-SET(libexecdir ${prefix}/bin)
-SET(scriptdir ${prefix}/bin)
-SET(datadir ${prefix}/share)
-SET(pkgdatadir ${prefix}/share)
-SET(pkgincludedir ${prefix}/include)
-SET(pkglibdir ${prefix}/lib)
-SET(pkgplugindir ${prefix}/lib/plugin)
-SET(localstatedir ${prefix}/data)
+SET(bindir ${prefix}/${INSTALL_BINDIR})
+SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
+SET(scriptdir ${prefix}/${INSTALL_BINDIR})
+SET(datadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+SET(pkgincludedir ${prefix}/${INSTALL_INCLUDEDIR})
+SET(pkglibdir ${prefix}/${INSTALL_LIBDIR})
+SET(pkgplugindir ${prefix}/${INSTALL_PLUGINDIR})
+SET(localstatedir ${MYSQL_DATADIR})
+
# some scripts use @TARGET_LINUX@
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(TARGET_LINUX 1)
@@ -242,7 +253,7 @@ IF(WIN32)
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
INSTALL(FILES
- "CMAKE_CURRENT_BINARY_DIR}/${file}.pl"
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}.pl
DESTINATION scripts
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
@@ -254,7 +265,7 @@ IF(WIN32)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
INSTALL(FILES
- "${CMAKE_CURRENT_BINARY_DIR}/${file}.pl"
+ ${CMAKE_CURRENT_BINARY_DIR}/${file}.pl
DESTINATION scripts
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
@@ -279,6 +290,7 @@ ELSE()
mysqld_multi
mysqlaccess
mysqlaccess.conf
+ mysqld_safe
)
FOREACH(file ${BIN_SCRIPTS})
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
@@ -291,38 +303,18 @@ ELSE()
MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file} in "
"${CMAKE_CURRENT_SOURCE_DIR}" )
ENDIF()
-
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/${file}
- DESTINATION bin
+ DESTINATION ${INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
ENDFOREACH()
-
- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqld_safe.sh
- ${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe @ONLY)
-
- INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe"
- DESTINATION bin
- PERMISSIONS OWNER_READ OWNER_WRITE
- OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- )
-
- # For some reason, mysqld_safe needs to be also in scripts directory
- INSTALL(FILES
- "${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe"
- DESTINATION scripts
- PERMISSIONS OWNER_READ OWNER_WRITE
- OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE
- )
ENDIF()
# Install libgcc as mylibgcc.a
-IF(CMAKE_COMPILER_IS_GNUCXX)
+IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
EXECUTE_PROCESS (
COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}
${CMAKE_CXX_FLAGS} --print-libgcc
@@ -332,7 +324,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
ERROR_QUIET
)
IF(${RESULT} EQUAL 0 AND EXISTS ${LIBGCC_LOCATION})
- INSTALL(FILES "${LIBGCC_LOCATION}" DESTINATION lib)
+ INSTALL(FILES "${LIBGCC_LOCATION}" DESTINATION ${INSTALL_LIBDIR})
ENDIF()
ENDIF()
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index 70b9b9f630e..f08e870d5e0 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -361,6 +361,9 @@ then
if test -x "$MY_BASEDIR_VERSION/libexec/mysqld"
then
ledir="$MY_BASEDIR_VERSION/libexec"
+ elif test -x "$MY_BASEDIR_VERSION/sbin/mysqld"
+ then
+ ledir="$MY_BASEDIR_VERSION/sbin"
else
ledir="$MY_BASEDIR_VERSION/bin"
fi
@@ -373,6 +376,10 @@ elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
then
MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are
ledir="$MY_PWD/libexec" # Where mysqld is
+elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/sbin/mysqld"
+then
+ MY_BASEDIR_VERSION="$MY_PWD" # Where sbin, share and var are
+ ledir="$MY_PWD/sbin" # Where mysqld is
# Since we didn't find anything, used the compiled-in defaults
else
MY_BASEDIR_VERSION='@prefix@'