Skip to content

Commit

Permalink
build-rust-static vs build-rust-release
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed Feb 26, 2020
1 parent 24f050a commit c71a0b6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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
build-rust: build-rust-static

# use debug build for quick testing
build-rust-debug:
Expand All @@ -32,9 +32,17 @@ build-rust-debug:

# use release build to actually ship - smaller and much faster
build-rust-release:
RUSTFLAGS="-C target-feature=-crt-static" rustup run nightly cargo build --release --features backtraces --target x86_64-unknown-linux-musl
rustup run nightly cargo build --release --features backtraces
rm -f api/libgo_cosmwasm.{a,$(DLL_EXT)}
cp target/release/libgo_cosmwasm.$(DLL_EXT) api

# static is like release, but bigger, but much more portable (doesn't depend on host libraries)
build-rust-static:
RUSTFLAGS="-C target-feature=-crt-static" rustup run nightly cargo build --release --features backtraces --target x86_64-unknown-linux-musl
rm -f api/libgo_cosmwasm.{a,$(DLL_EXT)}
cp target/x86_64-unknown-linux-musl/release/libgo_cosmwasm.a api


install-release-tools:
sudo apt install musl-tools
rustup target add x86_64-unknown-linux-musl
Expand All @@ -55,7 +63,8 @@ build-go:
go build ./...

test:
RUST_BACKTRACE=1 go test -v ./api .
# note: you must modify api/lib.go somehow after rebuilding the rust dll to relink it
RUST_BACKTRACE=1 go test -v -count=1 ./api .

docker-image-centos7:
docker build . -t go-cosmwasm:$(DOCKER_TAG)-centos7 -f ./Dockerfile.centos7
Expand Down

0 comments on commit c71a0b6

Please sign in to comment.