-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: turn dynamic lib into static (#8)
* replace dynamic to static lib * add precompiled library * add darwin arm64 * .a files * simplify readme * small fix * add linux arm64 * add readme --------- Co-authored-by: colinlyguo <[email protected]>
- Loading branch information
1 parent
d7bcb62
commit 32bfc9f
Showing
12 changed files
with
41 additions
and
30 deletions.
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 |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
*.exe | ||
*.exe~ | ||
*.dll | ||
*.a | ||
*.so | ||
*.dylib | ||
|
||
|
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
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 |
---|---|---|
@@ -1,20 +1,22 @@ | ||
# da-codec | ||
|
||
Scroll's DA encoding/decoding libraries. | ||
|
||
## Running unit tests | ||
``` | ||
# Prepare dev-container | ||
docker pull scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 --platform linux/amd64 | ||
docker run -it --rm -v "$(PWD):/workspace" -w /workspace scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 | ||
go test -v -race ./... | ||
``` | ||
|
||
# Compile libzstd | ||
cd libzstd && make libzstd && cd .. | ||
mkdir -p /scroll/lib/ | ||
cp -f $(pwd)/libzstd/target/release/libscroll_zstd.so /scroll/lib/ | ||
## FAQ | ||
|
||
# Set the environment variable | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/scroll/lib/ | ||
export CGO_LDFLAGS="-L/scroll/lib/ -Wl,-rpath,/scroll/lib/" | ||
**Q: Why the repo contains `libscroll_zstd*.a` binary files?** | ||
|
||
# Run unit tests | ||
go test -v -race ./... | ||
``` | ||
A: This simplifies package installation with `go get` without the need to perform additional steps for building the `libscroll_zstd*.a`. | ||
|
||
**Q: Which platforms/architectures are supported?** | ||
|
||
A: `linux/amd64`, `linux/arm64`, `darwin/arm64`. Pull requests for other platforms/architectures are accepted. | ||
|
||
**Q: I don't trust `libscroll_zstd*.a` binary files from the repo or these files don't work on my OS/ARCH. How to rebuild them?** | ||
|
||
A: Just run `cd libzstd && make libzstd` if your OS/ARCH is supported. |
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
Binary file not shown.
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,6 @@ | ||
package codecv2 | ||
|
||
/* | ||
#cgo LDFLAGS: ${SRCDIR}/libscroll_zstd_darwin_arm64.a | ||
*/ | ||
import "C" |
Binary file not shown.
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,9 @@ | ||
//go:build !musl | ||
// +build !musl | ||
|
||
package codecv2 | ||
|
||
/* | ||
#cgo LDFLAGS: ${SRCDIR}/libscroll_zstd_linux_amd64.a | ||
*/ | ||
import "C" |
Binary file not shown.
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,9 @@ | ||
//go:build !musl | ||
// +build !musl | ||
|
||
package codecv2 | ||
|
||
/* | ||
#cgo LDFLAGS: ${SRCDIR}/libscroll_zstd_linux_arm64.a | ||
*/ | ||
import "C" |
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
This file was deleted.
Oops, something went wrong.