Commit graph

29 commits

Author SHA1 Message Date
Fabian Boehm
e5d5e00969 Fix missing rename in build.rs 2024-05-13 20:04:08 +02:00
Mahmoud Al-Qudsi
ab68cf1eda Update build.rs formatting a bit 2024-05-13 11:34:07 -05:00
Mahmoud Al-Qudsi
a7bde3921b build.rs: Use rsconf::declare_dependency()
This new feature in rsconf 0.2.0 resolves the compile-time warnings we get under
rustc 1.80+ about unrecognized cfg names by informing cargo of all valid cfg
names/values even when the cfg in question isn't enabled.
2024-05-09 14:22:27 -05:00
Mahmoud Al-Qudsi
2faf1159fa Upgrade to rsconf 0.2.0 2024-05-09 14:20:57 -05:00
Mahmoud Al-Qudsi
2d4e42ee93 Don't use a hardcoded ./build/ path for FISH_BUILD_DIR
We use this fallback value for FISH_BUILD_DIR when `cargo` is not
invoked from `cmake`, but we already have a cargo-defined build
directory and we shouldn't just decide to use $TARGET_MANIFEST_DIR/build
instead.

Tests pass locally!
2024-05-06 19:50:49 -05:00
David Adam
3a98db46bc
build.rs: pick up version file for tarballs from source, not build, directory (#10400) 2024-03-31 00:43:55 -05:00
Fabian Boehm
2a4e776d92 Reimplement git version generation ourselves
This allows us to remove two dependency crates
2024-03-02 10:05:37 +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
Mahmoud Al-Qudsi
cf3d3f6497 Fix incremental compilation of src/libc.c with cargo
src/libc.c changes were not being picked up.
2024-02-01 13:51:04 -06:00
Fabian Boehm
1deb065f59 build.rs: canonicalize CARGO_MANIFEST_DIR
We use this so you can run fish from the build directory and it picks
up its data files.

If this wasn't canonicalized, that would break if you're building with
a $PWD through a symlink.
2024-01-27 20:00:10 +01:00
ridiculousfish
ce19f82c19 Fix some clippy warnings 2024-01-21 19:12:33 -08:00
Mahmoud Al-Qudsi
15a82b462f Remove unnecessary copies in build.rs 2024-01-21 17:20:38 -06:00
Johannes Altmanninger
38397734e2 Fix build on OpenSUSE Tumbleweed
Fix a search & replace gone wrong in 1234c77b1 (Support linking against
reentrant-configured curses, 2024-01-21).
2024-01-21 22:22:30 +01:00
Johannes Altmanninger
1234c77b15 Support linking against reentrant-configured curses
NCurses headers contain this conditional "#define cur_term":

	print  "#elif @cf_cv_enable_reentrant@"
	print  "NCURSES_WRAPPED_VAR(TERMINAL *, cur_term);"
	print  "#define cur_term   NCURSES_PUBLIC_VAR(cur_term())"
	print  "#else"

OpenSUSE Tumbleweed uses this configuration option; For reentrancy, cur_term
is a function.  If the NCurses autoconf variable @NCURSES_WRAP_PREFIX@
is not changed from its default, the function is called _nc_cur_term.

I'm not sure if we have a need to support non-default @NCURSES_WRAP_PREFIX@
but if we do there are various ways;
- search for the symbol with the cur_term suffix
- figure out the prefix based on the local curses installation,
  for example by looking at the header files.

Fixes #10243
2024-01-21 11:26:07 +01:00
Johannes Altmanninger
c52c03b03c Fix clippy warnings 2024-01-20 11:30:13 +01:00
Mahmoud Al-Qudsi
2f30d8f949 Stop caching CURSES_LIBRARY_LIST
Just treat it as if we are building without cmake when it's not present.
2024-01-20 08:56:29 +01:00
Mahmoud Al-Qudsi
66a4beadce Simplify a few things in build.rs 2024-01-20 08:56:29 +01:00
Fabian Boehm
f0af165348 build.rs: Try ncurses if curses couldn't be found
That's gonna be the typical one
2024-01-20 08:56:29 +01:00
Fabian Boehm
a5e35abeba build.rs: Default variables
So we can build without cmake
2024-01-20 08:56:29 +01:00
Johannes Altmanninger
2ffec7463e build.rs: fix formatting 2024-01-19 09:18:02 +01:00
Mahmoud Al-Qudsi
21b4a2e5d6 Simplify rsconf has_symbol() libc lookups 2024-01-18 18:22:07 -06:00
Mahmoud Al-Qudsi
a1147c7c4f Fix outdated build.rs comments 2024-01-18 18:10:47 -06:00
Johannes Altmanninger
10891d2985 build.rs: remove dead code 2024-01-14 13:20:52 +01:00
Mahmoud Al-Qudsi
5233370cda Fix build.rs formatting 2024-01-13 16:04:05 -06:00
Mahmoud Al-Qudsi
33f33c5f41 Simplify (and fix?) build.rs HAVE_XXX detection
Since none of the compiles(xxx) calls are to particularly complex code, we can
just use `rsconf` directly to test for the presence of the symbols or headers as
needed.

Note that it seems at least some of the previous detection was not working
correctly; in particular HAVE_PIPE2 was evaluating to false on my WSL install
where pipe2(2) was available (caught because it revealed some compilation errors
in that conditional compilation path after porting).

I kept the cfg names and the tests themselves mostly as-is, though we might want
to change that to conform with the rust convention of lowercase cfg names and
decide whether we want to prefix all these with have_, fish_, or nothing at all.
Also the posix_spawn() test should probably check for the symbol `posix_spawn()`
rather than the header `spawn.h` since we don't use it via the header but rather
via the symbol (but in reality they're almost certainly going to give the same
result).
2024-01-13 15:45:42 -06:00
Mahmoud Al-Qudsi
6e002b6d80 Use cfg directly instead of going through features
Features should be for user-specifiable build configurations but our dynamic,
target-based conditional compilation is something else.
2024-01-13 15:16:47 -06:00
Mahmoud Al-Qudsi
4f8265db47 Inline the localconv_l test
It's just one line.
2024-01-13 14:58:58 -06:00
Mahmoud Al-Qudsi
30f70f02de Feature-detect localeconv_l() presence 2024-01-13 14:21:14 -06:00
Johannes Altmanninger
3ae20bdba0 Move fish-rust to project root 2024-01-13 03:58:33 +01:00
Renamed from fish-rust/build.rs (Browse further)