Skip to content

Commit 6122564

Browse files
(fix): Install C libs for controller-gen
1 parent 5cde2a2 commit 6122564

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Diff for: Makefile

+14-2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ tidy: #HELP Update dependencies.
117117
# Force tidy to use the version already in go.mod
118118
$(Q)go mod tidy -go=$(GOLANG_VERSION)
119119

120+
# Controller-gen does not support build tags
121+
# After we upgrade github.com/containers/image/v5 from v5.33.1 start to be required to those installed
122+
.PHONY: setup-cgc-local-deps
123+
setup-cgc-local-deps: #EXHELP Install required system dependencies for controller-gen
124+
@if [ "$(shell uname -s)" = "Linux" ]; then \
125+
echo "Installing dependencies on Linux..."; \
126+
sudo apt update && sudo apt install -y libgmp-dev libgpgme-dev; \
127+
elif [ "$(shell uname -s)" = "Darwin" ]; then \
128+
echo "Installing dependencies on macOS..."; \
129+
brew install gmp gpgme; \
130+
fi
131+
120132
.PHONY: manifests
121133
KUSTOMIZE_CATD_CRDS_DIR := config/base/catalogd/crd/bases
122134
KUSTOMIZE_CATD_RBAC_DIR := config/base/catalogd/rbac
@@ -126,7 +138,7 @@ KUSTOMIZE_OPCON_RBAC_DIR := config/base/operator-controller/rbac
126138
CRD_WORKING_DIR := crd_work_dir
127139
# Due to https://github.com/kubernetes-sigs/controller-tools/issues/837 we can't specify individual files
128140
# So we have to generate them together and then move them into place
129-
manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
141+
manifests: setup-cgc-local-deps $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole, and CustomResourceDefinition objects.
130142
mkdir $(CRD_WORKING_DIR)
131143
$(CONTROLLER_GEN) crd paths="./api/v1/..." output:crd:artifacts:config=$(CRD_WORKING_DIR)
132144
mv $(CRD_WORKING_DIR)/olm.operatorframework.io_clusterextensions.yaml $(KUSTOMIZE_OPCON_CRDS_DIR)
@@ -139,7 +151,7 @@ manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole,
139151
$(CONTROLLER_GEN) webhook paths="./internal/catalogd/..." output:webhook:artifacts:config=$(KUSTOMIZE_CATD_WEBHOOKS_DIR)
140152

141153
.PHONY: generate
142-
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
154+
generate: setup-cgc-local-deps $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
143155
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
144156

145157
.PHONY: verify

0 commit comments

Comments
 (0)