diff --git a/modules/blake3/1.5.1.bcr.1/MODULE.bazel b/modules/blake3/1.5.1.bcr.1/MODULE.bazel new file mode 100644 index 0000000000..89d6b9ab2d --- /dev/null +++ b/modules/blake3/1.5.1.bcr.1/MODULE.bazel @@ -0,0 +1,10 @@ +module( + name = "blake3", + version = "1.5.1.bcr.1", + compatibility_level = 1, +) +bazel_dep(name = "rules_cc", version = "0.0.6") + +# Required only by `--extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows` used in CI. +cc_configure = use_extension("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_configure_extension", dev_dependency = True) +use_repo(cc_configure, "local_config_cc") diff --git a/modules/blake3/1.5.1.bcr.1/patches/add_build_file.patch b/modules/blake3/1.5.1.bcr.1/patches/add_build_file.patch new file mode 100644 index 0000000000..ba8a687fc1 --- /dev/null +++ b/modules/blake3/1.5.1.bcr.1/patches/add_build_file.patch @@ -0,0 +1,69 @@ +--- /dev/null ++++ BUILD.bazel +@@ -0,0 +1,66 @@ ++load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") ++ ++cc_library( ++ name = "blake3", ++ srcs = [ ++ "c/blake3.c", ++ "c/blake3_dispatch.c", ++ "c/blake3_portable.c", ++ ] + select({ ++ "@bazel_tools//src/conditions:linux_x86_64": [ ++ "c/blake3_avx2_x86-64_unix.S", ++ "c/blake3_avx512_x86-64_unix.S", ++ "c/blake3_sse2_x86-64_unix.S", ++ "c/blake3_sse41_x86-64_unix.S", ++ ], ++ "@bazel_tools//src/conditions:linux_aarch64": [ ++ "c/blake3_neon.c", ++ ], ++ "@bazel_tools//src/conditions:windows_x64": [ ++ "c/blake3_avx2_x86-64_windows_msvc.asm", ++ "c/blake3_avx512_x86-64_windows_msvc.asm", ++ "c/blake3_sse2_x86-64_windows_msvc.asm", ++ "c/blake3_sse41_x86-64_windows_msvc.asm", ++ ], ++ "@bazel_tools//src/conditions:windows_arm64": [ ++ "c/blake3_neon.c", ++ ], ++ "@bazel_tools//src/conditions:darwin_arm64": [ ++ "c/blake3_neon.c", ++ ], ++ "//conditions:default": [], ++ }), ++ hdrs = [ ++ "c/blake3.h", ++ "c/blake3_impl.h", ++ ], ++ copts = select({ ++ "@bazel_tools//src/conditions:linux_x86_64": [], ++ "@bazel_tools//src/conditions:linux_aarch64": [ ++ "-DBLAKE3_USE_NEON=1", ++ ], ++ "@bazel_tools//src/conditions:windows_x64": [], ++ "@bazel_tools//src/conditions:windows_arm64": [ ++ "-DBLAKE3_USE_NEON=1", ++ ], ++ "@bazel_tools//src/conditions:darwin_arm64": [ ++ "-DBLAKE3_USE_NEON=1", ++ ], ++ "//conditions:default": [ ++ "-DBLAKE3_NO_SSE2", ++ "-DBLAKE3_NO_SSE41", ++ "-DBLAKE3_NO_AVX2", ++ "-DBLAKE3_NO_AVX512", ++ ], ++ }), ++ includes = ["."], ++ visibility = ["//visibility:public"], ++) ++ ++platform( ++ name = "internal_ci_only_do_not_use_windows_arm64", ++ constraint_values = [ ++ "@@platforms//os:windows", ++ "@@platforms//cpu:arm64", ++ ], ++) diff --git a/modules/blake3/1.5.1.bcr.1/patches/fix_windows_arm_build_pr_389.patch b/modules/blake3/1.5.1.bcr.1/patches/fix_windows_arm_build_pr_389.patch new file mode 100644 index 0000000000..725e6cc4dd --- /dev/null +++ b/modules/blake3/1.5.1.bcr.1/patches/fix_windows_arm_build_pr_389.patch @@ -0,0 +1,46 @@ +commit 0816badf3ada3ec48e712dd4f4cbc2cd60828278 +Author: Javier Blazquez +Date: Sat Apr 6 17:30:49 2024 -0700 + + fix Windows ARM64 build and detect ARM64EC as ARM64 + +diff --git c/blake3_dispatch.c c/blake3_dispatch.c +index af6c3da..c9abc13 100644 +--- c/blake3_dispatch.c ++++ c/blake3_dispatch.c +@@ -4,9 +4,12 @@ + + #include "blake3_impl.h" + +-#if defined(IS_X86) + #if defined(_MSC_VER) + #include ++#endif ++ ++#if defined(IS_X86) ++#if defined(_MSC_VER) + #include + #elif defined(__GNUC__) + #include +diff --git c/blake3_impl.h c/blake3_impl.h +index beab5cf..98611c3 100644 +--- c/blake3_impl.h ++++ c/blake3_impl.h +@@ -28,7 +28,7 @@ enum blake3_flags { + #define INLINE static inline __attribute__((always_inline)) + #endif + +-#if defined(__x86_64__) || defined(_M_X64) ++#if (defined(__x86_64__) || defined(_M_X64)) && !defined(_M_ARM64EC) + #define IS_X86 + #define IS_X86_64 + #endif +@@ -38,7 +38,7 @@ enum blake3_flags { + #define IS_X86_32 + #endif + +-#if defined(__aarch64__) || defined(_M_ARM64) ++#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC) + #define IS_AARCH64 + #endif + diff --git a/modules/blake3/1.5.1.bcr.1/patches/module_dot_bazel.patch b/modules/blake3/1.5.1.bcr.1/patches/module_dot_bazel.patch new file mode 100644 index 0000000000..f80a846cb5 --- /dev/null +++ b/modules/blake3/1.5.1.bcr.1/patches/module_dot_bazel.patch @@ -0,0 +1,13 @@ +--- MODULE.bazel ++++ MODULE.bazel +@@ -0,0 +1,10 @@ ++module( ++ name = "blake3", ++ version = "1.5.1.bcr.1", ++ compatibility_level = 1, ++) ++bazel_dep(name = "rules_cc", version = "0.0.6") ++ ++# Required only by `--extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows` used in CI. ++cc_configure = use_extension("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_configure_extension", dev_dependency = True) ++use_repo(cc_configure, "local_config_cc") diff --git a/modules/blake3/1.5.1.bcr.1/presubmit.yml b/modules/blake3/1.5.1.bcr.1/presubmit.yml new file mode 100644 index 0000000000..e7c9e8d2aa --- /dev/null +++ b/modules/blake3/1.5.1.bcr.1/presubmit.yml @@ -0,0 +1,29 @@ +matrix: + platform: + - centos7 + - debian10 + - fedora39 + - ubuntu2004 + - macos + - macos_arm64 + - windows + bazel: + - 6.x + - 7.x +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + bazel: ${{ bazel }} + build_targets: + - '@blake3//:blake3' + verify_targets_windows_arm: + name: Verify build targets for Windows ARM + platform: windows + bazel: ${{ bazel }} + build_targets: + - '@blake3//:blake3' + build_flags: + - '--incompatible_enable_cc_toolchain_resolution' + - '--platforms=@blake3//:internal_ci_only_do_not_use_windows_arm64' + - '--extra_toolchains=@local_config_cc//:cc-toolchain-arm64_windows' diff --git a/modules/blake3/1.5.1.bcr.1/source.json b/modules/blake3/1.5.1.bcr.1/source.json new file mode 100644 index 0000000000..9ddeb1b3f2 --- /dev/null +++ b/modules/blake3/1.5.1.bcr.1/source.json @@ -0,0 +1,11 @@ +{ + "url": "https://github.com/BLAKE3-team/BLAKE3/archive/refs/tags/1.5.1.tar.gz", + "integrity": "sha256-gizTf3AVLlmFQz0sUMj2suyDqvEaoxvp/nFIapF0Tzc=", + "strip_prefix": "BLAKE3-1.5.1", + "patches": { + "add_build_file.patch": "sha256-BmZOqWOTfHup68uNZXOh2mP+b971CWY3QufbkIe6eEM=", + "module_dot_bazel.patch": "sha256-dKnHpXqvNwW2m7vYxnfWEoBhphBysqbeBxAMVX3b5a0=", + "fix_windows_arm_build_pr_389.patch": "sha256-9G3QDBp5OuyYP7vwPKjqK+uTUZmjhLpKSE7nshz8guc=" + }, + "patch_strip": 0 +} diff --git a/modules/blake3/metadata.json b/modules/blake3/metadata.json index 9b27119b84..d0d47d32e4 100644 --- a/modules/blake3/metadata.json +++ b/modules/blake3/metadata.json @@ -12,7 +12,8 @@ "versions": [ "1.3.3", "1.3.3.bcr.1", - "1.5.1" + "1.5.1", + "1.5.1.bcr.1" ], "yanked_versions": {} }