2017-10-05 11:45:48 +08:00
|
|
|
# -DLOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
|
|
|
|
# -DPREFIX=L"${CMAKE_INSTALL_PREFIX}"
|
|
|
|
# -DDATADIR=L"${CMAKE_INSTALL_FULL_DATADIR}"
|
|
|
|
# -DSYSCONFDIR=L"${CMAKE_INSTALL_FULL_SYSCONFDIR}"
|
|
|
|
# -DBINDIR=L"${CMAKE_INSTALL_FULL_BINDIR}"
|
|
|
|
# -DDOCDIR=L"${CMAKE_INSTALL_FULL_DOCDIR}")
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(CMAKE_INSTALL_MESSAGE NEVER)
|
2017-10-05 11:45:48 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(PROGRAMS fish fish_indent 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(rel_datadir ${CMAKE_INSTALL_DATADIR})
|
|
|
|
set(datadir ${CMAKE_INSTALL_FULL_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
|
|
|
|
2017-10-05 11:45:48 +08:00
|
|
|
# Comment at the top of some .in files
|
2020-03-15 07:11:35 +08:00
|
|
|
set(configure_input
|
2017-10-05 11:45:48 +08:00
|
|
|
"This file was generated from a corresponding .in file.\
|
|
|
|
DO NOT MANUALLY EDIT THIS FILE!")
|
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
set(extra_completionsdir
|
2020-01-18 23:22:25 +08:00
|
|
|
/usr/local/share/fish/vendor_completions.d
|
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-01-18 23:22:25 +08:00
|
|
|
/usr/local/share/fish/vendor_functions.d
|
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-01-18 23:22:25 +08:00
|
|
|
/usr/local/share/fish/vendor_conf.d
|
2017-10-05 11:45:48 +08:00
|
|
|
CACHE STRING "Path for extra configuration")
|
|
|
|
|
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
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/user_doc/man/man1/fish_key_reader.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
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(TARGETS ${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
|
|
|
|
${rel_datadir}/fish/tools/web_config/partials
|
|
|
|
${rel_datadir}/fish/tools/web_config/sample_prompts)
|
|
|
|
|
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)
|
|
|
|
configure_file(fish.pc.in fish.pc.noversion)
|
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}
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FBVF} ${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"
|
|
|
|
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-03-15 07:11:35 +08:00
|
|
|
install(FILES CHANGELOG.md DESTINATION ${docdir})
|
2018-01-21 15:27:51 +08:00
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(FILES share/lynx.lss DESTINATION ${rel_datadir}/fish/)
|
2017-10-05 12:40:58 +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
|
|
|
|
2020-03-15 07:11:35 +08:00
|
|
|
install(FILES fish.desktop DESTINATION ${rel_datadir}/applications)
|
|
|
|
install(FILES fish.png DESTINATION ${rel_datadir}/pixmaps)
|
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
|
2019-06-26 04:03:49 +08:00
|
|
|
test_fishscript
|
2017-10-05 12:40:58 +08:00
|
|
|
test_prep tests_buildroot_target
|
|
|
|
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)
|