-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add zstd-jni 1.5.2-3.bcr.1 to support Windows (#812)
* Add 1.5.2-3.bcr.1 to support Windows * Fix integrity value
- Loading branch information
1 parent
bf4579c
commit 2ce0884
Showing
7 changed files
with
135 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module( | ||
name = "zstd-jni", | ||
version = "1.5.2-3.bcr.1", | ||
compatibility_level = 1, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) { |
85 changes: 85 additions & 0 deletions
85
modules/zstd-jni/1.5.2-3.bcr.1/patches/add_build_file.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
+ ], | ||
+) |
8 changes: 8 additions & 0 deletions
8
modules/zstd-jni/1.5.2-3.bcr.1/patches/module_dot_bazel.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
+) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
matrix: | ||
platform: | ||
- centos7 | ||
- debian10 | ||
- ubuntu2004 | ||
- macos | ||
- windows | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
build_targets: | ||
- '@zstd-jni//...' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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": {} | ||
} |