Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,35 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-latest, windows-latest]
rust: ["1.82", stable, beta, nightly]

steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-latest' }}
with:
arch: x64

- name: Install WinFsp
if: ${{ matrix.os == 'windows-latest' }}
run: choco install winfsp -y --no-progress

- name: Set WinFsp include
if: ${{ matrix.os == 'windows-latest' }}
shell: pwsh
run: |
$candidates = @(
"C:\Program Files (x86)\WinFsp\inc\fuse",
"C:\Program Files\WinFsp\inc\fuse"
)
$selected = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $selected) { throw "WinFsp fuse headers not found." }
"LIBRCLONE_WINFSP_INCLUDE=$selected" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- uses: actions/setup-go@v5
with:
go-version: "stable"
go-version: "1.25.0"
check-latest: true
cache: false
- run: go version
Expand Down Expand Up @@ -75,7 +96,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "stable"
go-version: "1.25.0"
check-latest: true
cache: false
- run: go version
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.10.0 - local

- Update rclone to v1.73.2
- Minimum Go version is now 1.25.0
- MSRV remains 1.82

## 0.9.0 - 2025-02-12

- Update rclone to v1.69.0
Expand Down
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "librclone"
version = "0.10.0"
edition = "2021"
rust-version = "1.82"
description = "Rust bindings for librclone."
documentation = "https://docs.rs/librclone"
edition = "2021"
keywords = ["rclone"]
license = "MIT OR Apache-2.0 OR CC0-1.0"
name = "librclone"
readme = "README.md"
repository = "https://github.com/trevyn/librclone"
rust-version = "1.82"
version = "0.9.0"
license = "MIT OR Apache-2.0 OR CC0-1.0"
keywords = ["rclone"]

[workspace]
members = ["librclone-sys"]
members = ["examples/basic", "librclone-sys"]

[dependencies]
librclone-sys = {path = "librclone-sys", version = "=0.9.0"}
librclone-sys = { path = "librclone-sys", version = "=0.10.0" }
65 changes: 50 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,60 @@ Rust bindings for [`librclone`](https://github.com/rclone/rclone/tree/master/lib

Automatically compiles `rclone` as a library and links it into your Rust application.

Supports macOS and Linux. PR for Windows support welcome!

| crate version | `rclone` version | MSRV | Minimum `go` version |
| ------------------- | ---------------- | ---- | -------------------- |
| `librclone = "0.9"` | v1.69.0 | 1.82 | 1.21 |
| `librclone = "0.8"` | v1.66.0 | 1.70 | 1.21 |
| `librclone = "0.7"` | v1.65.0 | 1.65 | 1.19 |
| `librclone = "0.6"` | v1.64.2 | 1.65 | 1.19 |
| `librclone = "0.5"` | v1.63.1 | 1.60 | 1.18 |
| `librclone = "0.4"` | v1.62.2 | 1.54 | 1.18 |
| `librclone = "0.3"` | v1.61.0 | 1.54 | 1.17 |
| `librclone = "0.2"` | v1.60.1 | 1.54 | 1.17 |
| `librclone = "0.1"` | v1.56.2 | 1.54 | 1.17 |
Supports macOS, Linux, and Windows.

| crate version | `rclone` version | MSRV | Minimum `go` version |
| -------------------- | ---------------- | ---- | -------------------- |
| `librclone = "0.10"` | v1.73.2 | 1.82 | 1.25 |
| `librclone = "0.9"` | v1.69.0 | 1.82 | 1.21 |
| `librclone = "0.8"` | v1.66.0 | 1.70 | 1.21 |
| `librclone = "0.7"` | v1.65.0 | 1.65 | 1.19 |
| `librclone = "0.6"` | v1.64.2 | 1.65 | 1.19 |
| `librclone = "0.5"` | v1.63.1 | 1.60 | 1.18 |
| `librclone = "0.4"` | v1.62.2 | 1.54 | 1.18 |
| `librclone = "0.3"` | v1.61.0 | 1.54 | 1.17 |
| `librclone = "0.2"` | v1.60.1 | 1.54 | 1.17 |
| `librclone = "0.1"` | v1.56.2 | 1.54 | 1.17 |

To run the example:

```shell
cargo run -p basic
```

## Windows Runtime And Build Notes

Windows support is currently focused on `*-pc-windows-msvc`.

On Windows, `librclone-sys` builds `librclone.dll` using:

```shell
go build --buildmode=c-shared -tags cmount
```

This is shared linking: your executable has a runtime dependency on `librclone.dll`.
Place `librclone.dll` next to the executable or make it available via `PATH`.

Optional Windows build environment variables:

- `LIBRCLONE_WINFSP_INCLUDE` (path to WinFsp `fuse` headers; if not set, build script falls back to `CPATH`, `INCLUDE`, then `PATH`-derived WinFsp locations)
- `LIBRCLONE_GO_CC` (override cgo compiler used by `go build`, e.g. `gcc` or `clang`)

If a Windows build still does not include `cmount`, create `.cargo/config.toml` with:

```toml
[env]
LIBRCLONE_WINFSP_INCLUDE = { value = 'C:\Program Files (x86)\WinFsp\inc\fuse;C:\Program Files\WinFsp\inc\fuse', force = false }
```

When targeting `*-pc-windows-msvc`, ensure `lib.exe` is available in `PATH`.

To generate updated `go.mod` and `go.sum` files on new rclone version:

```ignore
```shell
cd librclone-sys
rm go.mod && rm go.sum
go mod init github.com/trevyn/librclone
go mod tidy -go=1.21
go mod tidy
go get github.com/rclone/rclone/librclone
```
11 changes: 11 additions & 0 deletions examples/basic/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "basic"
version = "0.1.0"
edition = "2021"

[dependencies]
librclone = { path = "../.." }

# serde
serde = "1"
serde_json = "1"
31 changes: 31 additions & 0 deletions examples/basic/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use std::env::consts;

use serde_json::json;

fn call(method: &str, input: serde_json::Value) {
println!("\n{method} {input}");
match librclone::rpc(method, input.to_string()) {
Ok(output) => {
println!("{output}");
}
Err(error) => {
eprintln!("Error: {error}");
}
}
}

fn main() {
println!("librclone running on: {}", consts::OS);

librclone::initialize();

call("core/version", json!({}));
call(
"rc/noop",
json!({
"lib":"rclone"
}),
);

librclone::finalize();
}
4 changes: 2 additions & 2 deletions librclone-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MIT AND Apache-2.0 AND BSD-3-Clause AND BSD-2-Clause AND MPL-2.0 AND
name = "librclone-sys"
repository = "https://github.com/trevyn/librclone"
rust-version = "1.82"
version = "0.9.0+rclone-v1.69.0"
version = "0.10.0+rclone-v1.73.2"

[build-dependencies]
bindgen = "0.71.1"
bindgen = "0.72.1"
Loading