Skip to content

Commit 3de73e4

Browse files
authored
Remove emcc requirement (#157)
* Remove emcc requirement * Clean emscripten define * Remove emcc requirement for sqite-wasm-vec * Remove docsrs workaround * Update rusqlite test * Fix atomics ci * Clean workflow * Update README * Add changelog
1 parent e2dc604 commit 3de73e4

29 files changed

Lines changed: 2207 additions & 123 deletions

File tree

.github/actions/setup-emscripten/action.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@ jobs:
1010
test_bundled:
1111
strategy:
1212
matrix:
13-
os: [ubuntu-latest, macos-latest, windows-latest]
13+
os: [ubuntu-latest]
1414
runs-on: ${{ matrix.os }}
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Install wasm-pack
1818
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
19-
- name: Setup emscripten
20-
uses: ./.github/actions/setup-emscripten
2119
- name: Test bundled
2220
run: |
2321
wasm-pack test --chrome --headless
@@ -30,14 +28,12 @@ jobs:
3028
test_bundled_sqlite3mc:
3129
strategy:
3230
matrix:
33-
os: [ubuntu-latest, macos-latest, windows-latest]
31+
os: [ubuntu-latest]
3432
runs-on: ${{ matrix.os }}
3533
steps:
3634
- uses: actions/checkout@v4
3735
- name: Install wasm-pack
3836
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
39-
- name: Setup emscripten
40-
uses: ./.github/actions/setup-emscripten
4137
- name: Test bundled sqlite3mc
4238
run: |
4339
wasm-pack test --chrome --headless --features sqlite3mc
@@ -46,8 +42,6 @@ jobs:
4642
runs-on: ubuntu-latest
4743
steps:
4844
- uses: actions/checkout@v4
49-
- name: Setup emscripten
50-
uses: ./.github/actions/setup-emscripten
5145
- name: Run diesel tests
5246
run: |
5347
git clone https://github.com/diesel-rs/diesel.git
@@ -64,15 +58,13 @@ jobs:
6458
- uses: actions/checkout@v4
6559
- name: Install wasm-pack
6660
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
67-
- name: Setup emscripten
68-
uses: ./.github/actions/setup-emscripten
6961
- name: Run rusqlite tests
7062
run: |
71-
git clone https://github.com/Spxg/rusqlite.git
63+
git clone https://github.com/rusqlite/rusqlite.git
7264
cd rusqlite
7365
printf "[patch.crates-io]\n" >> Cargo.toml
7466
printf "sqlite-wasm-rs = { path = \"..\" }\n" >> Cargo.toml
75-
WASM_BINDGEN_TEST_TIMEOUT=60 wasm-pack test --chrome --headless --features modern-base
67+
WASM_BINDGEN_TEST_TIMEOUT=60 wasm-pack test --chrome --headless --features modern-full
7668
7769
test_clippy:
7870
runs-on: ubuntu-latest
@@ -81,16 +73,14 @@ jobs:
8173
- name: Check clippy
8274
run: |
8375
rustup target add wasm32-unknown-unknown
84-
cargo clippy --no-default-features --config docsrs.toml --target wasm32-unknown-unknown -- -D warnings
76+
cargo clippy --no-default-features --target wasm32-unknown-unknown -- -D warnings
8577
8678
test_implement_a_vfs:
8779
runs-on: ubuntu-latest
8880
steps:
8981
- uses: actions/checkout@v4
9082
- name: Install wasm-pack
9183
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
92-
- name: Setup emscripten
93-
uses: ./.github/actions/setup-emscripten
9484
- name: Test implement-a-vfs example
9585
run: |
9686
cd examples/implement-a-vfs
@@ -112,13 +102,12 @@ jobs:
112102
- uses: actions/checkout@v4
113103
- name: Install wasm-pack
114104
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
115-
- name: Setup emscripten
116-
uses: ./.github/actions/setup-emscripten
117105
- name: Test
118106
run: |
119107
rustup toolchain install nightly
120108
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
121-
RUSTFLAGS='-Ctarget-feature=+atomics -Clink-args=--shared-memory -Clink-args=--max-memory=1073741824 -Clink-args=--import-memory -Clink-args=--export=__wasm_init_tls -Clink-args=--export=__tls_size -Clink-args=--export=__tls_align -Clink-args=--export=__tls_base' rustup run nightly wasm-pack test --chrome --headless -Z build-std=panic_abort,std
109+
cd tests
110+
CFLAGS_wasm32_unknown_unknown='-matomics' RUSTFLAGS='-Ctarget-feature=+atomics -Clink-args=--shared-memory -Clink-args=--max-memory=1073741824 -Clink-args=--import-memory -Clink-args=--export=__wasm_init_tls -Clink-args=--export=__tls_size -Clink-args=--export=__tls_align -Clink-args=--export=__tls_base' rustup run nightly wasm-pack test --chrome --headless -Z build-std=panic_abort,std
122111
123112
test_msrv:
124113
strategy:
@@ -129,10 +118,6 @@ jobs:
129118
- uses: actions/checkout@v4
130119
- name: Install wasm-pack
131120
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
132-
- name: Setup emscripten
133-
uses: ./.github/actions/setup-emscripten
134-
with:
135-
version: '3.1.52'
136121
- name: Test MSRV
137122
run: |
138123
rustup toolchain install 1.82.0
@@ -149,8 +134,6 @@ jobs:
149134
- uses: actions/checkout@v4
150135
- name: Install wasm-pack
151136
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
152-
- name: Setup emscripten
153-
uses: ./.github/actions/setup-emscripten
154137
- name: Test
155138
run: |
156139
cd examples/nodejs
@@ -160,14 +143,12 @@ jobs:
160143
test_sqlite_wasm_vec:
161144
strategy:
162145
matrix:
163-
os: [ubuntu-latest, macos-latest, windows-latest]
146+
os: [ubuntu-latest]
164147
runs-on: ${{ matrix.os }}
165148
steps:
166149
- uses: actions/checkout@v4
167150
- name: Install wasm-pack
168151
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
169-
- name: Setup emscripten
170-
uses: ./.github/actions/setup-emscripten
171152
- name: Test
172153
run: |
173154
cd extensions/sqlite-vec
@@ -176,14 +157,12 @@ jobs:
176157
test_sqlite_wasm_vfs:
177158
strategy:
178159
matrix:
179-
os: [ubuntu-latest, macos-latest, windows-latest]
160+
os: [ubuntu-latest]
180161
runs-on: ${{ matrix.os }}
181162
steps:
182163
- uses: actions/checkout@v4
183164
- name: Install wasm-pack
184165
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
185-
- name: Setup emscripten
186-
uses: ./.github/actions/setup-emscripten
187166
- name: Test
188167
run: |
189168
cd crates/sqlite-wasm-vfs
@@ -198,8 +177,6 @@ jobs:
198177
- uses: actions/checkout@v4
199178
- name: Install wasm-pack
200179
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
201-
- name: Setup emscripten
202-
uses: ./.github/actions/setup-emscripten
203180
- name: Test
204181
run: |
205182
cd tests

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
### Changed
1111

12+
* Removed emcc requirement.
13+
[#157](https://github.com/Spxg/sqlite-wasm-rs/pull/157)
14+
1215
--------------------------------------------------------------------------------
1316

1417
## [0.5.0](https://github.com/Spxg/sqlite-wasm-rs/compare/0.4.8...0.5.0)

Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ include = [
2323
'Cargo.toml',
2424
'/README.md',
2525
'LICENSE',
26-
# use to build docs
27-
'docsrs.toml',
2826
]
2927

3028
[dependencies]
@@ -46,10 +44,6 @@ wasm-bindgen-test = "0.3.54"
4644
cc = "1.2.27"
4745
bindgen = { version = "0.72", optional = true }
4846

49-
[package.metadata.docs.rs]
50-
targets = ["wasm32-unknown-unknown"]
51-
cargo-args = ["--config", "docsrs.toml"]
52-
5347
[workspace]
5448
resolver = "2"
5549
members = [

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
## Usage
66

7-
Due to restrictions on the target platform, the [emscripten](https://emscripten.org/docs/getting_started/downloads.html) toolchain needs to be installed for compilation.
8-
97
```toml
108
[dependencies]
119
sqlite-wasm-rs = "0.5"

build.rs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ fn bindgen(output: &std::path::PathBuf) {
189189
}
190190

191191
fn compile() {
192-
use std::collections::HashSet;
193-
194192
const C_SOURCE: [&str; 36] = [
195193
// string
196194
"string/memchr.c",
@@ -242,31 +240,21 @@ fn compile() {
242240
const SQLITE3_SOURCE: &str = "sqlite3mc/sqlite3mc_amalgamation.c";
243241

244242
let mut cc = cc::Build::new();
245-
cc.warnings(false).target("wasm32-unknown-emscripten");
246-
247-
if cc.get_compiler().to_command().status().is_err() {
248-
panic!("It looks like you don't have the emscripten toolchain: https://emscripten.org/docs/getting_started/downloads.html");
249-
}
250-
251-
cc.file(SQLITE3_SOURCE)
243+
cc.warnings(false)
244+
.flag("-Wno-macro-redefined")
245+
.include("shim")
246+
.include("shim/musl/arch/generic")
247+
.include("shim/musl/include")
248+
.file("shim/printf/printf.c")
249+
.file(SQLITE3_SOURCE)
252250
.files(C_SOURCE.map(|s| format!("shim/musl/{s}")))
253-
.file("shim/printf/printf.c");
251+
.flag("-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD")
252+
.flag("-include")
253+
.flag("shim/wasm-shim.h");
254+
254255
cc.flags(FULL_FEATURED);
255256
#[cfg(feature = "sqlite3mc")]
256257
cc.flags(SQLITE3_MC_FEATURED);
257258

258-
let target_features = std::env::var("CARGO_CFG_TARGET_FEATURE").unwrap_or_default();
259-
let target_features = target_features
260-
.split(',')
261-
.map(str::trim)
262-
.collect::<HashSet<_>>();
263-
264-
if target_features.contains("atomics") {
265-
cc.flag("-pthread");
266-
}
267-
cc.include("shim")
268-
.flag("-DPRINTF_ALIAS_STANDARD_FUNCTION_NAMES_HARD")
269-
.flag("-include")
270-
.flag("shim/wasm-shim.h")
271-
.compile("wsqlite3");
259+
cc.compile("wsqlite3");
272260
}

crates/sqlite-wasm-vfs/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,3 @@ indexed_db_futures = "0.6.4"
3333

3434
[dev-dependencies]
3535
wasm-bindgen-test = "0.3.54"
36-
37-
[package.metadata.docs.rs]
38-
targets = ["wasm32-unknown-unknown"]
39-
cargo-args = ["--config", "docsrs.toml"]

crates/sqlite-wasm-vfs/docsrs.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

docsrs.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

extensions/sqlite-vec/Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,3 @@ cc = "1.2.44"
1919
[dev-dependencies]
2020
sqlite-wasm-rs = { path = "../../" }
2121
wasm-bindgen-test = "0.3.55"
22-
23-
[package.metadata.docs.rs]
24-
targets = ["wasm32-unknown-unknown"]
25-
cargo-args = ["--config", "docsrs.toml"]

0 commit comments

Comments
 (0)