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

build: change to the default build method that uses a shared library #277

Merged
merged 4 commits into from
Sep 21, 2023
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
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
170210 marked this conversation as resolved.
Show resolved Hide resolved
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)
170210 marked this conversation as resolved.
Show resolved Hide resolved
@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
Loading