]> go.fuhry.dev Git - runtime.git/commitdiff
mtls/pkcs11: conditional build with tag "pkcs11"
authorDan Fuhry <dan@fuhry.com>
Tue, 27 Feb 2024 15:29:32 +0000 (10:29 -0500)
committerDan Fuhry <dan@fuhry.com>
Tue, 27 Feb 2024 15:29:32 +0000 (10:29 -0500)
Makefile
mtls/pkcs11.go
mtls/provider_tpm2_pkcs11.go

index 0251cc03318a5b75d0283b9bc995131d4e85cad2..a1b32234f9beb93a80926876d0911accfb4012a2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,25 @@
 GOMAINSRCS = $(shell find . -type f -name main.go | cut -c 3- | paste -s -d ' ' -)
 GOMAINDIRS = $(GOMAINSRCS:/main.go=)
+GOOS ?= $(shell go env GOOS)
+GOARCH ?= $(shell go env GOARCH)
+
+ifeq ($(GOOS)/$(GOARCH),$(shell go env GOOS)/$(shell go env GOARCH))
+NATIVE_BUILD := 1
+else
+NATIVE_BUILD := 0
+endif
+
+ifeq ($(GOOS)/$(GOARCH),openbsd/amd64)
+GOBUILDFLAGS := -trimpath
+else
 GOBUILDFLAGS := -buildmode=pie -trimpath
-GOMAINS =
+endif
 
+ifeq ($(NATIVE_BUILD),1)
+GOBUILDFLAGS += -tags=pkcs11
+endif
+
+GOMAINS =
 ROOT_DOMAIN := fuhry.dev
 DEFAULT_REGION := hq
 DEFAULT_HOST_DOMAIN := $(DEFAULT_REGION).$(ROOT_DOMAIN)
index 285367a626da976e74f743777122619f1622cca9..4a8a0479a6982bcca609de614ad9d9fb41831176 100644 (file)
@@ -1,3 +1,6 @@
+//go:build pkcs11
+// +build pkcs11
+
 package mtls
 
 import (
index cbec7a8fbb259fd01e633c2f1c78b00d3d6c0f67..edc2b903287d4ecca49790baae1d945f1dfe2477 100644 (file)
@@ -1,4 +1,5 @@
-//go:build linux
+//go:build pkcs11
+// +build pkcs11
 
 package mtls