Forráskód Böngészése

HPCC-15142 DESTDIR moved to cmake variable

Signed-off-by: Michael Gardner <michael.gardner@lexisnexis.com>
Michael Gardner 8 éve
szülő
commit
75635953f8

+ 12 - 18
CMakeLists.txt

@@ -48,24 +48,22 @@
 #   To create a development installation on Linux:
 #   1. Check out sources (for example, to directory ~/hpcc)
 #   2. Create a build directory alongside your source
-#   3. export a DESTDIR which will act as the new root of your installation
-#       This must be done before you attempt to build makefiles for the project
-#   4. To create makefiles and have the ability to run the applications as non-superuser, execute
-#       cmake -DRUNTIME_USER=$USER ~/hpcc
-#   5. To build the makefiles just created above, run
+#   3. To create makefiles and have the ability to run the applications as non-superuser, execute
+#       cmake -DRUNTIME_USER=$USER -DRUNTIME_GROUP=groupname -DDESTDIR=$HOME/myruntime ~/hpcc
+#   4. To build the makefiles just created above, run
 #       make
-#   6. To install the project under DESTDIR, run
+#   5. To install the project under DESTDIR, run
 #       make install
-#   7. To populate environment xml's and conf files necessary for running your development installation, run
+#   6. To populate environment xml's and conf files necessary for running your development installation, run
 #       make configure
-#   8a.To start up the platform, execute all binaries and scripts under DESTDIR as a regular user, example
-#       $DESTDIR/etc/init.d/hpcc-init start
-#   8b.All runtime files will be under $DESTDIR/var/{log,lib,run,lock}
-#   9a.To patch your running installation, simply modify the source, and then from the build directory run
+#   7a.To start up the platform, execute all binaries and scripts under DESTDIR as a regular user, example
+#       $HOME/myruntime/etc/init.d/hpcc-init start
+#   7b.All runtime files will be under $HOME/myruntime/var/{log,lib,run,lock}
+#   8a.To patch your running installation, simply modify the source, and then from the build directory run
 #       make install
 #      Which will recompile any changes and only install files into the platform that have been modified
-#   9b.Restart the platform (or specific component that had modifications), example
-#       $DESTDIR/etc/init.d/hpcc-init restart
+#   8b.Restart the platform (or specific component that had modifications), example
+#       $HOME/myruntime/etc/init.d/hpcc-init restart
 #
 #########################################################
 
@@ -118,6 +116,7 @@ option(RUNTIME_GROUP "Set the runtime group")
 option(ENV_XML_FILE "Set the environment xml file name.")
 option(ENV_CONF_FILE "Set the environment conf file name.")
 option(LICENSE_FILE "Set the license file to use.")
+option(DESTDIR "Set the alternate root installation path.")
 
 if(NOT LICENSE_FILE)
     if(REMBED)
@@ -477,9 +476,4 @@ configure_file(
 add_custom_target(uninstall
     COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
 
-if ( "$ENV{DESTDIR}" STRGREATER "" )
-  message(WARNING "DESTDIR is set to $ENV{DESTDIR}.
-This should only be done for development builds.")
-endif()
-
 include(CPack)

+ 2 - 2
cmake_modules/commonSetup.cmake

@@ -882,9 +882,9 @@ IF ("${COMMONSETUP_DONE}" STREQUAL "")
   ## The following sets the install directories and names.
   ###
   if ( PLATFORM OR PLUGIN )
-    set ( CMAKE_INSTALL_PREFIX "${PREFIX}/${DIR_NAME}" )
+      set ( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" )
   else ( )
-    set ( CMAKE_INSTALL_PREFIX "${PREFIX}/${DIR_NAME}/${version}/clienttools" )
+    set ( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}/${version}/clienttools" )
   endif ( PLATFORM OR PLUGIN )
   set (CMAKE_SKIP_BUILD_RPATH  FALSE)
   set (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

+ 13 - 10
cmake_modules/optionDefaults.cmake

@@ -1,3 +1,6 @@
+if ( NOT DESTDIR )
+    set( DESTDIR "" )
+endif()
 
 if ( NOT PREFIX )
 if ( WIN32 )
@@ -9,16 +12,16 @@ if ( WIN32 )
     endif()
     string(REGEX REPLACE "\\\\" "/" PREFIX ${PREFIX})    
 else (WIN32)
-    set( PREFIX "/opt" )
+    set( PREFIX "${DESTDIR}/opt" )
 endif (WIN32)    
 endif()
 
 if ( NOT EXEC_PREFIX )
-    set( EXEC_PREFIX "/var" )
+    set( EXEC_PREFIX "${DESTDIR}/var" )
 endif()
 
 if ( NOT CONFIG_PREFIX )
-    set( CONFIG_PREFIX "/etc" )
+    set( CONFIG_PREFIX "${DESTDIR}/etc" )
 endif()
 
 if ( NOT DIR_NAME )
@@ -89,13 +92,13 @@ if ( NOT ENV_CONF_FILE )
     set( ENV_CONF_FILE "environment.conf" )
 endif()
 
-set( INSTALL_DIR "$ENV{DESTDIR}${PREFIX}/${DIR_NAME}" )
-set( CONFIG_DIR "$ENV{DESTDIR}${CONFIG_PREFIX}/${DIR_NAME}" )
-set( RUNTIME_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${RUNTIME_DIR}/${DIR_NAME}" )
-set( LOG_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${LOG_DIR}/${DIR_NAME}" )
-set( LOCK_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${LOCK_DIR}/${DIR_NAME}" )
-set( PID_PATH "$ENV{DESTDIR}${EXEC_PREFIX}/${PID_DIR}/${DIR_NAME}" )
-set( INIT_PATH "$ENV{DESTDIR}${CONFIG_PREFIX}/init.d")
+set( INSTALL_DIR "${PREFIX}/${DIR_NAME}" )
+set( CONFIG_DIR "${CONFIG_PREFIX}/${DIR_NAME}" )
+set( RUNTIME_PATH "${EXEC_PREFIX}/${RUNTIME_DIR}/${DIR_NAME}" )
+set( LOG_PATH "${EXEC_PREFIX}/${LOG_DIR}/${DIR_NAME}" )
+set( LOCK_PATH "${EXEC_PREFIX}/${LOCK_DIR}/${DIR_NAME}" )
+set( PID_PATH "${EXEC_PREFIX}/${PID_DIR}/${DIR_NAME}" )
+set( INIT_PATH "${CONFIG_PREFIX}/init.d")
 
 set( CONFIG_SOURCE_PATH "${CONFIG_DIR}/${CONFIG_SOURCE_DIR}" )
 set( COMPONENTFILES_PATH "${INSTALL_DIR}/${COMPONENTFILES_DIR}" )

+ 2 - 1
initfiles/etc/DIR_NAME/CMakeLists.txt

@@ -31,7 +31,8 @@ Install ( FILES ${CMAKE_CURRENT_BINARY_DIR}/environment.xml DESTINATION ${CONFIG
 
 ADD_SUBDIRECTORY(configmgr)
 
-if("$ENV{DESTDIR}" STRGREATER "")
+if(NOT "${DESTDIR}" STREQUAL "")
+    message(STATUS "DESTDIR is set to ${DESTDIR}. Enabling configure target.")
     add_custom_target(configure
         COMMAND ${CMAKE_COMMAND} -E make_directory ${CONFIG_DIR}
         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${ENV_XML_FILE} ${CONFIG_DIR}