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 <ps@pks.im>
Patrick Steinhardt committed
Mar 11, 2025 at 11:09 UTC
8bf062dd147146c4bd76c7344ee5fcb5fbd0834c
4 files changed
+261
.gitattributes
+1
@@ -4,3 +4,4 @@ git-gui.sh encoding=UTF-8
4
/po/*.po encoding=UTF-8
5
/GIT-VERSION-GEN eol=lf
6
Makefile whitespace=!indent,trail,space
7
+meson.build whitespace=space
lib/meson.build
new
+74
@@ -0,0 +1,74 @@
1
+libfiles = [
2
+ 'about.tcl',
3
+ 'blame.tcl',
4
+ 'branch_checkout.tcl',
5
+ 'branch_create.tcl',
6
+ 'branch_delete.tcl',
7
+ 'branch_rename.tcl',
8
+ 'branch.tcl',
9
+ 'browser.tcl',
10
+ 'checkout_op.tcl',
11
+ 'choose_font.tcl',
12
+ 'choose_repository.tcl',
13
+ 'choose_rev.tcl',
14
+ 'chord.tcl',
15
+ 'class.tcl',
16
+ 'commit.tcl',
17
+ 'console.tcl',
18
+ 'database.tcl',
19
+ 'date.tcl',
20
+ 'diff.tcl',
21
+ 'encoding.tcl',
22
+ 'error.tcl',
23
+ 'index.tcl',
24
+ 'line.tcl',
25
+ 'logo.tcl',
26
+ 'merge.tcl',
27
+ 'mergetool.tcl',
28
+ 'option.tcl',
29
+ 'remote_add.tcl',
30
+ 'remote_branch_delete.tcl',
31
+ 'remote.tcl',
32
+ 'search.tcl',
33
+ 'shortcut.tcl',
34
+ 'spellcheck.tcl',
35
+ 'sshkey.tcl',
36
+ 'status_bar.tcl',
37
+ 'themed.tcl',
38
+ 'tools_dlg.tcl',
39
+ 'tools.tcl',
40
+ 'transport.tcl',
41
+ 'win32.tcl',
42
+]
43
+
44
+nontcl_libfiles = [
45
+ 'git-gui.ico',
46
+ 'win32_shortcut.js',
47
+]
48
+
49
+foreach file : libfiles + nontcl_libfiles
50
+ configure_file(
51
+ input: file,
52
+ output: file,
53
+ copy: true,
54
+ install: true,
55
+ install_dir: get_option('datadir') / 'git-gui/lib',
56
+ )
57
+endforeach
58
+
59
+custom_target(
60
+ output: 'tclIndex',
61
+ command: [
62
+ shell,
63
+ meson.project_source_root() / 'generate-tclindex.sh',
64
+ meson.project_build_root(),
65
+ meson.project_build_root() / 'GIT-GUI-BUILD-OPTIONS',
66
+ libfiles,
67
+ ],
68
+ depend_files: [
69
+ libfiles,
70
+ build_options,
71
+ ],
72
+ install: true,
73
+ install_dir: get_option('datadir') / 'git-gui/lib',
74
+)
meson.build
new
+148
@@ -0,0 +1,148 @@
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')
po/meson.build
new
+38
@@ -0,0 +1,38 @@
1
+languages = [
2
+ 'bg',
3
+ 'de',
4
+ 'el',
5
+ 'fr',
6
+ 'hu',
7
+ 'it',
8
+ 'ja',
9
+ 'nb',
10
+ 'pt_br',
11
+ 'pt_pt',
12
+ 'ru',
13
+ 'sv',
14
+ 'vi',
15
+ 'zh_cn',
16
+]
17
+
18
+msgfmt = find_program('msgfmt', required: false)
19
+if not msgfmt.found()
20
+ subdir_done()
21
+endif
22
+
23
+foreach language : languages
24
+ custom_target(
25
+ input: language + '.po',
26
+ output: language + '.msg',
27
+ command: [
28
+ msgfmt,
29
+ '--statistics',
30
+ '--tcl',
31
+ '--locale=' + language,
32
+ '-d', meson.current_build_dir(),
33
+ '@INPUT@',
34
+ ],
35
+ install: true,
36
+ install_dir: get_option('datadir') / 'git-gui/lib/msgs',
37
+ )
38
+endforeach