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

Add meson support #986

Merged
merged 8 commits into from
Jun 9, 2023
Merged

Conversation

jheaff1
Copy link
Collaborator

@jheaff1 jheaff1 commented Nov 26, 2022

This PR adds Meson support to rules_foreign_cc.

This PR depends on #987

This PR is rather large, I tried to make the commits atomic but I can split up the PR into smaller ones if need be.

@jheaff1 jheaff1 force-pushed the add_meson_support_tidy branch 12 times, most recently from 4fead53 to bd7a6a5 Compare November 30, 2022 16:16
@jheaff1 jheaff1 force-pushed the add_meson_support_tidy branch 18 times, most recently from 7d0d4f7 to 52414a8 Compare December 10, 2022 16:23
@inJeans
Copy link

inJeans commented Jun 6, 2023

@rules_foreign_cc_examples_third_party//python:python3_test FAILED in 3 out of 3 in 0.2s

@jheaff1 jheaff1 force-pushed the add_meson_support_tidy branch 5 times, most recently from 70b4498 to 2c1b87f Compare June 8, 2023 12:14
@jheaff1
Copy link
Collaborator Author

jheaff1 commented Jun 8, 2023

Hello everyone. I am sure you are all very busy, but may I request you try and land this pull request? Please? It would be very helpful for me. Please :-)

Because you asked so nicely... :)

@jsharpe CI is now building, could you please re-review?

@jheaff1 jheaff1 force-pushed the add_meson_support_tidy branch from 2c1b87f to 403b4a1 Compare June 8, 2023 13:05
@inJeans
Copy link

inJeans commented Jun 8, 2023

Wowie wowie. Thank you!

Copy link
Member

@jsharpe jsharpe left a comment

Choose a reason for hiding this comment

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

@jheaff1 this is a mammoth effort! Thanks for all the work you've put into this, including all the previous bits that have built up to this in previous PRs that we've already landed!

Just one doc string that needs updating about meson_version but otherwise this LGTM.
A few observations but nothing that needs to block landing this; they can be addressed after this lands.

@@ -39,6 +39,7 @@ configure_make(
"--without-docbook",
"--without-examples",
"--without-tests",
"CFLAGS='-fPIC'",
Copy link
Member

Choose a reason for hiding this comment

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

I don't love that this is required. Does features=["pic"] work for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried features=["pic"] and -fPIC was not added to the compiler command line args :(

examples/third_party/glib/BUILD.libffi.bazel Show resolved Hide resolved
examples/third_party/mesa/BUILD.libdrm.bazel Show resolved Hide resolved
foreign_cc/repositories.bzl Show resolved Hide resolved
foreign_cc/repositories.bzl Outdated Show resolved Hide resolved
foreign_cc/repositories.bzl Show resolved Hide resolved
@jheaff1 jheaff1 force-pushed the add_meson_support_tidy branch 2 times, most recently from 527b017 to 0c8aa89 Compare June 9, 2023 09:43
jheaff1 added 5 commits June 9, 2023 10:45
This commit adds the glib library to the "examples" build. glib requires
pcre2, so pcre and libgit2 (a dependent of pcre) have been
updated/modified
This commit adds mesa to the "examples" build.

This commit also changes the "examples" build to use the hermetic python
toolchain provided by rules_foreign_cc. As such, the python toolchain
built by rules_foreign_cc is no longer used, as it cannot be used in
workspace rules, .e.g pip_parse(). As such, the python2 build has been
removed from the examples as python2 is end-of-life.

Until Bazel 4.2.0, the built-in android toolchain required Python 2. As
such the minimum supported version has been upversioned to 4.2.0.

Note that the BAZEL_VC env var was removed from CI as mesa requires MSVC
2019.
Note that a newer version of pkgconfig than that installed in ubuntu 20
must be used to build libxau, therefore the built_pkgconfig_toolchain is
now registered
@jheaff1 jheaff1 force-pushed the add_meson_support_tidy branch from 0c8aa89 to fcab3af Compare June 9, 2023 09:46
@jheaff1
Copy link
Collaborator Author

jheaff1 commented Jun 9, 2023

@jheaff1 this is a mammoth effort! Thanks for all the work you've put into this, including all the previous bits that have built up to this in previous PRs that we've already landed!

Just one doc string that needs updating about meson_version but otherwise this LGTM. A few observations but nothing that needs to block landing this; they can be addressed after this lands.

Thank you very much. It only took me a year... 🤣. And thanks for your help with reviewing!

@jheaff1 jheaff1 merged commit 3cbd0a9 into bazel-contrib:main Jun 9, 2023
@UebelAndre
Copy link
Collaborator

Awesome work @jheaff1!

@inJeans
Copy link

inJeans commented Jun 9, 2023

Whoop! Thanks!! 🎉

@shixiong-jiang
Copy link

Hello, is meson supported today?
Could you plz add an example under the https://github.com/bazel-contrib/rules_foreign_cc/tree/main/examples?

I plan to use it to compile https://github.com/systemd/systemd
Thanks a lot.

@jjmaestro
Copy link
Contributor

jjmaestro commented Nov 4, 2024

Hello, is meson supported today? Could you plz add an example under the https://github.com/bazel-contrib/rules_foreign_cc/tree/main/examples?

This PR already added a Meson example: glib. Does that help?

@jsharpe
Copy link
Member

jsharpe commented Nov 4, 2024

Mesa is also built using meson: https://github.com/bazel-contrib/rules_foreign_cc/tree/main/examples/third_party/mesa

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

Successfully merging this pull request may close these issues.

9 participants