fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
0fafff2c8
master
1set ( CMAKE_INSTALL_MESSAGE NEVER ) 2 3set ( prefix ${ CMAKE_INSTALL_PREFIX }) 4set ( bindir ${ CMAKE_INSTALL_BINDIR }) 5set ( sysconfdir ${ CMAKE_INSTALL_SYSCONFDIR }) 6set ( mandir ${ CMAKE_INSTALL_MANDIR }) 7 8set ( datadir ${ CMAKE_INSTALL_FULL_DATADIR }) 9file ( RELATIVE_PATH rel_datadir ${ CMAKE_INSTALL_PREFIX } ${ datadir }) 10 11set ( docdir ${ CMAKE_INSTALL_DOCDIR }) 12 13set ( rel_completionsdir "fish/vendor_completions.d" ) 14set ( rel_functionsdir "fish/vendor_functions.d" ) 15set ( rel_confdir "fish/vendor_conf.d" ) 16 17set ( 18extra_completionsdir " ${ datadir } / ${ rel_completionsdir } " 19CACHE STRING "Path for extra completions" 20) 21 22set ( 23extra_functionsdir " ${ datadir } / ${ rel_functionsdir } " 24CACHE STRING "Path for extra functions" 25) 26 27set ( 28extra_confdir " ${ datadir } / ${ rel_confdir } " 29CACHE STRING "Path for extra configuration" 30) 31 32 33# These are the man pages that go in system manpath; all manpages go in the fish-specific manpath. 34set ( MANUALS 35${ SPHINX_OUTPUT_DIR } /man/man1/fish.1 36${ SPHINX_OUTPUT_DIR } /man/man1/fish_indent.1 37${ SPHINX_OUTPUT_DIR } /man/man1/fish_key_reader.1 38${ SPHINX_OUTPUT_DIR } /man/man1/fish-doc.1 39${ SPHINX_OUTPUT_DIR } /man/man1/fish-tutorial.1 40${ SPHINX_OUTPUT_DIR } /man/man1/fish-language.1 41${ SPHINX_OUTPUT_DIR } /man/man1/fish-interactive.1 42${ SPHINX_OUTPUT_DIR } /man/man1/fish-terminal-compatibility.1 43${ SPHINX_OUTPUT_DIR } /man/man1/fish-completions.1 44${ SPHINX_OUTPUT_DIR } /man/man1/fish-prompt-tutorial.1 45${ SPHINX_OUTPUT_DIR } /man/man1/fish-for-bash-users.1 46${ SPHINX_OUTPUT_DIR } /man/man1/fish-faq.1 47) 48 49# Determine which man page we don't want to install. 50# On OS X, don't install a man page for open, since we defeat fish's open 51# function on OS X. 52# On other operating systems, don't install a realpath man page, as they almost all have a realpath 53# command, while macOS does not. 54if (${ CMAKE_SYSTEM_NAME } MATCHES "Darwin" ) 55set ( CONDEMNED_PAGE "open.1" ) 56else () 57set ( CONDEMNED_PAGE "realpath.1" ) 58endif () 59 60# Define a function to help us create directories. 61function ( FISH_CREATE_DIRS ) 62foreach ( dir${ ARGV }) 63install ( DIRECTORY DESTINATION ${ dir }) 64endforeach ( dir) 65endfunction ( FISH_CREATE_DIRS) 66 67function ( FISH_TRY_CREATE_DIRS ) 68foreach ( dir${ ARGV }) 69if ( NOT IS_ABSOLUTE ${ dir }) 70set ( abs_dir "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/ ${ dir } " ) 71else () 72set ( abs_dir "\$ENV{DESTDIR} ${ dir } " ) 73endif () 74install ( SCRIPT CODE " 75EXECUTE_PROCESS(COMMAND mkdir -p ${ abs_dir } OUTPUT_QUIET ERROR_QUIET) 76execute_process(COMMAND chmod 755 ${ abs_dir } OUTPUT_QUIET ERROR_QUIET) 77" ) 78endforeach () 79endfunction ( FISH_TRY_CREATE_DIRS) 80 81install ( 82PROGRAMS ${ CMAKE_CURRENT_BINARY_DIR } /fish 83PERMISSIONS 84OWNER_READ 85OWNER_WRITE 86OWNER_EXECUTE 87GROUP_READ 88GROUP_EXECUTE 89WORLD_READ 90WORLD_EXECUTE 91DESTINATION ${ bindir } 92) 93 94if ( NOT IS_ABSOLUTE ${ bindir }) 95set ( abs_bindir "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/ ${ bindir } " ) 96else () 97set ( abs_bindir "\$ENV{DESTDIR} ${ bindir } " ) 98endif () 99install ( CODE "file(CREATE_LINK ${ abs_bindir } /fish ${ abs_bindir } /fish_indent)" ) 100install ( CODE "file(CREATE_LINK ${ abs_bindir } /fish ${ abs_bindir } /fish_key_reader)" ) 101 102fish_create_dirs ( $ { sysconfdir } /fish/conf.d ${ sysconfdir } /fish/completions 103${ sysconfdir } /fish/functions ) 104install ( FILES etc/config.fish DESTINATION ${ sysconfdir } /fish/ ) 105 106fish_create_dirs ( 107${ rel_datadir } /fish 108${ rel_datadir } /fish/man/man1 109) 110 111# This file is embedded in the executable by rust-embed and never read from the filesystem 112configure_file ( share/__fish_build_paths.fish.in share/__fish_build_paths.fish ) 113 114# Create only the vendor directories inside the prefix (#5029 / #6508) 115fish_create_dirs ( 116${ rel_datadir } /fish/vendor_completions.d 117${ rel_datadir } /fish/vendor_functions.d 118${ rel_datadir } /fish/vendor_conf.d 119) 120 121fish_try_create_dirs ( $ { rel_datadir } /pkgconfig ) 122configure_file ( fish.pc.in fish.pc.noversion @ONLY ) 123 124add_custom_command ( 125OUTPUT fish.pc 126COMMAND sed '/Version/d' fish.pc.noversion > fish.pc 127COMMAND printf "Version: " >> fish.pc 128COMMAND ${ CMAKE_CURRENT_SOURCE_DIR } /build_tools/git_version_gen.sh >> fish.pc 129WORKING_DIRECTORY ${ CMAKE_CURRENT_BINARY_DIR } 130DEPENDS ${ CMAKE_CURRENT_BINARY_DIR } /fish.pc.noversion 131) 132 133add_custom_target ( build_fish_pc ALL DEPENDS fish.pc ) 134 135install ( 136FILES ${ CMAKE_CURRENT_BINARY_DIR } /fish.pc 137DESTINATION ${ rel_datadir } /pkgconfig 138) 139 140# CONDEMNED_PAGE is managed by the conditional above 141# Building the man pages is optional: if sphinx isn't installed, they're not built 142install ( 143DIRECTORY ${ SPHINX_OUTPUT_DIR } /man/man1/ 144DESTINATION ${ rel_datadir } /fish/man/man1 145FILES_MATCHING 146PATTERN "*.1" 147PATTERN ${ CONDEMNED_PAGE } EXCLUDE 148) 149 150# Building the man pages is optional: if Sphinx isn't installed, they're not built 151install ( FILES ${ MANUALS } DESTINATION ${ mandir } /man1/ OPTIONAL ) 152install ( 153DIRECTORY ${ SPHINX_OUTPUT_DIR } /html/ # Trailing slash is important! 154DESTINATION ${ docdir } OPTIONAL 155) 156install ( FILES CHANGELOG.rst DESTINATION ${ docdir }) 157 158# Group install targets into a InstallTargets folder 159set_property ( 160TARGET build_fish_pc 161PROPERTY FOLDER cmake/InstallTargets 162) 163 164# Make a target build_root that installs into the buildroot directory, for testing. 165set ( BUILDROOT_DIR ${ CMAKE_CURRENT_BINARY_DIR } /buildroot ) 166add_custom_target ( 167build_root 168COMMAND DESTDIR= ${ BUILDROOT_DIR } ${ CMAKE_COMMAND } 169--build ${ CMAKE_CURRENT_BINARY_DIR } --target install 170)