From 527b0178fe31b786c3ba5ba406796ee6c63c19b8 Mon Sep 17 00:00:00 2001 From: jheaff1 Date: Thu, 8 Jun 2023 12:57:49 +0100 Subject: [PATCH] Get meson examples working with bzlmod 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 --- MODULE.bazel | 3 +++ examples/MODULE.bazel | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/MODULE.bazel b/MODULE.bazel index c0e42b0a6..cbe635e0c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,6 +16,7 @@ use_repo( "cmake_3.23.2_toolchains", "cmake_src", "gnumake_src", + "meson_src", "ninja_1.11.1_toolchains", "ninja_build_src", "pkgconfig_src", @@ -31,6 +32,8 @@ register_toolchains( "@rules_foreign_cc_framework_toolchain_macos//:toolchain", "@rules_foreign_cc_framework_toolchain_windows//:toolchain", "@rules_foreign_cc//toolchains:built_make_toolchain", + "@rules_foreign_cc//toolchains:built_meson_toolchain", + "@rules_foreign_cc//toolchains:built_pkgconfig_toolchain", "@rules_foreign_cc//toolchains:preinstalled_autoconf_toolchain", "@rules_foreign_cc//toolchains:preinstalled_automake_toolchain", "@rules_foreign_cc//toolchains:preinstalled_m4_toolchain", diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel index c6e14e7e3..51d4f1c9c 100644 --- a/examples/MODULE.bazel +++ b/examples/MODULE.bazel @@ -7,11 +7,44 @@ local_path_override( tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools") tools.cmake(version = "3.23.1") tools.ninja(version = "1.11.1") +use_repo( + tools, + "meson_src", +) bazel_dep(name = "platforms", version = "0.0.6") bazel_dep(name = "rules_swift", version = "1.6.0", repo_name = "build_bazel_rules_swift") bazel_dep(name = "rules_apple", version = "2.1.0", repo_name = "build_bazel_rules_apple") bazel_dep(name = "apple_support", version = "1.4.1", repo_name = "build_bazel_apple_support") +bazel_dep(name = "rules_python", version = "0.22.0") + +python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python.toolchain( + name = "python3_9", + python_version = "3.9", +) +use_repo(python, "python3_9") +use_repo(python, "python3_9_toolchains") + +register_toolchains( + "@python3_9_toolchains//:all", +) + +interpreter = use_extension("@rules_python//python/extensions:interpreter.bzl", "interpreter") +interpreter.install( + name = "interpreter_python3_9", + python_name = "python3_9", +) +use_repo(interpreter, "interpreter_python3_9") + +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip") +pip.parse( + name = "pip", + python_interpreter_target = "@interpreter_python3_9//:python", + requirements_lock = "//:requirements_lock.txt", + requirements_windows = "//:requirements_windows.txt", +) +use_repo(pip, "pip") # bazel_dep(name = "rules_android", version = "0.1.1") # bazel_dep(name = "rules_jvm_external", version = "5.1")