[NSIS 05/13] packaging: add Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow building the spice installer and building/installing the ovirt
installer.

Allow passing DISPLAYED_VERSION to make.

Allow passing MODE to make to choose between the two installers -
SPICE (default) or OVIRT.

Some of the code in the Makefile was copied and adapted from
ovirt-wgt-installer.spec [1] and ovirt-guest-tools-iso.spec [2].

[1] https://gerrit.ovirt.org/47432
[2] https://gerrit.ovirt.org/48425

Change-Id: I0d651065697d962d4e351ffc1b7274c8eb37cb22
Signed-off-by: Yedidyah Bar David <didi@xxxxxxxxxx>
---
 Makefile             | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++
 win-guest-tools.nsis |   5 ++-
 2 files changed, 127 insertions(+), 1 deletion(-)
 create mode 100644 Makefile

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f1d6558
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,123 @@
+NAME=spice-nsis
+VERSION=0.103
+DISPLAYED_VERSION=$(VERSION)
+
+# set to OVIRT to build the ovirt guest tools installer
+MODE=SPICE
+
+# Note: If you want to change the UN/INSTALLER name, you
+# have to edit also the nsis source.
+ifeq ($(MODE),SPICE)
+# generated executable
+INSTALLER=spice-guest-tools-$(VERSION).exe
+# 'make install' target (in /usr/share)
+INSTALL_NAME=spice-guest-tools-iso
+else
+ifeq ($(MODE),OVIRT)
+INSTALLER=ovirt-guest-tools-setup-$(VERSION).exe
+INSTALL_NAME=ovirt-guest-tools-iso
+else
+$(error Please set MODE to one of SPICE or OVIRT, not [$(MODE)])
+endif
+endif
+
+TEMP_DIR=temp_dir
+
+# common dependencies/sources
+
+# From RPMs available at http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.3/
+VDA32BIN=/usr/i686-w64-mingw32/sys-root/mingw/bin
+VDA64BIN=/usr/x86_64-w64-mingw32/sys-root/mingw/bin
+
+# From virtio-win package available in https://fedoraproject.org/wiki/Windows_Virtio_Drivers#Yum.7CDnf_Repo
+# TODO:
+# We are currently extracting the drivers from an iso inside this RPM.
+# Copy directly from the RPM once they are there. See also:
+# https://bugzilla.redhat.com/1167941
+VIRTIOWINISO=/usr/share/virtio-win/virtio-win.iso
+# Replace this with the final directory once it's there
+VIRTIOWINDRIVERS=$(TEMP_DIR)/virtio-win-drivers
+# Used to re-de-duplicate the drivers as the tool we use (7z) does not support hard links.
+# Built into recent Fedora because dracut requires it.
+HARDLINK=/usr/sbin/hardlink
+# We copy things around using rsync -H to keep hardlinked files hardlinked.
+# Many of virtio-win drivers are so - using both of these together currently reduces the
+# final oVirt iso from around 230MB to around 100MB.
+RSYNC_AH=rsync --archive --hard-links
+
+# ovirt dependencies/sources
+
+# Available from http://resources.ovirt.org/pub/ovirt-3.6/rpm/fc22
+OVIRTGA=/usr/share/ovirt-guest-agent-windows
+
+# Available from http://www.microsoft.com/en-us/download/details.aspx?id=5582
+# RPM wrapping this available from http://resources.ovirt.org/pub/ovirt-3.6/rpm/fc22
+VCREDIST=/usr/share/vcredist-x86/vcredist_x86.exe
+
+# Common definitions for targets
+PREFIX=/usr/local
+DATAROOT_DIR=$(PREFIX)/share
+
+# install targets
+INSTALL_DATA_DIR=$(DATAROOT_DIR)/$(INSTALL_NAME)
+
+all: copy-files installer
+
+copy-files: common-files extra-files
+
+# Note that the installer does not depend here on the copied files,
+# so that 'make install-*' will not have to recreate it.
+# that's the "lazy" way. The correct way would have been to (automatically)
+# add dependencies here per each external file we copy.
+# If you do update one of the dependencies (say one of the drivers),
+# run 'make clean' before trying again to build.
+installer: $(INSTALLER)
+
+$(INSTALLER): win-guest-tools.nsis
+	makensis \
+		-DVERSION="$(VERSION)" \
+		-D"$(MODE)" \
+		-DDISPLAYED_VERSION="$(DISPLAYED_VERSION)" \
+		win-guest-tools.nsis
+
+common-files: $(VIRTIOWINDRIVERS)
+	mkdir -p bin/vdagent_x86 bin/vdagent_x64 drivers/virtio
+	$(RSYNC_AH) "$(VDA32BIN)"/vdagent.exe bin/vdagent_x86/
+	$(RSYNC_AH) "$(VDA32BIN)"/vdservice.exe bin/vdagent_x86/
+	$(RSYNC_AH) "$(VDA64BIN)"/vdagent.exe bin/vdagent_x64/
+	$(RSYNC_AH) "$(VDA64BIN)"/vdservice.exe bin/vdagent_x64/
+	$(RSYNC_AH) "$(VIRTIOWINDRIVERS)"/* drivers/virtio/
+
+# TODO: Drop this once the drivers are shipped as normal files. See comment above.
+$(VIRTIOWINDRIVERS):
+	mkdir -p "$(VIRTIOWINDRIVERS)"
+	7z -o"$(VIRTIOWINDRIVERS)" x "$(VIRTIOWINISO)"
+	# Deduplicate. source iso is already so, but 7z does not support hardlinks.
+	# Do not fail on this.
+	if [ -x "$(HARDLINK)" ]; then \
+		"$(HARDLINK)" -vv "$(VIRTIOWINDRIVERS)"; \
+	else \
+		echo "Warning: $(HARDLINK) is missing. iso file will have many duplicate files"; \
+	fi
+
+# Extra files:
+
+ifeq ($(MODE),SPICE)
+extra-files:
+	: TODO: Add here spice-specific files if any
+else
+ifeq ($(MODE),OVIRT)
+extra-files:
+	$(RSYNC_AH) \
+		"$(OVIRTGA)/OVirtGuestService.exe" \
+		"$(OVIRTGA)/default.ini" \
+		"$(OVIRTGA)/default.ini" \
+		"$(OVIRTGA)/default-logger.ini" \
+		"$(OVIRTGA)/ovirt-guest-agent.ini" \
+		"$(VCREDIST)" \
+		bin/
+endif
+endif
+
+clean:
+	rm -rf *.exe bin drivers "$(TEMP_DIR)" "$(ISO_IMAGE)"
diff --git a/win-guest-tools.nsis b/win-guest-tools.nsis
index 9d289ad..ce3d5d5 100644
--- a/win-guest-tools.nsis
+++ b/win-guest-tools.nsis
@@ -59,7 +59,10 @@ SetCompressor /SOLID lzma
 !error "OVIRT or SPICE symbol should passed to makensis with the -D flag"
 !endif
 
-!define VERSION "0.103"
+!ifndef VERSION
+!error "-DVERSION=<version> should be passed to makensis, see Makefile"
+!endif
+
 !ifndef DISPLAYED_VERSION
 !define DISPLAYED_VERSION "${VERSION}"
 !endif
-- 
2.1.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]