Commit 106bfba0 authored by Antonio Rojas's avatar Antonio Rojas
Browse files

Fix DESTDIR usage

kajongg's build system uses DESTDIR during cmake to construct the command that creates the kajongg and kajonggserver symlinks in bindir.
This is a problem for distributions, which usually have separated cmake/make/make install stages with DESTDIR only available in the later one.
So distros are currently working around this in different ways, either creating the symlinks manually after make install (Gentoo, Fedora) or defining DESTDIR before running cmake (Arch, Opensuse).

This patch changes the symlink installation process to only make the DESTDIR substitution during make install.

Differential Revision: https://phabricator.kde.org/D27330
parent 8b802bbf
......@@ -108,13 +108,13 @@ MACRO(KDE_ADD_PYTHON_EXECUTABLE _pyname _exename)
set(TARGET ${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/${PROJECT_NAME}/${_pyname})
set(LINK_NAME ${CMAKE_INSTALL_PREFIX}/${BIN_INSTALL_DIR}/${_exename})
GET_FILENAME_COMPONENT(abs_link_name $ENV{DESTDIR}/${LINK_NAME} ABSOLUTE)
GET_FILENAME_COMPONENT(link_path $ENV{DESTDIR}/${LINK_NAME} PATH)
GET_FILENAME_COMPONENT(abs_link_name ${LINK_NAME} ABSOLUTE)
GET_FILENAME_COMPONENT(link_path ${LINK_NAME} PATH)
GET_FILENAME_COMPONENT(abs_link_path ${link_path} ABSOLUTE)
FILE(MAKE_DIRECTORY ${abs_link_path})
GET_FILENAME_COMPONENT(abs_target ${TARGET} ABSOLUTE)
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${abs_target} ${abs_link_name})")
INSTALL(CODE "EXECUTE_PROCESS(COMMAND chmod a+x $ENV{DESTDIR}/${abs_target})")
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV\{DESTDIR\}${abs_link_path})")
INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink ${abs_target} \$ENV\{DESTDIR\}${abs_link_name})")
INSTALL(CODE "EXECUTE_PROCESS(COMMAND chmod a+x \$ENV\{DESTDIR\}/${abs_target})")
ENDMACRO(KDE_ADD_PYTHON_EXECUTABLE)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment