You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2013/12/03 22:41:59 UTC
svn commit: r1547597 -
/qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt
Author: mcpierce
Date: Tue Dec 3 21:41:59 2013
New Revision: 1547597
URL: http://svn.apache.org/r1547597
Log:
PROTON-445: PHP install now honors the install prefix.
If the install prefix is not "/usr" then the INI directory is placed
below it. This is to accomodate a system install as opposed to a
developer install.
Modified:
qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt
Modified: qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt?rev=1547597&r1=1547596&r2=1547597&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt (original)
+++ qpid/proton/trunk/proton-c/bindings/php/CMakeLists.txt Tue Dec 3 21:41:59 2013
@@ -58,17 +58,47 @@ if ("${PHP_INCLUDE_DIR_DEFAULT}" STREQUA
set(PHP_INCLUDE_DIR_DEFAULT "/usr/share/php")
endif()
+if (NOT PHP_INSTALL_PREFIX)
+ set (PHP_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
+endif (NOT PHP_INSTALL_PREFIX)
+
+execute_process (COMMAND ${PHP_CONFIG_EXE} --prefix
+ OUTPUT_VARIABLE PHP_PREFIX
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
string(REGEX MATCH "--with-config-file-scan-dir=([^ ]*)" PHP_OPT_MATCH ${PHP_OPTS})
set (PHP_INI_DIR_DEFAULT ${CMAKE_MATCH_1})
if ("${PHP_INI_DIR_DEFAULT}" STREQUAL "")
- set(PHP_INI_DIR_DEFAULT "/etc/php.d")
+ set(PHP_INI_DIR_DEFAULT ${PHP_PREFIX}/etc/php.d)
+endif()
+
+# if not installing to the system directory, then update the prefix to the ini directory
+if (NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
+ set(PHP_INI_DIR_DEFAULT ${PHP_INSTALL_PREFIX}/${PHP_INI_DIR_DEFAULT})
endif()
+MESSAGE(STATUS "PHP_INI_DIR_DEFAULT=${PHP_INI_DIR_DEFAULT}")
+
set(PHP_EXT_DIR ${PHP_EXT_DIR_DEFAULT} CACHE PATH "PHP extensions directory.")
set(PHP_INI_DIR ${PHP_INI_DIR_DEFAULT} CACHE PATH "Directory scanned for PHP ini files.")
set(PHP_INCLUDE_DIR ${PHP_INCLUDE_DIR_DEFAULT} CACHE PATH "PHP include directory.")
+macro(replace_prefix prefix new_prefix source varname)
+ MESSAGE(STATUS "1:${${varname}}=${varname}")
+ string(REGEX REPLACE
+ "(.*)${${prefix}}(.*)"
+ "\\1${${new_prefix}}\\2"
+ ${varname}
+ "${${source}}")
+
+ MESSAGE(STATUS "2:${${varname}}=${varname}")
+endmacro()
+
+replace_prefix(PHP_PREFIX PHP_INSTALL_PREFIX PHP_EXT_DIR PHP_EXT_DIR)
+replace_prefix(PHP_PREFIX PHP_INSTALL_PREFIX PHP_INI_DIR PHP_INI_DIR)
+replace_prefix(PHP_PREFIX PHP_INSTALL_PREFIX PHP_INCLUDE_DIR PHP_INCLUDE_DIR)
+
install(TARGETS cproton
DESTINATION ${PHP_EXT_DIR}
COMPONENT PHP)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org