Commit graph

285 commits

Author SHA1 Message Date
Peter Ammon
0e474768f4
Set macOS version minimums when building
Allows running on older versions of macOS.
2024-10-06 14:39:04 -07:00
Peter Ammon
521498143a
Fix the static PCRE2 build harder
Commit 4e79ec5f tried to restore the static PCRE2 build after the update to the
pcre2 crate, but it set an environment variable at configure time, not build
time.

Properly set the environment variable at build time.
2024-10-05 20:22:55 -07:00
Peter Ammon
4e79ec5f0e
CMake: Restore static PCRE2 builds
The recent update to the rust-pcre2 crate lost the property where a static
PCRE2 build could be enabled with a Cargo feature. This means that static
PCRE2 builds can no longer be forced.

Switch to setting the "PCRE2_SYS_STATIC" variable again, which is how the
official rust-pcre2 crate expects to work.
2024-09-29 19:42:48 -07:00
Johannes Altmanninger
9eeed5ca12 Install fish-* man pages in default MANPATH
fish adds ~/.local/share/fish/man to its MANPATH for builtins etc.  But pages
like fish-doc are unambiguous so it seems like they should be accessible
from outside fish by default.

Closes #10711
2024-09-14 07:21:18 +02:00
Johannes Altmanninger
4df0adefc8 Update docker files and cirrus config
- Ubuntu focal is the lowest LTS release that we can support with only
  distro packages (e.g. no rustup).
- Remove tsan from Cirrus (it's not working currently, and also not really
  important).
- Remove Centos (it passes tests but I'm not sure it's worth adding; there
  isn't even an official docker image for CentOS Stream).
2024-08-05 10:41:17 +02:00
Johannes Altmanninger
f033bccd3c Move fish build dir canonicalization into build.rs, to lower CMake version 2024-08-05 10:41:17 +02:00
Johannes Altmanninger
f71233ae02 Remove a CMake 3.19 construct
CONFIG supports multiple arguments only as of CMake 3.19, see
https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#configuration-expressions

Ubuntu focal ships with 3.16 by default, so enable building with that.
Note that there is also the workaround of installing "cmake-mozilla".
2024-08-05 10:41:17 +02:00
Peter Ammon
9edd0cf8ee
Remove some now unused CMake bits 2024-07-07 16:06:45 -07:00
Peter Ammon
925382dc3e
Make make_pkg.sh create fat binaries again on macOS 2024-07-07 14:53:17 -07:00
Peter Ammon
c90862cd3d
Remove legacy Mac.cmake 2024-07-07 12:25:47 -07:00
Mahmoud Al-Qudsi
298cdb0c5b Always pass --target to cargo test when CMake Rust_CARGO_TARGET is set
The CMake `cargo test` integration was broken if Rust_CARGO_TARGET were used
with `CARGO_FLAGS` set to `-Zbuild-std` (e.g. to target i586 under i686 without
the i586 toolchain installed).
2024-06-21 12:00:10 -05:00
ridiculousfish
585dac6b08 Use cargo test --workspace
Allows running printf tests.
2024-05-26 16:07:27 -04:00
Johannes Altmanninger
8bf8b10f68 Extended & human-friendly keys
See the changelog additions for user-visible changes.

Since we enable/disable terminal protocols whenever we pass terminal ownership,
tests can no longer run in parallel on the same terminal.

For the same reason, readline shortcuts in the gdb REPL will not work anymore.
As a remedy, use gdbserver, or lobby for CSI u support in libreadline.

Add sleep to some tests, otherwise they fall (both in CI and locally).

There are two weird failures on FreeBSD remaining, disable them for now
https://github.com/fish-shell/fish-shell/pull/10359/checks?check_run_id=23330096362

Design and implementation borrows heavily from Kakoune.

In future, we should try to implement more of the kitty progressive
enhancements.

Closes #10359
2024-04-02 14:35:16 +02:00
Fabian Boehm
721a360707 cmake: Remove a bunch of unnecessary code
We are no longer C++, we no longer support xcode

Note: This will remove a warning "DO NOT EDIT" comment from __fish_build_paths.fish, but
that's unnecessary. The file is typically in /usr or another
package-manager-owned location, so people don't typically edit it.

And if it did we don't actually *care*, it'll work fine.
2024-03-03 20:36:24 +01:00
Fabian Boehm
f62f1aaf99 Remove remaining mentions of curses 2024-02-23 16:36:10 +01:00
Fabian Boehm
fc794bab4c Switch to the terminfo crate
This allows us to get the terminfo information without linking against curses.

That means we can get by without a bunch of awkward C-API trickery.

There is no global "cur_term" kept by a library for us that we need to invalidate.

Note that it still requires a "unhashed terminfo database", and I don't know how well it handles termcap.

I am not actually sure if there are systems that *can't* have terminfo, everything I looked at
has the ncurses terminfo available to install at least.
2024-02-22 20:10:16 +01:00
David Adam
2bc197fe74 cmake: add -g to existing RUSTFLAGS if required
Makes it possible to use the sanitizers again.

Note that this requires RUSTFLAGS to be set when running CMake, and will not be
updated when running the build system if the environment variable changes.
2024-02-08 00:28:30 +08:00
David Adam
cb46396b67 cmake: build executables by driving cargo directly
Drops the requirement for Corrosion, as almost none of its extensive features
are required.
2024-01-30 18:18:55 +08:00
David Adam
7d33f6706f Import FindRust from Corrosion 2024-01-30 18:18:55 +08:00
Fabian Boehm
120dc5c49f cmake: Include PushCheckState again
This was included in one file and used in another. Just include it here.
2024-01-21 12:17:33 +01:00
Fabian Boehm
8cf4d666b3 Remove more cmake configurechecks
PCRE2 is now handled by the crate, we don't need WCHAR_T_BITS anymore
2024-01-21 12:01:38 +01:00
Fabian Boehm
e73d7e26e4 Remove some more cmake bits 2024-01-20 09:13:04 +01:00
Fabian Boehm
5aa622daef Remove some more unused cmake bits 2024-01-20 08:56:29 +01:00
Fabian Boehm
cfeddcedb7 Remove unused bits from config.h 2024-01-20 08:56:29 +01:00
ridiculousfish
9747ab19d1 Eliminate UVAR_FILE_SET_MTIME_HACK checks
This was previously limited to Linux predicated on the existence
of certain headers, but Rust just exposes those functions unconditionally. So
remove the check and just perform the mtime hack on Linux and Android.
2024-01-19 09:33:33 -08:00
ridiculousfish
509d4fa122 Remove mbrtowc_invalid_utf8.cpp
This was used in CMake to detect invalid mbrtowc implementations. The only known
case was on SnowLeopard, which is no longer supported. Remove this file.
2024-01-13 15:35:46 -08:00
David Adam
f65ed782e8 Drop unused CMake module CheckIncludeFiles
This was only needed for certain configure checks, now elided, and for
CMake < 3.11.
2024-01-13 22:55:13 +08:00
David Adam
e59d164658 Drop unused configure checks
All of these checks are handled in external crates now.
2024-01-13 21:15:24 +08:00
David Adam
db9bb96910 Drop CMake PCRE2 download/linking and allow statically-linked PCRE2 crate
pcre2-sys includes a vendored copy of PCRE2, which allows for
statically-linked PCRE2. Hook this up to the CMake build variable, and
remove the C++ integration for PCRE2.
2024-01-13 20:43:12 +08:00
Fabian Boehm
507d634cfa Remove widestring-suffix from Cargo 2024-01-13 08:52:54 +01:00
Johannes Altmanninger
5512f44899 Enable doctests
They are probably not terribly useful for us but let's see what happens.

Unfortunately cargo does not properly forward the combination of "RUSTFLAGS"
and "--target" that is currently required to build with ASan [1].  Hence doctests
will fail to link on ASan builds. Let's disable doctests when ASan is active.

[1]: https://github.com/rust-lang/cargo/issues/10666 et al
2024-01-13 03:58:33 +01:00
David Adam
1683e720a8 Use Rust for executables
Use Rust for executables

Drops the C++ entry points and restructures the Rust package into a
library and three binary crates.

Renames the fish-rust package to fish.

At least on Ubuntu, "fish_indent" is built before "fish".
Make sure export CURSES_LIBRARY_LIST to all binaries to make sure
that "cached-curses-libnames" is populated.

Closes #10198
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
2871f5070f CMake: re-enable cargo-test under ASAN
With autocxx/cxx gone, this seems to work fine now.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
2d493621f4 test_cargo-test: use Corrosion target dir
This makes "ninja test" write only to the build directory, not to the source
tree. This enables our docker script which mounts the source as read-only.
2024-01-13 03:07:29 +01:00
Johannes Altmanninger
7686c39d76 test_cargo-test: inherit same variables as Corrosion build targets
In particular, pass the build directory, which is required in some test
scenarios (see next commit).
2024-01-13 03:07:29 +01:00
Fabian Boehm
cb51b236f3 cmake: Include GNUInstallDirs earlier for BINDIR etc to take effect
GNUInstallDirs is what defines CMAKE_INSTALL_FULL_BINDIR and such, so
the setting in Rust.cmake didn't work.

This also makes build.rs error out if any of these aren't defined
2024-01-10 17:51:23 +01:00
Fabian Boehm
2aee930659 Revert "Remove redundantly set corrosion env vars."
This reverts commit 114ebe3b8f.
2024-01-10 17:21:05 +01:00
Johannes Altmanninger
114ebe3b8f Remove redundantly set corrosion env vars.
They should already be set in Rust.cmake.
See https://github.com/fish-shell/fish-shell/pull/10198#discussion_r1446402611
2024-01-10 09:38:45 +01:00
Johannes Altmanninger
29bd6eebd0 Remove cxx and autocxx
Notably this gets rid of the Cargo target directory inside build directories,
in favor of "target/" at workspace root.
2024-01-07 22:19:56 +01:00
Johannes Altmanninger
ab98566c67 Remove fish_tests
The remaining tests are all obsolete or already ported.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
77550a2f0d Turn FFI tests into native Rust tests
Keep running tests serially to avoid breaking assumptions.

I think many of these tests can run in parallel and/or don't need test_init().
Use the safe variant everywhere, to get it done faster.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
b2d4619125 Link against curses in build.rs too
This will allow to use "cargo test" for unit tests that depend on our
curses.rs.

This means that Rust.cmake depends on ConfigureChecks, so move that one to
the front.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
3e3441429a Port wgettext wrapper from wutil.cpp
This introduces a string allocations on lookups of strings that are not
known at compile time; we should get rid of these allocations in future.
2024-01-07 12:12:09 +01:00
Johannes Altmanninger
55fd43d86c Port reader 2024-01-07 00:54:22 +01:00
Johannes Altmanninger
f3dd8d306f Port make_autoclose_pipes, fd_event_signaller_t
This allows to get rid of the C++ autoclose_fd_t.
2023-12-10 14:35:43 +01:00
David Adam
f2f41c6eec drop unused functions and configure checks
Remove the following C++ functions/methods, which have no callers:

common.cpp:
- read_loop
- narrow_string_safe
- escape_string_for_double_quotes
- read_unquoted_escape
- format_size
- format_size_safe
- valid_func_name
- get_executable_path

env.cpp:
- env_stack_t::set_empty
- env_stack_t::set_argv

fallback.cpp:
- fish_mkstemp_cloexec
- flock

proc_util.cpp:
- parse_util_slice_length
- parse_util_argument_is_help

path.cpp:
- path_get_path
- path_as_implicit_cd
- path_apply_working_directory
- path_emit_config_directory_messages
- path_get_data_remoteness
- path_get_config_remoteness
- path_is_valid
- paths_are_same_file

wcstringutil.cpp:
- split_string_tok

wutil.cpp:
- wgetcwd
- wunlink
- wrealpath
- wrename
- file_id_for_path
- fish_wcstoull

Also drop unused configure checks/defines:
- HAVE_FLOCK
2023-11-26 22:35:51 +08:00
ridiculousfish
5e06e80136 Remove angular "partials"
These are no longer used as we are fully on Alpine.js
2023-10-08 12:22:56 -07:00
Fabian Boehm
35baa88334 cmake: Canonicalize binary dir
This would otherwise fail to set $fish_function_path to
share/functions etc if run through a symlink.
2023-09-28 17:34:10 +02:00
Fabian Boehm
d6a6d77429 cmake: Fix SYSCONFDIR and friends 2023-09-06 09:49:24 +02:00
Henrik Hørlück Berg
e4df340f43 Forward CMake configs to Cargo 2023-09-05 11:38:59 +02:00