[Commits] 370ab48: MDEV-9209 - [PATCH] scripts: Do not prepend the prefix to absolute paths

Sergey Vojtovich svoj at mariadb.org
Fri Dec 18 14:50:10 EET 2015


revision-id: 370ab48e9fcf4bc15ffa5e313fc34aa97981a832 (mariadb-10.1.9-24-g370ab48)
parent(s): 428e09a789a17211de9b4f0a2c4c1226d5dcf993
committer: Sergey Vojtovich
timestamp: 2015-12-18 16:50:03 +0400
message:

MDEV-9209 - [PATCH] scripts: Do not prepend the prefix to absolute paths

Allow absolute paths for INSTALL_*DIR.

---
 CMakeLists.txt               |  2 +-
 cmake/cpack_rpm.cmake        |  4 ++--
 cmake/install_layout.cmake   |  6 ++++++
 scripts/CMakeLists.txt       | 40 ++++++++++++++++++++--------------------
 support-files/CMakeLists.txt | 14 +++++++-------
 support-files/mariadb.pc.in  | 22 +++++++++++-----------
 6 files changed, 47 insertions(+), 41 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9399c83..8d06f40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -283,7 +283,7 @@ IF(WIN32)
   SET(SHAREDIR share)
 ELSE()
   SET(DEFAULT_MYSQL_HOME ${CMAKE_INSTALL_PREFIX})
-  SET(SHAREDIR ${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLSHAREDIR})
+  SET(SHAREDIR ${INSTALL_MYSQLSHAREDIRABS})
 ENDIF()
 
 SET(DEFAULT_BASEDIR "${DEFAULT_MYSQL_HOME}")
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index d1030be..b452f29 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -55,8 +55,8 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "
 %define mysqldatadir ${INSTALL_MYSQLDATADIR}
 %define mysqld_user  mysql
 %define mysqld_group mysql
-%define _bindir     ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}
-%define _sbindir    ${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR}
+%define _bindir     ${INSTALL_BINDIRABS}
+%define _sbindir    ${INSTALL_SBINDIRABS}
 %define _sysconfdir ${INSTALL_SYSCONFDIR}
 ")
 
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 7c4639f..757166b 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -236,6 +236,12 @@ FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF
   SET(INSTALL_${var}DIR  ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
   CACHE STRING "${var} installation directory" ${FORCE})
   MARK_AS_ADVANCED(INSTALL_${var}DIR)
+
+  IF(IS_ABSOLUTE ${INSTALL_${var}DIR})
+    SET(INSTALL_${var}DIRABS ${INSTALL_${var}DIR})
+  ELSE()
+    SET(INSTALL_${var}DIRABS "${CMAKE_INSTALL_PREFIX}/${INSTALL_${var}DIR}")
+  ENDIF()
 ENDFOREACH()
 
 IF(NOT MYSQL_UNIX_ADDR)
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index eb78016..54289c0 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -179,25 +179,25 @@ ENDIF(UNIX)
 
 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(bindir ${prefix}/${INSTALL_BINDIR})
+  SET(sbindir ${prefix}/${INSTALL_SBINDIR})
+  SET(scriptdir ${prefix}/${INSTALL_BINDIR})
+  SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
+  SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
   SET(localstatedir ${prefix}/data)
 ELSE()
+  SET(prefix "${CMAKE_INSTALL_PREFIX}")
+  SET(bindir ${INSTALL_BINDIRABS})
+  SET(sbindir ${INSTALL_SBINDIRABS})
+  SET(scriptdir ${INSTALL_BINDIRABS})
+  SET(libexecdir ${INSTALL_SBINDIRABS})
+  SET(pkgdatadir ${INSTALL_MYSQLSHAREDIRABS})
   SET(localstatedir ${MYSQL_DATADIR})
 ENDIF()
 
 IF(UNIX)
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
   ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY)
-  SET(DEST ${INSTALL_SCRIPTDIR})
   SET(EXT)
   EXECUTE_PROCESS(
   COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db
@@ -205,7 +205,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
 
 INSTALL_SCRIPT(
  "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db"
-  DESTINATION ${DEST}
+  DESTINATION ${INSTALL_SCRIPTDIR}
   COMPONENT Server
   )
 ENDIF()
@@ -216,15 +216,15 @@ IF(INSTALL_SYSCONFDIR)
 ELSE()
   SET(sysconfdir "/etc")
 ENDIF()
-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(bindir ${INSTALL_BINDIRABS})
+SET(libexecdir ${INSTALL_SBINDIRABS})
+SET(scriptdir ${INSTALL_BINDIRABS})
+SET(datadir ${INSTALL_MYSQLSHAREDIRABS})
+SET(pkgdatadir ${INSTALL_MYSQLSHAREDIRABS})
 SET(libsubdir  ${INSTALL_LIBDIR})
-SET(pkgincludedir ${prefix}/${INSTALL_INCLUDEDIR})
-SET(pkglibdir ${prefix}/${INSTALL_LIBDIR})
-SET(pkgplugindir ${prefix}/${INSTALL_PLUGINDIR})
+SET(pkgincludedir ${INSTALL_INCLUDEDIRABS})
+SET(pkglibdir ${INSTALL_LIBDIRABS})
+SET(pkgplugindir ${INSTALL_PLUGINDIRABS})
 SET(localstatedir ${MYSQL_DATADIR})
 
 SET(RPATH_OPTION "")
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index c369e1d..eceff5f 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -20,8 +20,8 @@ IF(WIN32)
 ELSE()
   SET(localstatedir "${MYSQL_DATADIR}")
   SET(prefix "${CMAKE_INSTALL_PREFIX}")
-  SET(libexecdir "${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR}")
-  SET(bindir "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" )
+  SET(libexecdir ${INSTALL_SBINDIRABS})
+  SET(bindir ${INSTALL_BINDIRABS})
   SET(sbindir "${libexecdir}")
   SET(datadir "${MYSQL_DATADIR}")
   SET(CC ${CMAKE_C_COMPILER})
@@ -66,11 +66,11 @@ IF(UNIX)
 
   INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
   
-  SET(bindir ${prefix}/${INSTALL_BINDIR})
-  SET(sbindir ${prefix}/${INSTALL_SBINDIR})
-  SET(scriptdir ${prefix}/${INSTALL_SCRIPTDIR})
-  SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
-  SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+  SET(bindir ${INSTALL_BINDIRABS})
+  SET(sbindir ${INSTALL_SBINDIRABS})
+  SET(scriptdir ${INSTALL_SCRIPTDIRABS})
+  SET(libexecdir ${INSTALL_SBINDIRABS})
+  SET(pkgdatadir ${INSTALL_MYSQLSHAREDIRABS})
   CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh 
                  ${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY)
   INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
diff --git a/support-files/mariadb.pc.in b/support-files/mariadb.pc.in
index bc84a5c..0605d86 100644
--- a/support-files/mariadb.pc.in
+++ b/support-files/mariadb.pc.in
@@ -1,18 +1,18 @@
 # these four variables are present in almost every .pc file
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
-libdir=${prefix}/@INSTALL_LIBDIR@
-includedir=${prefix}/@INSTALL_INCLUDEDIR@
+libdir=@INSTALL_LIBDIRABS@
+includedir=@INSTALL_INCLUDEDIRABS@
 # those are rarely present or not at all, but we export them regardless
-bindir=${prefix}/@INSTALL_BINDIR@
-sbindir=${prefix}/@INSTALL_SBINDIR@
-scriptdir=${prefix}/@INSTALL_SCRIPTDIR@
-plugindir=${prefix}/@INSTALL_PLUGINDIR@
-docdir=${prefix}/@INSTALL_DOCDIR@
-mandir=${prefix}/@INSTALL_MANDIR@
-sharedir=${prefix}/@INSTALL_SHAREDIR@
-mysqlsharedir=${prefix}/@INSTALL_MYSQLSHAREDIR@
-mysqltestdir=${prefix}/@INSTALL_MYSQLTESTDIR@
+bindir=@INSTALL_BINDIRABS@
+sbindir=@INSTALL_SBINDIRABS@
+scriptdir=@INSTALL_SCRIPTDIRABS@
+plugindir=@INSTALL_PLUGINDIRABS@
+docdir=@INSTALL_DOCDIRABS@
+mandir=@INSTALL_MANDIRABS@
+sharedir=@INSTALL_SHAREDIRABS@
+mysqlsharedir=@INSTALL_MYSQLSHAREDIRABS@
+mysqltestdir=@INSTALL_MYSQLTESTDIRABS@
 socket=@INSTALL_UNIX_ADDRDIR@
 
 Name: @CPACK_PACKAGE_NAME@


More information about the commits mailing list