2020-03-15 07:11:35 +08:00
|
|
|
set(CMAKE_INSTALL_MESSAGE NEVER)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2024-01-25 19:58:50 +08:00
|
|
|
set(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/fish ${CMAKE_CURRENT_BINARY_DIR}/fish_indent ${CMAKE_CURRENT_BINARY_DIR}/fish_key_reader)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
|
set(bindir ${CMAKE_INSTALL_BINDIR})
|
|
|
|
set(sysconfdir ${CMAKE_INSTALL_SYSCONFDIR})
|
|
|
|
set(mandir ${CMAKE_INSTALL_MANDIR})
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(datadir ${CMAKE_INSTALL_FULL_DATADIR})
|
2021-07-20 06:14:44 +08:00
|
|
|
file(RELATIVE_PATH rel_datadir ${CMAKE_INSTALL_PREFIX} ${datadir})
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(docdir ${CMAKE_INSTALL_DOCDIR})
|
2018-01-21 15:27:51 +08:00
|
|
|
|
2020-03-20 22:17:46 +08:00
|
|
|
set(rel_completionsdir "fish/vendor_completions.d")
|
|
|
|
set(rel_functionsdir "fish/vendor_functions.d")
|
|
|
|
set(rel_confdir "fish/vendor_conf.d")
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(extra_completionsdir
|
2020-04-04 18:30:51 +08:00
|
|
|
"${datadir}/${rel_completionsdir}"
|
2017-10-05 11:45:48 +08:00
|
|
|
CACHE STRING "Path for extra completions")
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(extra_functionsdir
|
2020-04-04 18:30:51 +08:00
|
|
|
"${datadir}/${rel_functionsdir}"
|
2019-12-12 23:52:28 +08:00
|
|
|
CACHE STRING "Path for extra functions")
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(extra_confdir
|
2020-04-04 18:30:51 +08:00
|
|
|
"${datadir}/${rel_confdir}"
|
2017-10-05 11:45:48 +08:00
|
|
|
CACHE STRING "Path for extra configuration")
|
|
|
|
|
2023-09-06 15:35:56 +08:00
|
|
|
|
2018-03-23 16:03:02 +08:00
|
|
|
# These are the man pages that go in system manpath; all manpages go in the fish-specific manpath.
|
2020-03-15 07:11:35 +08:00
|
|
|
set(MANUALS ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish.1
|
2019-02-28 18:51:15 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_indent.1
|
2024-09-09 00:51:59 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_key_reader.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-doc.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-tutorial.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-language.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-interactive.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-completions.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-prompt-tutorial.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-for-bash-users.1
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish-faq.1)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2018-03-23 16:03:02 +08:00
|
|
|
# Determine which man page we don't want to install.
|
2017-10-05 11:45:48 +08:00
|
|
|
# On OS X, don't install a man page for open, since we defeat fish's open
|
|
|
|
# function on OS X.
|
2019-09-17 20:54:11 +08:00
|
|
|
# On other operating systems, don't install a realpath man page, as they almost all have a realpath
|
|
|
|
# command, while macOS does not.
|
2020-03-15 07:11:35 +08:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
|
|
set(CONDEMNED_PAGE "open.1")
|
|
|
|
else()
|
|
|
|
set(CONDEMNED_PAGE "realpath.1")
|
|
|
|
endif()
|
2017-10-05 11:45:48 +08:00
|
|
|
|
|
|
|
# Define a function to help us create directories.
|
2020-03-15 07:11:35 +08:00
|
|
|
function(FISH_CREATE_DIRS)
|
|
|
|
foreach(dir ${ARGV})
|
|
|
|
install(DIRECTORY DESTINATION ${dir})
|
|
|
|
endforeach(dir)
|
|
|
|
endfunction(FISH_CREATE_DIRS)
|
|
|
|
|
|
|
|
function(FISH_TRY_CREATE_DIRS)
|
|
|
|
foreach(dir ${ARGV})
|
|
|
|
if(NOT IS_ABSOLUTE ${dir})
|
|
|
|
set(abs_dir "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${dir}")
|
|
|
|
else()
|
|
|
|
set(abs_dir "\$ENV{DESTDIR}${dir}")
|
|
|
|
endif()
|
|
|
|
install(SCRIPT CODE "EXECUTE_PROCESS(COMMAND mkdir -p ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
|
|
|
|
execute_process(COMMAND chmod 755 ${abs_dir} OUTPUT_QUIET ERROR_QUIET)
|
2018-02-20 18:58:20 +08:00
|
|
|
")
|
2020-03-15 07:11:35 +08:00
|
|
|
endforeach()
|
|
|
|
endfunction(FISH_TRY_CREATE_DIRS)
|
2018-02-20 18:58:20 +08:00
|
|
|
|
2024-01-25 19:58:50 +08:00
|
|
|
install(PROGRAMS ${PROGRAMS}
|
2017-10-05 11:45:48 +08:00
|
|
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
|
|
|
|
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
|
|
|
|
DESTINATION ${bindir})
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
fish_create_dirs(${sysconfdir}/fish/conf.d ${sysconfdir}/fish/completions
|
2018-11-04 14:45:37 +08:00
|
|
|
${sysconfdir}/fish/functions)
|
2020-03-15 07:11:35 +08:00
|
|
|
install(FILES etc/config.fish DESTINATION ${sysconfdir}/fish/)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
fish_create_dirs(${rel_datadir}/fish ${rel_datadir}/fish/completions
|
2017-10-05 11:45:48 +08:00
|
|
|
${rel_datadir}/fish/functions ${rel_datadir}/fish/groff
|
|
|
|
${rel_datadir}/fish/man/man1 ${rel_datadir}/fish/tools
|
|
|
|
${rel_datadir}/fish/tools/web_config
|
|
|
|
${rel_datadir}/fish/tools/web_config/js
|
2021-07-10 17:06:16 +08:00
|
|
|
${rel_datadir}/fish/tools/web_config/sample_prompts
|
|
|
|
${rel_datadir}/fish/tools/web_config/themes
|
|
|
|
)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
configure_file(share/__fish_build_paths.fish.in share/__fish_build_paths.fish)
|
|
|
|
install(FILES share/config.fish
|
2017-10-05 11:45:48 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/share/__fish_build_paths.fish
|
|
|
|
DESTINATION ${rel_datadir}/fish)
|
|
|
|
|
2020-01-20 20:52:58 +08:00
|
|
|
# Create only the vendor directories inside the prefix (#5029 / #6508)
|
2020-03-15 07:11:35 +08:00
|
|
|
fish_create_dirs(${rel_datadir}/fish/vendor_completions.d ${rel_datadir}/fish/vendor_functions.d
|
2020-01-20 20:52:58 +08:00
|
|
|
${rel_datadir}/fish/vendor_conf.d)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
fish_try_create_dirs(${rel_datadir}/pkgconfig)
|
2020-03-20 22:17:46 +08:00
|
|
|
configure_file(fish.pc.in fish.pc.noversion @ONLY)
|
2018-02-22 03:40:15 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
add_custom_command(OUTPUT fish.pc
|
2018-02-22 03:40:15 +08:00
|
|
|
COMMAND sed '/Version/d' fish.pc.noversion > fish.pc
|
2018-03-22 12:34:33 +08:00
|
|
|
COMMAND printf "Version: " >> fish.pc
|
2018-02-22 03:40:15 +08:00
|
|
|
COMMAND sed 's/FISH_BUILD_VERSION=//\;s/\"//g' ${FBVF} >> fish.pc
|
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
2021-03-22 03:39:17 +08:00
|
|
|
DEPENDS CHECK-FISH-BUILD-VERSION-FILE ${CMAKE_CURRENT_BINARY_DIR}/fish.pc.noversion)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
add_custom_target(build_fish_pc ALL DEPENDS fish.pc)
|
2018-01-08 18:36:53 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fish.pc
|
2017-10-05 11:45:48 +08:00
|
|
|
DESTINATION ${rel_datadir}/pkgconfig)
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(DIRECTORY share/completions/
|
2017-10-05 11:45:48 +08:00
|
|
|
DESTINATION ${rel_datadir}/fish/completions
|
|
|
|
FILES_MATCHING PATTERN "*.fish")
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(DIRECTORY share/functions/
|
2017-10-05 11:45:48 +08:00
|
|
|
DESTINATION ${rel_datadir}/fish/functions
|
|
|
|
FILES_MATCHING PATTERN "*.fish")
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(DIRECTORY share/groff
|
2017-10-05 11:45:48 +08:00
|
|
|
DESTINATION ${rel_datadir}/fish)
|
|
|
|
|
2018-03-23 16:03:02 +08:00
|
|
|
# CONDEMNED_PAGE is managed by the conditional above
|
2019-02-26 04:12:08 +08:00
|
|
|
# Building the man pages is optional: if sphinx isn't installed, they're not built
|
2020-03-15 07:11:35 +08:00
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/
|
2018-03-23 16:03:02 +08:00
|
|
|
DESTINATION ${rel_datadir}/fish/man/man1
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.1"
|
|
|
|
PATTERN ${CONDEMNED_PAGE} EXCLUDE)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(PROGRAMS share/tools/create_manpage_completions.py share/tools/deroff.py
|
2017-10-05 11:45:48 +08:00
|
|
|
DESTINATION ${rel_datadir}/fish/tools/)
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(DIRECTORY share/tools/web_config
|
2017-10-05 11:45:48 +08:00
|
|
|
DESTINATION ${rel_datadir}/fish/tools/
|
|
|
|
FILES_MATCHING
|
|
|
|
PATTERN "*.png"
|
|
|
|
PATTERN "*.css"
|
|
|
|
PATTERN "*.html"
|
|
|
|
PATTERN "*.py"
|
|
|
|
PATTERN "*.js"
|
2021-07-10 17:06:16 +08:00
|
|
|
PATTERN "*.theme"
|
2017-10-05 11:45:48 +08:00
|
|
|
PATTERN "*.fish")
|
|
|
|
|
2019-02-28 18:51:15 +08:00
|
|
|
# Building the man pages is optional: if Sphinx isn't installed, they're not built
|
2020-03-15 07:11:35 +08:00
|
|
|
install(FILES ${MANUALS} DESTINATION ${mandir}/man1/ OPTIONAL)
|
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/user_doc/html/ # Trailing slash is important!
|
2018-03-13 22:01:49 +08:00
|
|
|
DESTINATION ${docdir} OPTIONAL)
|
2020-05-28 23:10:21 +08:00
|
|
|
install(FILES CHANGELOG.rst DESTINATION ${docdir})
|
2018-01-21 15:27:51 +08:00
|
|
|
|
2018-01-22 14:30:36 +08:00
|
|
|
# These files are built by cmake/gettext.cmake, but using GETTEXT_PROCESS_PO_FILES's
|
|
|
|
# INSTALL_DESTINATION leads to them being installed as ${lang}.gmo, not fish.mo
|
|
|
|
# The ${languages} array comes from cmake/gettext.cmake
|
2020-03-15 07:11:35 +08:00
|
|
|
if(GETTEXT_FOUND)
|
|
|
|
foreach(lang ${languages})
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo DESTINATION
|
2018-01-22 14:30:36 +08:00
|
|
|
${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES/ RENAME fish.mo)
|
2020-03-15 07:11:35 +08:00
|
|
|
endforeach()
|
|
|
|
endif()
|
2018-01-22 14:30:36 +08:00
|
|
|
|
2021-10-17 05:20:47 +08:00
|
|
|
if (NOT APPLE)
|
|
|
|
install(FILES fish.desktop DESTINATION ${rel_datadir}/applications)
|
2021-10-18 00:20:06 +08:00
|
|
|
install(FILES ${SPHINX_SRC_DIR}/python_docs_theme/static/fish.png DESTINATION ${rel_datadir}/pixmaps)
|
2021-10-17 05:20:47 +08:00
|
|
|
endif()
|
2020-01-25 14:03:12 +08:00
|
|
|
|
2017-10-05 12:40:58 +08:00
|
|
|
# Group install targets into a InstallTargets folder
|
2020-03-15 07:11:35 +08:00
|
|
|
set_property(TARGET build_fish_pc CHECK-FISH-BUILD-VERSION-FILE
|
2021-03-18 10:32:17 +08:00
|
|
|
tests_buildroot_target
|
2017-10-05 12:40:58 +08:00
|
|
|
PROPERTY FOLDER cmake/InstallTargets)
|
2017-11-06 03:25:08 +08:00
|
|
|
|
|
|
|
# Make a target build_root that installs into the buildroot directory, for testing.
|
2020-03-15 07:11:35 +08:00
|
|
|
set(BUILDROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/buildroot)
|
|
|
|
add_custom_target(build_root
|
2017-11-06 03:25:08 +08:00
|
|
|
COMMAND DESTDIR=${BUILDROOT_DIR} ${CMAKE_COMMAND}
|
|
|
|
--build ${CMAKE_CURRENT_BINARY_DIR} --target install)
|