summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhus Lu <phus.lu@citrix.com>2015-06-17 17:55:54 +0800
committerPhus Lu <phus.lu@citrix.com>2015-06-17 17:57:32 +0800
commit6ee5186f1d64fa181cdeab4d09ac7ee871c3804a (patch)
treedb4fb7dcb227a06e5ddb8c61be1937bc62d4b39b
parent1a15e0367703df35463e4cf20b5472d29c3daced (diff)
downloadvyos-xe-guest-utilities-6ee5186f1d64fa181cdeab4d09ac7ee871c3804a.tar.gz
vyos-xe-guest-utilities-6ee5186f1d64fa181cdeab4d09ac7ee871c3804a.zip
CA-172846: Tools installed out of date when a Linux VM is freshly installed from templates
This commit also fix top level Makefile Signed-off-by: Phus Lu <phus.lu@citrix.com>
-rw-r--r--Makefile40
1 files changed, 26 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index fa2563e..f2eac61 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
-
-PRODUCT_VERSION = 6.6.80
+PRODUCT_MAJOR_VERSION=6
+PRODUCT_MINOR_VERSION=6
+PRODUCT_MICRO_VERSION=80
+PRODUCT_VERSION = $(PRODUCT_MAJOR_VERSION).$(PRODUCT_MINOR_VERSION).$(PRODUCT_MICRO_VERSION)
GO_BUILD = go build
GO_FLAGS = -a -x
@@ -7,6 +9,7 @@ GO_FLAGS = -a -x
REPO = $(shell pwd)
SOURCEDIR = $(REPO)/mk
BUILDDIR = $(REPO)/build
+GOBUILDDIR = $(BUILDDIR)/gobuild
STAGEDIR = $(BUILDDIR)/stage
OBJECTDIR = $(BUILDDIR)/obj
DISTDIR = $(BUILDDIR)/dist
@@ -25,14 +28,14 @@ ifeq ($(ARCH), amd64)
endif
XE_DAEMON_SOURCES :=
-XE_DAEMON_SOURCES += $(REPO)/xe-daemon/xe-daemon.go
-XE_DAEMON_SOURCES += $(REPO)/guestmetric/guestmetric.go
-XE_DAEMON_SOURCES += $(REPO)/guestmetric/guestmetric_linux.go
-XE_DAEMON_SOURCES += $(REPO)/xenstoreclient/xenstore.go
+XE_DAEMON_SOURCES += ./xe-daemon/xe-daemon.go
+XE_DAEMON_SOURCES += ./guestmetric/guestmetric.go
+XE_DAEMON_SOURCES += ./guestmetric/guestmetric_linux.go
+XE_DAEMON_SOURCES += ./xenstoreclient/xenstore.go
XENSTORE_SOURCES :=
-XENSTORE_SOURCES += $(REPO)/xenstore/xenstore.go
-XENSTORE_SOURCES += $(REPO)/xenstoreclient/xenstore.go
+XENSTORE_SOURCES += ./xenstore/xenstore.go
+XENSTORE_SOURCES += ./xenstoreclient/xenstore.go
.PHONY: build
build: $(DISTDIR)/$(PACKAGE)_$(VERSION)-$(RELEASE)_$(ARCH).tgz
@@ -50,21 +53,30 @@ $(DISTDIR)/$(PACKAGE)_$(VERSION)-$(RELEASE)_$(ARCH).tgz: $(OBJECTS)
install -m 755 $(OBJECTDIR)/xe-daemon $(STAGEDIR)/usr/sbin/xe-daemon ; \
install -d $(STAGEDIR)/usr/bin/ ; \
install -m 755 $(OBJECTDIR)/xenstore $(STAGEDIR)/usr/bin/xenstore ; \
- ln -s /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-read ; \
- ln -s /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-write ; \
- ln -s /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-exists ; \
- ln -s /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-rm ; \
+ ln -sf /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-read ; \
+ ln -sf /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-write ; \
+ ln -sf /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-exists ; \
+ ln -sf /usr/bin/xenstore $(STAGEDIR)/usr/bin/xenstore-rm ; \
install -d $(STAGEDIR)/etc/udev/rules.d/ ; \
install -m 644 $(SOURCEDIR)/xen-vcpu-hotplug.rules $(STAGEDIR)/etc/udev/rules.d/z10_xen-vcpu-hotplug.rules ; \
cd $(STAGEDIR) ; \
tar cf $@ * \
)
-$(OBJECTDIR)/xe-daemon: $(XE_DAEMON_SOURCES)
+$(OBJECTDIR)/xe-daemon: $(XE_DAEMON_SOURCES:%=$(GOBUILDDIR)/%)
mkdir -p $(OBJECTDIR)
$(GO_BUILD) $(GO_FLAGS) -o $@ $<
-$(OBJECTDIR)/xenstore: $(XENSTORE_SOURCES)
+$(OBJECTDIR)/xenstore: $(XENSTORE_SOURCES:%=$(GOBUILDDIR)/%) $(GOROOT)
mkdir -p $(OBJECTDIR)
$(GO_BUILD) $(GO_FLAGS) -o $@ $<
+$(GOBUILDDIR)/%: $(REPO)/%
+ mkdir -p $$(dirname $@)
+ cat $< | \
+ sed -e "s/@PRODUCT_MAJOR_VERSION@/$(PRODUCT_MAJOR_VERSION)/g" | \
+ sed -e "s/@PRODUCT_MINOR_VERSION@/$(PRODUCT_MINOR_VERSION)/g" | \
+ sed -e "s/@PRODUCT_MICRO_VERSION@/$(PRODUCT_MICRO_VERSION)/g" | \
+ sed -e "s/@NUMERIC_BUILD_NUMBER@/$(RELEASE)/g" \
+ > $@
+