| 1 | project('git-gui', |
| 2 | meson_version: '>=0.61.0', |
| 3 | ) |
| 4 | |
| 5 | fs = import('fs') |
| 6 | |
| 7 | shell = find_program('/bin/sh', 'sh') |
| 8 | tclsh = find_program('tclsh') |
| 9 | wish = find_program('wish') |
| 10 | |
| 11 | build_options_config = configuration_data() |
| 12 | if target_machine.system() == 'windows' |
| 13 | build_options_config.set('GITGUI_RELATIVE', '1') |
| 14 | else |
| 15 | build_options_config.set('GITGUI_RELATIVE', '') |
| 16 | endif |
| 17 | build_options_config.set_quoted('GITGUI_GITEXECDIR', get_option('prefix') / get_option('libexecdir') / 'git-core') |
| 18 | build_options_config.set_quoted('GITGUI_LIBDIR', get_option('prefix') / get_option('datadir') / 'git-gui/lib') |
| 19 | build_options_config.set_quoted('SHELL_PATH', fs.as_posix(shell.full_path())) |
| 20 | build_options_config.set_quoted('TCLTK_PATH', fs.as_posix(wish.full_path())) |
| 21 | build_options_config.set_quoted('TCL_PATH', fs.as_posix(tclsh.full_path())) |
| 22 | |
| 23 | build_options = configure_file( |
| 24 | input: 'GIT-GUI-BUILD-OPTIONS.in', |
| 25 | output: 'GIT-GUI-BUILD-OPTIONS', |
| 26 | configuration: build_options_config, |
| 27 | ) |
| 28 | |
| 29 | version_file = custom_target( |
| 30 | input: 'GIT-VERSION-GEN', |
| 31 | output: 'GIT-VERSION-FILE', |
| 32 | command: [ |
| 33 | shell, |
| 34 | '@INPUT@', |
| 35 | meson.current_source_dir(), |
| 36 | '@OUTPUT@', |
| 37 | get_option('parent_project_dir'), |
| 38 | ], |
| 39 | build_always_stale: true, |
| 40 | ) |
| 41 | |
| 42 | gitgui_main = 'git-gui' |
| 43 | gitgui_main_install_dir = get_option('libexecdir') / 'git-core' |
| 44 | |
| 45 | if target_machine.system() == 'windows' |
| 46 | gitgui_main = 'git-gui.tcl' |
| 47 | |
| 48 | configure_file( |
| 49 | input: 'windows/git-gui.sh', |
| 50 | output: 'git-gui', |
| 51 | copy: true, |
| 52 | install: true, |
| 53 | install_dir: get_option('libexecdir') / 'git-core', |
| 54 | ) |
| 55 | endif |
| 56 | |
| 57 | foreach script : [ 'git-gui--askpass', 'git-gui--askyesno' ] |
| 58 | custom_target( |
| 59 | output: script, |
| 60 | input: script + '.sh', |
| 61 | command: [ |
| 62 | shell, |
| 63 | meson.current_source_dir() / 'generate-script.sh', |
| 64 | '@OUTPUT@', |
| 65 | '@INPUT@', |
| 66 | meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', |
| 67 | ], |
| 68 | install: true, |
| 69 | install_dir: get_option('libexecdir') / 'git-core', |
| 70 | ) |
| 71 | endforeach |
| 72 | |
| 73 | custom_target( |
| 74 | input: 'git-gui.sh', |
| 75 | output: gitgui_main, |
| 76 | command: [ |
| 77 | shell, |
| 78 | meson.current_source_dir() / 'generate-git-gui.sh', |
| 79 | '@INPUT@', |
| 80 | '@OUTPUT@', |
| 81 | meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', |
| 82 | meson.current_build_dir() / 'GIT-VERSION-FILE', |
| 83 | ], |
| 84 | depends: [ |
| 85 | version_file, |
| 86 | ], |
| 87 | depend_files: [ |
| 88 | build_options, |
| 89 | ], |
| 90 | install: true, |
| 91 | install_dir: gitgui_main_install_dir, |
| 92 | ) |
| 93 | |
| 94 | install_symlink('git-citool', |
| 95 | install_dir: get_option('libexecdir') / 'git-core', |
| 96 | pointing_to: 'git-gui', |
| 97 | ) |
| 98 | |
| 99 | subdir('lib') |
| 100 | subdir('po') |