From 6ef07285e3fe1cae2b4c27b9c9e2f8a81f2e6382 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Fri, 12 Aug 2022 12:27:51 +0300 Subject: [PATCH] CI/build.yaml: add libwasmer headless in default distribution --- .github/workflows/build.yml | 15 +++++++++++++++ Makefile | 32 +++++++++++++++++++++++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7be66796cc..0616460a17e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -180,6 +180,10 @@ jobs: '${{ runner.tool_cache }}/cargo-sccache/bin/sccache' -s echo 'RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache' >> $GITHUB_ENV shell: bash + - name: Build C API headless + shell: bash + run: | + make package-capi-headless - name: Build C API shell: bash run: | @@ -275,6 +279,17 @@ jobs: PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig PKG_CONFIG_ALLOW_CROSS: true ENABLE_LLVM: 0 + - name: Build C API headless + shell: bash + run: | + make package-capi-headless + env: + CARGO_BINARY: docker run -v /var/run/docker.sock:/var/run/docker.sock -v /home/runner/work/wasmer/wasmer:/project -w /project wasmer/aarch64 cross + CROSS_DOCKER_IN_DOCKER: true + CARGO_TARGET: --target aarch64-unknown-linux-gnu + PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig + PKG_CONFIG_ALLOW_CROSS: true + ENABLE_LLVM: 0 - name: Build C API run: | make build-capi diff --git a/Makefile b/Makefile index ed45ee807ee..2e5c46c42da 100644 --- a/Makefile +++ b/Makefile @@ -454,11 +454,7 @@ build-capi-llvm-universal: capi-setup # Headless (we include the minimal to be able to run) -build-capi-headless-universal: capi-setup - RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ - --no-default-features --features compiler-headless,wasi - -build-capi-headless-all: capi-setup +build-capi-headless: capi-setup RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features compiler-headless,wasi @@ -619,6 +615,32 @@ package-capi: cp $(TARGET_DIR)/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