From: Patrick Steinhardt Date: Tue, 11 Mar 2025 10:09:23 +0000 (+0100) Subject: git-gui: wire up support for the Meson build system X-Git-Tag: v2.50.0-rc1~17^2^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8bf062dd147146c4bd76c7344ee5fcb5fbd0834c;p=thirdparty%2Fgit.git git-gui: wire up support for the Meson build system The Git project has started to wire up Meson as a build system in Git v2.48.0. Wire up support for Meson in "git-gui" so that we can trivially include it as a subproject in Git. Signed-off-by: Patrick Steinhardt --- diff --git a/.gitattributes b/.gitattributes index 118d56cfbd..889d58257f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,3 +4,4 @@ git-gui.sh encoding=UTF-8 /po/*.po encoding=UTF-8 /GIT-VERSION-GEN eol=lf Makefile whitespace=!indent,trail,space +meson.build whitespace=space diff --git a/lib/meson.build b/lib/meson.build new file mode 100644 index 0000000000..4b9efab774 --- /dev/null +++ b/lib/meson.build @@ -0,0 +1,74 @@ +libfiles = [ + 'about.tcl', + 'blame.tcl', + 'branch_checkout.tcl', + 'branch_create.tcl', + 'branch_delete.tcl', + 'branch_rename.tcl', + 'branch.tcl', + 'browser.tcl', + 'checkout_op.tcl', + 'choose_font.tcl', + 'choose_repository.tcl', + 'choose_rev.tcl', + 'chord.tcl', + 'class.tcl', + 'commit.tcl', + 'console.tcl', + 'database.tcl', + 'date.tcl', + 'diff.tcl', + 'encoding.tcl', + 'error.tcl', + 'index.tcl', + 'line.tcl', + 'logo.tcl', + 'merge.tcl', + 'mergetool.tcl', + 'option.tcl', + 'remote_add.tcl', + 'remote_branch_delete.tcl', + 'remote.tcl', + 'search.tcl', + 'shortcut.tcl', + 'spellcheck.tcl', + 'sshkey.tcl', + 'status_bar.tcl', + 'themed.tcl', + 'tools_dlg.tcl', + 'tools.tcl', + 'transport.tcl', + 'win32.tcl', +] + +nontcl_libfiles = [ + 'git-gui.ico', + 'win32_shortcut.js', +] + +foreach file : libfiles + nontcl_libfiles + configure_file( + input: file, + output: file, + copy: true, + install: true, + install_dir: get_option('datadir') / 'git-gui/lib', + ) +endforeach + +custom_target( + output: 'tclIndex', + command: [ + shell, + meson.project_source_root() / 'generate-tclindex.sh', + meson.project_build_root(), + meson.project_build_root() / 'GIT-GUI-BUILD-OPTIONS', + libfiles, + ], + depend_files: [ + libfiles, + build_options, + ], + install: true, + install_dir: get_option('datadir') / 'git-gui/lib', +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000000..cdae85e4b9 --- /dev/null +++ b/meson.build @@ -0,0 +1,148 @@ +project('git-gui', + meson_version: '>=0.61.0', +) + +fs = import('fs') + +shell = find_program('sh') +tclsh = find_program('tclsh') +wish = find_program('wish') + +build_options_config = configuration_data() +if target_machine.system() == 'windows' + build_options_config.set('GITGUI_RELATIVE', '1') +else + build_options_config.set('GITGUI_RELATIVE', '') +endif +build_options_config.set_quoted('GITGUI_GITEXECDIR', get_option('prefix') / get_option('libexecdir') / 'git-core') +build_options_config.set_quoted('GITGUI_LIBDIR', get_option('prefix') / get_option('datadir') / 'git-gui/lib') +build_options_config.set_quoted('SHELL_PATH', fs.as_posix(shell.full_path())) +build_options_config.set_quoted('TCLTK_PATH', fs.as_posix(wish.full_path())) +build_options_config.set_quoted('TCL_PATH', fs.as_posix(tclsh.full_path())) +if target_machine.system() == 'darwin' + tkexecutables = [ + '/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish', + '/System/Library/Frameworks/Tk.framework/Resources/Wish.app/Contents/MacOS/Wish', + '/System/Library/Frameworks/Tk.framework/Resources/Wish Shell.app/Contents/MacOS/Wish Shell', + ] + tkexecutable = find_program(tkexecutables) + build_options_config.set_quoted('TKEXECUTABLE', tkexecutable.full_path()) +else + build_options_config.set('TKEXECUTABLE', '') +endif + +build_options = configure_file( + input: 'GIT-GUI-BUILD-OPTIONS.in', + output: 'GIT-GUI-BUILD-OPTIONS', + configuration: build_options_config, +) + +version_file = custom_target( + input: 'GIT-VERSION-GEN', + output: 'GIT-VERSION-FILE', + command: [ + shell, + '@INPUT@', + meson.current_source_dir(), + '@OUTPUT@', + ], + build_always_stale: true, +) + +configure_file( + input: 'git-gui--askpass', + output: 'git-gui--askpass', + copy: true, + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) + +gitgui_main = 'git-gui' +gitgui_main_install_dir = get_option('libexecdir') / 'git-core' + +if target_machine.system() == 'windows' + gitgui_main = 'git-gui.tcl' + + configure_file( + input: 'windows/git-gui.sh', + output: 'git-gui', + copy: true, + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) +elif target_machine.system() == 'darwin' + gitgui_main = 'git-gui.tcl' + gitgui_main_install_dir = get_option('datadir') / 'git-gui/lib' + + custom_target( + output: 'git-gui', + command: [ + shell, + meson.current_source_dir() / 'generate-macos-wrapper.sh', + '@OUTPUT@', + meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', + meson.current_build_dir() / 'GIT-VERSION-FILE', + ], + depends: [ + version_file, + ], + depend_files: [ + build_options, + ], + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) + + custom_target( + output: 'Git Gui.app', + command: [ + shell, + meson.current_source_dir() / 'generate-macos-app.sh', + meson.current_source_dir(), + meson.current_build_dir() / 'Git Gui.app', + meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', + meson.current_build_dir() / 'GIT-VERSION-FILE', + ], + depends: [ + version_file, + ], + depend_files: [ + build_options, + 'macosx/AppMain.tcl', + 'macosx/Info.plist', + 'macosx/git-gui.icns', + ], + build_by_default: true, + install: true, + install_dir: get_option('datadir') / 'git-gui/lib', + ) +endif + +custom_target( + input: 'git-gui.sh', + output: gitgui_main, + command: [ + shell, + meson.current_source_dir() / 'generate-git-gui.sh', + '@INPUT@', + '@OUTPUT@', + meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS', + meson.current_build_dir() / 'GIT-VERSION-FILE', + ], + depends: [ + version_file, + ], + depend_files: [ + build_options, + ], + install: true, + install_dir: gitgui_main_install_dir, +) + +install_symlink('git-citool', + install_dir: get_option('libexecdir') / 'git-core', + pointing_to: 'git-gui', +) + +subdir('lib') +subdir('po') diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 0000000000..00cae74338 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,38 @@ +languages = [ + 'bg', + 'de', + 'el', + 'fr', + 'hu', + 'it', + 'ja', + 'nb', + 'pt_br', + 'pt_pt', + 'ru', + 'sv', + 'vi', + 'zh_cn', +] + +msgfmt = find_program('msgfmt', required: false) +if not msgfmt.found() + subdir_done() +endif + +foreach language : languages + custom_target( + input: language + '.po', + output: language + '.msg', + command: [ + msgfmt, + '--statistics', + '--tcl', + '--locale=' + language, + '-d', meson.current_build_dir(), + '@INPUT@', + ], + install: true, + install_dir: get_option('datadir') / 'git-gui/lib/msgs', + ) +endforeach