Skip to content

Commit

Permalink
build: change to the default build method that uses a shared library (#…
Browse files Browse the repository at this point in the history
…277)

* build: change the default build binary to use shared library

Signed-off-by: zemyblue <[email protected]>

* ci: change smart contract ci to use static library

Signed-off-by: zemyblue <[email protected]>

* ci: change go version

Signed-off-by: zemyblue <[email protected]>

* chore: update changelog

Signed-off-by: zemyblue <[email protected]>

---------

Signed-off-by: zemyblue <[email protected]>
  • Loading branch information
zemyblue authored Sep 21, 2023
1 parent 022b5cb commit a450fb9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci-smart-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
TEST_DOCKER_IMAGE: finschianode:smartcontractci
GO_VERSION: "1.20"

jobs:
cleanup-runs:
Expand Down Expand Up @@ -60,9 +61,9 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: ${{ env.GO_VERSION }}
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false LINK_STATICALLY=true make build
- name: Upload build
uses: actions/upload-artifact@v3
with:
Expand All @@ -80,7 +81,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: ${{ env.GO_VERSION }}
- name: Download smart contracts
uses: dsaltares/fetch-gh-release-asset@master
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (build) [\#236](https://github.com/Finschia/finschia/pull/236) fix compile error when the build_tags is multiple.
* (wasm) [\#249](https://github.com/Finschia/finschia/pull/249) revert removing wasm configs
* (finschia-sdk) [\#264](https://github.com/Finschia/finschia/pull/264) Bump up finschia-sdk from `0a27aef22921` to `022614f80a0d`
* (build) [\#277](https://github.com/Finschia/finschia/pull/277) change to the default build method that uses a shared library

### Breaking Changes
* (ostracon) [\#240](https://github.com/Finschia/finschia/pull/240) remove `libsodium` vrf library
Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ endif

# process build tags

build_tags = netgo static_wasm muslc
build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
build_tags += ledger
endif
ifeq ($(LINK_STATICALLY),true)
build_tags += static_wasm muslc
endif

build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))
Expand All @@ -61,12 +64,14 @@ ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
CGO_CFLAGS := -I$(TEMPDIR)/include
CGO_LDFLAGS := -L$(TEMPDIR)/lib
ifeq ($(OS_NAME),darwin)
CGO_LDFLAGS += -lz -lbz2
else
CGO_LDFLAGS += -static -lwasmvm_muslc -lm
ifeq ($(LINK_STATICALLY),true)
CGO_CFLAGS := -I$(TEMPDIR)/include
CGO_LDFLAGS := -L$(TEMPDIR)/lib
ifeq ($(OS_NAME),darwin)
CGO_LDFLAGS += -lz -lbz2
else
CGO_LDFLAGS += -static -lwasmvm_muslc -lm
endif
endif


Expand All @@ -80,6 +85,7 @@ $(TEMPDIR)/:
mkdir -p $(TEMPDIR)/

wasmvmlib: $(TEMPDIR)/
ifeq ($(LINK_STATICALLY),true)
@mkdir -p $(TEMPDIR)/lib
ifeq (",$(wildcard $(TEMPDIR)/lib/libwasmvm*.a)")
ifeq ($(OS_NAME),darwin)
Expand All @@ -92,6 +98,7 @@ wasmvmlib: $(TEMPDIR)/
endif
endif
endif
endif

# command for make build and make install
build: BUILDARGS=-o $(BUILDDIR)/
Expand Down

0 comments on commit a450fb9

Please sign in to comment.