-
Notifications
You must be signed in to change notification settings - Fork 270
chore/docs: enable cgo as much as possible #564
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
base: main
Are you sure you want to change the base?
Changes from all commits
70c62d6
2b9a405
c2b5acb
2ff3c10
201dd45
1a6ea54
c3b69c7
4539f38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,32 @@ | ||||||
# | ||||||
# SPDX-License-Identifier: AGPL-3.0-only | ||||||
# Copyright (c) 2022-2024, daeuniverse Organization <[email protected]> | ||||||
# | ||||||
|
||||||
ifneq ($(KEEP_CGO_ENVS),1) | ||||||
ifdef CGO_ENABLED_NDEF | ||||||
export CGO_ENABLED := 0 | ||||||
endif | ||||||
ifeq ($(CGO_ENABLED),0) | ||||||
ifdef GOARCH_NDEF | ||||||
ifeq ($(CC),cc) | ||||||
ifneq ($(shell which musl-gcc),) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
|
||||||
export CC := musl-gcc | ||||||
else ifneq ($(shell which zig),) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
export CC := zig cc -target $(shell . install/musl-targets.sh && echo $$GOARCH_$(GOARCH)) | ||||||
else | ||||||
$(info ! CGO_ENABLED=0 is not recommended. Please consider to install musl-gcc for static link instead. See https://github.com/daeuniverse/dae/issues/557) | ||||||
endif | ||||||
endif | ||||||
else ifneq ($(shell which zig),) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. command -v 在 /bin/sh 能用吗 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mzz2017 I can confirm |
||||||
export CC := zig cc -target $(shell . install/musl-targets.sh && echo $$GOARCH_$(GOARCH)) | ||||||
else | ||||||
$(info ! CGO_ENABLED=0 is not recommended. See https://github.com/daeuniverse/dae/issues/557) | ||||||
endif | ||||||
endif | ||||||
ifneq ($(CC),cc) | ||||||
export CGO_ENABLED := 1 | ||||||
GO_LDFLAGS += -linkmode external -extldflags=-static | ||||||
$(info * Building dae with "$(CC)" static linking instead of CGO_ENABLED=0. See https://github.com/daeuniverse/dae/issues/557) | ||||||
endif | ||||||
endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
GOARCH_386=i386-linux-musl | ||
GOARCH_amd64=x86_64-linux-musl | ||
GOARCH_arm=arm-linux-musleabi | ||
GOARCH_arm64=aarch64-linux-musl | ||
GOARCH_mips64le=mips64el-linux-musl | ||
GOARCH_mips64=mips64-linux-musl | ||
GOARCH_mipsle=mipsel-linux-musl | ||
GOARCH_mips=mips-linux-musl | ||
GOARCH_riscv64=riscv64-linux-musl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.