-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[curses] New meta port #22093
[curses] New meta port #22093
Conversation
NB: Windows static triplets available for CI test after merging #22092. |
what about making ports depending on pdcurses/ncurses depending on this one, instead? |
@@ -0,0 +1,20 @@ | |||
if(NOT DEFINED CURSES_NEED_NCURSES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should generate this file with the selection here rather than trying to derive it; I'm concerned that this form makes it path dependent since the supports for this port and the dependencies don't match exactly. Does that seem reasonable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generating from portfile is a reasonable request. However this introduces redundancy in implementing the platform condition. This is one reason why I didn't start with that complexity.
(The only way to carry variable dependency information to the portfile is through features. The ideal solution would be attaching platform expressions to members of the default-features
array...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is unfortunate that it introduces redundancy; however, I'm worried about a case like:
-
A depends on curses
-
B depends on curses
-
The end user wants a program that links with A and B
-
vcpkg install pdcurses
-
vcpkg install A
(which installscurses
as a dependency, A was built withpdcurses
) -
vcpkg install ncurses
-
vcpkg install B
(whoops, now B was built withncurses
because that's what this wrapper prefers) -
End user program is doomed because the different curses provide different features and/or expect to track information about the console in different globals, etc.
If there is some reason that pdcurses
and ncurses
can never be installed at the same time, and thus this kind of phantom switch triggered by vcpkg install ncurses
can't happen, then we can avoid that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(NOT DEFINED CURSES_NEED_NCURSES) | |
if("@CURSES_BACKEND@" STREQUAL "ncurses") | |
... | |
elseif("@CURSES_BACKEND@" STREQUAL "pdcurses") | |
... | |
else() | |
message(FATAL_ERROR "Unknown backend: '@CURSES_BACKEND@'") | |
endif() |
Thanks for fixing this! |
This is left as a separate exercise. Since depending ports can't rely on a simple |
For the record: ncurses documentation proposes This port changes that behaviour if |
Fair enough. :) What do you think about the phantom dependency switch concern I discussed in the review comment earlier? |
The phantom dependency switching is a general problem, isn't it? It is also what happens with unguarded discovery like
Normally, we need to turn this unguarded discovery into explicit control. With the curses wrapper, I see two layers of this problem: It must do nothing if there is no explicit dependency on The only way I see to handle this situation here is using |
It's a more general problem if things end up getting selected from the system but not generally if someone stays within the catalog right now.
I don't understand why there would need to be a |
Wait, now I'm confused. Is the entire purpose of this port not to make that work? |
It is a problem within the catalog: if a port build randomly picks a dependency already installed at build time, but doesn't make it part of its ABI hash and doesn't forward the usage requirements. In the best case, it explodes right at consuming the port in a build. In the worst case, it explodes randomly at run-time.
For now this should work. |
@@ -0,0 +1,20 @@ | |||
if(NOT DEFINED CURSES_NEED_NCURSES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(NOT DEFINED CURSES_NEED_NCURSES) | |
if("@CURSES_BACKEND@" STREQUAL "ncurses") | |
... | |
elseif("@CURSES_BACKEND@" STREQUAL "pdcurses") | |
... | |
else() | |
message(FATAL_ERROR "Unknown backend: '@CURSES_BACKEND@'") | |
endif() |
ports/curses/portfile.cmake
Outdated
@@ -0,0 +1,3 @@ | |||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) | |||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | |
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) | |
set(CURSES_BACKEND "pdcurses") | |
else() | |
set(CURSES_BACKEND "ncurses") | |
endif() | |
configure_file( | |
"${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" | |
"${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" | |
@ONLY | |
) |
I understand you don't want to re-write the logic, but I think that doing this in the build is necessary.
Updated. I tried to find some test ports, but as expected, vcpkg's focus on libs doesn't help. |
If someone can't be expected to just say they need curses and be able to not care then I'm not sure what this change is doing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have modified or added at least one vcpkg.json where a "license" field is missing.
If you feel able to do so, please consider adding a "license" field to the following files:
ports/curses/vcpkg.json
scripts/test_ports/cmake-user/vcpkg.json
Valid values for the license field can be found in the documentation
The reason I'm still in 'waiting' state here is that as far as I understand it there's still no practical use of this metaport, because every consumer described still needs to have the check for which particular curses that they got. Put another way, what would a consumer of this metaport look like? Note that the "customer" doesn't need to be a port :) |
The requested configuration bit I asked for is fixed so I'm dropping 'request changes' status but I want the consumer question answered first.
Ping @dg0yt for response. And could you please resolve the conflicts? |
Closing this PR since it seems that no progress is being made. Please reopen if work is still being done. |
What does your PR fix?
This PR adds a curses meta-port. It pulls in a suitable implementation (pdcurses, ncurses) and makes it available via
find_package(Curses)
.Relates issues: How do I use PDCurses after having installed it? #11027, [ncurses] fix windows/uwp port #20828, [ncurses] Add new port #17226 (comment)
Which triplets are supported/not supported? Have you updated the CI baseline?
!uwp
, noDoes your PR follow the maintainer guide?
yes
If you have added/updated a port: Have you run
./vcpkg x-add-version --all
and committed the result?yes