From 50adcbb245bbcb4b324f28301ddaf63eb66329e1 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 | 25 +++++++++++++++++++++++++ Makefile | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7be66796cc..3b793205c8d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -180,6 +180,18 @@ 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 + if: matrix.build != 'macos-arm64' + shell: bash + run: | + make package-capi-headless + - name: Build C API headless + if: matrix.build == 'macos-arm64' + run: | + make package-capi-headless + env: + TARGET: aarch64-apple-darwin + TARGET_DIR: target/aarch64-apple-darwin/release - name: Build C API shell: bash run: | @@ -275,6 +287,19 @@ 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 + TARGET: aarch64-unknown-linux-gnu + TARGET_DIR: target/aarch64-unknown-linux-gnu/release - name: Build C API run: | make build-capi diff --git a/Makefile b/Makefile index ed45ee807ee..7bedf81b62c 100644 --- a/Makefile +++ b/Makefile @@ -454,16 +454,12 @@ 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 - RUSTFLAGS="${RUSTFLAGS}" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ +build-capi-headless: capi-setup + RUSTFLAGS="${RUSTFLAGS} -C panic=abort" $(CARGO_BINARY) build $(CARGO_TARGET) --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features compiler-headless,wasi build-capi-headless-ios: capi-setup - RUSTFLAGS="${RUSTFLAGS}" cargo lipo --manifest-path lib/c-api/Cargo.toml --release \ + RUSTFLAGS="${RUSTFLAGS} -C panic=abort" cargo lipo --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features compiler-headless,wasi ##### @@ -619,6 +615,33 @@ 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 ;\ + strip 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