Message ID | 20241112-pks-meson-v6-0-648b30996827@pks.im (mailing list archive) |
---|---|
Headers | show |
Series | Modernize the build system | expand |
On 12/11/2024 17:02, Patrick Steinhardt wrote: > Hi, > > this patch series modernizes our build infrasturcture. It refactors > various parts of it to make it possible to perform out-of-tree builds in > theory. > > The series then continues to wire up Meson as a proposed alternative as > a modern replacement for our current build systems. It provides better > integration into IDEs than our Makefiles, better usability than our > Makefiles and CMake, better configuration and discoverability thereof > than autoconf and CMake (which is of course my personal opinion). > > The intent is to have Meson replace autoconf, which is mostly unused and > broken. Eventually, the plan would to also replace CMake and our > Makefiles in case we figure out that this replacement is indeed a net > benefit for the project, but all of this would happen over the course of > multiple releases. > > Changes in v6: > > - Add documentation for how to use Meson. > > - Fix compilation in case libintl exists, but required tools like > msgfmt and related don't. Instead of failing, we now automatically > compile with the equivalent of NO_GETTEXT=YesPlease. > > - Update last patch that fixes semantic merge conflics with in-flight > topics in "seen". > > - I've changed the series to be based on "master" at b31fb630c0 (Merge > https://github.com/j6t/git-gui, 2024-11-11) as all prereqs of this > series have since landed. This doesn't make any difference though > as there aren't any merge conflicts or additional changes caused by > this. I mostly mention this so that there is no confusion around the > changed base commit. > Tested this version, without issue, on Linux and cygwin (build + test). On cygwin, the unit test now no longer times out: $ cd git/build $ tail test-out 1030/1030 t9902-completion OK 114.74s Ok: 1030 Expected Fail: 0 Fail: 0 Unexpected Pass: 0 Skipped: 0 Timeout: 0 Full log written to /home/ramsay/git/build/meson-logs/testlog.txt $ Having said that, I was expecting to see an 'Unexpected Pass', since meson decides to not set NO_REGEX. (The 'make' build on cygwin will set 'NO_REGEX = UnfortunatelyYes' in the config.mak.uname). In the meson-logs/testlog.txt file, for the t7815-grep-binary.sh test stdout, we find: ----------------------------------- stdout ----------------------------------- ok 1 - setup ok 2 - git grep ina a ok 3 - git grep -ah ina a ok 4 - git grep -I ina a ok 5 - git grep -c ina a ok 6 - git grep -l ina a ok 7 - git grep -L bar a ok 8 - git grep -q ina a ok 9 - git grep -F ile a ok 10 - git grep -Fi iLE a ok 11 - git grep ile a ok 12 - git grep .fi a # TODO known breakage vanished ok 13 - grep respects binary diff attribute ok 14 - grep --cached respects binary diff attribute ok 15 - grep --cached respects binary diff attribute (2) ok 16 - grep revision respects binary diff attribute ok 17 - grep respects not-binary diff attribute ok 18 - setup textconv filters ok 19 - grep does not honor textconv ok 20 - grep --textconv honors textconv ok 21 - grep --no-textconv does not honor textconv ok 22 - grep --textconv blob honors textconv # 1 known breakage(s) vanished; please update test(s) # passed all remaining 21 test(s) 1..22 ============================================================================== Note the 'TODO known breakage vanished' on test 12. Setting NO_REGEX on cygwin is for 'reasons' (not necessarily good) and we need a way to override it's decision here. (In general, we need to be able to use *any* of the many build variables to override meson's automatic setting of these build variables). Thanks! ATB, Ramsay Jones
On Tue, Nov 12, 2024 at 9:42 PM Patrick Steinhardt <ps@pks.im> wrote: > ++# The prefix into which Git shall be installed is defined when setting up > ++# the build directory. More on that in the "Configuration" section. > ++# > ++# Meson supports multiple backends. The default backend generates Ninja build > ++# instructions, but it also supports the generation of Microsoft Visual > ++# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual > ++# Studio Code provide plugins to import Meson files directly. > ++# > ++# Configuration > ++# ============= > ++# > ++# The exact configuration of Git is determined when setting up the Git > ++# directory. Is it the "Git directory" or the "build directory"? It might be helpful to repeat that this happens when `meson setup build/` is run (as far as I understand it). Maybe something like: "The exact configuration of Git is determined when setting up the build directory, so when running `meson setup <build-dir>/`." >Unless told otherwise, Meson will automatically detect the > ++# availability of various bits and pieces. There are two different kinds of > ++# options that can be used to further tweak the build: > ++# > ++# - Built-in options provided by Meson. > ++# > ++# - Options defined by the project in the "meson_options.txt" file. > ++# > ++# Both kinds of options can be inspected by running `meson configure` in the > ++# build directory, which will give you a list of the current value for all > ++# options. > ++# > ++# Options can be configured either when setting up the build directory or can > ++# be changed in preexisting build directories: > ++# > ++# # Set up a build directory with optimized settings that will be > ++# # installed into an alternative prefix. > ++# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER It's not very clear if the above instruction should be run inside an existing build directory to modify its configuration, or if it creates a new build directory. If it creates one, it's also not clear what the name of that directory would be. Maybe "build", but then what if an existing build directory exists with that name? > ++# # Set up a build directory with 'address' and 'undefined' sanitizers > ++# # using Clang. > ++# $ CC=clang meson setup -Db_sanitize=address,undefined Same as above. > ++# # Disable tests in a preexisting build directory. > ++# $ meson configure -Dtests=false As here the command is "configure" instead of "setup", I guess it doesn't create a build directory and should be run inside a one. > ++# # Disable features based on Python > ++# $ meson configure -Dpython=disabled > ++# > ++# # Disable features based on Python > ++# $ meson configure -Dpython=disabled It looks like there is some duplication above. > ++# Options have a type like booleans, choices, strings or features. Features are > ++# somewhat special as they can have one of three values: enabled, disabled or > ++# auto. While the first two values are self-explanatory, "auto" will enable or > ++# disable the feature based on the availability of prerequisites to support it. > ++# Python-based features for example will be enabled automatically when a Python > ++# interpreter could be found. The default value of such features can be changed > ++# globally via `meson setup --auto-features={enabled,disabled,auto}`, which > ++# will set the value of all features with a value of "auto" to the provided one > ++# by default. > ++# > ++# It is also possible to store a set of configuration options in machine files. It's not very clear what a "machine file" is. How is it different from a config file? > ++# This can be useful in case you regularly want to reuse the same set of options: > ++# > ++# [binaries] > ++# c = ['clang'] > ++# ar = ['ar'] > ++# > ++# [project options] > ++# gettext = 'disabled' > ++# default_editor = 'vim' > ++# > ++# [built-in options] > ++# b_lto = true > ++# b_sanitize = 'address,undefined' > ++# > ++# These machine files can be passed to Meson via `meson setup --native-file`. > ++# > ++# Subproject wrappers > ++# =================== > ++# > ++# Subproject wrappers are a feature provided by Meson that allow the automatic > ++# fallback to a "wrapped" dependency in case the dependency is not provided by > ++# the system. For example if the system is lacking curl, then Meson will use > ++# "subprojects/curl.wrap" to set up curl as a subproject and compile and link > ++# the dependency into Git itself. This is especially helpful on systems like > ++# Windows, where you typically don't have such dependencies installed. > ++# > ++# The use of subproject wrappers can be disabled by executing `meson setup > ++# --wrap-mode nofallback`. I guess this will make the build fail if the system doesn't provide curl then.
On Wed, Nov 13, 2024 at 11:45:41AM +0100, Christian Couder wrote: > On Tue, Nov 12, 2024 at 9:42 PM Patrick Steinhardt <ps@pks.im> wrote: > > > ++# The prefix into which Git shall be installed is defined when setting up > > ++# the build directory. More on that in the "Configuration" section. > > ++# > > ++# Meson supports multiple backends. The default backend generates Ninja build > > ++# instructions, but it also supports the generation of Microsoft Visual > > ++# Studio solutions as well as Xcode projects. IDEs like Eclipse and Visual > > ++# Studio Code provide plugins to import Meson files directly. > > ++# > > ++# Configuration > > ++# ============= > > ++# > > ++# The exact configuration of Git is determined when setting up the Git > > ++# directory. > > Is it the "Git directory" or the "build directory"? > > It might be helpful to repeat that this happens when `meson setup > build/` is run (as far as I understand it). Maybe something like: > > "The exact configuration of Git is determined when setting up the > build directory, so when running `meson setup <build-dir>/`." Good catch, this is of course the build directory. I've also adapted in the spirit of your proposed text. > >Unless told otherwise, Meson will automatically detect the > > ++# availability of various bits and pieces. There are two different kinds of > > ++# options that can be used to further tweak the build: > > ++# > > ++# - Built-in options provided by Meson. > > ++# > > ++# - Options defined by the project in the "meson_options.txt" file. > > ++# > > ++# Both kinds of options can be inspected by running `meson configure` in the > > ++# build directory, which will give you a list of the current value for all > > ++# options. > > ++# > > ++# Options can be configured either when setting up the build directory or can > > ++# be changed in preexisting build directories: > > ++# > > ++# # Set up a build directory with optimized settings that will be > > ++# # installed into an alternative prefix. > > ++# $ meson setup --buildtype release --optimization 3 --strip --prefix=/home/$USER > > It's not very clear if the above instruction should be run inside an > existing build directory to modify its configuration, or if it creates > a new build directory. If it creates one, it's also not clear what the > name of that directory would be. Maybe "build", but then what if an > existing build directory exists with that name? Oh, that's because I forgot to add the name of the build directory. [snip] > > ++# # Disable features based on Python > > ++# $ meson configure -Dpython=disabled > > ++# > > ++# # Disable features based on Python > > ++# $ meson configure -Dpython=disabled > > It looks like there is some duplication above. Ah, indeed. > > ++# Options have a type like booleans, choices, strings or features. Features are > > ++# somewhat special as they can have one of three values: enabled, disabled or > > ++# auto. While the first two values are self-explanatory, "auto" will enable or > > ++# disable the feature based on the availability of prerequisites to support it. > > ++# Python-based features for example will be enabled automatically when a Python > > ++# interpreter could be found. The default value of such features can be changed > > ++# globally via `meson setup --auto-features={enabled,disabled,auto}`, which > > ++# will set the value of all features with a value of "auto" to the provided one > > ++# by default. > > ++# > > ++# It is also possible to store a set of configuration options in machine files. > > It's not very clear what a "machine file" is. How is it different from > a config file? It's not, the machine file is a configuration file. It's just what Meson calls it. > > ++# This can be useful in case you regularly want to reuse the same set of options: > > ++# > > ++# [binaries] > > ++# c = ['clang'] > > ++# ar = ['ar'] > > ++# > > ++# [project options] > > ++# gettext = 'disabled' > > ++# default_editor = 'vim' > > ++# > > ++# [built-in options] > > ++# b_lto = true > > ++# b_sanitize = 'address,undefined' > > ++# > > ++# These machine files can be passed to Meson via `meson setup --native-file`. > > ++# > > ++# Subproject wrappers > > ++# =================== > > ++# > > ++# Subproject wrappers are a feature provided by Meson that allow the automatic > > ++# fallback to a "wrapped" dependency in case the dependency is not provided by > > ++# the system. For example if the system is lacking curl, then Meson will use > > ++# "subprojects/curl.wrap" to set up curl as a subproject and compile and link > > ++# the dependency into Git itself. This is especially helpful on systems like > > ++# Windows, where you typically don't have such dependencies installed. > > ++# > > ++# The use of subproject wrappers can be disabled by executing `meson setup > > ++# --wrap-mode nofallback`. > > I guess this will make the build fail if the system doesn't provide curl then. It depends on the value of the feature. If it's set to 'enabled' then yes, Meson would fail. If it's set to 'auto' then it would simply disable the feature and continue. Right now it's set to 'enabled', so yes, we'd fail. Patrick
On Wed, Nov 13, 2024 at 03:30:20AM +0000, Ramsay Jones wrote: > On 12/11/2024 17:02, Patrick Steinhardt wrote: > > Hi, > > > > this patch series modernizes our build infrasturcture. It refactors > > various parts of it to make it possible to perform out-of-tree builds in > > theory. > > > > The series then continues to wire up Meson as a proposed alternative as > > a modern replacement for our current build systems. It provides better > > integration into IDEs than our Makefiles, better usability than our > > Makefiles and CMake, better configuration and discoverability thereof > > than autoconf and CMake (which is of course my personal opinion). > > > > The intent is to have Meson replace autoconf, which is mostly unused and > > broken. Eventually, the plan would to also replace CMake and our > > Makefiles in case we figure out that this replacement is indeed a net > > benefit for the project, but all of this would happen over the course of > > multiple releases. > > > > Changes in v6: > > > > - Add documentation for how to use Meson. > > > > - Fix compilation in case libintl exists, but required tools like > > msgfmt and related don't. Instead of failing, we now automatically > > compile with the equivalent of NO_GETTEXT=YesPlease. > > > > - Update last patch that fixes semantic merge conflics with in-flight > > topics in "seen". > > > > - I've changed the series to be based on "master" at b31fb630c0 (Merge > > https://github.com/j6t/git-gui, 2024-11-11) as all prereqs of this > > series have since landed. This doesn't make any difference though > > as there aren't any merge conflicts or additional changes caused by > > this. I mostly mention this so that there is no confusion around the > > changed base commit. > > > > Tested this version, without issue, on Linux and cygwin (build + test). Thanks for verifying! > On cygwin, the unit test now no longer times out: > > $ cd git/build > $ tail test-out > 1030/1030 t9902-completion OK 114.74s > > Ok: 1030 > Expected Fail: 0 > Fail: 0 > Unexpected Pass: 0 > Skipped: 0 > Timeout: 0 > > Full log written to /home/ramsay/git/build/meson-logs/testlog.txt > $ Great. > Having said that, I was expecting to see an 'Unexpected Pass', since > meson decides to not set NO_REGEX. (The 'make' build on cygwin will > set 'NO_REGEX = UnfortunatelyYes' in the config.mak.uname). > > In the meson-logs/testlog.txt file, for the t7815-grep-binary.sh test > stdout, we find: > > ----------------------------------- stdout ----------------------------------- > ok 1 - setup > ok 2 - git grep ina a > ok 3 - git grep -ah ina a > ok 4 - git grep -I ina a > ok 5 - git grep -c ina a > ok 6 - git grep -l ina a > ok 7 - git grep -L bar a > ok 8 - git grep -q ina a > ok 9 - git grep -F ile a > ok 10 - git grep -Fi iLE a > ok 11 - git grep ile a > ok 12 - git grep .fi a # TODO known breakage vanished > ok 13 - grep respects binary diff attribute > ok 14 - grep --cached respects binary diff attribute > ok 15 - grep --cached respects binary diff attribute (2) > ok 16 - grep revision respects binary diff attribute > ok 17 - grep respects not-binary diff attribute > ok 18 - setup textconv filters > ok 19 - grep does not honor textconv > ok 20 - grep --textconv honors textconv > ok 21 - grep --no-textconv does not honor textconv > ok 22 - grep --textconv blob honors textconv > # 1 known breakage(s) vanished; please update test(s) > # passed all remaining 21 test(s) > 1..22 > ============================================================================== > > Note the 'TODO known breakage vanished' on test 12. Interesting. Right now we don't parse the output of the test executions themselves, so we only operate on the level of whether or not the whole test suite passed. So it's expected that this does not get reported as an unexpected pass. While Meson can itself generate TAP output, I don't think that it has support for _reading_ the TAP format. > Setting NO_REGEX on cygwin is for 'reasons' (not necessarily good) and we > need a way to override it's decision here. (In general, we need to be able > to use *any* of the many build variables to override meson's automatic > setting of these build variables). I can add an option for this. Out of curiosity, what is the reason? Is this anything that we can autodetect? Patrick