diff --git a/modules/zstd-jni/1.5.2-3.bcr.1/MODULE.bazel b/modules/zstd-jni/1.5.2-3.bcr.1/MODULE.bazel new file mode 100644 index 00000000000..417565e73d6 --- /dev/null +++ b/modules/zstd-jni/1.5.2-3.bcr.1/MODULE.bazel @@ -0,0 +1,5 @@ +module( + name = "zstd-jni", + version = "1.5.2-3.bcr.1", + compatibility_level = 1, +) diff --git a/modules/zstd-jni/1.5.2-3.bcr.1/patches/Native.java.patch b/modules/zstd-jni/1.5.2-3.bcr.1/patches/Native.java.patch new file mode 100644 index 00000000000..4990d14a728 --- /dev/null +++ b/modules/zstd-jni/1.5.2-3.bcr.1/patches/Native.java.patch @@ -0,0 +1,11 @@ +--- a/src/main/java/com/github/luben/zstd/util/Native.java ++++ b/src/main/java/com/github/luben/zstd/util/Native.java +@@ -59,7 +59,7 @@ public enum Native { + if (loaded) { + return; + } +- String resourceName = resourceName(); ++ String resourceName = "/libzstd-jni.so"; + + String overridePath = System.getProperty(nativePathOverride); + if (overridePath != null) { diff --git a/modules/zstd-jni/1.5.2-3.bcr.1/patches/add_build_file.patch b/modules/zstd-jni/1.5.2-3.bcr.1/patches/add_build_file.patch new file mode 100644 index 00000000000..3b638e421dd --- /dev/null +++ b/modules/zstd-jni/1.5.2-3.bcr.1/patches/add_build_file.patch @@ -0,0 +1,85 @@ +--- /dev/null ++++ a/BUILD.bazel +@@ -0,0 +1,82 @@ ++genrule( ++ name = "copy_link_jni_md_header", ++ srcs = select({ ++ "@bazel_tools//src/conditions:darwin": ["@bazel_tools//tools/jdk:jni_md_header-darwin"], ++ "@bazel_tools//src/conditions:freebsd": ["@bazel_tools//tools/jdk:jni_md_header-freebsd"], ++ "@bazel_tools//src/conditions:openbsd": ["@bazel_tools//tools/jdk:jni_md_header-openbsd"], ++ "@bazel_tools//src/conditions:windows": ["@bazel_tools//tools/jdk:jni_md_header-windows"], ++ "//conditions:default": ["@bazel_tools//tools/jdk:jni_md_header-linux"], ++ }), ++ outs = ["jni_md.h"], ++ cmd = "cp -f $< $@", ++) ++ ++genrule( ++ name = "copy_link_jni_header", ++ srcs = ["@bazel_tools//tools/jdk:jni_header"], ++ outs = ["jni.h"], ++ cmd = "cp -f $< $@", ++) ++ ++cc_binary( ++ name = "libzstd-jni.so", ++ srcs = glob([ ++ "src/main/native/**/*.c", ++ "src/main/native/**/*.h", ++ ]) + [ ++ ":jni_md.h", ++ ":jni.h", ++ ] + select({ ++ "@bazel_tools//src/conditions:windows": [], ++ "//conditions:default": glob(["src/main/native/**/*.S"]), ++ }), ++ copts = select({ ++ "@bazel_tools//src/conditions:windows": [], ++ "@bazel_tools//src/conditions:darwin": [ ++ "-std=c99", ++ "-Wno-unused-variable", ++ "-Wno-sometimes-uninitialized", ++ ], ++ "//conditions:default": [ ++ "-std=c99", ++ "-Wno-unused-variable", ++ "-Wno-maybe-uninitialized", ++ "-Wno-sometimes-uninitialized", ++ ] ++ }), ++ linkshared = 1, ++ includes = [ ++ ".", # For jni headers. ++ "src/main/native", ++ "src/main/native/common", ++ ], ++ local_defines = [ ++ "ZSTD_LEGACY_SUPPORT=4", ++ "ZSTD_MULTITHREAD=1", ++ ] + select({ ++ "@bazel_tools//src/conditions:windows": ["_JNI_IMPLEMENTATION_"], ++ "//conditions:default": [], ++ }), ++) ++ ++ ++genrule( ++ name = "version-java", ++ cmd_bash = 'echo "package com.github.luben.zstd.util;\n\npublic class ZstdVersion {\n\tpublic static final String VERSION = \\"$$(cat $<)\\";\n}" > $@', ++ cmd_ps = '$$PSDefaultParameterValues.Remove("*:Encoding"); $$version = (Get-Content $<) -join ""; Set-Content -NoNewline -Path $@ -Value "package com.github.luben.zstd.util;\n\npublic class ZstdVersion {\n\tpublic static final String VERSION = `"$${version}`";\n}\n"', ++ srcs = ["version"], ++ outs = ["ZstdVersion.java"], ++) ++ ++java_library( ++ name = "zstd-jni", ++ srcs = glob([ ++ "src/main/java/**/*.java", ++ ]) + [ ++ ":version-java", ++ ], ++ resources = [":libzstd-jni.so"], ++ visibility = [ ++ "//visibility:public", ++ ], ++) diff --git a/modules/zstd-jni/1.5.2-3.bcr.1/patches/module_dot_bazel.patch b/modules/zstd-jni/1.5.2-3.bcr.1/patches/module_dot_bazel.patch new file mode 100644 index 00000000000..f1a4f9d635a --- /dev/null +++ b/modules/zstd-jni/1.5.2-3.bcr.1/patches/module_dot_bazel.patch @@ -0,0 +1,8 @@ +--- a/MODULE.bazel ++++ a/MODULE.bazel +@@ -0,0 +1,5 @@ ++module( ++ name = "zstd-jni", ++ version = "1.5.2-3.bcr.1", ++ compatibility_level = 1, ++) diff --git a/modules/zstd-jni/1.5.2-3.bcr.1/presubmit.yml b/modules/zstd-jni/1.5.2-3.bcr.1/presubmit.yml new file mode 100644 index 00000000000..f5193e26c51 --- /dev/null +++ b/modules/zstd-jni/1.5.2-3.bcr.1/presubmit.yml @@ -0,0 +1,13 @@ +matrix: + platform: + - centos7 + - debian10 + - ubuntu2004 + - macos + - windows +tasks: + verify_targets: + name: Verify build targets + platform: ${{ platform }} + build_targets: + - '@zstd-jni//...' diff --git a/modules/zstd-jni/1.5.2-3.bcr.1/source.json b/modules/zstd-jni/1.5.2-3.bcr.1/source.json new file mode 100644 index 00000000000..71d1cdb5533 --- /dev/null +++ b/modules/zstd-jni/1.5.2-3.bcr.1/source.json @@ -0,0 +1,11 @@ +{ + "url": "https://github.com/luben/zstd-jni/archive/refs/tags/v1.5.2-3.zip", + "integrity": "sha256-NmAJpDz62jUBXkzECn78S38BfGuN9crD+H0keAJ7IFY=", + "strip_prefix": "zstd-jni-1.5.2-3", + "patches": { + "Native.java.patch": "sha256-HDzZr1BxNacyg+xWvojosR8VgfZdOQ2TDAPW2bCATDs=", + "add_build_file.patch": "sha256-k67/p9wSUWEfSeeLVPabVleF+lH9YLxlog1auvezsts=", + "module_dot_bazel.patch": "sha256-0KGh/q92+gB4AWBFco0+/UkrkRGsZf0QynxMdWvAgPo=" + }, + "patch_strip": 1 +} diff --git a/modules/zstd-jni/metadata.json b/modules/zstd-jni/metadata.json index 36219ca066f..4b2bf878799 100644 --- a/modules/zstd-jni/metadata.json +++ b/modules/zstd-jni/metadata.json @@ -6,7 +6,8 @@ ], "versions": [ "1.5.0-4", - "1.5.2-3" + "1.5.2-3", + "1.5.2-3.bcr.1" ], "yanked_versions": {} }