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 cygwin #11238

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

Support cygwin #11238

wants to merge 15 commits into from

Conversation

Berrysoft
Copy link
Contributor

@Berrysoft Berrysoft commented Mar 7, 2025

Description

This PR adds support for Cygwin & MSYS2.

  • Cygwin wchar_t is UTF-16.
    • wcwidth is replaced by unicode-width. removed.
    • wcrtomb and mbrtowc are replaced by c32rtomb and mbrtoc32.
  • The target is cross-compiled from Windows.
  • There are some bugs on cygwin, so I have to add some workarounds.

Fixes issue #10956, though it has been closed.

Tracking:

TODO:

  • Link libintl correctly
  • Link libpcre2 correctly

Sorry, something went wrong.

@faho faho added the cygwin label Mar 7, 2025
@faho faho added this to the fish 4.1 milestone Mar 7, 2025
@ridiculousfish ridiculousfish self-assigned this Mar 7, 2025
Copy link
Member

@faho faho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine by me, I think @ridiculousfish would like to take a look.

Awesome work, btw

@Berrysoft Berrysoft marked this pull request as ready for review March 16, 2025 11:03
#[cfg(target_os = "cygwin")]
{
// No system wcwidth for UTF-32 on cygwin.
0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be Ambiguous instead of 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are 0 in cygwin. You can see in the following code that it returns 0 for non-spacing characters.

https://github.com/cygwin/cygwin/blob/main/newlib/libc/string/wcwidth.c

We don't use the cygwin wcwidth function because it's UTF-16.

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

Successfully merging this pull request may close these issues.

None yet

5 participants