Skip to content

Commit 2d9ccd3

Browse files
committed
fix(Makefile): common cgo flags
1 parent a6b965d commit 2d9ccd3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ endif
4242

4343
CGO_CFLAGS =
4444
CGO_LDFLAGS = -v
45+
LDFLAGS =
4546

4647
ifeq ($(MAKECMDGOALS),statusgo-android-library)
4748
ARCH ?= arm64
@@ -56,6 +57,7 @@ ifeq ($(MAKECMDGOALS),statusgo-android-library)
5657
ANDROID_BUILD_FLAGS := CC="$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(HOST_OS)-x86_64/bin/clang --target=aarch64-linux-android$(ANDROID_API) --sysroot=$(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/$(HOST_OS)-x86_64/sysroot" CGO_ENABLED=1 GOOS=android GOARCH=$(MOBILE_GOARCH)
5758
CGO_CFLAGS += -Os -flto -fembed-bitcode
5859
CGO_LDFLAGS += -Os -flto
60+
LDFLAGS += -checklinkname=0 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true
5961
endif
6062

6163
ifeq ($(MAKECMDGOALS),statusgo-ios-library)
@@ -70,6 +72,7 @@ ifeq ($(MAKECMDGOALS),statusgo-ios-library)
7072
IOS_BUILD_FLAGS := CGO_ENABLED=1 GOOS=ios GOARCH=$(MOBILE_GOARCH)
7173
CGO_CFLAGS += -Os -flto -arch $(ARCH) -isysroot $$(xcrun --sdk $(IPHONE_SDK) --show-sdk-path) -miphoneos-version-min=$(IOS_TARGET) -fembed-bitcode
7274
CGO_LDFLAGS += -Os -flto
75+
LDFLAGS += -checklinkname=0 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true
7376
endif
7477

7578
ifeq ($(detected_OS),Darwin)
@@ -101,7 +104,7 @@ ifeq ($(USE_NWAKU), true)
101104
CGO_LDFLAGS += -L${NWAKU_DIR}/build/ -lwaku -Wl,-rpath,${NWAKU_DIR}/build/
102105
endif
103106

104-
BUILD_FLAGS ?= -ldflags=""
107+
BUILD_FLAGS ?= -ldflags="$(LDFLAGS)"
105108
BUILD_FLAGS_MOBILE ?=
106109
BUILD_ENV = CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)"
107110

@@ -266,7 +269,6 @@ endif
266269
statusgo-android-library: generate statusgo-c-bindings $(LIBWAKU) ##@cross-compile Build status-go as Android mobile library
267270
@echo "Building Android mobile library..."
268271
$(BUILD_ENV) $(ANDROID_BUILD_FLAGS) go build -buildmode=c-shared -tags 'gowaku_no_rln nowatchdog disable_torrent' \
269-
-ldflags="-checklinkname=0 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true" \
270272
-o "build/bin/libstatus.so" ./build/bin/statusgo-lib
271273
@echo "Android library built"
272274
@file build/bin/libstatus.so
@@ -276,7 +278,6 @@ statusgo-ios-library: generate statusgo-c-bindings $(LIBWAKU) ##@cross-compile B
276278
DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" \
277279
CC="$$(xcrun --sdk $(IPHONE_SDK) --find clang)" \
278280
$(BUILD_ENV) $(IOS_BUILD_FLAGS) go build -buildmode=c-archive -tags 'gowaku_no_rln nowatchdog disable_torrent' \
279-
-ldflags="-checklinkname=0 -X github.com/status-im/status-go/vendor/github.com/ethereum/go-ethereum/metrics.EnabledStr=true" \
280281
-o "build/bin/libstatus.a" ./build/bin/statusgo-lib
281282
@echo "iOS library built"
282283
@file build/bin/libstatus.a

0 commit comments

Comments
 (0)