mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #1213 'Fix install permissions'
This commit is contained in:
commit
a4b9e0df67
@ -119,12 +119,13 @@ endif()
|
|||||||
|
|
||||||
message(STATUS "Using the Lua interpreter ${LUA_PRG}")
|
message(STATUS "Using the Lua interpreter ${LUA_PRG}")
|
||||||
|
|
||||||
add_subdirectory(config)
|
# Setup busted.
|
||||||
add_subdirectory(src/nvim)
|
|
||||||
add_subdirectory(test/includes)
|
|
||||||
|
|
||||||
find_program(BUSTED_PRG busted)
|
find_program(BUSTED_PRG busted)
|
||||||
|
if(NOT BUSTED_OUTPUT_TYPE)
|
||||||
|
set(BUSTED_OUTPUT_TYPE "utfTerminal")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Setup make.
|
||||||
find_program(MAKE_PRG NAMES gmake make)
|
find_program(MAKE_PRG NAMES gmake make)
|
||||||
if(MAKE_PRG)
|
if(MAKE_PRG)
|
||||||
execute_process(
|
execute_process(
|
||||||
@ -146,10 +147,47 @@ if(CMAKE_GENERATOR MATCHES "Makefiles")
|
|||||||
set(MAKE_PRG "$(MAKE)")
|
set(MAKE_PRG "$(MAKE)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT BUSTED_OUTPUT_TYPE)
|
# CMake is painful here. It will create the destination using the user's
|
||||||
set(BUSTED_OUTPUT_TYPE "utfTerminal")
|
# current umask, and we don't want that. And we don't just want to install
|
||||||
endif()
|
# the target directory, as it will mess with existing permissions. So this
|
||||||
|
# seems like the best compromise. If we create it, then everyone can see it.
|
||||||
|
# If it's preexisting, leave it alone.
|
||||||
|
include(InstallHelpers)
|
||||||
|
|
||||||
|
install_helper(
|
||||||
|
DIRECTORY runtime
|
||||||
|
DESTINATION share/nvim)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE RUNTIME_PROGRAMS
|
||||||
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
runtime/*.pl runtime/*.awk runtime/*.sh
|
||||||
|
runtime/tools/ref
|
||||||
|
runtime/tools/vimm)
|
||||||
|
|
||||||
|
foreach(PROG ${RUNTIME_PROGRAMS})
|
||||||
|
get_filename_component(BASEDIR ${PROG} PATH)
|
||||||
|
install_helper(PROGRAMS ${PROG} DESTINATION share/nvim/${BASEDIR})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
install(SCRIPT ${CMAKE_MODULE_PATH}/GenerateHelptags.cmake)
|
||||||
|
|
||||||
|
# Unfortunately, the below does not work under Ninja. Ninja doesn't use a
|
||||||
|
# pseudo-tty when launching processes, because it can put many jobs in parallel
|
||||||
|
# and eat-up all the available pseudo-ttys. Unfortunately, that doesn't work
|
||||||
|
# well with the legacy tests. I have a branch that converts them to run under
|
||||||
|
# CTest, but it needs a little more work.
|
||||||
|
# add_custom_target(test
|
||||||
|
# COMMAND ${MAKE_PRG} -C ${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/testdir
|
||||||
|
# VIMPROG=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nvim)
|
||||||
|
|
||||||
|
# Go down the tree.
|
||||||
|
|
||||||
|
add_subdirectory(config)
|
||||||
|
add_subdirectory(src/nvim)
|
||||||
|
add_subdirectory(test/includes)
|
||||||
|
|
||||||
|
# Setup some test-related bits. We do this after going down the tree because we
|
||||||
|
# need some of the targets.
|
||||||
if(BUSTED_PRG)
|
if(BUSTED_PRG)
|
||||||
get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
PROPERTY INCLUDE_DIRECTORIES)
|
PROPERTY INCLUDE_DIRECTORIES)
|
||||||
@ -176,15 +214,3 @@ if(BUSTED_PRG)
|
|||||||
-P ${CMAKE_MODULE_PATH}/RunUnittests.cmake
|
-P ${CMAKE_MODULE_PATH}/RunUnittests.cmake
|
||||||
DEPENDS nvim-test unittest-headers)
|
DEPENDS nvim-test unittest-headers)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY runtime DESTINATION share/nvim)
|
|
||||||
install(SCRIPT ${CMAKE_MODULE_PATH}/GenerateHelptags.cmake)
|
|
||||||
|
|
||||||
# Unfortunately, the below does not work under Ninja. Ninja doesn't use a
|
|
||||||
# pseudo-tty when launching processes, because it can put many jobs in parallel
|
|
||||||
# and eat-up all the available pseudo-ttys. Unfortunately, that doesn't work
|
|
||||||
# well with the legacy tests. I have a branch that converts them to run under
|
|
||||||
# CTest, but it needs a little more work.
|
|
||||||
# add_custom_target(test
|
|
||||||
# COMMAND ${MAKE_PRG} -C ${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/testdir
|
|
||||||
# VIMPROG=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/nvim)
|
|
||||||
|
136
cmake/InstallHelpers.cmake
Normal file
136
cmake/InstallHelpers.cmake
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
# This will create any directories that need to be created in the destination
|
||||||
|
# path with the typical owner, group, and user permissions--independent of the
|
||||||
|
# umask setting.
|
||||||
|
function(create_install_dir_with_perms)
|
||||||
|
cmake_parse_arguments(_install_dir
|
||||||
|
""
|
||||||
|
"DESTINATION"
|
||||||
|
"DIRECTORY_PERMISSIONS"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _install_dir_DESTINATION)
|
||||||
|
message(FATAL_ERROR "Must specify DESTINATION")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _install_dir_DIRECTORY_PERMISSIONS)
|
||||||
|
set(_install_dir_DIRECTORY_PERMISSIONS
|
||||||
|
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||||
|
GROUP_READ GROUP_EXECUTE
|
||||||
|
WORLD_READ WORLD_EXECUTE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(CODE
|
||||||
|
"
|
||||||
|
if(ENV{DESTDIR})
|
||||||
|
set(PREFIX \$ENV{DESTDIR}/\${CMAKE_INSTALL_PREFIX})
|
||||||
|
else()
|
||||||
|
set(PREFIX \${CMAKE_INSTALL_PREFIX})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_current_dir \"\${PREFIX}/${_install_dir_DESTINATION}\")
|
||||||
|
set(_dir_permissions \"${_install_dir_DIRECTORY_PERMISSIONS}\")
|
||||||
|
|
||||||
|
set(_parent_dirs)
|
||||||
|
while(NOT EXISTS \${_current_dir})
|
||||||
|
list(APPEND _parent_dirs \${_current_dir})
|
||||||
|
get_filename_component(_current_dir \${_current_dir} PATH)
|
||||||
|
endwhile()
|
||||||
|
|
||||||
|
if(_parent_dirs)
|
||||||
|
list(REVERSE _parent_dirs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Create any missing folders with the useful permissions. Note: this uses
|
||||||
|
# a hidden option of CMake, but it's been shown to work with 2.8.11 thru
|
||||||
|
# 3.0.2.
|
||||||
|
foreach(_current_dir \${_parent_dirs})
|
||||||
|
if(NOT IS_DIRECTORY \${_current_dir})
|
||||||
|
file(INSTALL DESTINATION \${_current_dir}
|
||||||
|
TYPE DIRECTORY
|
||||||
|
DIR_PERMISSIONS \${_dir_permissions}
|
||||||
|
FILES \"\")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
")
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# This is to prevent the user's umask from corrupting the expected permissions
|
||||||
|
# for the parent directories. We want to behave like the install tool here:
|
||||||
|
# preserve what's there already, but create new things with useful permissions.
|
||||||
|
function(install_helper)
|
||||||
|
cmake_parse_arguments(_install_helper
|
||||||
|
""
|
||||||
|
"DESTINATION;DIRECTORY;RENAME"
|
||||||
|
"FILES;PROGRAMS;TARGETS;DIRECTORY_PERMISSIONS;FILE_PERMISSIONS"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT _install_helper_DESTINATION AND NOT _install_helper_TARGETS)
|
||||||
|
message(FATAL_ERROR "Must specify the DESTINATION path")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _install_helper_FILES AND NOT _install_helper_DIRECTORY AND
|
||||||
|
NOT _install_helper_PROGRAMS AND NOT _install_helper_TARGETS)
|
||||||
|
message(FATAL_ERROR "Must specify FILES, PROGRAMS, TARGETS, or a DIRECTORY to install")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _install_helper_DIRECTORY_PERMISSIONS)
|
||||||
|
set(_install_helper_DIRECTORY_PERMISSIONS
|
||||||
|
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||||
|
GROUP_READ GROUP_EXECUTE
|
||||||
|
WORLD_READ WORLD_EXECUTE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT _install_helper_FILE_PERMISSIONS)
|
||||||
|
set(_install_helper_FILE_PERMISSIONS
|
||||||
|
OWNER_READ OWNER_WRITE
|
||||||
|
GROUP_READ
|
||||||
|
WORLD_READ)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_install_helper_RENAME)
|
||||||
|
set(RENAME RENAME ${_install_helper_RENAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_install_helper_TARGETS)
|
||||||
|
set(_install_helper_DESTINATION "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_install_helper_TARGETS)
|
||||||
|
# Ensure the bin area exists with the correct permissions.
|
||||||
|
create_install_dir_with_perms(DESTINATION bin)
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS ${_install_helper_TARGETS}
|
||||||
|
RUNTIME DESTINATION bin)
|
||||||
|
else()
|
||||||
|
create_install_dir_with_perms(
|
||||||
|
DESTINATION ${_install_helper_DESTINATION}
|
||||||
|
DIRECTORY_PERMISSIONS ${_install_helper_DIRECTORY_PERMISSIONS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_install_helper_DIRECTORY)
|
||||||
|
install(
|
||||||
|
DIRECTORY ${_install_helper_DIRECTORY}
|
||||||
|
DESTINATION ${_install_helper_DESTINATION}
|
||||||
|
DIRECTORY_PERMISSIONS ${_install_helper_DIRECTORY_PERMISSIONS}
|
||||||
|
FILE_PERMISSIONS ${_install_helper_FILE_PERMISSIONS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_install_helper_FILES)
|
||||||
|
install(
|
||||||
|
FILES ${_install_helper_FILES}
|
||||||
|
DESTINATION ${_install_helper_DESTINATION}
|
||||||
|
PERMISSIONS ${_install_helper_FILE_PERMISSIONS}
|
||||||
|
${RENAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(_install_helper_PROGRAMS)
|
||||||
|
install(
|
||||||
|
PROGRAMS ${_install_helper_PROGRAMS}
|
||||||
|
DESTINATION ${_install_helper_DESTINATION}
|
||||||
|
PERMISSIONS ${_install_helper_FILE_PERMISSIONS}
|
||||||
|
${RENAME})
|
||||||
|
endif()
|
||||||
|
endfunction()
|
0
runtime/doc/vim2html.pl
Normal file → Executable file
0
runtime/doc/vim2html.pl
Normal file → Executable file
0
runtime/indent/lifelines.vim
Executable file → Normal file
0
runtime/indent/lifelines.vim
Executable file → Normal file
@ -174,7 +174,7 @@ if(NOT DEFINED ENV{SKIP_EXEC})
|
|||||||
add_executable(nvim ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES}
|
add_executable(nvim ${NEOVIM_GENERATED_SOURCES} ${NEOVIM_SOURCES}
|
||||||
${NEOVIM_HEADERS})
|
${NEOVIM_HEADERS})
|
||||||
target_link_libraries(nvim ${NVIM_LINK_LIBRARIES})
|
target_link_libraries(nvim ${NVIM_LINK_LIBRARIES})
|
||||||
install(TARGETS nvim RUNTIME DESTINATION bin)
|
install_helper(TARGETS nvim)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT DEFINED ENV{SKIP_UNITTEST})
|
if(NOT DEFINED ENV{SKIP_UNITTEST})
|
||||||
|
@ -71,7 +71,7 @@ if(HAVE_WORKING_LIBINTL AND GETTEXT_FOUND AND XGETTEXT_PRG AND ICONV_PRG AND
|
|||||||
-P ${CMAKE_MODULE_PATH}/RunMsgfmt.cmake
|
-P ${CMAKE_MODULE_PATH}/RunMsgfmt.cmake
|
||||||
DEPENDS ${poFile} ${NVIM_POT})
|
DEPENDS ${poFile} ${NVIM_POT})
|
||||||
|
|
||||||
install(
|
install_helper(
|
||||||
FILES ${moFile}
|
FILES ${moFile}
|
||||||
DESTINATION share/locale/${name}/LC_MESSAGES
|
DESTINATION share/locale/${name}/LC_MESSAGES
|
||||||
RENAME nvim.mo)
|
RENAME nvim.mo)
|
||||||
|
Loading…
Reference in New Issue
Block a user