-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[vcpkg_configure_make] Standardize OPTIONS
list item handling
#19540
Conversation
cc @Neumann-A for review this PR. |
It is still a draft PR. I expected problems, but was too tired to figure out which ports to test. From previous CMake experience I know that dealing with double quotes, single quotes and escaping, cross-platform, can be quite tricky. An alternative could be writing and calling a bash script, and call this script uniformly. One could even look at the script in case of trouble. |
there is another way to pass env variables. E.g. |
Thanks for the incoming review comments, despite the draft state. However it means you may raise issues which I planned to study in the course of the CI run, and adress before review. This PR is about lack of portability, and I can't cover this locally, quickly. libtasn1 turned out to be the only port which already deals with vcpkg/ports/libtasn1/portfile.cmake Lines 21 to 25 in c801072
This fails now. (libtasn1 also has another use case: CFLAGS=... .)
The problem with the above code is that it works for Windows because here arguments are substituted into a single string which is evaluated as a command line by bash. But for non-Windows targets, For more consistency and portability, we need to get completely rid of the branching around In the end, the most portable solution might be to generate a parameterless bash script which handles setting up the environment and calling |
Thanks for this pointer. I will try that for libtasn1 in a separate PR. It is broken for mingw now, so it needs an update anyway. |
Unfortunately this won't work for variables which are already handled by So in libtasn1, For the Windows code path, the parameters are part of a command run in bash, with parameters expanded by bash at runtime. That's how libtasn1 manages to merge the For the non-Windows code path, the parameters are passed directly to configure, without expansion in bash. This eliminates the need for quoting or escaping. But here, there is no way to combine with the values from The question remains: How to combine detected values with additional values, in a portable and clean way? |
Add the additional values to the detected values. Or to be more precise make the additional values the detected values + the normally detected values. |
You mean to make I considered this, too. But I couldn't see a clean and consistent way to do this. All examples I know use the
This doesn't look clean and consistent to me. Did I miss another approach or working example? |
For the record, this is the current situation:
where |
918ca16
to
540eb55
Compare
OPTIONS
list item handling
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.
This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!
PRs must add only one version and must not modify any published versions
When making any changes to a library, the version or port-version in vcpkg.json
or CONTROL
must be modified.
Error: Local changes detected for freexl but no changes to version or port version.
-- Version: 1.0.4#11
-- Old SHA: eb377ce039ce22eaec25f3bf81668c5d77bec086
-- New SHA: c7bbdaf0ed27ec1c61cd4302c976435ccbfb6dbf
-- Did you remember to update the version or port version?
-- Pass `--overwrite-version` to bypass this check.
***No files were updated.***
When building
|
No more results from |
Ping @strega-nil-ms for review again. |
# Conflicts: # versions/p-/python3.json
Since this rebuilds a lot I just merged with master; will merge once build comes back |
/azp run |
Failure before was not related:
|
Azure Pipelines successfully started running 1 pipeline(s). |
Thanks for your help! |
Thanks for merging. Already needed for changes to the next port (libspatialite)... |
foreach(var IN ITEMS _csc_OPTIONS _csc_OPTIONS_RELEASE _csc_OPTIONS_DEBUG) | ||
vcpkg_list(SET tmp) | ||
foreach(element IN LISTS "${var}") | ||
string(REPLACE [["]] [[\"]] element "${element}") | ||
vcpkg_list(APPEND tmp "\"${element}\"") | ||
endforeach() | ||
vcpkg_list(JOIN tmp " " "${var}") | ||
endforeach() |
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.
Thoese codes are not used, can you please double confirm 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.
This code is used. Verified by CI. Verified once more manually by instrumenting the code and building libtasn1.
What does your PR fix?
This PR fixes cross-platform differences in
vcpkg_configure_make
by unifying the way how it invokesconfigure
.Before this PR, the capabilites of passing spaces, quotes or bash variable references (e.g.
$LIBS
) were dependent on the platform:OPTIONS
list itemLIBS=$LIBS -la -lb
$LIBS
)LIBS=-la -lb
LIBS
)LIBS="$LIBS -la -lb"
$LIBS
)--with-a --with-b
With this PR, the capabilites are identical, and for spaces also consistent with
vcpkg_configure_cmake
:OPTIONS
list itemLIBS=$LIBS -la -lb
$LIBS
at the end!LIBS=-la -lb
$LIBS
now.LIBS="$LIBS -la -lb"
--with-a --with-b
Note that "fails" is meant with regard to the particular use case. With this PR, quotes and spaces are generally passed literally.
With the uniform invocation, it was possible to standardize and simplify other code in
vcpkg_configure_make
, such as handling${prefix}
.The PR also removes an unused
EXTRA_QUOTES
variable.A number of
if(EXISTS ...)
test are rectified to use pristine paths (no escaped spaces).Still unchanged: For maximum consistency, the BUILD_TRIPLET parameter should be changed to accept cmake lists, too.
Which triplets are supported/not supported? Have you updated the CI baseline?
all, no
Tested manually on mingw (Windows and Linux hosts).
Does 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