Skip to content

Commit

Permalink
Merge pull request wasmerio#3558 from wasmerio/reduce-libwasmer-headl…
Browse files Browse the repository at this point in the history
…ess-size

Reduce libwasmer-headless size
  • Loading branch information
fschutt authored Jan 30, 2023
2 parents a90b82a + a23c02f commit b498bda
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
22 changes: 21 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ jobs:
with:
toolchain: 1.64
target: ${{ matrix.target }}
- name: Install Rust nightly (to build capi-headless)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
target: ${{ matrix.metadata.target }}
- uses: Swatinem/rust-cache@v1
if: matrix.use_sccache != true
- name: Install LLVM (macOS Apple Silicon)
Expand Down Expand Up @@ -273,6 +278,11 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
target: x86_64-pc-windows-gnu
- name: Install Rust nightly (to build capi-headless)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
target: x86_64-pc-windows-gnu
- name: Install Windows-GNU target
shell: bash
run: |
Expand Down Expand Up @@ -301,9 +311,19 @@ jobs:
- name: Build Wasmer C-API without LLVM
shell: bash
run: |
cargo build --release --target x86_64-pc-windows-gnu --manifest-path lib/c-api/Cargo.toml --no-default-features --features wat,compiler,wasi,middlewares,webc_runner --features cranelift,singlepass,wasmer-artifact-create,static-artifact-create,wasmer-artifact-load,static-artifact-load
make build-capi
env:
RUSTFLAGS: -Cpanic=abort
CARGO_TARGET: x86_64-pc-windows-gnu
ENABLE_LLVM: 0
- name: Build Wasmer C-API headless without LLVM
shell: bash
run: |
make build-capi-headless
env:
RUSTFLAGS: -Cpanic=abort
CARGO_TARGET: x86_64-pc-windows-gnu
ENABLE_LLVM: 0
- name: Dist
run: |
make distribution-gnu
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ jobs:
with:
toolchain: 1.64
target: ${{ matrix.metadata.target }}
- name: Install Rust nightly (to build capi-headless)
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
target: ${{ matrix.metadata.target }}
- name: Install Windows-GNU linker
if: ${{ matrix.metadata.build == 'windows-gnu' }}
shell: bash
Expand Down
30 changes: 3 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ ifeq ($(IS_DARWIN), 1)
endif
endif

package-capi-headless: build-capi-headless package-capi

package-capi:
mkdir -p "package/include"
mkdir -p "package/lib"
Expand Down Expand Up @@ -695,39 +697,13 @@ package-capi:
cp target/$(HOST_TARGET)/release/libwasmer.a package/lib/libwasmer.a ;\
fi

package-capi-headless: build-capi-headless
mkdir -p "package/include"
mkdir -p "package/lib"
cp lib/c-api/wasmer.h* package/include
cp lib/c-api/wasmer_wasm.h* package/include
cp lib/c-api/wasm.h* package/include
cp lib/c-api/README.md package/include/README.md

if [ -f $(TARGET_DIR)/wasmer.dll ]; then \
cp $(TARGET_DIR)/wasmer.dll package/lib/wasmer-headless.dll ;\
fi
if [ -f $(TARGET_DIR)/wasmer.lib ]; then \
cp $(TARGET_DIR)/wasmer.lib package/lib/wasmer-headless.lib ;\
fi

if [ -f $(TARGET_DIR)/libwasmer.dylib ]; then \
cp $(TARGET_DIR)/libwasmer.dylib package/lib/libwasmer-headless.dylib ;\
fi

if [ -f $(TARGET_DIR)/libwasmer.so ]; then \
cp $(TARGET_DIR)/libwasmer.so package/lib/libwasmer-headless.so ;\
fi
if [ -f $(TARGET_DIR)/libwasmer.a ]; then \
cp $(TARGET_DIR)/libwasmer.a package/lib/libwasmer-headless.a ;\
fi

package-docs: build-docs build-docs-capi
mkdir -p "package/docs/crates"
cp -R target/doc/ package/docs/crates
echo '<meta http-equiv="refresh" content="0; url=crates/wasmer/index.html">' > package/docs/index.html
echo '<meta http-equiv="refresh" content="0; url=wasmer/index.html">' > package/docs/crates/index.html

package: package-wasmer package-minimal-headless-wasmer package-capi package-capi-headless
package: package-wasmer package-minimal-headless-wasmer package-capi

tar-capi:
ls -R package
Expand Down

0 comments on commit b498bda

Please sign in to comment.