Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile cleanups #245

Merged
merged 2 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 9 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,42 @@ BUILDERS_PREFIX := cosmwasm/go-ext-builder:0007
USER_ID := $(shell id -u)
USER_GROUP = $(shell id -g)

DLL_EXT = ""
SHARED_LIB_EXT = "" # File extension of the shared library
ifeq ($(OS),Windows_NT)
DLL_EXT = dll
SHARED_LIB_EXT = dll
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
DLL_EXT = so
SHARED_LIB_EXT = so
endif
ifeq ($(UNAME_S),Darwin)
DLL_EXT = dylib
SHARED_LIB_EXT = dylib
endif
endif

all: build test

build: build-rust build-go

# don't strip for now, for better error reporting
# build-rust: build-rust-release strip
build-rust: build-rust-release

# Use debug build for quick testing.
# In order to use "--features backtraces" here we need a Rust nightly toolchain, which we don't have by default
build-rust-debug:
(cd libwasmvm && cargo build)
cp libwasmvm/target/debug/libwasmvm.$(DLL_EXT) api
cp libwasmvm/target/debug/libwasmvm.$(SHARED_LIB_EXT) api
make update-bindings

# use release build to actually ship - smaller and much faster
#
# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).
build-rust-release:
(cd libwasmvm && cargo build --release)
cp libwasmvm/target/release/libwasmvm.$(DLL_EXT) api
cp libwasmvm/target/release/libwasmvm.$(SHARED_LIB_EXT) api
make update-bindings
@ #this pulls out ELF symbols, 80% size reduction!

# implement stripping based on os
ifeq ($(DLL_EXT),so)
strip:
strip api/libwasmvm.so
else
# TODO: add for windows and osx
strip:
endif

build-go:
go build ./...

Expand Down
3 changes: 3 additions & 0 deletions builders/guest/build_linux.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/bash

# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).

cargo build --release
3 changes: 3 additions & 0 deletions builders/guest/build_macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ export LIBZ_SYS_STATIC=1
export CC=o64-clang
export CXX=o64-clang++

# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).

cargo build --release --target x86_64-apple-darwin
3 changes: 3 additions & 0 deletions builders/guest/build_muslc.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/bin/sh

# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to
# enable stripping through cargo (if that is desired).

cargo build --release --example muslc