Skip to contentSkip to conversation

w32, w64: Add build rule for installer

PATCH In review Stefan Weil 1 participant 2 messages Jul 15, 2013 – Jul 25, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 w32, w64: Add build rule for installer

The new rules in Makefile allow building installers for QEMU on Windows using NSIS, a package which is also available for Linux distributions (so cross builds are possible).

The rules for NSIS are in qemu.nsi which also uses two new images.

---

This code is used to build my signed installers for QEMU on Windows, see http://qemu.weilnetz.de.

Best regards
Stefan W.

 Makefile              |   55 +++++++++++
 pc-bios/qemu-nsis.bmp |  Bin 0 -> 154542 bytes
 pc-bios/qemu-nsis.ico |  Bin 0 -> 4846 bytes
 qemu.nsi              |  250 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 305 insertions(+)
 create mode 100644 pc-bios/qemu-nsis.bmp
 create mode 100644 pc-bios/qemu-nsis.ico
 create mode 100644 qemu.nsi
Makefile +55 -0
index c06bfab..29f1043 100644
@@ -437,6 +437,61 @@ qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
 	qemu-img.texi qemu-nbd.texi qemu-options.texi \
 	qemu-monitor.texi qemu-img-cmds.texi
 
+ifdef CONFIG_WIN32
+
+INSTALLER = qemu-setup-$(VERSION)$(EXESUF)
+
+nsisflags = -V2 -NOCD
+
+ifneq ($(wildcard $(SRC_PATH)/dll),)
+ifeq ($(ARCH),x86_64)
+# 64 bit executables
+DLL_PATH = $(SRC_PATH)/dll/w64
+nsisflags += -DW64
+else
+# 32 bit executables
+DLL_PATH = $(SRC_PATH)/dll/w32
+endif
+endif
+
+.PHONY: installer
+installer: $(INSTALLER)
+
+INSTDIR=/tmp/qemu-nsis
+
+$(INSTALLER): $(SRC_PATH)/qemu.nsi
+	make install prefix=${INSTDIR}
+ifdef SIGNCODE
+	(cd ${INSTDIR}; \
+         for i in *.exe; do \
+           $(SIGNCODE) $${i}; \
+         done \
+        )
+endif # SIGNCODE
+	(cd ${INSTDIR}; \
+         for i in qemu-system-*.exe; do \
+           arch=$${i%.exe}; \
+           arch=$${arch#qemu-system-}; \
+           echo Section \"$$arch\" Section_$$arch; \
+           echo SetOutPath \"\$$INSTDIR\"; \
+           echo File \"\$${BINDIR}\\$$i\"; \
+           echo SectionEnd; \
+         done \
+        ) >${INSTDIR}/system-emulations.nsh
+	makensis $(nsisflags) \
+                $(if $(BUILD_DOCS),-DCONFIG_DOCUMENTATION="y") \
+                $(if $(CONFIG_GTK),-DCONFIG_GTK="y") \
+                -DBINDIR="${INSTDIR}" \
+                $(if $(DLL_PATH),-DDLLDIR="$(DLL_PATH)") \
+                -DSRCDIR="$(SRC_PATH)" \
+                -DOUTFILE="$(INSTALLER)" \
+                $(SRC_PATH)/qemu.nsi
+	rm -r ${INSTDIR}
+ifdef SIGNCODE
+	$(SIGNCODE) $(INSTALLER)
+endif # SIGNCODE
+endif # CONFIG_WIN
+
 # Add a dependency on the generated files, so that they are always
 # rebuilt before other object files
 ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
pc-bios/qemu-nsis.bmp new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..ae82cd2697ab688137c1758c724c2e2597cf8121
GIT binary patch
pc-bios/qemu-nsis.ico new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..1d0128cd4c37f9c845f19c499febd61f85af5961
GIT binary patch
qemu.nsi new file +250 -0

250 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#1 lore raw

Am 15.07.2013 23:52, schrieb Stefan Weil:

Quoted 16 lines

The new rules in Makefile allow building installers for QEMU on Windows using NSIS, a package which is also available for Linux distributions (so cross builds are possible).

The rules for NSIS are in qemu.nsi which also uses two new images.

---

This code is used to build my signed installers for QEMU on Windows, see http://qemu.weilnetz.de.

Best regards
Stefan W.

Quoted 9 lines
 Makefile              |   55 +++++++++++
 pc-bios/qemu-nsis.bmp |  Bin 0 -> 154542 bytes
 pc-bios/qemu-nsis.ico |  Bin 0 -> 4846 bytes
 qemu.nsi              |  250 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 305 insertions(+)
 create mode 100644 pc-bios/qemu-nsis.bmp
 create mode 100644 pc-bios/qemu-nsis.ico
 create mode 100644 qemu.nsi

Hello Anthony,

I'd appreciate if this patch could be added to QEMU 1.6.

It is valuable for users of QEMU for Windows and does not modify anything for other hosts, so the risk is very low.

Should I send a pull request (it's only a single patch, so maybe a pull request is not needed)?

Thanks,
Stefan