Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
2988: Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary r=epilys a=epilys

# Description

1. modified target `install-capi-lib` to detect version without requiring the binary being built.
2. added separate install target for library: `install-capi` instead of using `install` for both binary and library
3. added target `install-capi-pkgconfig` that outputs this example `.pc` file if the binary is missing:

   ```pc
   prefix=/usr/local
   includedir=${prefix}/include
   libdir=${prefix}/lib

   Name: wasmer
   Description: The Wasmer library for running WebAssembly
   Version: 2.3.0
   Cflags: -I${prefix}/include
   Libs: -L${prefix}/lib -lwasmer
   ```

Fixes wasmerio#2541

# Review

- [x] Add a short description of the change to the CHANGELOG.md file


Co-authored-by: Manos Pitsidianakis <[email protected]>
  • Loading branch information
bors[bot] and epilys authored Jun 29, 2022
2 parents 711bfef + 62283b6 commit 14d8084
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C
- [#2942](https://github.com/wasmerio/wasmer/pull/2942) Fix clippy lints.
- [#2943](https://github.com/wasmerio/wasmer/pull/2943) Fix build error on some archs by using c_char instead of i8
- [2976](https://github.com/wasmerio/wasmer/pull/2976) Upgrade minimum enumset to one that compiles
- [2988](https://github.com/wasmerio/wasmer/pull/2988) Have make targets install-capi-lib,install-pkgconfig work without building the wasmer binary

## 2.3.0 - 2022/06/06

Expand Down
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ DESTDIR ?= /usr/local

install: install-wasmer install-capi-headers install-capi-lib install-pkgconfig install-misc

install-capi: install-capi-headers install-capi-lib install-capi-pkgconfig install-misc

install-wasmer:
install -Dm755 target/release/wasmer $(DESTDIR)/bin/wasmer

Expand All @@ -657,7 +659,7 @@ install-capi-headers:

# Currently implemented for linux only. TODO
install-capi-lib:
pkgver=$$(target/release/wasmer --version | cut -d\ -f2) && \
pkgver=$$($(CARGO_BINARY) pkgid --manifest-path lib/c-api/Cargo.toml | sed --posix 's/^.*wasmer-c-api:\([0-9.]*\)$\/\1/') && \
shortver="$${pkgver%.*}" && \
majorver="$${shortver%.*}" && \
install -Dm755 target/release/libwasmer.so "$(DESTDIR)/lib/libwasmer.so.$$pkgver" && \
Expand All @@ -668,6 +670,10 @@ install-capi-lib:
install-misc:
install -Dm644 LICENSE "$(DESTDIR)"/share/licenses/wasmer/LICENSE

install-capi-pkgconfig:
@pkgver=$$($(CARGO_BINARY) pkgid --manifest-path lib/c-api/Cargo.toml | sed --posix 's/^.*wasmer-c-api:\([0-9.]*\)$\/\1/') && \
printf "prefix=%s\nincludedir=\044{prefix}/include\nlibdir=\044{prefix}/lib\n\nName: wasmer\nDescription: The Wasmer library for running WebAssembly\nVersion: %s\nCflags: -I\044{prefix}/include\nLibs: -L\044{prefix}/lib -lwasmer\n" "$(DESTDIR)" "$${pkgver}" | install -Dm644 /dev/stdin "$(DESTDIR)"/lib/pkgconfig/wasmer.pc

install-pkgconfig:
# Make sure WASMER_INSTALL_PREFIX is set during build
unset WASMER_DIR; \
Expand Down

0 comments on commit 14d8084

Please sign in to comment.