Allows `fish_indent -w **.fish` to restyle all fish files under the
current directory.
(This also has the sideeffect of reducing style.fish time by ~10s, as
we only need to invoke `fish_indent` once, instead of once per-file)
This used "argparse" to parse the args, which broke since CXXFLAGS
contained options.
Instead we pass "--all" before any other arguments, and then stop
argparse at nonoptions.
Came in handy for tracking down the performance regression in #5219. This will
take the output of two (necessarily identical) `fish --profile ...` runs and
produce a third profile log in which all times are the difference between the
first and the second profile provided.
(I'm not sure if build_tools is the right place for it, but I think it's OK?)
I can't seem to find a reason why the shell interpreter needs to be bash
and not just sh here. Needed to replace `BASH_SOURCE[0]` with the legacy
`$0` supported by sh, but otherwise it seems to still work.
Many non-Linux platforms do not ship with bash out-of-the-box (and as a
shell, I don't think we need to encourage the further proliferation of
bash ;-), this lets fish build on a clean install of FreeBSD, which does
not have bash.
This fixes a variety of issues related to building the documentation
with CMake. In particular it cleans up the dependency management and
fixes some issues where the documentation build was using generated
files from the source directory.
This untangles the CMake versioning issues (I hope) as discussed in #4626.
Note most of the advice found on the Internet about how to inject git
versions into CMake is just wrong.
The behavior we want is to unconditionally run the script
build_tools/git_version_gen.sh at build time (i.e. when you invoke ninja or
make, and not when you invoke cmake, which is build system generation time).
This script is careful to only update the FISH-BUILD-VERSION-FILE if the
contents have changed, to avoid spurious rebuilding dependencies of
FISH-BUILD-VERSION-FILE. Assuming the git version hasn't changed, the script
will run, but not update FISH-BUILD-VERSION-FILE, and therefore
fish_version.o will not have to be rebuilt.
This might normally rebuild more than is necessary even if the timestamp is
not updated, because ninja computes the dependency chain ahead of time. But
Ninja also supports the 'restat' option for just this case, and CMake is rad
and exposes this via BYPRODUCTS. So mark FISH-BUILD-VERSION-FILE as a
byproduct and make the script always update a dummy file
(fish-build-version-witness.txt). Note this is the use case for which
BYPRODUCTS is designed.
We also have fish_version.cpp #include "FISH-BUILD-VERSION-FILE", and do a
semi-silly thing and make FISH-BUILD-VERSION-FILE valid C++ (so there's just
one version file). This means we have to filter out the quotes in other
cases..
This reverts commit 25839b8c36.
This was an attempt to simplify the version generation, but it
computed the version at build sytem generation time rather than
at build time, requiring another run of CMake to update it.
Correctly generate FISH_BUILD_VERSION for use in fish_version.h/cpp and
fish.pc to allow `fish --version` and `echo $version` to work again.
Not needing the same convoluted measures used by Makefile builds to
prevent the regeneration of the fish version file when it hasn't
changed.
Purposely created a new `cmake_git_version_gen.sh` file so that the old
`git_version_gen.sh` remains compatible with the existing Makefile build
script. Same reason why `fish.pc.in` was not modified to use a lowercase
variable name to match the CMAKE variable of the same name.
Closes#4626