You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2025/12/12 08:47:10 UTC
(opendal) branch xuanwo/ocaml-dylib-link created (now b1c13178c)
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a change to branch xuanwo/ocaml-dylib-link
in repository https://gitbox.apache.org/repos/asf/opendal.git
at b1c13178c ci(bindings/ocaml): Use dyn link instead
This branch includes the following new commits:
new b1c13178c ci(bindings/ocaml): Use dyn link instead
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(opendal) 01/01: ci(bindings/ocaml): Use dyn link instead
Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch xuanwo/ocaml-dylib-link
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit b1c13178cbf690c1986e47333db75b5c26acbbbf
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Fri Dec 12 16:46:42 2025 +0800
ci(bindings/ocaml): Use dyn link instead
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
bindings/ocaml/Cargo.toml | 2 +-
bindings/ocaml/src/dune | 22 ++++++++++++++++++----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/bindings/ocaml/Cargo.toml b/bindings/ocaml/Cargo.toml
index 1b9cdc4fc..82bb8d277 100644
--- a/bindings/ocaml/Cargo.toml
+++ b/bindings/ocaml/Cargo.toml
@@ -27,7 +27,7 @@ repository = "https://github.com/apache/opendal"
rust-version = "1.85"
[lib]
-crate-type = ["staticlib", "cdylib"]
+crate-type = ["cdylib"]
doc = false
[dependencies]
diff --git a/bindings/ocaml/src/dune b/bindings/ocaml/src/dune
index bcd2d45a8..25668961b 100644
--- a/bindings/ocaml/src/dune
+++ b/bindings/ocaml/src/dune
@@ -16,16 +16,24 @@
; under the License.
(rule
- (targets libopendal_core.a dllopendal_core.so)
+ (targets libopendal_core.a dllopendal_core.so libopendal_core.so)
(deps
(glob_files *.rs))
(action
(progn
(run sh -c "cd %{project_root}/../.. && cargo build --release")
(run sh -c
- "mv %{project_root}/../../target/release/libopendal_ocaml.so ./dllopendal_core.so 2> /dev/null || mv %{project_root}/../../target/release/libopendal_ocaml.dylib ./dllopendal_core.so")
- (run mv %{project_root}/../../target/release/libopendal_ocaml.a
- libopendal_core.a))))
+ "if [ -f %{project_root}/../../target/release/libopendal_ocaml.so ]; then \
+ cp %{project_root}/../../target/release/libopendal_ocaml.so ./dllopendal_core.so; \
+ cp %{project_root}/../../target/release/libopendal_ocaml.so ./libopendal_core.so; \
+ else \
+ cp %{project_root}/../../target/release/libopendal_ocaml.dylib ./dllopendal_core.so; \
+ cp %{project_root}/../../target/release/libopendal_ocaml.dylib ./libopendal_core.so; \
+ fi")
+ (run sh -c
+ "echo 'void __opendal_core_dummy(void) {}' | cc -c -x c - -o opendal_core_dummy.o && \
+ ar crs libopendal_core.a opendal_core_dummy.o && \
+ rm opendal_core_dummy.o"))))
(library
(name opendal_core)
@@ -33,3 +41,9 @@
(foreign_archives opendal_core)
(c_library_flags
(-lpthread -lc -lm)))
+
+(install
+ (section lib)
+ (package opendal)
+ (files
+ (libopendal_core.so as opendal_core/libopendal_core.so)))