forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Matthias Aßhauer <mha1993@live.de>
- Loading branch information
Showing
10 changed files
with
278 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
mingw-w64-clang/0001-Fix-GetHostTriple-for-mingw-w64-in-msys.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
From b47a00af69f3c662e54dc54e482fc9b0d4ba6480 Mon Sep 17 00:00:00 2001 | ||
From: Martell Malone <martellmalone@gmail.com> | ||
Date: Sun, 28 Jun 2015 20:14:51 +0100 | ||
Subject: [PATCH 2/5] Fix GetHostTriple for mingw-w64 in msys | ||
|
||
--- | ||
cmake/modules/GetHostTriple.cmake | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/cmake/modules/GetHostTriple.cmake b/cmake/modules/GetHostTriple.cmake | ||
index 0cad1db4eff..47e9f986e15 100644 | ||
--- a/cmake/modules/GetHostTriple.cmake | ||
+++ b/cmake/modules/GetHostTriple.cmake | ||
@@ -16,7 +16,7 @@ | ||
else() | ||
set( value "i686-pc-windows-msvc" ) | ||
endif() | ||
- elseif( MINGW AND NOT MSYS ) | ||
+ elseif( MINGW ) | ||
# CMake doesn't provide COMPILER_ARCHITECTURE_ID for Clang/GCC, | ||
# but it does for MSVC. | ||
if( CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "ARM.*" ) | ||
2.13.3 | ||
|
30 changes: 30 additions & 0 deletions
30
mingw-w64-clang/0002-Revert-CMake-try-creating-symlink-first-on-windows.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- a/cmake/modules/LLVMInstallSymlink.cmake | ||
+++ b/cmake/modules/LLVMInstallSymlink.cmake | ||
@@ -6,6 +6,12 @@ | ||
|
||
function(install_symlink name target outdir) | ||
set(DESTDIR $ENV{DESTDIR}) | ||
+ if(CMAKE_HOST_UNIX) | ||
+ set(LINK_OR_COPY create_symlink) | ||
+ else() | ||
+ set(LINK_OR_COPY copy) | ||
+ endif() | ||
+ | ||
if(NOT IS_ABSOLUTE "${outdir}") | ||
set(outdir "${CMAKE_INSTALL_PREFIX}/${outdir}") | ||
endif() | ||
@@ -14,12 +20,7 @@ | ||
message(STATUS "Creating ${name}") | ||
|
||
execute_process( | ||
- COMMAND "${CMAKE_COMMAND}" -E create_symlink "${target}" "${name}" | ||
- WORKING_DIRECTORY "${outdir}" ERROR_VARIABLE has_err) | ||
- if(CMAKE_HOST_WIN32 AND has_err) | ||
- execute_process( | ||
- COMMAND "${CMAKE_COMMAND}" -E copy "${target}" "${name}" | ||
- WORKING_DIRECTORY "${outdir}") | ||
- endif() | ||
+ COMMAND "${CMAKE_COMMAND}" -E ${LINK_OR_COPY} "${target}" "${name}" | ||
+ WORKING_DIRECTORY "${outdir}") | ||
|
||
endfunction() |
26 changes: 26 additions & 0 deletions
26
mingw-w64-clang/0003-add-pthread-as-system-lib-for-mingw.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 9102055df75457e1194008ce6152221112a785ad Mon Sep 17 00:00:00 2001 | ||
From: Mateusz Mikula <mati865@gmail.com> | ||
Date: Tue, 14 Mar 2017 17:50:29 +0100 | ||
Subject: [PATCH 5/5] add pthread as system lib for mingw | ||
|
||
--- | ||
lib/Support/CMakeLists.txt | 3 +++ | ||
1 file changed, 3 insertions(+) | ||
|
||
diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt | ||
index 0a8e3897cce..de9cda5dda3 100644 | ||
--- a/lib/Support/CMakeLists.txt | ||
+++ b/lib/Support/CMakeLists.txt | ||
@@ -6,6 +6,9 @@ set(system_libs) | ||
# libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc. | ||
# advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc. | ||
set(system_libs ${system_libs} psapi shell32 ole32 uuid advapi32) | ||
+ if( MINGW ) | ||
+ set(system_libs ${system_libs} pthread) | ||
+ endif() | ||
elseif( CMAKE_HOST_UNIX ) | ||
if( HAVE_LIBRT ) | ||
set(system_libs ${system_libs} rt) | ||
-- | ||
2.13.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/include/llvm/TargetParser/Triple.h | ||
+++ b/include/llvm/TargetParser/Triple.h | ||
@@ -952,7 +952,7 @@ | ||
|
||
/// Tests whether the target uses emulated TLS as default. | ||
bool hasDefaultEmulatedTLS() const { | ||
- return isAndroid() || isOSOpenBSD() || isWindowsCygwinEnvironment(); | ||
+ return isAndroid() || isOSOpenBSD() || isOSCygMing(); | ||
} | ||
|
||
/// Tests whether the target uses -data-sections as default. |
11 changes: 11 additions & 0 deletions
11
mingw-w64-clang/0005-Fix-Any-linker-error-with-multiple-compilers.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/include/llvm/ADT/Any.h | ||
+++ b/include/llvm/ADT/Any.h | ||
@@ -124,7 +124,7 @@ | ||
std::unique_ptr<StorageBase> Storage; | ||
}; | ||
|
||
-template <typename T> char Any::TypeId<T>::Id = 0; | ||
+template <typename T> char Any::TypeId<T>::Id = 1; | ||
|
||
template <typename T> | ||
LLVM_DEPRECATED("Use any_cast(Any*) != nullptr instead", "any_cast") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From 9498118b65fa150f074efb52b4507b53434a90ad Mon Sep 17 00:00:00 2001 | ||
From: Mateusz Mikula <mati865@gmail.com> | ||
Date: Thu, 2 Feb 2017 12:33:51 +0100 | ||
Subject: [PATCH 4/6] link pthread with mingw | ||
|
||
--- | ||
lib/Driver/ToolChains/MinGW.cpp | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/lib/Driver/ToolChains/MinGW.cpp b/lib/Driver/ToolChains/MinGW.cpp | ||
index 632b76d92b..23da2d6376 100644 | ||
--- a/lib/Driver/ToolChains/MinGW.cpp | ||
+++ b/lib/Driver/ToolChains/MinGW.cpp | ||
@@ -265,7 +265,7 @@ | ||
if (Args.hasArg(options::OPT_pg)) | ||
CmdArgs.push_back("-lgmon"); | ||
|
||
- if (Args.hasArg(options::OPT_pthread)) | ||
+ if (!Args.hasArg(options::OPT_no_pthread)) | ||
CmdArgs.push_back("-lpthread"); | ||
|
||
if (Sanitize.needsAsanRt()) { | ||
-- | ||
2.14.1 | ||
|
65 changes: 65 additions & 0 deletions
65
mingw-w64-clang/0102-Rename-flang-new-flang-experimental-exec-to-flang.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Index: clang/include/clang/Driver/Options.td | ||
=================================================================== | ||
--- clang/include/clang/Driver/Options.td | ||
+++ clang/include/clang/Driver/Options.td | ||
@@ -5076,9 +5076,6 @@ | ||
// FLangOption + NoXarchOption | ||
//===----------------------------------------------------------------------===// | ||
|
||
-def flang_experimental_exec : Flag<["-"], "flang-experimental-exec">, | ||
- Flags<[FlangOption, FlangOnlyOption, NoXarchOption, HelpHidden]>, | ||
- HelpText<"Enable support for generating executables (experimental)">; | ||
|
||
def flang_experimental_hlfir : Flag<["-"], "flang-experimental-hlfir">, | ||
Flags<[FlangOption, FC1Option, FlangOnlyOption, NoXarchOption, HelpHidden]>, | ||
Index: clang/lib/Driver/Driver.cpp | ||
=================================================================== | ||
--- clang/lib/Driver/Driver.cpp | ||
+++ clang/lib/Driver/Driver.cpp | ||
@@ -1936,7 +1936,7 @@ | ||
|
||
void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const { | ||
if (IsFlangMode()) { | ||
- OS << getClangToolFullVersion("flang-new") << '\n'; | ||
+ OS << getClangToolFullVersion("flang") << '\n'; | ||
} else { | ||
// FIXME: The following handlers should use a callback mechanism, we don't | ||
// know what the client would like to do. | ||
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp | ||
=================================================================== | ||
--- clang/lib/Driver/ToolChains/CommonArgs.cpp | ||
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp | ||
@@ -886,12 +886,6 @@ | ||
void tools::addFortranRuntimeLibraryPath(const ToolChain &TC, | ||
const llvm::opt::ArgList &Args, | ||
ArgStringList &CmdArgs) { | ||
- // NOTE: Generating executables by Flang is considered an "experimental" | ||
- // feature and hence this is guarded with a command line option. | ||
- // TODO: Make this work unconditionally once Flang is mature enough. | ||
- if (!Args.hasArg(options::OPT_flang_experimental_exec)) | ||
- return; | ||
- | ||
// Default to the <driver-path>/../lib directory. This works fine on the | ||
// platforms that we have tested so far. We will probably have to re-fine | ||
// this in the future. In particular, on some platforms, we may need to use | ||
Index: clang/lib/Driver/ToolChains/Flang.cpp | ||
=================================================================== | ||
--- clang/lib/Driver/ToolChains/Flang.cpp | ||
+++ clang/lib/Driver/ToolChains/Flang.cpp | ||
@@ -409,14 +409,12 @@ | ||
|
||
CmdArgs.push_back(Input.getFilename()); | ||
|
||
- // TODO: Replace flang-new with flang once the new driver replaces the | ||
- // throwaway driver | ||
- const char *Exec = Args.MakeArgString(D.GetProgramPath("flang-new", TC)); | ||
+ const char *Exec = Args.MakeArgString(D.GetProgramPath("flang", TC)); | ||
C.addCommand(std::make_unique<Command>(JA, *this, | ||
ResponseFileSupport::AtFileUTF8(), | ||
Exec, CmdArgs, Inputs, Output)); | ||
} | ||
|
||
-Flang::Flang(const ToolChain &TC) : Tool("flang-new", "flang frontend", TC) {} | ||
+Flang::Flang(const ToolChain &TC) : Tool("flang", "flang frontend", TC) {} | ||
|
||
Flang::~Flang() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- a/MinGW/Options.td | ||
+++ b/MinGW/Options.td | ||
@@ -165,6 +165,8 @@ def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>; | ||
def: Joined<["-"], "O">; | ||
def: F<"as-needed">; | ||
def: F<"build-id">; | ||
+def: F<"default-image-base-high">; | ||
+def: F<"default-image-base-low">; | ||
def: F<"disable-auto-image-base">; | ||
def: F<"enable-auto-image-base">; | ||
def: F<"end-group">; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Patches statuses | ||
|
||
Legend: | ||
|
||
- :grey_exclamation: - not meant to upstream, for compatibility with GCC only | ||
- :x: - not upstreamed | ||
- :grey_question: - sent but not merged yet | ||
- :arrow_up_small: - upstreamed | ||
- :arrow_down_small: - backported | ||
|
||
----- | ||
|
||
- `"0001-Fix-GetHostTriple-for-mingw-w64-in-msys.patch"` :x: | ||
- `"0002-Revert-CMake-try-creating-symlink-first-on-windows.patch"` :x: (win symlinks don't play well with pacman packages) | ||
- `"0003-add-pthread-as-system-lib-for-mingw.patch"` :grey_exclamation: | ||
- `"0004-enable-emutls-for-mingw.patch"` :grey_exclamation: | ||
- `"0005-Fix-Any-linker-error-with-multiple-compilers.patch"` :grey_question: | ||
- `"0101-link-pthread-with-mingw.patch"` :grey_exclamation: | ||
- `"0301-Add-exceptions-for-Flang-runtime-libraries-on-MinGW.patch"` :upstreamed: | ||
- `"0303-ignore-new-bfd-options.patch"` :x: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
die () { | ||
printf "$@" >&2 | ||
cleanup | ||
exit 1 | ||
} | ||
cleanup(){ | ||
rm -rf upstream | ||
} | ||
|
||
pkgname=mingw-w64-clang | ||
|
||
old_pkgver="$(sed -ne 's/pkgver=\([.0-9]*\).*/\1/p' -e 's/_version=\([.0-9]*\).*/\1/p' < PKGBUILD)" | ||
old_pkgrel="$(sed -ne 's/pkgrel=\([0-9]*\).*/\1/p' < PKGBUILD)" | ||
|
||
test -n "$old_pkgver" || | ||
die "$0: could not determine current pkgver\n" | ||
|
||
test -n "$old_pkgrel" || | ||
die "$0: could not determine current pkgrel\n" | ||
|
||
git clone --sparse --depth 1 https://github.com/msys2/MINGW-packages upstream | ||
cd upstream | ||
git sparse-checkout add $pkgname | ||
cd .. | ||
|
||
new_pkgver="$(sed -ne 's/pkgver=\([.0-9]*\).*/\1/p' -e 's/_version=\([.0-9]*\).*/\1/p' < upstream/$pkgname/PKGBUILD)" | ||
new_pkgrel="$(sed -ne 's/pkgrel=\([0-9]*\).*/\1/p' < upstream/$pkgname/PKGBUILD)" | ||
rc="$(sed -ne 's/_rc="\(*\)".*/\1/p' < upstream/$pkgname/PKGBUILD)" | ||
|
||
test -n "$new_pkgver" || | ||
die "$0: could not determine new pkgver\n" | ||
|
||
test -n "$new_pkgrel" || | ||
die "$0: could not determine new pkgrel\n" | ||
|
||
test -z "$rc" || | ||
die "$0: MSYS2 is currently on an RC version. This script is not able to handle RC versions." | ||
|
||
test "$new_pkgver" = "$old_pkgver" && | ||
new_pkgrel="$old_pkgrel" | ||
|
||
new_pkgrel=$(("$new_pkgrel"+1)) | ||
|
||
rm -f *.patch | ||
mv upstream/$pkgname/*.patch ./ | ||
rm -f PKGBUILD | ||
mv upstream/$pkgname/PKGBUILD ./ | ||
rm -f README-patches.md | ||
mv upstream/$pkgname/README-patches.md ./ | ||
|
||
sed -i "s/pkgrel=[.0-9]\+\(.*\)/pkgrel=$new_pkgrel\1/" PKGBUILD | ||
sed -i 's/-DLLVM_TARGETS_TO_BUILD=".*"/-DLLVM_TARGETS_TO_BUILD="host"/' PKGBUILD | ||
|
||
cleanup |