-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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/build_make] Fix variable setup #26108
base: master
Are you sure you want to change the base?
Conversation
CC @Neumann-A I already knew the make options issue. With port x264 (which is not using autotools), I really need to have consistent behaviour if I want to be able improve cross build support. |
@@ -409,6 +405,12 @@ function(vcpkg_configure_make) | |||
endif() | |||
endif() | |||
|
|||
# Explicit environment variable setup | |||
foreach(_env IN LISTS arg_CONFIGURE_ENVIRONMENT_VARIABLES) |
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.
Note to other reviewer: moved these code out of VCPKG_TARGET_IS_WINDOWS
.
If anyone does not object to this change, I will mark the reviewed tag later today. |
Creating the environment string should probably be moved into its own function. But i don't object the movement just make sure the other make PR gets merged around the same time to minimize world rebuilds. |
I found that there is still more Windows-only behaviour going on in with I want to go one step back and fully understand the current intention of AFAIU it is related to the following:
Unfortunately, this is quite inconsistent, depending on whether target and/or host are windows. Example: Targeting Current
|
ENV{AS} in |
Target: | android | windows | mingw | mingw | linux |
---|---|---|---|---|---|---|
Host: | windows | windows | mingw | linux | linux | |
unset | ENV{AS} out: |
unset | : |
: |
: |
unset |
set | ENV{AS} out: |
ENV{AS} |
ENV{AS} |
ENV{AS} |
: 🟥 |
ENV{AS} |
🟥 Problem: ENV{AS}
still uses the default :
for mingw cross builds.
Current master
, with CONFIGURE_ENVIRONMENT_VARIABLES AS
:
ENV{AS} in |
Target: | android | windows | mingw | mingw | linux |
---|---|---|---|---|---|---|
Host: | windows | windows | mingw | linux | linux | |
unset | ENV{AS} out: |
unset | AS |
AS |
AS |
unset |
set | ENV{AS} out: |
ENV{AS} |
ENV{AS} |
ENV{AS} |
AS 🟥 |
ENV{AS} |
🟥 Problem: ENV{AS}
still defined by AS
for mingw cross builds.
A consistent pattern
I assuming that for setting well-known autotools variables in vcpkg_configure_make
, we have to deal with default values, overrides from a portfile, and overrides from a (custom) triplet. A possible consistent pattern is:
- The default values for setting a well-known environment variable
ENV{<VAR>}
is derived from the CMake toolchain, if needed. - An alternative value can be set from the portfile by setting CMake variable
<VAR>
and passingCONFIGURE_ENVIRONMENT_VARIABLES <VAR>
. - An alternative to default values and portfile values can be set from the triplet via
ENV{<VAR>}
.
Changes
a. Don't override ENV{<VAR>}
for windows (mingw) targets on non-windows hosts (:red_square:).
(Required for no. 3. Basically, we can savely assume that if ENV{<VAR>}
is meant to be used if it is already set.)
b. Implement CONFIGURE_ENVIRONMENT_VARIABLES
also for other targets than Windows (this PR, but incomplete without a.).
(Required for no. 2. Current workaround is to override ENV{<VAR>
in the portfile, but this may override triplet settings.)
c. Depending on on what is "needed", set the well-known autotools variables also for other triplets than windows.
(Required for consistency with regard to no. 1. However, we currently do very well without it, and it may come with side effects. For example, x264
can't handle a CC
with space in the path.)
d. The current implementation may inject a variable twice into the bash command line (for the default and for CONFIGURE_ENVIRONMENT_VARIABLES
). IMO this should be merged.
e. Why do we have to inject the variables into the bash command line at all? I would suggest to just set ENV{<VAR>}
directly. If we are concerned about side effects on other CMake code, we may clear what we set before leaving.
f. Update ENV{PATH}
for all platforms, maybe limited to tools which have space characters in the file path.
Ping @dg0yt for response. Is work still being done for this PR? |
I wrote on long text on existing problems and possible directions. I'm still waiting for feedback. |
So I stumble over this again now. If it is not possible to get feedback, I have to change my approach. |
I think you aren't getting feedback because this is marked as "draft" which makes it not show up on any lists we look at except the "close really old draft PRs" one. |
(And also because this touches a bunch of autotools edge cases for which there is very little understanding among vcpkg's maintainers; as you point out with your tables above a lot of this is 'build and fix until it works' rather than careful design) |
A) It is not ready for merge, and ATM I don't ask for a review of the implementation. But if needed, I can mark it "Ready for review". (I also have ready-for-review PRs which are stuck in review, #26754.) B) ATM the issue is not an edge-case autotools particularity but a genuine vcpkg script question: |
that probably should be a
that is a requirement since most stuff cannot handle spaces at all.
that was required because from testing in seemed like The real problem is the amount of different make file buildsystem:
So my advice here is just make it consistent with the smallest change set possible ;) The whole make system needs a general overhaul and be moved into a helper port any way. The env setup needs to be moved into its own little function so that it can be reused more often for other stuff. |
What does your PR fix?
Fixes difficulties to set (environement) variables and make variables.
vcpkg_configure/build_make
: ExtendCONFIGURE_ENVIRONMENT_VARIABLES
setup from windows targets to all platforms. (Documentation mentions no restrictions.)vcpkg_build_make
: FixOPTIONS
for non-windows hosts. Drop invalidMAKE_OPTIONS
.Which triplets are supported/not supported? Have you updated the CI baseline?
unchanged, no
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?not needed