Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the Meson build system #9

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

pks-t
Copy link

@pks-t pks-t commented Mar 11, 2025

Similar to the recent MR in gitk, this patch series wires up support for Meson in git-gui. Once landed, I'll send a patch series to Git to wire up both of these over there.

pks-t added 10 commits March 11, 2025 11:55
The GIT-GUI-VARS file is used to track whether any of our build options
has changed. Unfortunately, the format of that file does not allow us to
propagate those build options to other scripts. But as we are about to
introduce support for the Meson build system, we will extract a couple
of scripts to deduplicate core build logic across Makefiles and Meson.
With this refactoring, it will become necessary to make build options
more widely accessible.

Replace GIT-GUI-VARS with a new GIT-GUI-BUILD-OPTIONS file that is being
populated from a template. This file can easily be sourced from build
scripts in subsequent steps.

Signed-off-by: Patrick Steinhardt <[email protected]>
The GIT-VERSION-GEN unconditionally writes version information into the
source directory in the form of the "GIT-VERSION-FILE". We are about to
introduce the Meson build system though, which enforces out-of-tree
builds by default, and in that context we cannot continue to write
version information into the source tree.

Prepare the script for out-of-tree builds by treating the source
directory different from the output file.

Signed-off-by: Patrick Steinhardt <[email protected]>
The output of GIT-VERSION-GEN can be sourced by our Makefile to make the
version available there. The output has a couple of spaces around the
equals sign, which is perfectly valid for parsing it in our Makefile.
But in subsequent steps we'll also want to source the file in a couple
of newly-introduced shell scripts, but having spaces around variable
assignments is invalid there.

Prepare for this step by dropping the spaces surrounding the equals
sign. Like this, we can easily use the same file both in our Makefile
and in shell scripts.

Signed-off-by: Patrick Steinhardt <[email protected]>
The value of the GITGUI_SCRIPT variable is only used in a single place
as part of an sed(1) script that massages the "git-gui.sh" script.
Interestingly, this specific replacement does seem to be a no-op: we
replace "^ argv0=$$0" with " argv=$(GITGUI_SCRIPT)", which has a value
of "$$0". The result would thus be completely unchanged.

Drop the replacement and its variable.

Signed-off-by: Patrick Steinhardt <[email protected]>
Extract script to generate "git-gui". This change allows us to reuse the
build logic with the Meson build system.

Signed-off-by: Patrick Steinhardt <[email protected]>
Extract script to generate "tclIndex". This change allows us to reuse
the build logic with the Meson build system.

Signed-off-by: Patrick Steinhardt <[email protected]>
Extract script to generate the macOS wrapper for git-gui. This change
allows us to reuse the build logic with the Meson build system.

Signed-off-by: Patrick Steinhardt <[email protected]>
Extract script to generate the macOS app. This change allows us to reuse
the build logic with the Meson build system.

Note that as part of this change we also modify the TKEXECUTABLE
variable to track its full path. Like this we don't have to propagate
both the TKEXECUTABLE and TKFRAMEWORK variables into the script, and the
basename can be trivially computed from TKEXECUTABLE anyway.

Signed-off-by: Patrick Steinhardt <[email protected]>
The "GITGUI_VERSION" variable is made available by generating and
including the "GIT-VERSION-FILE" file. Its value has been used in
various build steps, but in the preceding commits we have refactored
those to instead source the "GIT-VERSION-FILE" directly. As a result,
the variable is now only used in a single recipe, and this use can be
trivially replaced with sed(1).

Refactor the recipe to do so and stop including "GIT-VERSION-FILE" to
simplify the build process.

Signed-off-by: Patrick Steinhardt <[email protected]>
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 <[email protected]>
@pks-t
Copy link
Author

pks-t commented Mar 11, 2025

I've tested the build instructions on NixOS, Windows 10 and (ancient) macOS 10.15 and have compared results between old/new Makefile results as well as Make and Meson. There are some minor differences around injected paths in Meson because we use the dynamically derived paths there. But other than that results looked mostly the same to me.

@j6t
Copy link
Owner

j6t commented Mar 11, 2025

Thank you. It will take some time until I can tend to this. Please bear with me.

@pks-t
Copy link
Author

pks-t commented Mar 11, 2025

Thank you. It will take some time until I can tend to this. Please bear with me.

No worries, take your time, there is no urgency here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants