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

[angle] Update to chromium/5414, improve build system (and future updates) #27444

Merged
merged 14 commits into from
Feb 10, 2023

Conversation

past-due
Copy link
Contributor

  • Update commit to latest on stable chromium/5249 branch
  • Generate angle_commit.h
  • Refactor build system based on WebKit's CMake build system for libANGLE
  • Add maintainer-notes.md

Describe the pull request

Update the angle port (libANGLE) to chromium/5249 (corresponding to the current Chromium Stable release).

(This follows the recommendations in the libANGLE "Choosing an ANGLE branch" guide, matching the current Chromium Stable 106.0.5249.119.)

Also, refactor the build system based on WebKit's CMake build system for libANGLE (including scripts and instructions to ease updating this port in the future).

  • Which triplets are supported/not supported? Have you updated the CI baseline?

    Same triplets as existing

  • 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, waiting to see how CI checks out

github-actions[bot]
github-actions bot previously approved these changes Oct 24, 2022
Copy link

@github-actions github-actions bot left a 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 you should check the license field.

If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/angle/vcpkg.json

Valid values for the license field can be found in the documentation

Comment on lines 1 to 12
# The ANGLE vcpkg port

The ANGLE port's buildsystem is based off of [WebKit's approach](https://github.com/WebKit/WebKit/tree/main/Source/ThirdParty/ANGLE) to converting ANGLE's buildsystem to CMake.

Details:

- `cmake-buildsystem/CMakeLists.txt`
- This is an augmented version of WebKit's [CMakeLists.txt](https://github.com/WebKit/WebKit/blob/main/Source/ThirdParty/ANGLE/CMakeLists.txt), with vcpkg edits and additions.
- `cmake-buildsystem/*.cmake`
- These are configuration files based on [WebKit's approach](https://github.com/WebKit/WebKit/tree/main/Source/ThirdParty/ANGLE), with some minor vcpkg edits (and renaming `PlatformGTK` to `PlatformLinux`)
- `cmake-buildsystem/generated/*.cmake`
- These are generated from the upstream ANGLE .gni files using WebKit's [gni-to-cmake.py](https://github.com/WebKit/WebKit/blob/main/Source/ThirdParty/ANGLE/gni-to-cmake.py) conversion script (see below)
Copy link
Contributor

Choose a reason for hiding this comment

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

considering that port skia and crashpad are already invoking gn and can be used I don't see why we should still use CMake to build angle. The main thing somebody has to find out is how to get from vcpkg-get-cmake-vars to a proper toolchain with the compiler and everything setup.

Copy link
Contributor Author

@past-due past-due Oct 25, 2022

Choose a reason for hiding this comment

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

And support community triplet quirks, and handle a bunch of chromium/standalone-specific stuff and flags, which the existing (and this revised) CMake build system do (or otherwise bypass having to worry about), etc.

In lieu of spending time trying to add support for another build system (with extremely limited port use), I figured this would be a good improvement over the status quo, based on a widely-used CMake build system for the port.

(And updating a long-outdated port, fixing numerous security issues.)

Longer-term, if someone wants to go through the effort and get a gn build setup working for windows, osx, linux, mingw, other community triplets, etc - I will be happy to test. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

(And updating a long-outdated port, fixing numerous security issues.)

The reason it is outdated is because it uses a CMakeLists.txt instead of the upstream buildsystem. Just saying...

Comment on lines +348 to +397
if(TARGET EGL)
set_target_properties(EGL PROPERTIES EXPORT_NAME libEGL)
endif()
if(TARGET GLESv2)
set_target_properties(GLESv2 PROPERTIES EXPORT_NAME libGLESv2)
endif()
set_target_properties(ANGLE PROPERTIES EXPORT_NAME libANGLE)
Copy link
Contributor

Choose a reason for hiding this comment

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

(even though this is the wrong section to comment on)
The OUTPUT_NAME of the libraries are in conflict with glvnd on linux

Copy link
Contributor Author

@past-due past-due Oct 25, 2022

Choose a reason for hiding this comment

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

The port currently exports libGLESv2.dll, libEGL.dll, (etc), that's what the upstream ANGLE setup builds, and that's what other projects are expecting the port to export.

(Example: SDL2)

So there's no change here (unless I'm missing something?), and any such conflict is pre-existing and expected. (ANGLE, by definition, provides an implementation of libGLESv2 and libEGL.)

Copy link
Contributor

Choose a reason for hiding this comment

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

The port currently exports libGLESv2.dll, libEGL.dll, (etc), that's what the upstream ANGLE setup builds, and that's what other projects are expecting the port to export.

I am not talking about windows where those name are in conflict with mesa ;) I just accept angle as superior on windows since it redirects to D3D instead of using SWR. That being said you also want a egl.pc file on windows.

On Linux however you don't want to link the angle implementation. You want to link libglvnd which will redirect to the correct egl/glx/gles vendor implementation on a per window basis. So you need libEGL_angle.so and an ICD manifest for it in the correct folder.

I had enough problems with trying to link against it in #26693

Copy link
Contributor Author

@past-due past-due Oct 25, 2022

Choose a reason for hiding this comment

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

The port currently exports libGLESv2.dll, libEGL.dll, (etc), that's what the upstream ANGLE setup builds, and that's what other projects are expecting the port to export.

I am not talking about windows where those name are in conflict with mesa ;) I just accept angle as superior on windows since it redirects to D3D instead of using SWR. That being said you also want a egl.pc file on windows.

On Linux however you don't want to link the angle implementation. You want to link libglvnd which will redirect to the correct egl/glx/gles vendor implementation on a per window basis. So you need libEGL_angle.so and an ICD manifest for it in the correct folder.

My understanding is that would not match the upstream build system (at least, it’s a change from the current port), but if we want to diverge then contributions are welcome.

I had enough problems with trying to link against it in #26693

I thought Qt6 no longer included ANGLE?

(Reference: https://doc.qt.io/qt-6/opengl-changes-qt6.html )

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought Qt6 no longer included ANGLE?

It doesn't but it still links egl. And if ANGLE is installed with libEGL it will pickup ANGLE from vcpkg instead of using the system version from libglvnd.

FindEGL or FindOpenGL are stupid. They will just search by name.

@JonLiu1993 JonLiu1993 added the category:port-update The issue is with a library, which is requesting update new revision label Oct 25, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 25, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 25, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 25, 2022
@past-due
Copy link
Contributor Author

Could someone please trigger a re-run of the x64_linux CI pass?

Looks like an unrelated failure:

Downloading vcpkg-glibc...
curl: (18) transfer closed with 3386757 bytes remaining to read

@past-due past-due marked this pull request as ready for review October 25, 2022 19:44
JonLiu1993
JonLiu1993 previously approved these changes Oct 31, 2022
@JonLiu1993 JonLiu1993 added the info:reviewed Pull Request changes follow basic guidelines label Oct 31, 2022
@BillyONeal BillyONeal added requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. and removed info:reviewed Pull Request changes follow basic guidelines labels Oct 31, 2022
@BillyONeal
Copy link
Member

I agree being able to use the upstream build system would be better, but IMO this is an improvement over the status quo so I'm inclined to merge it. However, I want to confirm with other maintainers.

@BillyONeal BillyONeal added requires:author-response and removed requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. labels Nov 3, 2022
@BillyONeal
Copy link
Member

@ras0219-msft @JavierMatosD @markle11m @vicroms @AugP @valeriaconde @dan-shaw, and I discussed this today.

I noted that I am happy with this approach.

@ras0219-msft asked that the instructions and scripts (like maintainer-notes.md, convert-angle-to-cmake.sh) be moved outside of the port (for example, to scripts/angle/*).

We are concerned about potential licensing impact of copying this much Angle and WebKit code into vcpkg's repo and would prefer reducing that if possible. For example, running the python script and including a patch file with the edits.

Should we just try to use WebKit's fork directly?

@past-due
Copy link
Contributor Author

past-due commented Nov 4, 2022

@ras0219-msft asked that the instructions and scripts (like maintainer-notes.md, convert-angle-to-cmake.sh) be moved outside of the port (for example, to scripts/angle/*).

Makes sense to me.

We are concerned about potential licensing impact of copying this much Angle and WebKit code into vcpkg's repo and would prefer reducing that if possible. For example, running the python script and including a patch file with the edits.

This is partially why I did not include the gni-to-cmake.py script, but instead referenced it in the maintainer-notes.md. However, I see there's the potential for vcpkg_find_acquire_program(PYTHON3), so this could indeed seemingly be used to generate the files as part of the port.

I can look into fetching certain files from a pinned commit from the WebKit repo, and using those to generate the files under ports/angle/cmake-buildsystem/generated/*.cmake as part of the vcpkg portfile.

A few files needed to be extensively modified (or largely re-written), so I'll evaluate to see which ones offer the easiest path for reductions.

Should we just try to use WebKit's fork directly?

Two issues that come immediately to mind:

  1. I believe WebKit employs a completely different process in regards to selecting the ANGLE commit / branch they are using (and also update cadence), and I think for vcpkg it makes more sense to follow the libANGLE "Choosing an ANGLE branch" guide (matching the current Chromium Stable).
  2. WebKit's fork has their own additional patches applied (which have changed over the years) and isn't really intended for use outside of WebKit

So I'd lean much more towards your first proposal of reducing what needs to be in the vcpkg repo, fetching selected files, running gni-to-cmake.py as part of the port, etc. I think that'll work better and continue to limit how tightly bound it is to all of the other WebKit build system.

github-actions[bot]
github-actions bot previously approved these changes Feb 8, 2023
@JonLiu1993
Copy link
Member

@past-due, could you please fix the conflicting files?, then we can merge this PR, thanks!

Copy link

@github-actions github-actions bot left a 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: checked-in files for angle have changed but the version was not updated
version: chromium_5414
old SHA: 0b94de610273c3ac6a4a8e9aeef0d1176dce1462
new SHA: 4d21d50c6a69b88182c328b4867a27909fa34b01
Did you remember to update the version or port version?
Use --overwrite-version to bypass this check
***No files were updated***

@past-due
Copy link
Contributor Author

@past-due, could you please fix the conflicting files?, then we can merge this PR, thanks!

@JonLiu1993: Done 👍

@JonLiu1993 JonLiu1993 added the info:reviewed Pull Request changes follow basic guidelines label Feb 10, 2023
@JavierMatosD JavierMatosD merged commit 6912441 into microsoft:master Feb 10, 2023
@molesmoke
Copy link

Looks like this now installs the headers to the wrong location? e.g.
include/headers/EGL/eglext_angle.h
should be
include/EGL/eglext_angle.h

However, it seems like the intention of an earlier commit was that the angle headers should be copied to:
include/angle/
Though I note that didn't seem to be working previously anyway...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-update The issue is with a library, which is requesting update new revision info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants