|
| 1 | +project('git-gui', |
| 2 | + meson_version: '>=0.61.0', |
| 3 | +) |
| 4 | + |
| 5 | +fs = import('fs') |
| 6 | + |
| 7 | +shell = find_program('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 | +if target_machine.system() == 'darwin' |
| 23 | + tkexecutables = [ |
| 24 | + '/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish', |
| 25 | + '/System/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish', |
| 26 | + '/System/Library/Frameworks/Tk.framework/Resources/Wish Shell.app/Contents/MacOS/Wish Shell', |
| 27 | + ] |
| 28 | + tkexecutable = find_program(tkexecutables) |
| 29 | + build_options_config.set_quoted('TKEXECUTABLE', tkexecutable.full_path()) |
| 30 | +else |
| 31 | + build_options_config.set('TKEXECUTABLE', '') |
| 32 | +endif |
| 33 | + |
| 34 | +build_options = configure_file( |
| 35 | + input: 'GIT-GUI-BUILD-OPTIONS.in', |
| 36 | + output: 'GIT-GUI-BUILD-OPTIONS', |
| 37 | + configuration: build_options_config, |
| 38 | +) |
| 39 | + |
| 40 | +version_file = custom_target( |
| 41 | + input: 'GIT-VERSION-GEN', |
| 42 | + output: 'GIT-VERSION-FILE', |
| 43 | + command: [ |
| 44 | + shell, |
| 45 | + '@INPUT@', |
| 46 | + meson.current_source_dir(), |
| 47 | + '@OUTPUT@', |
| 48 | + ], |
| 49 | + build_always_stale: true, |
| 50 | +) |
| 51 | + |
| 52 | +configure_file( |
| 53 | + input: 'git-gui--askpass', |
| 54 | + output: 'git-gui--askpass', |
| 55 | + copy: true, |
| 56 | + install: true, |
| 57 | + install_dir: get_option('libexecdir') / 'git-core', |
| 58 | +) |
| 59 | + |
| 60 | +gitgui_main = 'git-gui' |
| 61 | +gitgui_main_install_dir = get_option('libexecdir') / 'git-core' |
| 62 | + |
| 63 | +if target_machine.system() == 'windows' |
| 64 | + gitgui_main = 'git-gui.tcl' |
| 65 | + |
| 66 | + configure_file( |
| 67 | + input: 'windows/git-gui.sh', |
| 68 | + output: 'git-gui', |
| 69 | + copy: true, |
| 70 | + install: true, |
| 71 | + install_dir: get_option('libexecdir') / 'git-core', |
| 72 | + ) |
| 73 | +elif target_machine.system() == 'darwin' |
| 74 | + gitgui_main = 'git-gui.tcl' |
| 75 | + gitgui_main_install_dir = get_option('datadir') / 'git-gui/lib' |
| 76 | + |
| 77 | + custom_target( |
| 78 | + output: 'git-gui', |
| 79 | + command: [ |
| 80 | + shell, |
| 81 | + meson.current_source_dir() / 'generate-macos-wrapper.sh', |
| 82 | + '@OUTPUT@', |
| 83 | + meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', |
| 84 | + meson.current_build_dir() / 'GIT-VERSION-FILE', |
| 85 | + ], |
| 86 | + depends: [ |
| 87 | + version_file, |
| 88 | + ], |
| 89 | + depend_files: [ |
| 90 | + build_options, |
| 91 | + ], |
| 92 | + install: true, |
| 93 | + install_dir: get_option('libexecdir') / 'git-core', |
| 94 | + ) |
| 95 | + |
| 96 | + custom_target( |
| 97 | + output: 'Git Gui.app', |
| 98 | + command: [ |
| 99 | + shell, |
| 100 | + meson.current_source_dir() / 'generate-macos-app.sh', |
| 101 | + meson.current_source_dir(), |
| 102 | + meson.current_build_dir() / 'Git Gui.app', |
| 103 | + meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', |
| 104 | + meson.current_build_dir() / 'GIT-VERSION-FILE', |
| 105 | + ], |
| 106 | + depends: [ |
| 107 | + version_file, |
| 108 | + ], |
| 109 | + depend_files: [ |
| 110 | + build_options, |
| 111 | + 'macosx/AppMain.tcl', |
| 112 | + 'macosx/Info.plist', |
| 113 | + 'macosx/git-gui.icns', |
| 114 | + ], |
| 115 | + build_by_default: true, |
| 116 | + install: true, |
| 117 | + install_dir: get_option('datadir') / 'git-gui/lib', |
| 118 | + ) |
| 119 | +endif |
| 120 | + |
| 121 | +custom_target( |
| 122 | + input: 'git-gui.sh', |
| 123 | + output: gitgui_main, |
| 124 | + command: [ |
| 125 | + shell, |
| 126 | + meson.current_source_dir() / 'generate-git-gui.sh', |
| 127 | + '@INPUT@', |
| 128 | + '@OUTPUT@', |
| 129 | + meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', |
| 130 | + meson.current_build_dir() / 'GIT-VERSION-FILE', |
| 131 | + ], |
| 132 | + depends: [ |
| 133 | + version_file, |
| 134 | + ], |
| 135 | + depend_files: [ |
| 136 | + build_options, |
| 137 | + ], |
| 138 | + install: true, |
| 139 | + install_dir: gitgui_main_install_dir, |
| 140 | +) |
| 141 | + |
| 142 | +install_symlink('git-citool', |
| 143 | + install_dir: get_option('libexecdir') / 'git-core', |
| 144 | + pointing_to: 'git-gui', |
| 145 | +) |
| 146 | + |
| 147 | +subdir('lib') |
| 148 | +subdir('po') |
0 commit comments