From 46d0746d53f863d9d76fa117f1259459803a36e3 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Thu, 1 Jun 2017 08:25:30 +0300 Subject: winpthreads: use posix threads library from mingw64 Change from win32 thread model to posix model to get access to the c++11 features. Use the winpthreads library available in the mingw64. Change-Id: I842c65781436f8b82653350bdd83c668f18286ae Reviewed-by: Mikko Gronoff Reviewed-by: Samuli Piippo --- conf/machine-sdk/i686-mingw32.conf | 2 - conf/machine-sdk/x86_64-mingw32.conf | 2 - recipes-core/gettext/gettext_0.19.%.bbappend | 6 +-- recipes-devtools/gcc/gcc-runtime_%.bbappend | 2 +- .../mingw-w64/nativesdk-mingw-w64-headers_5.0.0.bb | 5 +++ .../nativesdk-mingw-w64-winpthreads_5.0.0.bb | 31 ++++++++++++++ .../pthreads-win32/pthreads-win32_2.9.1.bb | 47 ---------------------- 7 files changed, 38 insertions(+), 57 deletions(-) create mode 100644 recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_5.0.0.bb delete mode 100644 recipes-devtools/pthreads-win32/pthreads-win32_2.9.1.bb diff --git a/conf/machine-sdk/i686-mingw32.conf b/conf/machine-sdk/i686-mingw32.conf index d426fe3..c3b54e4 100644 --- a/conf/machine-sdk/i686-mingw32.conf +++ b/conf/machine-sdk/i686-mingw32.conf @@ -1,8 +1,6 @@ SDK_ARCH = "i686" SDK_OS = "mingw32" -GCCTHREADS_mingw32 = "win32" - PREFERRED_PROVIDER_virtual/nativesdk-${SDK_PREFIX}libc-for-gcc_mingw32 = "nativesdk-mingw-w64-runtime" PREFERRED_PROVIDER_virtual/nativesdk-${SDK_PREFIX}libc-initial_mingw32 = "nativesdk-mingw-w64-runtime" PREFERRED_PROVIDER_virtual/nativesdk-libc = "nativesdk-mingw-w64-runtime" diff --git a/conf/machine-sdk/x86_64-mingw32.conf b/conf/machine-sdk/x86_64-mingw32.conf index b9706f9..b9142f2 100644 --- a/conf/machine-sdk/x86_64-mingw32.conf +++ b/conf/machine-sdk/x86_64-mingw32.conf @@ -1,8 +1,6 @@ SDK_ARCH = "x86_64" SDK_OS = "mingw32" -GCCTHREADS_mingw32 = "win32" - PREFERRED_PROVIDER_virtual/nativesdk-${SDK_PREFIX}libc-for-gcc_mingw32 = "nativesdk-mingw-w64-runtime" PREFERRED_PROVIDER_virtual/nativesdk-${SDK_PREFIX}libc-initial_mingw32 = "nativesdk-mingw-w64-runtime" PREFERRED_PROVIDER_virtual/nativesdk-libc = "nativesdk-mingw-w64-runtime" diff --git a/recipes-core/gettext/gettext_0.19.%.bbappend b/recipes-core/gettext/gettext_0.19.%.bbappend index efd10d6..4270a86 100644 --- a/recipes-core/gettext/gettext_0.19.%.bbappend +++ b/recipes-core/gettext/gettext_0.19.%.bbappend @@ -1,6 +1,2 @@ -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-static --disable-shared " diff --git a/recipes-devtools/gcc/gcc-runtime_%.bbappend b/recipes-devtools/gcc/gcc-runtime_%.bbappend index df0ac9e..28237a5 100644 --- a/recipes-devtools/gcc/gcc-runtime_%.bbappend +++ b/recipes-devtools/gcc/gcc-runtime_%.bbappend @@ -6,4 +6,4 @@ FILES_libssp_append_mingw32 = " ${bindir}/libssp*.dll" RUNTIMETARGET_remove_mingw32 = "libatomic libgomp" RUNTIMETARGET_remove_mingw32 = "libitm" -DEPENDS_append_mingw32 = " pthreads-win32" +DEPENDS_append_mingw32 = " nativesdk-mingw-w64-winpthreads" diff --git a/recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_5.0.0.bb b/recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_5.0.0.bb index 5126a35..95fc69b 100644 --- a/recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_5.0.0.bb +++ b/recipes-devtools/mingw-w64/nativesdk-mingw-w64-headers_5.0.0.bb @@ -26,4 +26,9 @@ do_compile() { : } +do_install_append() { + # install correct pthread headers + install -m 0644 -t ${D}${includedir} ${S}/../mingw-w64-libraries/winpthreads/include/*.h +} + FILES_${PN} += "${exec_prefix}/${TARGET_SYS}" diff --git a/recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_5.0.0.bb b/recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_5.0.0.bb new file mode 100644 index 0000000..959d045 --- /dev/null +++ b/recipes-devtools/mingw-w64/nativesdk-mingw-w64-winpthreads_5.0.0.bb @@ -0,0 +1,31 @@ +DESCRIPTION = "Winpthreads runtime libraries from MinGW-w64 project" +LICENSE = "ZPL-2.1" +LIC_FILES_CHKSUM = "file://../../COPYING;md5=bb936f0e04d8f1e19ad545100cee9654" + +COMPATIBLE_HOST = ".*-mingw.*" + +SRC_URI = "${SOURCEFORGE_MIRROR}/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v${PV}.tar.bz2" +SRC_URI[md5sum] = "c9f4bb72a87d9be2cc98e0d7e1868c88" +SRC_URI[sha256sum] = "e41d8ca739e22b4215c8ebe99ed2fc398c734cae73877f3143c394661b096d08" + +S = "${WORKDIR}/mingw-w64-v${PV}/mingw-w64-libraries/winpthreads" +B = "${WORKDIR}/build-${TARGET_SYS}" + +inherit autotools nativesdk + +INHIBIT_DEFAULT_DEPS = "1" +DEPENDS = "nativesdk-mingw-w64-runtime" + +do_configure() { + oe_runconf +} + +STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" +STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" +TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}" +PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" + +do_install_append() { + # headers are already installed by mingw-w64-headers + rm -rf ${D}${includedir} +} diff --git a/recipes-devtools/pthreads-win32/pthreads-win32_2.9.1.bb b/recipes-devtools/pthreads-win32/pthreads-win32_2.9.1.bb deleted file mode 100644 index 68291b9..0000000 --- a/recipes-devtools/pthreads-win32/pthreads-win32_2.9.1.bb +++ /dev/null @@ -1,47 +0,0 @@ -DESCRIPTION = "A Win32 implementation of the POSIX standard threads API" -HOMEPAGE = "http://www.sourceware.org/pthreads-win32" -LICENSE = "LGPLv2.1" -LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=7fbc338309ac38fefcd64b04bb903e34" - -BBCLASSEXTEND = "nativesdk" - -COMPATIBLE_HOST = ".*-mingw.*" - -## Replace dots with dashes -PVdash = "2-9-1" - -## cvs -d :pserver:anonymous@sourceware.org:/cvs/pthreads-win32 checkout pthreads -SRC_URI = "ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-${PVdash}-release.tar.gz" -SRC_URI[md5sum] = "36ba827d6aa0fa9f9ae740a35626e2e3" -SRC_URI[sha256sum] = "e6aca7aea8de33d9c8580bcb3a0ea3ec0a7ace4ba3f4e263ac7c7b66bc95fb4d" - -## Reference: http://sourceware.org/ml/pthreads-win32/2009/msg00030/w64sup.patch -#SRC_URI += "file://w64sup.patch" - -S = "${WORKDIR}/pthreads-w32-${PVdash}-release" - -INHIBIT_DEFAULT_DEPS = "1" -DEPENDS = "virtual/${SDK_PREFIX}gcc-initial libgcc virtual/libc" - -do_configure_prepend() { - ## First reset all permissions because all are executable - find . -type f -exec chmod 644 {} \; - ## Make a copy of config.h - cp config.h pthreads_win32_config.h -} - -do_compile() { - make -f GNUmakefile CROSS=${SDK_PREFIX} CC="${CC}" RC="${WINDRES}" clean GC -} - -do_install() { - install -d -m 0755 ${D}${bindir} - install -d -m 0755 ${D}${includedir} - install -d -m 0755 ${D}${libdir} - - install -m 0644 ${S}/pthread.h ${S}/sched.h ${S}/semaphore.h ${D}${includedir}/ - - install -m 0644 ${S}/libpthreadGC2.a ${D}${libdir}/libpthread.dll.a - install -m 0644 ${S}/pthreadGC2.dll ${D}${bindir}/libpthread-2.dll - install -m 0644 ${S}/pthreadGC2.dll ${D}${bindir}/pthreadGC2.dll -} -- cgit v1.2.3