Skip to content

Commit b888613

Browse files
authored
Merge branch 'main' into meson-ldflags
2 parents c991b44 + 66b9b32 commit b888613

File tree

11 files changed

+504
-15
lines changed

11 files changed

+504
-15
lines changed

.github/workflows/release_prep.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ TAG=${GITHUB_REF_NAME}
88
# The prefix is chosen to match what GitHub generates for source archives
99
PREFIX="rules_foreign_cc-${TAG}"
1010
ARCHIVE="rules_foreign_cc-$TAG.tar.gz"
11-
git archive --format=tar --prefix="${PREFIX}"/ "${TAG}" | gzip > "$ARCHIVE"
11+
git archive --format=tar --prefix="${PREFIX}"/ "${TAG}" | gzip >"$ARCHIVE"
1212
SHA="$(shasum -a 256 "$ARCHIVE" | awk '{print $1}')"
1313

14-
cat << EOF
14+
cat <<EOF
1515
## Using Bzlmod
1616
1717
1. Enable with \`common --enable_bzlmod\` in \`.bazelrc\`.
@@ -55,6 +55,10 @@ load("@rules_python//python:repositories.bzl", "py_repositories")
5555
5656
py_repositories()
5757
58+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
59+
60+
protobuf_deps()
61+
5862
EOF
5963

6064
# TODO: add example of how to configure for bzlmod

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,23 @@ use_repo(python, "python_3_12")
2626
tools = use_extension("@rules_foreign_cc//foreign_cc:extensions.bzl", "tools")
2727
use_repo(
2828
tools,
29-
"cmake_3.31.7_toolchains",
29+
"cmake_3.31.8_toolchains",
3030
"cmake_src",
3131
"gettext_runtime",
3232
"glib_dev",
3333
"glib_src",
3434
"gnumake_src",
3535
"meson_src",
36-
"ninja_1.12.1_toolchains",
36+
"ninja_1.13.0_toolchains",
3737
"ninja_build_src",
3838
"pkgconfig_src",
3939
"rules_foreign_cc_framework_toolchains",
4040
)
4141

4242
register_toolchains(
4343
"@rules_foreign_cc_framework_toolchains//:all",
44-
"@cmake_3.31.7_toolchains//:all",
45-
"@ninja_1.12.1_toolchains//:all",
44+
"@cmake_3.31.8_toolchains//:all",
45+
"@ninja_1.13.0_toolchains//:all",
4646
"@python_3_12//:all",
4747
"@rules_foreign_cc//toolchains:all",
4848
)

foreign_cc/built_tools/make_build.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ def _make_tool_impl(ctx):
8181
if os_name(ctx) == "macos":
8282
non_sysroot_ldflags += ["-undefined", "error"]
8383

84+
# On macOS, remove "-lm".
85+
# During compilation, the ./configure script disables USE_SYSTEM_GLOB,
86+
# and chooses its own glob implementation (lib/glob.h, lib/glob.c).
87+
# all source files in lib/* are compiled to ./lib/libgnu.a
88+
# However, at link time, "-lm" appears before "-lgnu".
89+
# This linker commandline is like this: LINKER ... -lm -L./lib -o xxx ... -lgnu
90+
# So the system glob is linked instead, causing ABI conflicts.
91+
non_sysroot_ldflags = [x for x in non_sysroot_ldflags if x != "-lm"]
92+
8493
configure_options = [
8594
"--without-guile",
8695
"--with-guile=no",

foreign_cc/extensions.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ load("@bazel_features//:features.bzl", "bazel_features")
44
load("//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
55
load("//toolchains:prebuilt_toolchains.bzl", "prebuilt_toolchains")
66

7-
_DEFAULT_CMAKE_VERSION = "3.31.7"
8-
_DEFAULT_NINJA_VERSION = "1.12.1"
7+
_DEFAULT_CMAKE_VERSION = "3.31.8"
8+
_DEFAULT_NINJA_VERSION = "1.13.0"
99

1010
cmake_toolchain_version = tag_class(attrs = {
1111
"version": attr.string(doc = "The cmake version", default = _DEFAULT_CMAKE_VERSION),

foreign_cc/private/framework/toolchains/macos_commands.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def replace_symlink(file):
261261
# as `readlink` is.
262262
return """\
263263
if [[ -L "{file}" ]]; then
264-
target="$(python3 -c "import os; print(os.path.realpath('{file}'))")"
264+
target="$(realpath '{file}')"
265265
rm "{file}" && cp -a "${{target}}" "{file}"
266266
fi
267267
""".format(file = file)

foreign_cc/repositories.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ load("//toolchains:toolchains.bzl", "built_toolchains", "prebuilt_toolchains", "
99
def rules_foreign_cc_dependencies(
1010
native_tools_toolchains = [],
1111
register_default_tools = True,
12-
cmake_version = "3.31.7",
12+
cmake_version = "3.31.8",
1313
make_version = "4.4.1",
14-
ninja_version = "1.12.1",
14+
ninja_version = "1.13.0",
1515
meson_version = "1.5.1",
1616
pkgconfig_version = "0.29.2",
1717
register_preinstalled_tools = True,

toolchains/built_toolchains.bzl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ def _ninja_toolchain(version, register_toolchains):
131131
native.register_toolchains(
132132
"@rules_foreign_cc//toolchains:built_ninja_toolchain",
133133
)
134+
if version == "1.13.0":
135+
maybe(
136+
http_archive,
137+
name = "ninja_build_src",
138+
build_file_content = _ALL_CONTENT,
139+
integrity = "sha256-8IZB0ACZqeQNROwBRvhBxHKuWLfm3VF77jlFz9kjzt8=",
140+
strip_prefix = "ninja-1.13.0",
141+
urls = [
142+
"https://mirror.bazel.build/github.com/ninja-build/ninja/archive/v1.13.0.tar.gz",
143+
"https://github.com/ninja-build/ninja/archive/v1.13.0.tar.gz",
144+
],
145+
)
146+
return
134147
if version == "1.12.1":
135148
maybe(
136149
http_archive,

toolchains/cmake_versions.bzl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,13 @@ CMAKE_SRCS = {
629629
"cmake-3.30.8",
630630
"10434223a40531b4d6bd77f8ffc471f1714029f4e6d2c83c499187a940276720",
631631
],
632+
"3.30.9": [
633+
[
634+
"https://github.com/Kitware/CMake/releases/download/v3.30.9/cmake-3.30.9.tar.gz",
635+
],
636+
"cmake-3.30.9",
637+
"65f765bb87c8019316cabe67cbe5e8f45ede334eeb5afd161ca6874d17994e0d",
638+
],
632639
"3.31.0": [
633640
[
634641
"https://github.com/Kitware/CMake/releases/download/v3.31.0/cmake-3.31.0.tar.gz",
@@ -685,6 +692,13 @@ CMAKE_SRCS = {
685692
"cmake-3.31.7",
686693
"a6d2eb1ebeb99130dfe63ef5a340c3fdb11431cce3d7ca148524c125924cea68",
687694
],
695+
"3.31.8": [
696+
[
697+
"https://github.com/Kitware/CMake/releases/download/v3.31.8/cmake-3.31.8.tar.gz",
698+
],
699+
"cmake-3.31.8",
700+
"e3cde3ca83dc2d3212105326b8f1b565116be808394384007e7ef1c253af6caa",
701+
],
688702
"4.0.0": [
689703
[
690704
"https://github.com/Kitware/CMake/releases/download/v4.0.0/cmake-4.0.0.tar.gz",
@@ -706,4 +720,11 @@ CMAKE_SRCS = {
706720
"cmake-4.0.2",
707721
"1c3a82c8ca7cf12e0b17178f9d0c32f7ac773bd5651a98fcfd80fbf4977f8d48",
708722
],
723+
"4.0.3": [
724+
[
725+
"https://github.com/Kitware/CMake/releases/download/v4.0.3/cmake-4.0.3.tar.gz",
726+
],
727+
"cmake-4.0.3",
728+
"8d3537b7b7732660ea247398f166be892fe6131d63cc291944b45b91279f3ffb",
729+
],
709730
}

0 commit comments

Comments
 (0)