Skip to contentSkip to conversation

Adding support for building QEMU for Windows

PATCH New Nathan Rossi 1 participant 8 messages Jan 16, 2017

lore
Share & tools
lore
#0 lore raw

cover Adding support for building QEMU for Windows

This series is paired with a series that is sent for the oe-core meta layer. That series depends on changes in this series and vice-versa. The oe-core meta series can be reviewed via:

https://patchwork.openembedded.org/series/4800/

Additional information about this work can be read in the cover letter of the above linked series.

The following series fixes a number of issues with compilation of certain components that are required to build and distribute QEMU. This series includes:

* Enabling 'secure-api' for mingw-w64-headers
* Allow building of shared libraries for gettext
* Work around to avoid dependency on bash for glib-2.0, and clean up of glib-2.0 appends which are resolved in oe-core meta
* Better packaging of libgcc for easy use on Windows (deploy dll to bindir)
* Enabling build of libfdt in the dtc the recipe, but skipping dtc itself

Additionally this series includes an un-merged patch from Juro which is required for functional building with master of oe-core.

The goal of these changes is to allow for building of QEMU for mingw32 and generating a deployable archive for use on the target.

For convenience this series is also available in the git repository:

https://github.com/nathanrossi/meta-mingw nrossi/mingw-qemu-v1

Juro Bystricky (1):
mingw-64-runtime_3.1.bb: Adapt to SDK_ARCH -> SDK_SYS chanages for
crosssdk

Nathan Rossi (6):
mingw-w64-headers: Add 'secure-api' PACKAGECONFIG
gettext: Enabling building shared libs/dlls glib-2.0_%.bbappend: Prevent a bash dependency via bash-completion glib-2.0: Clean up unnecessary appends that are resolved in oe-core libgcc_%.bbappend: Relocate and package dll's in bindir dtc_%.bbappend: Only build libfdt for mingw32

 recipes-core/dtc/dtc_%.bbappend                          | 16 ++++++++++++++++
 recipes-core/gettext/gettext_0.19.%.bbappend             |  2 +-
 recipes-core/glib-2.0/glib-2.0_%.bbappend                |  5 +++--
 recipes-devtools/gcc/libgcc_%.bbappend                   |  8 +++++++-
 .../mingw-w64/nativesdk-mingw-w64-headers_3.1.0.bb       |  4 ++++
 .../mingw-w64/nativesdk-mingw-w64-runtime_3.1.0.bb       |  2 +-
 6 files changed, 32 insertions(+), 5 deletions(-)
 create mode 100644 recipes-core/dtc/dtc_%.bbappend
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/7 mingw-64-runtime_3.1.bb: Adapt to SDK_ARCH -> SDK_SYS chanages for crosssdk

From: Juro Bystricky <[email protected]>

With the change of crosssdk to use SDK_SYS instead of SDK_ARCH, we need to update the recipe to match the changes in master.

[YOCTO #9281]

---
 recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_3.1.0.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_3.1.0.bb +1 -1
index ddffcf4180..c4292ad48e 100644
@@ -24,7 +24,7 @@ PROVIDES += "virtual/nativesdk-${SDK_PREFIX}libc-for-gcc"
 PROVIDES += "virtual/nativesdk-libintl"
 
 STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
-STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}"
+STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
 TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}"
 PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
 
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/7 mingw-w64-headers: Add 'secure-api' PACKAGECONFIG

In reply to Nathan Rossi

Add the 'secure-api' PACKAGECONFIG and enable it by default. The 'secure-api' feature enables the secure string functions that are provided in the MS C Runtime e.g. "strerror_s".

These functions are needed for glib-2.0 compilation.

---
 recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_3.1.0.bb | 4 ++++
 1 file changed, 4 insertions(+)
recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_3.1.0.bb +4 -0
index 06312d604e..5cd4e34e09 100644
@@ -18,6 +18,10 @@ inherit autotools nativesdk
 INHIBIT_DEFAULT_DEPS = "1"
 DEPENDS = ""
 
+PACKAGECONFIG ??= "secure-api"
+
+PACKAGECONFIG[secure-api] = "--enable-secure-api,--disable-secure-api"
+
 do_configure() {
 	oe_runconf
 }
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/7 gettext: Enabling building shared libs/dlls

In reply to Nathan Rossi

Enable building of shared libs/dlls for gettext.

---
 recipes-core/gettext/gettext_0.19.%.bbappend | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-core/gettext/gettext_0.19.%.bbappend +1 -1
index efd10d6bb6..d6ecc46f4d 100644
@@ -2,5 +2,5 @@ DEPENDS_append_mingw32 = " pthreads-win32"
 LDFLAGS_prepend_mingw32 = " -lpthread "
 
 CFLAGS_append_mingw32 = " -DLIBXML_STATIC"
-EXTRA_OECONF_append_mingw32 = " --enable-threads=windows --enable-static --disable-shared "
+EXTRA_OECONF_append_mingw32 = " --enable-threads=windows --enable-static"
 
Signature · 1 line
2.11.0
#4 lore raw

PATCH 4/7 glib-2.0_%.bbappend: Prevent a bash dependency via bash-completion

In reply to Nathan Rossi

Prevent glib-2.0 depending on bash indirectly due to the RDEPEND on bash-completion. The bash dependency is undesirable due to bash depending on POSIX compatibility (fork, etc) which is not provided by MinGW but instead MSYS or CYGWIN.

The glib-2.0 configure does not allow for disabling of bash-completion output, so instead of disabling the bash-completion bbclass entirely allow the output to be packaged but remove the RDEPENDS_${PN}-bash-completion on bash-completion.

---
 recipes-core/glib-2.0/glib-2.0_%.bbappend | 4 ++++
 1 file changed, 4 insertions(+)
recipes-core/glib-2.0/glib-2.0_%.bbappend +4 -0
index d0531d6f4c..2b9ec53182 100644
@@ -1,2 +1,6 @@
 EXTRA_OECONF_mingw32 = "--enable-included-printf=yes ${CORECONF}"
 FILES_${PN}_append_mingw32 = " ${libdir}/charset.alias ${libdir}/gthread-2.0.def"
+
+# glib always provides bash-completion output, package the output but prevent
+# the dependency chain on bash (via bash-completion) for mingw32 targets only.
+RDEPENDS_${PN}-bash-completion_remove_mingw32 = "bash-completion"
Signature · 1 line
2.11.0
#5 lore raw

PATCH 5/7 glib-2.0: Clean up unnecessary appends that are resolved in oe-core

In reply to Nathan Rossi

The changes that are appended for '--enable-include=printf=yes' and packaging of charset.alias and gthread-2.0.def are handled in oe-core. Clean up these appends.

---
 recipes-core/glib-2.0/glib-2.0_%.bbappend | 3 ---
 1 file changed, 3 deletions(-)
recipes-core/glib-2.0/glib-2.0_%.bbappend +0 -3
index 2b9ec53182..398af88d8b 100644
@@ -1,6 +1,3 @@
-EXTRA_OECONF_mingw32 = "--enable-included-printf=yes ${CORECONF}"
-FILES_${PN}_append_mingw32 = " ${libdir}/charset.alias ${libdir}/gthread-2.0.def"
-
 # glib always provides bash-completion output, package the output but prevent
 # the dependency chain on bash (via bash-completion) for mingw32 targets only.
 RDEPENDS_${PN}-bash-completion_remove_mingw32 = "bash-completion"
Signature · 1 line
2.11.0
#6 lore raw

PATCH 6/7 libgcc_%.bbappend: Relocate and package dll's in bindir

In reply to Nathan Rossi

Relocate and package the dll's provided by libgcc in bindir. It is convention that on mingw/windows dll files are installed into the bindir, this is done to avoid issues with search paths and allows for execution of binaries without the need to point at a libdir.

---
 recipes-devtools/gcc/libgcc_%.bbappend | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
recipes-devtools/gcc/libgcc_%.bbappend +7 -1
index dd95317618..2a95d02cad 100644
@@ -1,2 +1,8 @@
-FILES_${PN}_append_mingw32 = " ${base_libdir}/libgcc*.dll"
+FILES_${PN}_append_mingw32 = " ${bindir}/libgcc*.dll"
 FILES_${PN}-dev_append_mingw32 = " ${base_libdir}/libgcc*.a"
+
+do_install_append_mingw32 () {
+	# move the .dll files into bindir
+	install -d ${D}${bindir}
+	mv ${D}${base_libdir}/libgcc*.dll ${D}${bindir}/
+}
Signature · 1 line
2.11.0
#7 lore raw

PATCH 7/7 dtc_%.bbappend: Only build libfdt for mingw32

In reply to Nathan Rossi

Whilst building libfdt on mingw32 is functional, building dtc for minw32 is not. This is due to dtc relying on certain POSIX functions as well as not handling the MSVCRT printf formatting.

This change enables building and installing libfdt only for mingw32, disabling the build of device-tree-compiler itself.

---
 recipes-core/dtc/dtc_%.bbappend | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
 create mode 100644 recipes-core/dtc/dtc_%.bbappend
recipes-core/dtc/dtc_%.bbappend new file +16 -0
new file mode 100644
index 0000000000..140693778a
@@ -0,0 +1,16 @@
+
+do_configure_append_mingw32 () {
+		# don't try to build the other dtc components when installing libs
+		sed -i 's/install-lib: all/install-lib: libfdt/g' ${S}/Makefile
+}
+
+do_compile_mingw32 () {
+		oe_runmake libfdt
+}
+
+do_install_mingw32 () {
+		oe_runmake install-lib install-includes
+}
+
+RDEPENDS_${PN}-misc_remove_mingw32 = "bash"
+
Signature · 1 line
2.11.0