Skip to contentSkip to conversation

Adding support for building QEMU for Windows

PATCH In review Nathan Rossi 1 participant 21 messages Jan 30, 2017 – Mar 9, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover Adding support for building QEMU for Windows

This series enables a number of packages and dependencies to be built for mingw32. The goal is to enable the building and packaging of QEMU targeting mingw32 with support for SDL/VNC enabled as well as being able to execute the qemu* machines of oe-core/meta.

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
* Fix/enable building of shared libraries for gettext
* Work around to avoid dependency on bash for glib-2.0, clean up of some glib-2.0 appends which are resolved in oe-core meta
* Better packaging of libgcc for easy use on Windows (deploy dll to bindir)
* Updating FILES_* to support locations for mingw32 output (bindir contains .dll) for libgcc, expat, libpcre, gettext, glib-2.0, libsdl, libgpg-error and libgcrypt
* Addition of PACKAGECONFIG options to libsdl, and configuring of PACKAGECONFIG for libsdl, glib-2.0 and libgcrypt to handle Windows only features and or ability to disable features that do not support mingw32/Windows
* Enabling build of libfdt in the dtc recipe, but skipping dtc itself
* Fixes for configuring libgpg-error and libgcrypt when targeting mingw32

The intended build execution is to allow for 'buildtools-tarball' (or any populate_sdk target with 'nativesdk-qemu' in TOOLCHAIN_HOST_TASK) to create an output that includes all dependent nativesdk binaries as well as a nativesdk QEMU binaries. This series does not however address fixing the environment setup script or self-extracting installer shell script that is normally provided by buildtools-tarball.

This series with the multiple oe-core/meta series was tested on the following target Windows platforms: Windows 10 (64-bit), Windows 8.1 (64-bit) and Windows 7 SP1 (64-bit).

The changes were also tested on the following Linux build hosts: Debian 8 (64-bit), Ubuntu 16.04 (64-bit), CentOS 7 (64-bit).

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

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

This series partly depends on a set of series for oe-core/meta. The following series are required for building of QEMU (but not all parts of this series specifically), including dll packaging detection and libgcrypt support:

https://patchwork.openembedded.org/series/5049/
https://patchwork.openembedded.org/series/5050/
https://patchwork.openembedded.org/series/5051/
https://patchwork.openembedded.org/series/5052/
https://patchwork.openembedded.org/series/5053/

A branch which has the series above merged has been published to allow for easy testing, it is available at:

https://github.com/nathanrossi/openembedded-core testing/mingw-support-2017-01-30

---

Changes v2:
* Moved a number of patches from oe-core series to this series
* Updated cover letter to reflect series additional inclusion
* Bring cover letter info from oe-core/meta series
* Updated commit messages

Nathan Rossi (19):
mingw-w64-headers: Add 'secure-api' PACKAGECONFIG
libgcc: Relocate and package dll's in bindir
expat: Fix ${PN}-bin handling for .exe files
libpcre: Handle shipping .exe and .dll files for mingw32 gettext_0.19.%.bbappend: Fix/enable shared building of gettext gettext_0.19.%.bbappend: Handle packaging .dll's for mingw32 gettext_0.19.%.bbappend: Handle gettext-libintl .dll packaging glib-2.0: Prevent a bash dependency via bash-completion glib-2.0: Disable libmount support for mingw32 targets glib-2.0: Handle packaging .dll and .exe files for mingw32 glib-2.0: Clean up unnecessary appends that are resolved in oe-core
dtc: Only build libfdt for mingw32
libsdl: Windows specific PACKAGECONFIG
libsdl: Fix ${PN}-bin handling for .exe files
libgpg-error: Handle packaging .exe files libgpg-error_1.25.bbappend: Add patch to fix configure bug for mingw32
libgcrypt: Handle packaging of .exe and .def files
libgcrypt: Disable 'capabilities' for mingw32 libgcrypt_1.7.3.bbappend: Add patch to fix configure bug for mingw32

 recipes-core/dtc/dtc_%.bbappend                    | 16 ++++++
 recipes-core/expat/expat_%.bbappend                |  3 +
 .../fix-gl_cv_prog_as_underscore-test.patch        | 67 ++++++++++++++++++++++
 recipes-core/gettext/gettext_0.19.%.bbappend       | 11 +++-
 recipes-core/glib-2.0/glib-2.0_%.bbappend          | 17 +++++-
 recipes-devtools/gcc/libgcc_%.bbappend             |  8 ++-
 .../mingw-w64/nativesdk-mingw-w64-headers_3.1.0.bb |  4 ++
 recipes-graphics/libsdl/libsdl_%.bbappend          |  9 +++
 ...c-Set-mym4_revision-to-0-if-not-a-git-rep.patch | 46 +++++++++++++++
 recipes-support/libgcrypt/libgcrypt_%.bbappend     | 11 ++++
 recipes-support/libgcrypt/libgcrypt_1.7.3.bbappend |  6 ++
 ...c-Set-mym4_revision-to-0-if-not-a-git-rep.patch | 46 +++++++++++++++
 .../libgpg-error/libgpg-error_%.bbappend           |  3 +
 .../libgpg-error/libgpg-error_1.25.bbappend        |  6 ++
 recipes-support/libpcre/libpcre_%.bbappend         |  6 ++
 15 files changed, 255 insertions(+), 4 deletions(-)
 create mode 100644 recipes-core/dtc/dtc_%.bbappend
 create mode 100644 recipes-core/expat/expat_%.bbappend
 create mode 100644 recipes-core/gettext/gettext/fix-gl_cv_prog_as_underscore-test.patch
 create mode 100644 recipes-graphics/libsdl/libsdl_%.bbappend
 create mode 100644 recipes-support/libgcrypt/files/configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch
 create mode 100644 recipes-support/libgcrypt/libgcrypt_%.bbappend
 create mode 100644 recipes-support/libgcrypt/libgcrypt_1.7.3.bbappend
 create mode 100644 recipes-support/libgpg-error/files/configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch
 create mode 100644 recipes-support/libgpg-error/libgpg-error_%.bbappend
 create mode 100644 recipes-support/libgpg-error/libgpg-error_1.25.bbappend
 create mode 100644 recipes-support/libpcre/libpcre_%.bbappend
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/19 mingw-w64-headers: Add 'secure-api' PACKAGECONFIG

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
#2 lore raw

PATCH v2 2/19 libgcc: 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
#3 lore raw

PATCH v2 3/19 expat: Fix ${PN}-bin handling for .exe files

In reply to Nathan Rossi

For mingw it is convention to have DLLs in bindir. To avoid grouping anything other that .exe files into the ${PN}-bin package, override it so that only '*.exe' files are shipped.

---
 recipes-core/expat/expat_%.bbappend | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 recipes-core/expat/expat_%.bbappend
recipes-core/expat/expat_%.bbappend new file +3 -0
new file mode 100644
index 0000000000..626ea5b938
@@ -0,0 +1,3 @@
+
+FILES_${PN}-bin_mingw32 = "${bindir}/*.exe ${sbindir}/*.exe"
+
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 4/19 libpcre: Handle shipping .exe and .dll files for mingw32

In reply to Nathan Rossi

Package the .dll and .exe files into their expected packages.

---
 recipes-support/libpcre/libpcre_%.bbappend | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 recipes-support/libpcre/libpcre_%.bbappend
recipes-support/libpcre/libpcre_%.bbappend new file +6 -0
new file mode 100644
index 0000000000..b154f8d3b6
@@ -0,0 +1,6 @@
+
+FILES_libpcrecpp_mingw32 = "${bindir}/libpcrecpp*.dll"
+FILES_libpcreposix_mingw32 = "${bindir}/libpcreposix*.dll"
+FILES_pcregrep_mingw32 = "${bindir}/pcregrep.exe"
+FILES_pcretest_mingw32 = "${bindir}/pcretest.exe"
+
Signature · 1 line
2.11.0
#5 lore raw

PATCH v2 5/19 gettext_0.19.%.bbappend: Fix/enable shared building of gettext

In reply to Nathan Rossi

Fix building of shared gettext for i686/32-bit mingw32. This adds a patch which fixes an issue with gnulib that is included in gettext.

This patch does not need to be submitted upstream as it is fixing an issue with the included version of gnulib. Upstream gnulib has already fixed this issue and upstream gettext has already updated the included gnulib, however gettext has not yet made a release that includes this fix.

---
 .../fix-gl_cv_prog_as_underscore-test.patch        | 67 ++++++++++++++++++++++
 recipes-core/gettext/gettext_0.19.%.bbappend       |  7 ++-
 2 files changed, 73 insertions(+), 1 deletion(-)
 create mode 100644 recipes-core/gettext/gettext/fix-gl_cv_prog_as_underscore-test.patch
recipes-core/gettext/gettext/fix-gl_cv_prog_as_underscore-test.patch new file +67 -0
new file mode 100644
index 0000000000..636789f31d
@@ -0,0 +1,67 @@
+Backport gnulib fix for mingw into gettext's included version of gnulib
+
+http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=68b6adebef05670a312fb92b05e7bd089d2ed43a
+
+Upstream-Status: Backport
+Signed-off-by: Nathan Rossi <[email protected]>
+
+--- a/gettext-runtime/gnulib-m4/asm-underscore.m4
++++ b/gettext-runtime/gnulib-m4/asm-underscore.m4
+@@ -27,11 +27,11 @@
+ #endif
+ int foo(void) { return 0; }
+ EOF
+      # Look for the assembly language name in the .s file.
+      AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
+-     if LC_ALL=C grep -E '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then
++     if LC_ALL=C grep -E '(^|[[^a-zA-Z0-9_]])_foo([[^a-zA-Z0-9_]]|$)' conftest.$gl_asmext >/dev/null; then
+        gl_cv_prog_as_underscore=yes
+      else
+        gl_cv_prog_as_underscore=no
+      fi
+      rm -f conftest*
+--- a/gettext-runtime/configure
++++ b/gettext-runtime/configure
+@@ -24601,11 +24601,11 @@
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; } >/dev/null 2>&1
+-     if LC_ALL=C grep -E '(^|^a-zA-Z0-9_)_foo(^a-zA-Z0-9_|$)' conftest.$gl_asmext >/dev/null; then
++     if LC_ALL=C grep -E '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then
+        gl_cv_prog_as_underscore=yes
+      else
+        gl_cv_prog_as_underscore=no
+      fi
+      rm -f conftest*
+--- a/gettext-tools/gnulib-m4/asm-underscore.m4
++++ b/gettext-tools/gnulib-m4/asm-underscore.m4
+@@ -27,11 +27,11 @@
+ #endif
+ int foo(void) { return 0; }
+ EOF
+      # Look for the assembly language name in the .s file.
+      AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1
+-     if LC_ALL=C grep -E '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then
++     if LC_ALL=C grep -E '(^|[[^a-zA-Z0-9_]])_foo([[^a-zA-Z0-9_]]|$)' conftest.$gl_asmext >/dev/null; then
+        gl_cv_prog_as_underscore=yes
+      else
+        gl_cv_prog_as_underscore=no
+      fi
+      rm -f conftest*
+--- a/gettext-tools/configure
++++ b/gettext-tools/configure
+@@ -32284,11 +32284,11 @@
+   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+   (eval $ac_try) 2>&5
+   ac_status=$?
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; } >/dev/null 2>&1
+-     if LC_ALL=C grep -E '(^|^a-zA-Z0-9_)_foo(^a-zA-Z0-9_|$)' conftest.$gl_asmext >/dev/null; then
++     if LC_ALL=C grep -E '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then
+        gl_cv_prog_as_underscore=yes
+      else
+        gl_cv_prog_as_underscore=no
+      fi
+      rm -f conftest*
recipes-core/gettext/gettext_0.19.%.bbappend +6 -1
index efd10d6bb6..1cf0188ea5 100644
@@ -2,5 +2,10 @@ 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"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
+SRC_URI_append = " \
+		file://fix-gl_cv_prog_as_underscore-test.patch \
+		"
 
Signature · 1 line
2.11.0
#6 lore raw

PATCH v2 6/19 gettext_0.19.%.bbappend: Handle packaging .dll's for mingw32

In reply to Nathan Rossi

Package the libgettext*.dll files in their respective packages.

---
 recipes-core/gettext/gettext_0.19.%.bbappend | 3 +++
 1 file changed, 3 insertions(+)
recipes-core/gettext/gettext_0.19.%.bbappend +3 -0
index 1cf0188ea5..d485cdc70e 100644
@@ -9,3 +9,6 @@ SRC_URI_append = " \
 		file://fix-gl_cv_prog_as_underscore-test.patch \
 		"
 
+FILES_libgettextlib_mingw32 = "${bindir}/libgettextlib-*.dll"
+FILES_libgettextsrc_mingw32 = "${bindir}/libgettextsrc-*.dll"
+
Signature · 1 line
2.11.0
#7 lore raw

PATCH v2 7/19 gettext_0.19.%.bbappend: Handle gettext-libintl .dll packaging

In reply to Nathan Rossi

For mingw32 handle packaging of gettext-libintl in bindir.

---
Note this patch is separated from the preceding due to being dependent on a change in oe-core/meta being applied to add the 'gettext-libintl' package.

---
 recipes-core/gettext/gettext_0.19.%.bbappend | 1 +
 1 file changed, 1 insertion(+)
recipes-core/gettext/gettext_0.19.%.bbappend +1 -0
index d485cdc70e..6238b3871a 100644
@@ -11,4 +11,5 @@ SRC_URI_append = " \
 
 FILES_libgettextlib_mingw32 = "${bindir}/libgettextlib-*.dll"
 FILES_libgettextsrc_mingw32 = "${bindir}/libgettextsrc-*.dll"
+FILES_gettext-libintl_mingw32 = "${bindir}/libintl*.dll"
 
Signature · 1 line
2.11.0
#8 lore raw

PATCH v2 8/19 glib-2.0: 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
#9 lore raw

PATCH v2 9/19 glib-2.0: Disable libmount support for mingw32 targets

In reply to Nathan Rossi

MinGW/Windows does not have support for libmount, so disable it when targeting mingw32.

---
 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 2b9ec53182..5683364c37 100644
@@ -4,3 +4,7 @@ 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"
+
+# libmount is not buildable for mingw/windows
+PACKAGECONFIG_remove_mingw32 = "libmount"
+
Signature · 1 line
2.11.0
#10 lore raw

PATCH v2 10/19 glib-2.0: Handle packaging .dll and .exe files for mingw32

In reply to Nathan Rossi

Handle the packaging of .dll files into the ${PN} package, also package only certain .exe files into the ${PN} and others into the ${PN}-utils packages. This is required due to the mingw/windows convention where .dll's are shipped in the bindir.

Move the packaging of *.def into the ${PN}-dev package, it is only used during development/compilation.

---
 recipes-core/glib-2.0/glib-2.0_%.bbappend | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
recipes-core/glib-2.0/glib-2.0_%.bbappend +8 -1
index 5683364c37..2accd7aa83 100644
@@ -1,5 +1,5 @@
 EXTRA_OECONF_mingw32 = "--enable-included-printf=yes ${CORECONF}"
-FILES_${PN}_append_mingw32 = " ${libdir}/charset.alias ${libdir}/gthread-2.0.def"
+FILES_${PN}_append_mingw32 = " ${libdir}/charset.alias"
 
 # glib always provides bash-completion output, package the output but prevent
 # the dependency chain on bash (via bash-completion) for mingw32 targets only.
@@ -8,3 +8,10 @@ RDEPENDS_${PN}-bash-completion_remove_mingw32 = "bash-completion"
 # libmount is not buildable for mingw/windows
 PACKAGECONFIG_remove_mingw32 = "libmount"
 
+FILES_${PN}_append_mingw32 = " \
+		${bindir}/lib*.dll \
+		${libexecdir}/*gio-querymodules.exe \
+		"
+FILES_${PN}-dev_append_mingw32 = " ${libdir}/*.def"
+FILES_${PN}-utils_mingw32 = "${bindir}/*.exe"
+
Signature · 1 line
2.11.0
#11 lore raw

PATCH v2 11/19 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 removal of charset.alias are handled in oe-core.

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

PATCH v2 12/19 dtc: Only build libfdt for mingw32

In reply to Nathan Rossi

Whilst building libfdt on mingw32 is functional, building dtc for mingw32 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
#13 lore raw

PATCH v2 13/19 libsdl: Windows specific PACKAGECONFIG

In reply to Nathan Rossi

Add a PACKAGECONFIG for 'stdio-redirect'. This configure option enables/disables the Windows only option for redirecting the stdout/stderr to files instead of to the console.

Add the 'directx' PACKAGECONFIG to configure whether to build with DirectX support. By default this is enabled (when targeting mingw32/windows) however this requires the DirectX libraries in order to include and link against.

Disable X11 support when building for the nativesdk mingw32.

---
 recipes-graphics/libsdl/libsdl_%.bbappend | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 recipes-graphics/libsdl/libsdl_%.bbappend
recipes-graphics/libsdl/libsdl_%.bbappend new file +7 -0
new file mode 100644
index 0000000000..5f5787d318
@@ -0,0 +1,7 @@
+# Disable default x11 support
+PACKAGECONFIG_class-nativesdk_mingw32 = ""
+
+# Configs that only apply to Windows/MinGW
+PACKAGECONFIG[stdio-redirect] = "--enable-stdio-redirect,--disable-stdio-redirect"
+PACKAGECONFIG[directx] = "--enable-directx,--disable-directx"
+
Signature · 1 line
2.11.0
#14 lore raw

PATCH v2 14/19 libsdl: Fix ${PN}-bin handling for .exe files

In reply to Nathan Rossi

For mingw it is convention to have DLLs in bindir. To avoid grouping anything other that .exe files into the ${PN}-bin package, override it so that only '*.exe' files are shipped.

---
 recipes-graphics/libsdl/libsdl_%.bbappend | 2 ++
 1 file changed, 2 insertions(+)
recipes-graphics/libsdl/libsdl_%.bbappend +2 -0
index 5f5787d318..bb65f03d89 100644
@@ -5,3 +5,5 @@ PACKAGECONFIG_class-nativesdk_mingw32 = ""
 PACKAGECONFIG[stdio-redirect] = "--enable-stdio-redirect,--disable-stdio-redirect"
 PACKAGECONFIG[directx] = "--enable-directx,--disable-directx"
 
+FILES_${PN}-bin_mingw32 = "${bindir}/*.exe ${sbindir}/*.exe"
+
Signature · 1 line
2.11.0
#15 lore raw

PATCH v2 15/19 libgpg-error: Handle packaging .exe files

In reply to Nathan Rossi

Handle packaging gpg-error.exe in the -dev package.

---
 recipes-support/libgpg-error/libgpg-error_%.bbappend | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 recipes-support/libgpg-error/libgpg-error_%.bbappend
recipes-support/libgpg-error/libgpg-error_%.bbappend new file +3 -0
new file mode 100644
index 0000000000..8fcfa78225
@@ -0,0 +1,3 @@
+
+FILES_${PN}-dev_append_mingw32 = " ${bindir}/gpg-error.exe"
+
Signature · 1 line
2.11.0
#16 lore raw

PATCH v2 16/19 libgpg-error_1.25.bbappend: Add patch to fix configure bug for mingw32

In reply to Nathan Rossi

Resolve bug with the generation of the versioninfo.rc file which depends on the BUILD_REVISION being set during configure. The BUILD_REVISION is unset when building against tarball source due to no git repository information. This patch sets the BUILD_REVISION to 0 when no information is available.

---
 ...c-Set-mym4_revision-to-0-if-not-a-git-rep.patch | 46 ++++++++++++++++++++++
 .../libgpg-error/libgpg-error_1.25.bbappend        |  6 +++
 2 files changed, 52 insertions(+)
 create mode 100644 recipes-support/libgpg-error/files/configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch
 create mode 100644 recipes-support/libgpg-error/libgpg-error_1.25.bbappend
recipes-support/libgpg-error/files/configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch new file +46 -0
new file mode 100644
index 0000000000..ea5a10261c
@@ -0,0 +1,46 @@
+From 274bb6fc22f8e0bfe521305d5e67eee268cabf7f Mon Sep 17 00:00:00 2001
+From: Nathan Rossi <[email protected]>
+Date: Fri, 30 Dec 2016 18:02:26 +1000
+Subject: [PATCH] configure.ac: Set 'mym4_revision' to 0 if not a git repo
+
+---
+It is possible for the source to not be located in a git repository
+(e.g. source is from a tarball). In which case the git repository
+information is not available. This results in the mym4_revision being an
+empty string however this value is used in BUILD_FILEVERSION where it is
+assumed to be 4 decimal values. Additionally BUILD_REVISION uses this
+value and is also assumed to be non-empty.
+
+In the case of BUILD_FILEVERSION it is used in versioninfo.rc.in, where
+it must be populated as 4 decimal values due to the expected syntax. In
+cases where it is not (e.g. when BUILD_FILEVERSION = '1,26,0,' a syntax
+error is raised.
+
+    windres: versioninfo.rc.in:21: syntax error
+
+This patch changes mym4_revision so that if the 'git rev-parse' returns
+non-zero (e.g. not in a git repository) the value falls back to '0'.
+This propagates as '0' to both BUILD_FILEVERSION and BUILD_REVISION.
+
+Signed-off-by: Nathan Rossi <[email protected]>
+Upstream-Status: Submitted
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 6d4f173d1b..149ac02b5f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -35,7 +35,7 @@ m4_define([mym4_version_minor], [27])
+ # processing is done by autoconf and not during the configure run.
+ m4_define([mym4_version], [mym4_version_major.mym4_version_minor])
+ m4_define([mym4_revision],
+-          m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
++          m4_esyscmd([(git rev-parse --short HEAD || printf '0') | tr -d '\n\r']))
+ m4_define([mym4_revision_dec],
+           m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
+ m4_define([mym4_betastring],
+-- 
+2.11.0
+
recipes-support/libgpg-error/libgpg-error_1.25.bbappend new file +6 -0
new file mode 100644
index 0000000000..e30e37688e
@@ -0,0 +1,6 @@
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI_append = " \
+		file://configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch \
+		"
+
Signature · 1 line
2.11.0
#17 lore raw

PATCH v2 17/19 libgcrypt: Handle packaging of .exe and .def files

In reply to Nathan Rossi

Handle packaging of .exe for the hmac/dumpexp packages. Also add the packaging of mpicalc.exe to the -dev package.

Also handle the packaging of the .def files into the -dev package.

---
 recipes-support/libgcrypt/libgcrypt_%.bbappend | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100644 recipes-support/libgcrypt/libgcrypt_%.bbappend
recipes-support/libgcrypt/libgcrypt_%.bbappend new file +8 -0
new file mode 100644
index 0000000000..631cbabb3e
@@ -0,0 +1,8 @@
+
+FILES_${PN}-dev_append_mingw32 = " \
+		${libdir}/*.def \
+		${bindir}/hmac256.exe \
+		${bindir}/mpicalc.exe \
+		"
+FILES_dumpsexp-dev_append_mingw32 = " ${bindir}/dumpsexp.exe"
+
Signature · 1 line
2.11.0
#18 lore raw

PATCH v2 18/19 libgcrypt: Disable 'capabilities' for mingw32

In reply to Nathan Rossi

libcap does not support mingw32, so disable 'capabilities' support for the mingw32 targets.

---
 recipes-support/libgcrypt/libgcrypt_%.bbappend | 3 +++
 1 file changed, 3 insertions(+)
recipes-support/libgcrypt/libgcrypt_%.bbappend +3 -0
index 631cbabb3e..50dca097fb 100644
@@ -1,4 +1,7 @@
 
+# libcap does not support mingw32
+PACKAGECONFIG_remove_mingw32 = "capabilities"
+
 FILES_${PN}-dev_append_mingw32 = " \
 		${libdir}/*.def \
 		${bindir}/hmac256.exe \
Signature · 1 line
2.11.0
#19 lore raw

PATCH v2 19/19 libgcrypt_1.7.3.bbappend: Add patch to fix configure bug for mingw32

In reply to Nathan Rossi

Resolve bug with the generation of the versioninfo.rc file which depends on the BUILD_REVISION being set during configure. The BUILD_REVISION is unset when building against tarball source due to no git repository information. This patch sets the BUILD_REVISION to 0 when no information is available.

---
 ...c-Set-mym4_revision-to-0-if-not-a-git-rep.patch | 46 ++++++++++++++++++++++
 recipes-support/libgcrypt/libgcrypt_1.7.3.bbappend |  6 +++
 2 files changed, 52 insertions(+)
 create mode 100644 recipes-support/libgcrypt/files/configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch
 create mode 100644 recipes-support/libgcrypt/libgcrypt_1.7.3.bbappend
recipes-support/libgcrypt/files/configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch new file +46 -0
new file mode 100644
index 0000000000..b7b407ab4b
@@ -0,0 +1,46 @@
+From bb6f9e18b5ccef26978f3f3ed2fe7bf3d4d498e7 Mon Sep 17 00:00:00 2001
+From: Nathan Rossi <[email protected]>
+Date: Fri, 30 Dec 2016 18:02:26 +1000
+Subject: [PATCH] configure.ac: Set 'mym4_revision' to 0 if not a git repo
+
+---
+It is possible for the source to not be located in a git repository
+(e.g. source is from a tarball). In which case the git repository
+information is not available. This results in the mym4_revision being an
+empty string however this value is used in BUILD_FILEVERSION where it is
+assumed to be 4 decimal values. Additionally BUILD_REVISION uses this
+value and is also assumed to be non-empty.
+
+In the case of BUILD_FILEVERSION it is used in versioninfo.rc.in, where
+it must be populated as 4 decimal values due to the expected syntax. In
+cases where it is not (e.g. when BUILD_FILEVERSION = '1,7,5,' a syntax
+error is raised.
+
+    windres: versioninfo.rc.in:21: syntax error
+
+This patch changes mym4_revision so that if the 'git rev-parse' returns
+non-zero (e.g. not in a git repository) the value falls back to '0'.
+This propagates as '0' to both BUILD_FILEVERSION and BUILD_REVISION.
+
+Signed-off-by: Nathan Rossi <[email protected]>
+Upstream-Status: Submitted
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 31c0d553fa..a3deffa6e9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -39,7 +39,7 @@ m4_define(mym4_version_micro, [0])
+ m4_define(mym4_version,
+           [mym4_version_major.mym4_version_minor.mym4_version_micro])
+ m4_define([mym4_revision],
+-          m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
++          m4_esyscmd([(git rev-parse --short HEAD || printf '0') | tr -d '\n\r']))
+ m4_define([mym4_revision_dec],
+           m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
+ m4_define([mym4_betastring],
+-- 
+2.11.0
+
recipes-support/libgcrypt/libgcrypt_1.7.3.bbappend new file +6 -0
new file mode 100644
index 0000000000..e30e37688e
@@ -0,0 +1,6 @@
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+SRC_URI_append = " \
+		file://configure.ac-Set-mym4_revision-to-0-if-not-a-git-rep.patch \
+		"
+
Signature · 1 line
2.11.0
#20 lore raw
In reply to Nathan Rossi
Quoted 49 lines · Nathan Rossi

This series enables a number of packages and dependencies to be built for mingw32. The goal is to enable the building and packaging of QEMU targeting mingw32 with support for SDL/VNC enabled as well as being able to execute the qemu* machines of oe-core/meta.

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
* Fix/enable building of shared libraries for gettext
* Work around to avoid dependency on bash for glib-2.0, clean up of some glib-2.0 appends which are resolved in oe-core meta
* Better packaging of libgcc for easy use on Windows (deploy dll to bindir)
* Updating FILES_* to support locations for mingw32 output (bindir contains .dll) for libgcc, expat, libpcre, gettext, glib-2.0, libsdl, libgpg-error and libgcrypt
* Addition of PACKAGECONFIG options to libsdl, and configuring of PACKAGECONFIG for libsdl, glib-2.0 and libgcrypt to handle Windows only features and or ability to disable features that do not support mingw32/Windows
* Enabling build of libfdt in the dtc recipe, but skipping dtc itself
* Fixes for configuring libgpg-error and libgcrypt when targeting mingw32

The intended build execution is to allow for 'buildtools-tarball' (or any populate_sdk target with 'nativesdk-qemu' in TOOLCHAIN_HOST_TASK) to create an output that includes all dependent nativesdk binaries as well as a nativesdk QEMU binaries. This series does not however address fixing the environment setup script or self-extracting installer shell script that is normally provided by buildtools-tarball.

This series with the multiple oe-core/meta series was tested on the following target Windows platforms: Windows 10 (64-bit), Windows 8.1 (64-bit) and Windows 7 SP1 (64-bit).

The changes were also tested on the following Linux build hosts: Debian 8 (64-bit), Ubuntu 16.04 (64-bit), CentOS 7 (64-bit).

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

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

This series partly depends on a set of series for oe-core/meta. The following series are required for building of QEMU (but not all parts of this series specifically), including dll packaging detection and libgcrypt support:

Quoted 5 lines

https://patchwork.openembedded.org/series/5049/
https://patchwork.openembedded.org/series/5050/
https://patchwork.openembedded.org/series/5051/
https://patchwork.openembedded.org/series/5052/
https://patchwork.openembedded.org/series/5053/

These patch series have been merged into oe-core. However the gettext-libintl packaging patch was moved to a change in meta-mingw layer as of v3 (see below).

I have updated and pushed a v3 branch of this meta-mingw series to the meta-mingw-contrib repo here:

http://git.yoctoproject.org/cgit/cgit.cgi/meta-mingw-contrib/log/?h=nrossi/mingw-qemu-v3

Changes v3:
* Updated changes to layer on current master of oe/meta
* Squished the gettext libintl packaging and dll packaging patches
* Moved the adding of the libintl packaging to meta-mingw

To avoid patch spam, I have skipped sending the v3 patches individually to the list. Please let me know if patch emails are desired.

Thanks,
Nathan