swift: 4.0.3 -> 4.1

This commit is contained in:
Will Dietz 2018-03-30 02:09:26 -05:00
parent 80e730c9a4
commit 26f537ffab
7 changed files with 39 additions and 271 deletions

View File

@ -37,7 +37,7 @@
}:
let
v_major = "4.0.3";
v_major = "4.1";
version = "${v_major}-RELEASE";
version_friendly = "${v_major}";
@ -55,15 +55,15 @@ let
# For more inforation, see: https://github.com/apple/swift/pull/3594#issuecomment-234169759
clang = fetch {
repo = "swift-clang";
sha256 = "0zm624iwiprk3c3nzqf4p1fd9zqic4yi3jv51cw3249ax4x6vy10";
sha256 = "0j8bi6jv4m4hqiib02q5cvnxd9j6bwiri853x6px86vai3mdff0h";
};
llvm = fetch {
repo = "swift-llvm";
sha256 = "11vw6461c0cdvwm1wna1a5709fjj14hzp6br6jg94p4f6jp3yv4d";
sha256 = "03558f5zbchqvdabi3x9ahyz4xkmj7w69gazivz372832lgr9zfh";
};
compilerrt = fetch {
repo = "swift-compiler-rt";
sha256 = "1hj4qaj4c9n2wzg2cvarbyl0n708zd1dlw4zkzq07fjxxqs36nfa";
sha256 = "1wkymmxi2v759xkwlzfrq9rivndjfvp6ikrzz10mvvrvyvrgwqnl";
};
cmark = fetch {
repo = "swift-cmark";
@ -71,32 +71,32 @@ let
};
lldb = fetch {
repo = "swift-lldb";
sha256 = "0yk5qg85008vcn63vn2jpn5ls9pdhda222p2w1cfkrj27k5k8vqr";
sha256 = "09x3d3bc6rn9g6jpi3fb120c4r2carsmqla4bq4scjrs0867jz9m";
};
llbuild = fetch {
repo = "swift-llbuild";
sha256 = "0jffw6z1s6ck1i05brw59x6vsg7zrxbz5n2wz72fj29rh3nppc7a";
sha256 = "04y0ihfyam2n671vmpk9gy0gb9lb3ivh6mr19862p5kg5bmrcic1";
};
pm = fetch {
repo = "swift-package-manager";
sha256 = "0xj070b8fii7ijfsnyq4fxgv6569vdrg0yippi85h2p1l7s9aagh";
sha256 = "08d87fc29qq7m92jaxkiczsa7b567pwbibiwwkzdrj6a0gr11qn3";
};
xctest = fetch {
repo = "swift-corelibs-xctest";
sha256 = "0l355wq8zfwrpv044xf4smjwbm0bmib360748n8cwls3vkr9l2yv";
sha256 = "1alkgxx8jsr2jjv2kchnjaaddb1byjwim015m1z3qxh6lknqm0k5";
};
foundation = fetch {
repo = "swift-corelibs-foundation";
sha256 = "0s7yc5gsbd96a4bs8c6q24dyfjm4xhcr2nzhl2ics8dmi60j15s4";
sha256 = "06pbhb7wg4q5qgprhiyzbqy6hssga7xxjclhlh81gd6rvfd6bxvw";
};
libdispatch = fetch {
repo = "swift-corelibs-libdispatch";
sha256 = "0x8zzq3shhvmhq4sbhaaa0ddiv3nw347pz6ayym6jyzq7j9n15ia";
sha256 = "198vskbajch8s168a649qz5an92i2mxmmmzcjlgxlzh38fgxri0n";
fetchSubmodules = true;
};
swift = fetch {
repo = "swift";
sha256 = "0a1gq0k5701i418f0qi7kywv16q7vh4a4wp0f6fpyv4sjkq27msx";
sha256 = "1flvr12bg8m4k44yq0xy9qrllv5rpxgxisjgbpakk5p3myfsx7ky";
};
};
@ -132,19 +132,6 @@ let
install_destdir=$SWIFT_INSTALL_DIR \
extra_cmake_options="${stdenv.lib.concatStringsSep "," cmakeFlags}"'';
# from llvm/4/llvm.nix
sigaltstackPatch = fetchpatch {
name = "sigaltstack.patch"; # for glibc-2.26
url = https://github.com/llvm-mirror/compiler-rt/commit/8a5e425a68d.diff;
sha256 = "0h4y5vl74qaa7dl54b1fcyqalvlpd8zban2d1jxfkxpzyi7m8ifi";
};
# https://bugs.swift.org/browse/SR-6409
sigunusedPatch = fetchpatch {
name = "sigunused.patch";
url = "https://github.com/apple/swift-llbuild/commit/303a89bc6da606c115560921a452686aa0655f5e.diff";
sha256 = "04sw7ym1grzggj1v3xrzr2ljxz8rf9rnn9n5fg1xjbwlrdagkc7m";
};
in
stdenv.mkDerivation rec {
name = "swift-${version_friendly}";
@ -179,7 +166,7 @@ stdenv.mkDerivation rec {
configurePhase = ''
cd ..
export INSTALLABLE_PACKAGE=$PWD/swift.tar.gz
mkdir build install
@ -236,20 +223,18 @@ stdenv.mkDerivation rec {
'' + ''
patch -p1 -d swift -i ${./patches/0001-build-presets-linux-don-t-require-using-Ninja.patch}
patch -p1 -d swift -i ${./patches/0002-build-presets-linux-allow-custom-install-prefix.patch}
patch -p1 -d swift -i ${./patches/0003-build-presets-linux-disable-tests.patch}
patch -p1 -d swift -i ${./patches/0004-build-presets-linux-plumb-extra-cmake-options.patch}
# https://sourceware.org/glibc/wiki/Release/2.26#Removal_of_.27xlocale.h.27
patch -p1 -i ${./patches/remove_xlocale.patch}
# https://bugs.swift.org/browse/SR-4633
patch -p1 -d swift -i ${./patches/icu59.patch}
sed -i swift/utils/build-presets.ini \
-e 's/^test-installable-package$/# \0/' \
-e 's/^test$/# \0/' \
-e 's/^validation-test$/# \0/' \
-e 's/^long-test$/# \0/'
# https://bugs.swift.org/browse/SR-5779
sed -i -e 's|"-latomic"|"-Wl,-rpath,${clang.cc.gcc.lib}/lib" "-L${clang.cc.gcc.lib}/lib" "-latomic"|' swift/cmake/modules/AddSwift.cmake
# https://bugs.swift.org/browse/SR-4838
sed -i -e '30i#include <functional>' lldb/include/lldb/Utility/TaskPool.h
substituteInPlace clang/lib/Driver/ToolChains.cpp \
substituteInPlace clang/lib/Driver/ToolChains/Linux.cpp \
--replace ' addPathIfExists(D, SysRoot + "/usr/lib", Paths);' \
' addPathIfExists(D, SysRoot + "/usr/lib", Paths); addPathIfExists(D, "${glibc}/lib", Paths);'
patch -p1 -d clang -i ${./purity.patch}
@ -258,19 +243,15 @@ stdenv.mkDerivation rec {
sed -i 's,curses,ncurses,' llbuild/*/*/CMakeLists.txt
# This test fails on one of my machines, not sure why.
# Disabling for now.
# Disabling for now.
rm llbuild/tests/Examples/buildsystem-capi.llbuild
PREFIX=''${out/#\/}
substituteInPlace swift-corelibs-xctest/build_script.py \
--replace usr "$PREFIX"
substituteInPlace swiftpm/Utilities/bootstrap \
--replace "usr" "$PREFIX"
'' + stdenv.lib.optionalString (stdenv ? glibc) ''
patch -p1 -d compiler-rt -i ${sigaltstackPatch}
patch -p1 -d compiler-rt -i ${./patches/sigaltstack.patch}
patch -p1 -d llbuild -i ${sigunusedPatch}
patch -p1 -i ${./patches/sigunused.patch}
--replace \"usr\" \"$PREFIX\" \
--replace usr/lib "$PREFIX/lib"
'';
doCheck = false;

View File

@ -1,38 +0,0 @@
From fcc7c216da6cd255f884b7aa39f361786e3afa6a Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Tue, 28 Mar 2017 15:02:18 -0500
Subject: [PATCH 3/4] build-presets: (linux) disable tests.
---
utils/build-presets.ini | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/utils/build-presets.ini b/utils/build-presets.ini
index 1095cbaab7..1739e91dc2 100644
--- a/utils/build-presets.ini
+++ b/utils/build-presets.ini
@@ -700,7 +700,7 @@ build-swift-stdlib-unittest-extra
# Executes the lit tests for the installable package that is created
# Assumes the swift-integration-tests repo is checked out
-test-installable-package
+# test-installable-package
# Path to the root of the installation filesystem.
install-destdir=%(install_destdir)s
@@ -713,9 +713,9 @@ mixin-preset=mixin_linux_installation
build-subdir=buildbot_linux
lldb
release
-test
-validation-test
-long-test
+#test
+#validation-test
+#long-test
foundation
libdispatch
lit-args=-v
--
2.12.2

View File

@ -1,113 +0,0 @@
--- a/stdlib/public/stubs/UnicodeNormalization.cpp
+++ b/stdlib/public/stubs/UnicodeNormalization.cpp
@@ -86,11 +86,8 @@ ASCIICollation() {
for (unsigned char c = 0; c < 128; ++c) {
UErrorCode ErrorCode = U_ZERO_ERROR;
intptr_t NumCollationElts = 0;
-#if defined(__CYGWIN__) || defined(_MSC_VER)
UChar Buffer[1];
-#else
- uint16_t Buffer[1];
-#endif
+
Buffer[0] = c;
UCollationElements *CollationIterator =
@@ -127,18 +124,9 @@ swift::_swift_stdlib_unicode_compare_utf16_utf16(const uint16_t *LeftString,
int32_t LeftLength,
const uint16_t *RightString,
int32_t RightLength) {
-#if defined(__CYGWIN__) || defined(_MSC_VER)
- // ICU UChar type is platform dependent. In Cygwin, it is defined
- // as wchar_t which size is 2. It seems that the underlying binary
- // representation is same with swift utf16 representation.
return ucol_strcoll(GetRootCollator(),
reinterpret_cast<const UChar *>(LeftString), LeftLength,
reinterpret_cast<const UChar *>(RightString), RightLength);
-#else
- return ucol_strcoll(GetRootCollator(),
- LeftString, LeftLength,
- RightString, RightLength);
-#endif
}
/// Compares the strings via the Unicode Collation Algorithm on the root locale.
@@ -156,12 +144,8 @@ swift::_swift_stdlib_unicode_compare_utf8_utf16(const unsigned char *LeftString,
UErrorCode ErrorCode = U_ZERO_ERROR;
uiter_setUTF8(&LeftIterator, reinterpret_cast<const char *>(LeftString), LeftLength);
-#if defined(__CYGWIN__) || defined(_MSC_VER)
uiter_setString(&RightIterator, reinterpret_cast<const UChar *>(RightString),
RightLength);
-#else
- uiter_setString(&RightIterator, RightString, RightLength);
-#endif
uint32_t Diff = ucol_strcollIter(GetRootCollator(),
&LeftIterator, &RightIterator, &ErrorCode);
@@ -199,14 +183,10 @@ swift::_swift_stdlib_unicode_compare_utf8_utf8(const unsigned char *LeftString,
void *swift::_swift_stdlib_unicodeCollationIterator_create(
const __swift_uint16_t *Str, __swift_uint32_t Length) {
UErrorCode ErrorCode = U_ZERO_ERROR;
-#if defined(__CYGWIN__) || defined(_MSC_VER)
UCollationElements *CollationIterator = ucol_openElements(
GetRootCollator(), reinterpret_cast<const UChar *>(Str), Length,
&ErrorCode);
-#else
- UCollationElements *CollationIterator = ucol_openElements(
- GetRootCollator(), Str, Length, &ErrorCode);
-#endif
+
if (U_FAILURE(ErrorCode)) {
swift::crash("_swift_stdlib_unicodeCollationIterator_create: ucol_openElements() failed.");
}
@@ -244,17 +224,12 @@ swift::_swift_stdlib_unicode_strToUpper(uint16_t *Destination,
const uint16_t *Source,
int32_t SourceLength) {
UErrorCode ErrorCode = U_ZERO_ERROR;
-#if defined(__CYGWIN__) || defined(_MSC_VER)
uint32_t OutputLength = u_strToUpper(reinterpret_cast<UChar *>(Destination),
DestinationCapacity,
reinterpret_cast<const UChar *>(Source),
SourceLength,
"", &ErrorCode);
-#else
- uint32_t OutputLength = u_strToUpper(Destination, DestinationCapacity,
- Source, SourceLength,
- "", &ErrorCode);
-#endif
+
if (U_FAILURE(ErrorCode) && ErrorCode != U_BUFFER_OVERFLOW_ERROR) {
swift::crash("u_strToUpper: Unexpected error uppercasing unicode string.");
}
@@ -271,17 +246,12 @@ swift::_swift_stdlib_unicode_strToLower(uint16_t *Destination,
const uint16_t *Source,
int32_t SourceLength) {
UErrorCode ErrorCode = U_ZERO_ERROR;
-#if defined(__CYGWIN__) || defined(_MSC_VER)
uint32_t OutputLength = u_strToLower(reinterpret_cast<UChar *>(Destination),
DestinationCapacity,
reinterpret_cast<const UChar *>(Source),
SourceLength,
"", &ErrorCode);
-#else
- uint32_t OutputLength = u_strToLower(Destination, DestinationCapacity,
- Source, SourceLength,
- "", &ErrorCode);
-#endif
+
if (U_FAILURE(ErrorCode) && ErrorCode != U_BUFFER_OVERFLOW_ERROR) {
swift::crash("u_strToLower: Unexpected error lowercasing unicode string.");
}
@@ -300,9 +300,9 @@
swift::__swift_stdlib_UBreakIterator *swift::__swift_stdlib_ubrk_open(
swift::__swift_stdlib_UBreakIteratorType type, const char *locale,
- const UChar *text, int32_t textLength, __swift_stdlib_UErrorCode *status) {
+ const __swift_stdlib_UChar * text, __swift_int32_t textLength, __swift_stdlib_UErrorCode *status) {
return ptr_cast<swift::__swift_stdlib_UBreakIterator>(
- ubrk_open(static_cast<UBreakIteratorType>(type), locale, text, textLength,
+ ubrk_open(static_cast<UBreakIteratorType>(type), locale, reinterpret_cast<const UChar *>(text), textLength,
ptr_cast<UErrorCode>(status)));
}

View File

@ -1,54 +0,0 @@
--- a/swift/stdlib/public/SDK/os/os_trace_blob.c
+++ b/swift/stdlib/public/SDK/os/os_trace_blob.c
@@ -14,7 +14,6 @@
#include <dispatch/dispatch.h>
#include <os/base.h>
#include <os/log.h>
-#include <xlocale.h>
#include "os_trace_blob.h"
OS_NOINLINE
--- a/swift/stdlib/public/stubs/Stubs.cpp
+++ b/swift/stdlib/public/stubs/Stubs.cpp
@@ -61,7 +61,6 @@
#define strtof_l swift_strtof_l
#define strtold_l swift_strtold_l
#else
-#include <xlocale.h>
#endif
#include <limits>
#include "llvm/ADT/StringExtras.h"
--- a/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringDefaultEncoding.h
+++ b/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringDefaultEncoding.h
@@ -20,7 +20,6 @@
#include <unistd.h>
#include <string.h>
#include <stdio.h>
-#include <xlocale.h>
CF_EXTERN_C_BEGIN
--- a/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringEncodings.c
+++ b/swift-corelibs-foundation/CoreFoundation/String.subproj/CFStringEncodings.c
@@ -24,7 +24,6 @@
#include <unistd.h>
#include <string.h>
#include <stdio.h>
-#include <xlocale.h>
#include <CoreFoundation/CFStringDefaultEncoding.h>
#endif
--- a/swift-corelibs-foundation/CoreFoundation/Base.subproj/CFInternal.h
+++ b/swift-corelibs-foundation/CoreFoundation/Base.subproj/CFInternal.h
@@ -95,7 +95,6 @@
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_EMBEDDED || DEPLOYMENT_TARGET_EMBEDDED_MINI || DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_FREEBSD
#if TARGET_OS_CYGWIN
#else
-#include <xlocale.h>
#endif
#include <unistd.h>
#include <sys/time.h>

View File

@ -1,11 +0,0 @@
--- a/lib/esan/esan_sideline_linux.cpp
+++ b/lib/esan/esan_sideline_linux.cpp
@@ -70,7 +70,7 @@ int SidelineThread::runSideline(void *Arg) {
// Set up a signal handler on an alternate stack for safety.
InternalScopedBuffer<char> StackMap(SigAltStackSize);
- struct sigaltstack SigAltStack;
+ stack_t SigAltStack;
SigAltStack.ss_sp = StackMap.data();
SigAltStack.ss_size = SigAltStackSize;
SigAltStack.ss_flags = 0;

View File

@ -1,11 +0,0 @@
--- a/swiftpm/Sources/Basic/Process.swift
+++ b/swiftpm/Sources/Basic/Process.swift
@@ -258,7 +258,7 @@ public func launch() throws {
// modify, so we have to take care about the set we use.
var mostSignals = sigset_t()
sigemptyset(&mostSignals)
- for i in 1 ..< SIGUNUSED {
+ for i in 1 ..< SIGSYS {
if i == SIGKILL || i == SIGSTOP {
continue
}

View File

@ -1,6 +1,17 @@
--- a/lib/Driver/Tools.cpp 2016-08-25 15:48:05.187553443 +0200
+++ b/lib/Driver/Tools.cpp 2016-08-25 15:48:47.534468882 +0200
@@ -9420,13 +9420,6 @@
From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Thu, 18 May 2017 11:56:12 -0500
Subject: [PATCH] "purity" patch for 5.0
---
lib/Driver/ToolChains/Gnu.cpp | 7 -------
1 file changed, 7 deletions(-)
diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index fe3c0191bb..c6a482bece 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (!Args.hasArg(options::OPT_static)) {
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
@ -14,3 +25,6 @@
}
CmdArgs.push_back("-o");
--
2.11.0