diff --git a/Makefile b/Makefile index d40e1298..c12e71b4 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,9 @@ RPM = rpmbuild/RPMS/$(PROGRAM)-$(VERSION)-$(RELEASE).$(ARCH).rpm USERNAME := $(shell cat ~/.config/copr 2>/dev/null | grep username | awk -F '=' '{print $$2}' | tr -d ' ') SERVER = 'dl.fedoraproject.org' REMOTE_PATH = 'pub/alt/$(USERNAME)/$(PROGRAM)' +ifneq ($(GOTAGS),) + BUILD_FLAGS = -tags $(GOTAGS) +endif # # art @@ -105,9 +108,9 @@ $(PROGRAM): main.go @echo "Building: $(PROGRAM), version: $(SVERSION)..." ifneq ($(OLDGOLANG),) @# avoid equals sign in old golang versions eg in: -X foo=bar - time go build -ldflags "-X main.program $(PROGRAM) -X main.version $(SVERSION)" -o $(PROGRAM); + time go build -ldflags "-X main.program $(PROGRAM) -X main.version $(SVERSION)" -o $(PROGRAM) $(BUILD_FLAGS); else - time go build -ldflags "-X main.program=$(PROGRAM) -X main.version=$(SVERSION)" -o $(PROGRAM); + time go build -ldflags "-X main.program=$(PROGRAM) -X main.version=$(SVERSION)" -o $(PROGRAM) $(BUILD_FLAGS); endif $(PROGRAM).static: main.go diff --git a/docs/documentation.md b/docs/documentation.md index 4cbcf139..0e75d27c 100644 --- a/docs/documentation.md +++ b/docs/documentation.md @@ -42,6 +42,7 @@ along with this program. If not, see . * [Meta parameters](#meta-parameters) * [Graph definition file](#graph-definition-file) * [Command line](#command-line) + * [Compilation options](#compilation-options) 8. [Examples - Example configurations](#examples) 9. [Development - Background on module development and reporting bugs](#development) 10. [Authors - Authors and contact information](#authors) @@ -420,6 +421,7 @@ If you feel that a well used option needs documenting here, please patch it! * [Meta parameters](#meta-parameters): List of available resource meta parameters. * [Graph definition file](#graph-definition-file): Main graph definition file. * [Command line](#command-line): Command line parameters. +* [Compilation options](#compilation-options): Compilation options. ### Meta parameters These meta parameters are special parameters (or properties) which can apply to @@ -545,6 +547,18 @@ like to try. The canonical example is when running `mgmt` with `--remote` there might be a cached copy of the binary in the primary prefix, but in case there's no binary available continue working in a temporary directory to avoid failure. +### Compilation options + +You can control some compilation variables by using environment variables. + +#### Disable livirt support + +If you wish to compile mgmt without libvirt, you can use the following command: + +``` +GOTAGS=novirt make build +``` + ## Examples For example configurations, please consult the [examples/](https://github.com/purpleidea/mgmt/tree/master/examples) directory in the git source repository. It is available from: diff --git a/resources/virt.go b/resources/virt.go index 37401cdb..b5b26af5 100644 --- a/resources/virt.go +++ b/resources/virt.go @@ -14,6 +14,7 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +// +build !novirt package resources diff --git a/resources/virt_disabled.go b/resources/virt_disabled.go new file mode 100644 index 00000000..1a477930 --- /dev/null +++ b/resources/virt_disabled.go @@ -0,0 +1,24 @@ +// Mgmt +// Copyright (C) 2013-2016+ James Shubin and the project contributors +// Written by James Shubin and the project contributors +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +build novirt + +package resources + +// VirtRes represents the fields of the Virt resource. Since this file is +// only invoked with the tag "novirt", we do not need any fields here. +type VirtRes struct { +}