Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4 from vgorloff/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
vgorloff authored Dec 26, 2018
2 parents eb2a121 + 1fee268 commit 6b294dc
Show file tree
Hide file tree
Showing 35 changed files with 1,210 additions and 600 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ Layout/EmptyLinesAroundClassBody:
Layout/IndentationWidth:
Width: 3

Layout/IndentHeredoc:
Enabled: false

Metrics/BlockLength:
Enabled: false

Naming/VariableName:
EnforcedStyle: camelCase

Expand Down
13 changes: 13 additions & 0 deletions Patches/swift-corelibs-foundation/CFKnownLocations.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CoreFoundation/Base.subproj/CFKnownLocations.c b/CoreFoundation/Base.subproj/CFKnownLocations.c
index c610813fdcc4ec0d0d43ba50c42f329534925fce..b2bc4550f42edffdeb6003eb35929cb43234b653 100644
--- a/CoreFoundation/Base.subproj/CFKnownLocations.c
+++ b/CoreFoundation/Base.subproj/CFKnownLocations.c
@@ -45,7 +45,7 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs
}

}
-#elif !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID
+#elif !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS

/*
Building for an OS that uses the FHS, BSD's hier(7), and/or the XDG specification for paths:
21 changes: 21 additions & 0 deletions Patches/swift-corelibs-foundation/CMakeLists.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ff47064da305032b285037bbcd6846bed15c027c..28f63dabaee5234e177ff113beb425b413e8bdfe 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@ option(FOUNDATION_PATH_TO_XCTEST_BUILD "Path to XCTest build" "")
find_package(CURL REQUIRED)
find_package(ICU COMPONENTS uc i18n REQUIRED)
find_package(LibXml2 REQUIRED)
-find_package(UUID REQUIRED)
+# find_package(UUID REQUIRED)

include(SwiftSupport)
include(GNUInstallDirs)
@@ -45,6 +45,7 @@ ExternalProject_Add(CoreFoundation
-DCF_PATH_TO_LIBDISPATCH_SOURCE=${FOUNDATION_PATH_TO_LIBDISPATCH_SOURCE}
-DCF_PATH_TO_LIBDISPATCH_BUILD=${FOUNDATION_PATH_TO_LIBDISPATCH_BUILD}
-DICU_INCLUDE_DIR=${ICU_INCLUDE_DIR}
+ -DICU_LIBRARY=${ICU_LIBRARY}
-DLIBXML2_LIBRARY=${LIBXML2_LIBRARY}
-DLIBXML2_INCLUDE_DIR=${LIBXML2_INCLUDE_DIR}
-DCURL_LIBRARY=${CURL_LIBRARY}
13 changes: 13 additions & 0 deletions Patches/swift-corelibs-foundation/CmakeSystemProcessor.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/cmake/modules/SwiftSupport.cmake b/cmake/modules/SwiftSupport.cmake
index 52e9af116fe94769fb9b3fedd3e846968dafb59a..bff1dc2db57b1971d4e9f20080a3113eb367c02c 100644
--- a/cmake/modules/SwiftSupport.cmake
+++ b/cmake/modules/SwiftSupport.cmake
@@ -237,6 +237,8 @@ function(get_swift_host_arch result_var_name)
set("${result_var_name}" "armv6" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7l")
set("${result_var_name}" "armv7" PARENT_SCOPE)
+ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7-a")
+ set("${result_var_name}" "armv7" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set("${result_var_name}" "x86_64" PARENT_SCOPE)
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
25 changes: 25 additions & 0 deletions Patches/swift-corelibs-foundation/CompileOptions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/CoreFoundation/CMakeLists.txt b/CoreFoundation/CMakeLists.txt
index 0aa9565e3c3930e7375cc548870003c1b8432653..643e53a03e36477d71e3b0339f337a01e868c72b 100644
--- a/CoreFoundation/CMakeLists.txt
+++ b/CoreFoundation/CMakeLists.txt
@@ -194,6 +194,7 @@ add_framework(CoreFoundation
URL.subproj/CFURLAccess.h
URL.subproj/CFURLComponents.h
SOURCES
+ ../uuid/uuid.c
# Base
Base.subproj/CFBase.c
Base.subproj/CFFileUtilities.c
@@ -405,9 +406,9 @@ if(CF_DEPLOYMENT_SWIFT)
PRIVATE
/clang:-fcf-runtime-abi=swift)
else()
- target_compile_options(CoreFoundation
- PRIVATE
- -fcf-runtime-abi=swift)
+ # target_compile_options(CoreFoundation
+ # PRIVATE
+ # -fcf-runtime-abi=swift)
endif()
endif()

75 changes: 75 additions & 0 deletions Patches/swift-corelibs-foundation/FileManager.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
diff --git a/Foundation/FileManager.swift b/Foundation/FileManager.swift
index c51536246fc92efd82115c2217b256466b234712..a537ae8e676f4e5326d8cd4aae38a2e312b42faf 100644
--- a/Foundation/FileManager.swift
+++ b/Foundation/FileManager.swift
@@ -91,7 +91,10 @@ open class FileManager : NSObject {
urls = mountPoints(statBuf, Int(fsCount))
}
#else
+/* FIXME: Android compile Workaround.
#error("Requires a platform-specific implementation")
+*/
+ urls = [] // FIXME: Android compile Workaround.
#endif
return urls
}
@@ -581,6 +584,7 @@ open class FileManager : NSObject {
var entry = dirent()
var result: UnsafeMutablePointer<dirent>? = nil

+ /* FIXME: Android compile Workaround.
while readdir_r(dir, &entry, &result) == 0 {
guard result != nil else {
return
@@ -595,6 +599,7 @@ open class FileManager : NSObject {
try closure(entryName, entryType)
}
}
+ */
}

/**
@@ -651,6 +656,8 @@ open class FileManager : NSObject {
This method replaces fileAttributesAtPath:traverseLink:.
*/
open func attributesOfItem(atPath path: String) throws -> [FileAttributeKey : Any] {
+ return [:]
+ /* FIXME: Android compile Workaround.
let s = try _lstatFile(atPath: path)
var result = [FileAttributeKey : Any]()
result[.size] = NSNumber(value: UInt64(s.st_size))
@@ -698,6 +705,7 @@ open class FileManager : NSObject {
result[.groupOwnerAccountID] = NSNumber(value: UInt64(s.st_gid))

return result
+ */
}

/* attributesOfFileSystemForPath:error: returns an NSDictionary of key/value pairs containing the attributes of the filesystem containing the provided path. If this method returns 'nil', an NSError will be returned by reference in the 'error' parameter. This method does not traverse a terminal symlink.
@@ -880,6 +888,7 @@ open class FileManager : NSObject {
return
}

+ /* FIXME: Android compile Workaround.
let fileType = FileAttributeType(statMode: stat.st_mode)
if fileType == .typeDirectory {
try createDirectory(atPath: dstPath, withIntermediateDirectories: false, attributes: nil)
@@ -903,6 +912,7 @@ open class FileManager : NSObject {
} else {
try body(srcPath, dstPath, fileType)
}
+ */
}

private func shouldProceedAfterError(_ error: Error, copyingItemAtPath path: String, toPath: String, isURL: Bool) -> Bool {
@@ -1413,8 +1423,10 @@ open class FileManager : NSObject {

if file1Type == S_IFCHR || file1Type == S_IFBLK {
// For character devices, just check the major/minor pair is the same.
+ /* FIXME: Android compile Workaround.
return _dev_major(file1.st_rdev) == _dev_major(file2.st_rdev)
&& _dev_minor(file1.st_rdev) == _dev_minor(file2.st_rdev)
+ */
}

// If both paths point to the same device/inode or they are both zero length
13 changes: 13 additions & 0 deletions Patches/swift-corelibs-foundation/ForSwiftFoundationOnly.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
index 034dc502d839aafcab6c9f69e42e725ef02059d4..3950c48a2cacf16d0e5f6df64da98dd1684cfd0e 100644
--- a/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
+++ b/CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h
@@ -44,7 +44,7 @@

#include <CoreFoundation/CFCalendar_Internal.h>

-#if __has_include(<execinfo.h>)
+#if __has_include(<execinfo.h>) && !DEPLOYMENT_TARGET_ANDROID
#include <execinfo.h>
#endif

19 changes: 19 additions & 0 deletions Patches/swift-corelibs-foundation/NSGeometry.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
diff --git a/Foundation/NSGeometry.swift b/Foundation/NSGeometry.swift
index da860ff8b580483f27748cc98e8bfac3a1b2b4b8..4b26672dd07eab50ef83be0178572dab3381a447 100644
--- a/Foundation/NSGeometry.swift
+++ b/Foundation/NSGeometry.swift
@@ -682,10 +682,10 @@ public func NSEdgeInsetsEqual(_ aInsets: NSEdgeInsets, _ bInsets: NSEdgeInsets)
}

public func NSInsetRect(_ aRect: NSRect, _ dX: CGFloat, _ dY: CGFloat) -> NSRect {
- let x = aRect.origin.x.native + dX.native
- let y = aRect.origin.y.native + dY.native
- let w = aRect.size.width.native - (dX.native * 2)
- let h = aRect.size.height.native - (dY.native * 2)
+ let x = CGFloat(aRect.origin.x.native + dX.native)
+ let y = CGFloat(aRect.origin.y.native + dY.native)
+ let w = CGFloat(aRect.size.width.native - (dX.native * 2))
+ let h = CGFloat(aRect.size.height.native - (dY.native * 2))
return NSRect(x: x, y: y, width: w, height: h)
}

2 changes: 1 addition & 1 deletion Patches/swift-corelibs-foundation/Readme.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Bugreport: https://bugs.swift.org/browse/SR-9513
MissedLocaleHeaders - Bugreport: https://bugs.swift.org/browse/SR-9513
13 changes: 13 additions & 0 deletions Patches/swift-corelibs-foundation/plutil.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Tools/plutil/main.swift b/Tools/plutil/main.swift
index 9c3b81602242a85f09bbb3163eb5edde5d72168b..d5a5800dcb8d6914f358300674a44a2f741b522f 100644
--- a/Tools/plutil/main.swift
+++ b/Tools/plutil/main.swift
@@ -9,7 +9,7 @@
#if os(macOS) || os(iOS)
import Darwin
import SwiftFoundation
-#elseif os(Linux)
+#elseif os(Linux) || os(Android)
import Foundation
import Glibc
#endif
13 changes: 13 additions & 0 deletions Patches/swift-corelibs-foundation/uuid.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/uuid/uuid.h b/uuid/uuid.h
index cc997a855b5484ff33a2cfc87698308d6829dca5..a23eb95eaf383738da5d225c2cee0de7fb325e38 100644
--- a/uuid/uuid.h
+++ b/uuid/uuid.h
@@ -33,7 +33,7 @@
#ifndef _UUID_UUID_H
#define _UUID_UUID_H

-#include <TargetConditionals.h>
+#include "../CoreFoundation/Base.subproj/SwiftRuntime/TargetConditionals.h"
#if TARGET_OS_MAC
#include <sys/_types.h>
#include <sys/_types/_uuid_t.h>
12 changes: 12 additions & 0 deletions Patches/swift-corelibs-libdispatch/DisableWarningsAsErrors.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/cmake/modules/DispatchCompilerWarnings.cmake b/cmake/modules/DispatchCompilerWarnings.cmake
index a7b31c818210a7b6de8ba094e6e8ce6de32e97e2..081616d8dfcbf3bf6ea9e0a4b1e32766bcc3fbd2 100644
--- a/cmake/modules/DispatchCompilerWarnings.cmake
+++ b/cmake/modules/DispatchCompilerWarnings.cmake
@@ -5,7 +5,6 @@ if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
endmacro()
else()
macro(dispatch_common_warnings)
- add_compile_options(-Werror)
add_compile_options(-Wall)
add_compile_options(-Wextra)

59 changes: 59 additions & 0 deletions Patches/uuid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cmake_minimum_required(VERSION 3.8)

project(uuid)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set (SOURCE_FILES
clear.c
compare.c
copy.c
gen_uuid.c
isnull.c
pack.c
parse.c
unpack.c
unparse.c
uuid_time.c
../../lib/randutils.c
../../lib/md5.c
../../lib/sha1.c
)

add_definitions(
-DHAVE_INTTYPES_H
-DHAVE_UNISTD_H
-DHAVE_ERRNO_H
-DHAVE_NETINET_IN_H
-DHAVE_SYS_IOCTL_H
-DHAVE_SYS_MMAN_H
-DHAVE_SYS_MOUNT_H
-DHAVE_SYS_PRCTL_H
-DHAVE_SYS_RESOURCE_H
-DHAVE_SYS_SELECT_H
-DHAVE_SYS_STAT_H
-DHAVE_SYS_TYPES_H
-DHAVE_STDLIB_H
-DHAVE_STRDUP
-DHAVE_MMAP
-DHAVE_UTIME_H
-DHAVE_GETPAGESIZE
-DHAVE_LSEEK64
-DHAVE_LSEEK64_PROTOTYPE
-DHAVE_EXT2_IOCTLS
-DHAVE_LINUX_FD_H
-DHAVE_TYPE_SSIZE_T
-DHAVE_SYS_TIME_H
-DHAVE_SYS_PARAM_H
-DHAVE_SYSCONF
-DHAVE_NANOSLEEP
-DHAVE_SYS_FILE_H
)

add_library(uuid SHARED ${SOURCE_FILES})
target_include_directories(uuid PRIVATE ../../include)
set_target_properties(uuid PROPERTIES PUBLIC_HEADER "uuid.h")
install(TARGETS uuid
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/uuid
)
Loading

0 comments on commit 6b294dc

Please sign in to comment.