Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #1312

Closed
wants to merge 10 commits into from
Closed

Master #1312

Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions mingw-w64-clang/0061-libunwind-add-support-for-mingw-w64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
From 81b5dabfed88d2976faf587598361c054630ef95 Mon Sep 17 00:00:00 2001
From: Martell Malone <[email protected]>
Date: Tue, 21 Jul 2015 04:35:55 +0100
Subject: [PATCH] libunwind add support for mingw-w64


diff --git a/include/unwind.h b/include/unwind.h
index 31fb871..e8c63d7 100644
--- a/include/unwind.h
+++ b/include/unwind.h
@@ -121,7 +121,7 @@ struct _Unwind_Exception {
_Unwind_Exception *exc);
uintptr_t private_1; // non-zero means forced unwind
uintptr_t private_2; // holds sp that phase1 found for phase2 to use
-#ifndef __LP64__
+#if !defined(__LP64__) && !defined(_WIN64)
// The gcc implementation of _Unwind_Exception used attribute mode on the
// above fields which had the side effect of causing this whole struct to
// round up to 32 bytes in size. To be more explicit, we add pad fields
diff --git a/src/AddressSpace.hpp b/src/AddressSpace.hpp
index 567cbda..fd0b233 100644
--- a/src/AddressSpace.hpp
+++ b/src/AddressSpace.hpp
@@ -18,7 +18,7 @@
#include <stdlib.h>
#include <string.h>

-#ifndef _LIBUNWIND_IS_BAREMETAL
+#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32)
#include <dlfcn.h>
#endif

@@ -104,7 +104,7 @@ struct UnwindInfoSections {
/// making local unwinds fast.
class __attribute__((visibility("hidden"))) LocalAddressSpace {
public:
-#ifdef __LP64__
+#if defined(__LP64__) || defined(_WIN64)
typedef uint64_t pint_t;
typedef int64_t sint_t;
#else
@@ -156,7 +156,7 @@ public:
};

inline uintptr_t LocalAddressSpace::getP(pint_t addr) {
-#ifdef __LP64__
+#if defined(__LP64__) || defined(_WIN64)
return get64(addr);
#else
return get32(addr);
@@ -434,6 +434,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
},
&cb_data);
return static_cast<bool>(found);
+#elif defined(_WIN32)
#else
#error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires _LIBUNWIND_SUPPORT_DWARF_INDEX on this platform."
#endif
@@ -457,7 +458,9 @@ inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf,
size_t bufLen,
unw_word_t *offset) {
-#ifndef _LIBUNWIND_IS_BAREMETAL
+#ifdef _WIN32
+// FIXME: support DLLs on Windows.
+#elif !defined(_LIBUNWIND_IS_BAREMETAL)
Dl_info dyldInfo;
if (dladdr((void *)addr, &dyldInfo)) {
if (dyldInfo.dli_sname != NULL) {
diff --git a/src/UnwindLevel1-gcc-ext.c b/src/UnwindLevel1-gcc-ext.c
index 28ba092..0decf77 100644
--- a/src/UnwindLevel1-gcc-ext.c
+++ b/src/UnwindLevel1-gcc-ext.c
@@ -29,7 +29,7 @@
_LIBUNWIND_EXPORT _Unwind_Reason_Code
_Unwind_Resume_or_Rethrow(_Unwind_Exception *exception_object) {
#if _LIBUNWIND_ARM_EHABI
- _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%ld\n",
+ _LIBUNWIND_TRACE_API("_Unwind_Resume_or_Rethrow(ex_obj=%p), private_1=%" PRIdPTR "\n",
(void *)exception_object,
(long)exception_object->unwinder_cache.reserved1);
#else
diff --git a/src/assembly.h b/src/assembly.h
index f46a24d..4d6c3e1 100644
--- a/src/assembly.h
+++ b/src/assembly.h
@@ -26,6 +26,8 @@

#if defined(__APPLE__)
#define HIDDEN_DIRECTIVE .private_extern
+#elif defined(_WIN32)
+#define HIDDEN_DIRECTIVE .globl
#else
#define HIDDEN_DIRECTIVE .hidden
#endif
diff --git a/src/config.h b/src/config.h
index c9ec087..6f14e92 100644
--- a/src/config.h
+++ b/src/config.h
@@ -60,6 +60,23 @@
#define _LIBUNWIND_SUPPORT_DWARF_INDEX 0
#endif

+#elif defined(_WIN32)
+ // Note! the assembler files must be .S and not .s.
+ #define _LIBUNWIND_BUILD_ZERO_COST_APIS 1
+
+ // #define _LIBUNWIND_BUILD_SJLJ_APIS
+ // #define _LIBUNWIND_SUPPORT_FRAME_APIS
+ #define _LIBUNWIND_EXPORT
+ #define _LIBUNWIND_HIDDEN
+ #define _LIBUNWIND_LOG(msg, ...) fprintf(stderr, "libuwind: " msg, __VA_ARGS__)
+ #define _LIBUNWIND_ABORT(msg) do { fprintf(stderr, msg); abort(); } while(0)
+ #define _LIBUNWIND_SUPPORT_COMPACT_UNWIND 1
+ #define _LIBUNWIND_SUPPORT_DWARF_UNWIND 1
+ // #define _LIBUNWIND_SUPPORT_DWARF_INDEX
+ #define bzero(s,n) memset(s,0,n)
+ // libcxx may have defined __USE_MINGW_ANSI_STDIO.
+ // Here we would like to get the regular versions, not the _mingw ones.
+ #undef __USE_MINGW_ANSI_STDIO
#else
#include <stdlib.h>

--
2.4.5

82 changes: 53 additions & 29 deletions mingw-w64-clang/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
"${MINGW_PACKAGE_PREFIX}-libc++abi"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increase pkgrel

"${MINGW_PACKAGE_PREFIX}-libc++"
"${MINGW_PACKAGE_PREFIX}-lld"
"${MINGW_PACKAGE_PREFIX}-libunwind"
"${MINGW_PACKAGE_PREFIX}-llvm"
#"${MINGW_PACKAGE_PREFIX}-lldb"
)
Expand Down Expand Up @@ -39,25 +40,25 @@ source=(http://llvm.org/releases/${pkgver}/llvm-${pkgver}.src.tar.xz{,.sig}
http://llvm.org/releases/${pkgver}/clang-tools-extra-${pkgver}.src.tar.xz{,.sig}
http://llvm.org/releases/${pkgver}/lld-${pkgver}.src.tar.xz{,.sig}
http://llvm.org/releases/${pkgver}/lldb-${pkgver}.src.tar.xz{,.sig}
0001-Fix-GetHostTriple-for-mingw-w64-in-msys.patch
0002-use-DESTDIR-on-windows.patch
0003-generate-proper-library-names-mingw.patch
0012-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch
0013-mingw-w64-dont-have-dl-library.patch
0014-dont-create-cl-mingw.patch
0018-mingw-enable-static-libclang.patch
0021-missing-include.patch
0041-libcxx-add-support-for-mingw-w64.patch
)

http://llvm.org/releases/${pkgver}/libunwind-${pkgver}.src.tar.xz{,.sig}
"0001-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
"0002-use-DESTDIR-on-windows.patch"
"0003-generate-proper-library-names-mingw.patch"
"0012-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
"0013-mingw-w64-dont-have-dl-library.patch"
"0014-dont-create-cl-mingw.patch"
"0018-mingw-enable-static-libclang.patch"
"0021-missing-include.patch"
"0041-libcxx-add-support-for-mingw-w64.patch"
"0061-libunwind-add-support-for-mingw-w64.patch")
# Some patch notes :)
#0001-0009 -> llvm
#0011-0019 -> clang
#0021-0029 -> rt
#0031-0039 -> lld
#0041-0049 -> c++
#0051-0059 -> lldb

#0061-0069 -> libunwind
sha256sums=('555b028e9ee0f6445ff8f949ea10e9cd8be0d084840e21fbbe1d31d51fc06e46'
'SKIP'
'04149236de03cf05232d68eb7cb9c50f03062e339b68f4f8a03b650a11536cf9'
Expand All @@ -76,6 +77,8 @@ sha256sums=('555b028e9ee0f6445ff8f949ea10e9cd8be0d084840e21fbbe1d31d51fc06e46'
'SKIP'
'e3f68f44147df0433e7989bf6ed1c58ff28d7c68b9c47553cb9915f744785a35'
'SKIP'
'af3eaf39ecdc3b9e89863fb62e1aa3c135cfde7e9415424e4e396d7486a9422b'
'SKIP'
'0804146b32138d55c611336cc81e1783c29a8fab0fe62f248ba1ad7acc711c4d'
'76bcdcae0ef3a4d3ae7082b7fcd668e9560e63fb82068c3f889f9e89b9becf4a'
'6a95ed671876a6de04799d15bf7485d628016bb4a95a6764217ad452d8eed0d8'
Expand All @@ -84,9 +87,9 @@ sha256sums=('555b028e9ee0f6445ff8f949ea10e9cd8be0d084840e21fbbe1d31d51fc06e46'
'b03cfc7ebbbfb847e88ae3569d9dcafb01f179b06f1312de29fbd5b7cf906617'
'0e45e76ee6d6658de52edb7b508a8bcc9f10ff0b295ff2a4e35577136a40c6a5'
'a0933775b979b4879e220358b1076d8eeb9170403d0d190b1340d179fcd3cd1e'
'5b8edbbb638c906216e20229529e8348abc50d5886d20e07af08543e1e574e94')
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') #Hans Wennborg, Google

'5b8edbbb638c906216e20229529e8348abc50d5886d20e07af08543e1e574e94'
'c05162c426e90a01cef4a9d34d09e6314b966f2fea5a121223c98e51f5b6bd93')
validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg, Google.
noextract=(cfe-${pkgver}.src.tar.xz
#libcxx-${pkgver}.src.tar.xz
lldb-${pkgver}.src.tar.xz
Expand All @@ -97,26 +100,26 @@ prepare() {
plain "Extracting clang-${pkgver}.src.tar.xz due to symlink(s) without pre-existing target(s)"
[[ -d ${srcdir}/cfe-${pkgver} ]] && rm -rf ${srcdir}/cfe-${pkgver}
[[ -d ${srcdir}/cfe-${pkgver} ]] || tar -xJvf ${srcdir}/cfe-${pkgver}.src.tar.xz -C ${srcdir} || true

cd "${srcdir}/llvm-${pkgver}.src"
patch -p1 -i ${srcdir}/0001-Fix-GetHostTriple-for-mingw-w64-in-msys.patch
patch -p1 -i ${srcdir}/0002-use-DESTDIR-on-windows.patch
patch -p1 -i ${srcdir}/0003-generate-proper-library-names-mingw.patch
patch -p1 -i "${srcdir}/0001-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"
patch -p1 -i "${srcdir}/0002-use-DESTDIR-on-windows.patch"
patch -p1 -i "${srcdir}/0003-generate-proper-library-names-mingw.patch"

cd "${srcdir}/cfe-${pkgver}.src"
patch -p1 -i ${srcdir}/0012-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch
patch -p1 -i ${srcdir}/0013-mingw-w64-dont-have-dl-library.patch
patch -p1 -i ${srcdir}/0014-dont-create-cl-mingw.patch
patch -p1 -i ${srcdir}/0018-mingw-enable-static-libclang.patch
patch -p1 -i "${srcdir}/0012-Set-the-x86-arch-name-to-i686-for-mingw-w64.patch"
patch -p1 -i "${srcdir}/0013-mingw-w64-dont-have-dl-library.patch"
patch -p1 -i "${srcdir}/0014-dont-create-cl-mingw.patch"
patch -p1 -i "${srcdir}/0018-mingw-enable-static-libclang.patch"

cd "${srcdir}/compiler-rt-${pkgver}.src"
patch -p1 -i ${srcdir}/0021-missing-include.patch

cd "${srcdir}/lld-${pkgver}.src"

cd "${srcdir}/libcxx-${pkgver}.src"
patch -p1 -i "${srcdir}"/0041-libcxx-add-support-for-mingw-w64.patch

patch -p1 -i "${srcdir}/0041-libcxx-add-support-for-mingw-w64.patch"
cd "${srcdir}/libunwind-${pkgver}.src"
patch -p1 -i "${srcdir}/0061-libunwind-add-support-for-mingw-w64.patch"
cd "${srcdir}/llvm-${pkgver}.src"

# Fix docs installation directory
Expand All @@ -131,13 +134,15 @@ prepare() {
# See http://llvm.org/bugs/show_bug.cgi?id=4840

cd "${srcdir}"/llvm-${pkgver}.src
mv "${srcdir}/cfe-${pkgver}.src" tools/clang
mv "${srcdir}/clang-tools-extra-${pkgver}.src" tools/clang/tools/extra
# note you need to ignore failure if there is stuff that already exists
mv "${srcdir}/cfe-${pkgver}.src" tools/clang | true
mv "${srcdir}/clang-tools-extra-${pkgver}.src" tools/clang/tools/extra | true
mv "${srcdir}/lld-${pkgver}.src" tools/lld | true
#mv "${srcdir}/lldb-${pkgver}.src" tools/lldb
#mv "${srcdir}/lldb-${pkgver}.src" tools/lldb | true
mv "${srcdir}/compiler-rt-${pkgver}.src" projects/compiler-rt | true
mv "${srcdir}/libcxxabi-${pkgver}.src" projects/libcxxabi | true
mv "${srcdir}/libcxx-${pkgver}.src" projects/libcxx | true
mv "${srcdir}/libunwind-${pkgver}.src" projects/libunwind | true
#mv "${srcdir}/testsuite-${pkgver}.src" projects/test-suite | true
}

Expand Down Expand Up @@ -185,6 +190,7 @@ build() {
-DLIBCLANG_BUILD_STATIC=ON \
-DLIBCXX_ENABLE_SHARED=OFF \
-DLIBCXXABI_ENABLE_SHARED=OFF \
-DLIBUNWIND_ENABLE_SHARED=OFF \
"${extra_config[@]}" \
../llvm-${pkgver}.src

Expand All @@ -195,7 +201,8 @@ build() {
#
sed -i.orig '/\(clang\|lld\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake
sed -i.orig '/\(extra\|scan-build\|scan-view\)\/cmake_install.cmake/d' tools/clang/tools/cmake_install.cmake
sed -i.orig '/\(compiler-rt\|libcxxabi\|libcxx\)\/cmake_install.cmake/d' projects/cmake_install.cmake
# sed -i.orig '/\(compiler-rt\|libcxxabi\|libcxx\)\/cmake_install.cmake/d' projects/cmake_install.cmake
sed -i.orig '/\(compiler-rt\|libcxxabi\|libcxx\|libunwind\)\/cmake_install.cmake/d' projects/cmake_install.cmake
}

#check() {
Expand Down Expand Up @@ -236,6 +243,7 @@ package_compiler-rt() {
package_libcxxabi() {
pkgdesc="C++ Standard Library Support (mingw-w64)"
url="http://libcxxabi.llvm.org/"
depends="${MINGW_PACKAGE_PREFIX}-libunwind"

cd "${srcdir}/llvm-${pkgver}.src"
make -C ../build-${CARCH}/projects/libcxxabi -j1 DESTDIR="${pkgdir}" install
Expand All @@ -249,6 +257,14 @@ package_libcxx() {
make -C ../build-${CARCH}/projects/libcxx -j1 DESTDIR="${pkgdir}" install
}

package_libunwind() {
pkgdesc='A new implementation of a stack unwinder for C++ exceptions (mingw-w64)'
url='http://llvm.org'

cd "${srcdir}/llvm-${pkgver}.src"
make -C ../build-${CARCH}/projects/libunwind -j1 DESTDIR="${pkgdir}" install
}

package_lldb() {
pkgdesc="Next generation, high-performance debugger (mingw-w64)"
url="http://lldb.llvm.org/"
Expand Down Expand Up @@ -350,6 +366,10 @@ package_mingw-w64-i686-lldb(){
package_lldb
}

package_mingw-w64-i686-libunwind(){
package_libunwind
}

package_mingw-w64-i686-llvm(){
package_llvm
}
Expand Down Expand Up @@ -386,6 +406,10 @@ package_mingw-w64-x86_64-lldb(){
package_lldb
}

package_mingw-w64-x86_64-libunwind(){
package_libunwind
}

package_mingw-w64-x86_64-llvm(){
package_llvm
}
Expand Down
16 changes: 8 additions & 8 deletions mingw-w64-cmake/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_realname=cmake
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.4.1
pkgver=3.5.1
pkgrel=1
pkgdesc="A cross-platform open-source make system (mingw-w64)"
arch=('any')
Expand All @@ -26,20 +26,20 @@ source=("https://www.cmake.org/files/v${pkgver%.*}/${_realname}-${pkgver}.tar.gz
"qt5-static-plugin-support.patch"
"pkg-config-without-prefix.patch"
"do-not-generate-import-library-for-executables.patch")
sha256sums=('d41462bdd80dc37f0d5608167b354bb3af8c068eee640be04c907154c5c113e2'
sha256sums=('93d651a754bcf6f0124669646391dd5774c0fc4d407c384e3ae76ef9a60477e8'
'76565ffc20010b27e895af7919f35deedc7fd0b86ca8746bbc22329185ad57fa'
'aa816b734bf91941403b25bc9d9fd1797675ce2b4a7311bdb6e3ecae38964c37'
'5470eaf830aa43f37893d34af224915cc9be0c8b2d165a0115d7fd01881b9e69'
'3558259452883de78b176543de701d8a5757dbaf0d187b07e72256d97e13cabe'
'aa807e20e4a2902a8e6f3f36e1cd7d4b043d0df12f4fb0f4e6bd27d9d6842c0f'
'8503536bfc6606e147c62cd7bc28f984911a04b7bf8164264c345eacbf68dc5b')

prepare() {
cd ${_realname}-${pkgver}
patch -Np1 -i ${srcdir}/disable-response-files-for-msys.patch
patch -Np1 -i ${srcdir}/dont-install-bundle.patch
patch -Np1 -i ${srcdir}/qt5-static-plugin-support.patch
patch -Np1 -i ${srcdir}/pkg-config-without-prefix.patch
patch -Np1 -i ${srcdir}/do-not-generate-import-library-for-executables.patch
patch -Np1 -i "${srcdir}/disable-response-files-for-msys.patch"
patch -Np1 -i "${srcdir}/dont-install-bundle.patch"
# patch -Np1 -i "${srcdir}/qt5-static-plugin-support.patch"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why on earth have you disabled static plugin support?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the patch does not compile properly with the new version of CMake 3.5.1. I have not figured out how to fix that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you can't just silently drop a patch in that instance, you break a whole lot of things. If that happens, then you forgo the update to cmake 3.5.1 instead. I spent weeks working on qt5-static and cmake-with-qt5-static, do you think it's reasonable to just break this without so much as a mention?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the broken cmake 3.5.1 upgrade from this patchset. It represents a serious regression.

I'm sorry for being harsh here and really do appreciate the efforts, but please in future don't try to slip something like this into an otherwise good PR.

patch -Np1 -i "${srcdir}/pkg-config-without-prefix.patch"
patch -Np1 -i "${srcdir}/do-not-generate-import-library-for-executables.patch"
}

build() {
Expand Down
48 changes: 48 additions & 0 deletions mingw-w64-cunit/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Maintainer: Some One <[email protected]>

_realname=cunit
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
_distname="CUnit"
_distver="2.1-3"
pkgver=2.1.3
pkgrel=1
pkgdesc="Lightweight system for writing, administering, and running unit tests in C (mingw-w64)"
arch=('any')
url='http://cunit.sourceforge.net/'
license=('LGPL2.1')
source=("https://downloads.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2")
sha256sums=('f5b29137f845bb08b77ec60584fdb728b4e58f1023e6f249a464efa49a40f214')

prepare() {
cd "$srcdir/"${_distname}-${_distver}
}

build() {
cd "$srcdir"/${_distname}-${_distver}
rm -rf "${srcdir}"/build-${CARCH} | true
mkdir -p "${srcdir}"/build-${CARCH}
cp -Rf ${srcdir}/${_distname}-${_distver}/* "${srcdir}"/build-${CARCH}
cd "${srcdir}"/build-${CARCH}

./bootstrap /mingw
./configure \
--prefix=${MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--enable-debug \
--enable-static \
--enable-shared
sed "s|\/Users\/aks\/CUnitHome|${MINGW_PREFIX}|" -i cunit.pc
make
}

check() {
cd "${srcdir}"/build-${CARCH}
}

package() {
cd "${srcdir}"/build-${CARCH}
make install DESTDIR="${pkgdir}"
}
Loading