swift: add recipe for 4.1.0 git version.

stays disabled:
* the package is definitely too large (500MB).
* this doesn't use cmake for the installation, so binaries have
a RPATH hardcoded, this is bad.
This commit is contained in:
Jerome Duval
2017-11-11 18:49:22 +01:00
parent fe16d8ae36
commit 9f487cd246
4 changed files with 550 additions and 0 deletions

View File

@@ -0,0 +1,177 @@
From e0361784072b954f39beaab5c4ccc3614c32e17e Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Tue, 15 Aug 2017 21:55:36 +0100
Subject: swift-clang: reapply Haiku toolchain patches.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 04ab7b7..8d1bcf1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -390,6 +390,10 @@ endif()
if(CLANG_ENABLE_ARCMT)
set(CLANG_ENABLE_OBJC_REWRITER ON)
endif()
+if(DEFINED HAIKU_HYBRID_SECONDARY)
+ add_definitions(-DHAIKU_HYBRID_SECONDARY=${HAIKU_HYBRID_SECONDARY})
+endif()
+
# Clang version information
set(CLANG_EXECUTABLE_VERSION
diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index b0dc0d2..2e3157e 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -436,8 +436,6 @@ public:
this->IntPtrType = TargetInfo::SignedLong;
this->PtrDiffType = TargetInfo::SignedLong;
this->ProcessIDType = TargetInfo::SignedLong;
- this->TLSSupported = false;
-
}
};
diff --git a/lib/Driver/ToolChains/Haiku.cpp b/lib/Driver/ToolChains/Haiku.cpp
index 284d269..bc33eea 100644
--- a/lib/Driver/ToolChains/Haiku.cpp
+++ b/lib/Driver/ToolChains/Haiku.cpp
@@ -19,7 +19,13 @@ using namespace llvm::opt;
Haiku::Haiku(const Driver &D, const llvm::Triple& Triple, const ArgList &Args)
: Generic_ELF(D, Triple, Args) {
-
+#ifdef HAIKU_HYBRID_SECONDARY
+ getProgramPaths().insert(getProgramPaths().begin(), getDriver().SysRoot
+ + "/system/bin/" HAIKU_HYBRID_SECONDARY);
+ getFilePaths().clear();
+ getFilePaths().push_back(getDriver().SysRoot + "/system/lib/"
+ HAIKU_HYBRID_SECONDARY);
+#endif
}
std::string Haiku::findLibCxxIncludePath() const {
@@ -28,6 +34,12 @@ std::string Haiku::findLibCxxIncludePath() const {
void Haiku::addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
llvm::opt::ArgStringList &CC1Args) const {
+#ifdef HAIKU_HYBRID_SECONDARY
+ addLibStdCXXIncludePaths(getDriver().SysRoot, "/system/develop/headers"
+ HAIKU_HYBRID_SECONDARY "/c++", getTriple().str(), "", "", "",
+ DriverArgs, CC1Args);
+#else
addLibStdCXXIncludePaths(getDriver().SysRoot, "/system/develop/headers/c++",
getTriple().str(), "", "", "", DriverArgs, CC1Args);
+#endif
}
diff --git a/lib/Driver/ToolChains/Haiku.h b/lib/Driver/ToolChains/Haiku.h
index 8b5b48e..ccd851f 100644
--- a/lib/Driver/ToolChains/Haiku.h
+++ b/lib/Driver/ToolChains/Haiku.h
@@ -23,9 +23,7 @@ public:
Haiku(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args);
- bool isPIEDefault() const override {
- return getTriple().getArch() == llvm::Triple::x86_64;
- }
+ bool isPIEDefault() const override { return false; }
std::string findLibCxxIncludePath() const override;
void addLibStdCxxIncludePaths(
diff --git a/lib/Frontend/InitHeaderSearch.cpp b/lib/Frontend/InitHeaderSearch.cpp
index 1d7c8a0..e8ccd4e 100644
--- a/lib/Frontend/InitHeaderSearch.cpp
+++ b/lib/Frontend/InitHeaderSearch.cpp
@@ -234,7 +234,20 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
if (HSOpts.UseBuiltinIncludes) {
// Ignore the sys root, we *always* look for clang headers relative to
// supplied path.
+#ifdef HAIKU_HYBRID_SECONDARY
+ // Remove version from foo/lib/clang/version
+ StringRef Ver = llvm::sys::path::filename(HSOpts.ResourceDir);
+ StringRef NoVer = llvm::sys::path::parent_path(HSOpts.ResourceDir);
+ // Remove clang from foo/lib/clang
+ StringRef Clang = llvm::sys::path::filename(NoVer);
+ SmallString<128> P = llvm::sys::path::parent_path(NoVer);
+
+ // Get foo/include/c++/v1
+ llvm::sys::path::append(P, HAIKU_HYBRID_SECONDARY, Clang, Ver);
+#else
SmallString<128> P = StringRef(HSOpts.ResourceDir);
+#endif
+
llvm::sys::path::append(P, "include");
AddUnmappedPath(P, ExternCSystem, false);
}
@@ -267,7 +280,12 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
}
case llvm::Triple::Haiku:
+#ifdef HAIKU_HYBRID_SECONDARY
+ AddPath("/boot/system/non-packaged/develop/headers/" HAIKU_HYBRID_SECONDARY,
+ System, false);
+#else
AddPath("/boot/system/non-packaged/develop/headers", System, false);
+#endif
AddPath("/boot/system/develop/headers/os", System, false);
AddPath("/boot/system/develop/headers/os/app", System, false);
AddPath("/boot/system/develop/headers/os/arch", System, false);
@@ -299,6 +317,13 @@ void InitHeaderSearch::AddDefaultCIncludePaths(const llvm::Triple &triple,
AddPath("/boot/system/develop/headers/bsd", System, false);
AddPath("/boot/system/develop/headers/glibc", System, false);
AddPath("/boot/system/develop/headers/posix", System, false);
+#ifdef HAIKU_HYBRID_SECONDARY
+ AddPath("/boot/system/develop/headers/" HAIKU_HYBRID_SECONDARY, System, false);
+ AddPath("/boot/system/develop/headers/" HAIKU_HYBRID_SECONDARY "/os", System,
+ false);
+ AddPath("/boot/system/develop/headers/" HAIKU_HYBRID_SECONDARY "/os/opengl",
+ System, false);
+#endif
AddPath("/boot/system/develop/headers", System, false);
break;
case llvm::Triple::RTEMS:
diff --git a/test/Driver/haiku.c b/test/Driver/haiku.c
new file mode 100644
index 0000000..9591739
--- /dev/null
+++ b/test/Driver/haiku.c
@@ -0,0 +1,12 @@
+// RUN: %clang -no-canonical-prefixes -target x86_64-unknown-haiku %s -### 2> %t.log
+// RUN: FileCheck --check-prefix=CHECK-X86_64 -input-file %t.log %s
+
+// CHECK-X86_64: clang{{.*}}" "-cc1" "-triple" "x86_64-unknown-haiku"
+// CHECK-X86_64: gcc{{.*}}" "-o" "a.out" "{{.*}}.o"
+
+// RUN: %clang -no-canonical-prefixes -target i586-pc-haiku %s -### 2> %t.log
+// RUN: FileCheck --check-prefix=CHECK-X86 -input-file %t.log %s
+
+// CHECK-X86: clang{{.*}}" "-cc1" "-triple" "i586-pc-haiku"
+// CHECK-X86: gcc{{.*}}" "-o" "a.out" "{{.*}}.o"
+
--
2.14.2
From 8b814e4c5bac68c07990d5e65279395dd76a1102 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 11 Nov 2017 14:02:31 +0100
Subject: default to PIC
diff --git a/lib/Driver/ToolChains/Haiku.h b/lib/Driver/ToolChains/Haiku.h
index ccd851f..df98cd6 100644
--- a/lib/Driver/ToolChains/Haiku.h
+++ b/lib/Driver/ToolChains/Haiku.h
@@ -25,6 +25,8 @@ public:
bool isPIEDefault() const override { return false; }
+ bool isPICDefault() const override { return true; }
+
std::string findLibCxxIncludePath() const override;
void addLibStdCxxIncludePaths(
const llvm::opt::ArgList &DriverArgs,
--
2.14.2

View File

@@ -0,0 +1,102 @@
From 726a054ecac7e3b2d235706118d8a564bebd2200 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Mon, 6 Nov 2017 15:11:55 +0000
Subject: StdlibUnittest: temp workarounds for Haiku errno constants
diff --git a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb
index b8c9f03..787cae2 100644
--- a/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb
+++ b/stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb
@@ -740,7 +740,7 @@ struct _ParentProcess {
var ret: CInt
repeat {
ret = _stdlib_select(&readfds, &writefds, &errorfds, nil)
- } while ret == -1 && errno == EINTR
+ } while ret == -1 && errno == 10
if ret <= 0 {
fatalError("select() returned an error")
}
diff --git a/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift b/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
index 5d77a73..2b797e4 100644
--- a/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
+++ b/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
@@ -278,7 +278,7 @@ public func posixWaitpid(_ pid: pid_t) -> ProcessTerminationStatus {
}
#else
while waitpid(pid, &status, 0) < 0 {
- if errno != EINTR {
+ if errno != 10 {
preconditionFailure("waitpid() failed")
}
}
diff --git a/stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift b/stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift
index 35f0ff1..b18fe28 100644
--- a/stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift
+++ b/stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift
@@ -69,7 +69,7 @@ public func _stdlib_pthread_barrier_init(
) -> CInt {
barrier.pointee = _stdlib_pthread_barrier_t()
if count == 0 {
- errno = EINVAL
+ errno = 11
return -1
}
barrier.pointee.mutex = UnsafeMutablePointer.allocate(capacity: 1)
--
2.14.2
From c7dd4397b9a1df9493391bf68e816fa04a89b3da Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 11 Nov 2017 17:25:41 +0100
Subject: stdlib: fixes depend targets.
example error: No rule to make target
'stdlib/public/runtime/CMakeFiles/section_magic_end-haiku-x86-64.dir/swift_sections.S.o'.
diff --git a/stdlib/public/runtime/CMakeLists.txt b/stdlib/public/runtime/CMakeLists.txt
index ebd6568..61ac765 100644
--- a/stdlib/public/runtime/CMakeLists.txt
+++ b/stdlib/public/runtime/CMakeLists.txt
@@ -192,8 +192,8 @@ foreach(sdk ${ELFISH_SDKS})
OUTPUT
"${SWIFTLIB_DIR}/${arch_subdir}/swift_begin.o"
DEPENDS
- "${section_magic_begin_obj}"
- "${section_magic_loader_obj}")
+ "section_magic_begin-${arch_suffix}"
+ "section_magic_loader-${arch_suffix}")
add_custom_command_target(section_magic_${arch_suffix}_end_object
COMMAND
@@ -203,7 +203,7 @@ foreach(sdk ${ELFISH_SDKS})
OUTPUT
"${SWIFTLIB_DIR}/${arch_subdir}/swift_end.o"
DEPENDS
- "${section_magic_end_obj}")
+ "section_magic_end-${arch_suffix}")
list(APPEND object_target_list
"${section_magic_${arch_suffix}_begin_object}"
@@ -226,7 +226,7 @@ foreach(sdk ${ELFISH_SDKS})
OUTPUT
"${SWIFTSTATICLIB_DIR}/${arch_subdir}/swift_begin.o"
DEPENDS
- "${section_magic_begin_obj}")
+ "section_magic_begin-${arch_suffix}")
add_custom_command_target(static_section_magic_${arch_suffix}_end_object
COMMAND
@@ -236,7 +236,7 @@ foreach(sdk ${ELFISH_SDKS})
OUTPUT
"${SWIFTSTATICLIB_DIR}/${arch_subdir}/swift_end.o"
DEPENDS
- "${section_magic_end_obj}")
+ "section_magic_end-${arch_suffix}")
list(APPEND object_target_list
"${static_section_magic_${arch_suffix}_begin_object}"
--
2.14.2

View File

@@ -0,0 +1,88 @@
From b386d1db8fbaac139f6207d956bf863b9a08da73 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Tue, 15 Aug 2017 20:24:28 +0100
Subject: llvm: Add Haiku triple and more compilation fixes
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index 7126c4b..ff4abee 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -681,7 +681,7 @@ add_definitions( -D__STDC_LIMIT_MACROS )
if (UNIX AND
CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
CMAKE_GENERATOR STREQUAL "Ninja")
- append("-fcolor-diagnostics" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ append("-fdiagnostics-color=auto" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
# lld doesn't print colored diagnostics when invoked from Ninja
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index 45097eb..cf154e8 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -97,7 +97,7 @@
#define STATVFS_F_FRSIZE(vfs) static_cast<uint64_t>(vfs.f_bsize)
#endif
-#if defined(__NetBSD__)
+#if defined(__NetBSD__) || defined(__HAIKU__)
#define STATVFS_F_FLAG(vfs) (vfs).f_flag
#else
#define STATVFS_F_FLAG(vfs) (vfs).f_flags
@@ -386,6 +386,9 @@ static bool is_local_impl(struct STATVFS &Vfs) {
StringRef fstype(Vfs.f_basetype);
// NFS is the only non-local fstype??
return !fstype.equals("nfs");
+#elif defined(__HAIKU__)
+ // Haiku doesn't support MNT_LOCAL so return false for now.
+ return false;
#else
return !!(STATVFS_F_FLAG(Vfs) & MNT_LOCAL);
#endif
diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
index 08b096a..739213c 100644
--- a/tools/llvm-config/llvm-config.cpp
+++ b/tools/llvm-config/llvm-config.cpp
@@ -332,11 +332,16 @@ int main(int argc, char **argv) {
("-I" + ActiveIncludeDir + " " + "-I" + ActiveObjRoot + "/include");
} else {
ActivePrefix = CurrentExecPrefix;
+#ifdef __HAIKU__
+ ActiveIncludeDir = ActivePrefix + "/develop/headers";
+ ActiveLibDir = ActivePrefix + "/develop/lib" + LLVM_LIBDIR_SUFFIX;
+#else
ActiveIncludeDir = ActivePrefix + "/include";
+ ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+#endif
SmallString<256> path(StringRef(LLVM_TOOLS_INSTALL_DIR));
sys::fs::make_absolute(ActivePrefix, path);
ActiveBinDir = path.str();
- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
ActiveIncludeOption = "-I" + ActiveIncludeDir;
}
@@ -556,10 +561,16 @@ int main(int argc, char **argv) {
OS << (LLVM_HAS_GLOBAL_ISEL ? "ON" : "OFF") << '\n';
} else if (Arg == "--shared-mode") {
PrintSharedMode = true;
- } else if (Arg == "--obj-root") {
- OS << ActivePrefix << '\n';
- } else if (Arg == "--src-root") {
- OS << LLVM_SRC_ROOT << '\n';
+ } else if (Arg == "--obj-root" || Arg == "--src-root") {
+ if (IsInDevelopmentTree) {
+ if (Arg == "--obj-root")
+ OS << ActivePrefix << '\n';
+ else
+ OS << LLVM_SRC_ROOT << '\n';
+ } else {
+ llvm::errs() << "llvm-config: sources not installed\n";
+ exit(1);
+ }
} else if (Arg == "--ignore-libllvm") {
LinkDyLib = false;
LinkMode = BuiltSharedLibs ? LinkModeShared : LinkModeAuto;
--
2.14.2

View File

@@ -0,0 +1,183 @@
SUMMARY="A modern high performance safe general-purpose programming language"
DESCRIPTION="Swift is a general-purpose programming language built using a \
modern approach to safety, performance, and software design patterns. \
The goal of the Swift project is to create the best available \
language for uses ranging from systems programming to mobile \
and desktop apps, scaling up to cloud services. Most importantly, \
Swift is designed to make writing and maintaining correct programs \
easier for the developer."
HOMEPAGE="https://swift.org"
LICENSE="Apache v2"
COPYRIGHT="2017 Apple Inc"
REVISION="1"
srcGitRev="2ee9fdff636f17aa6ee749050ce373a3ecdc7b78"
srcGitRev2="81aea9ea0d003bfa139cc800e0ba4eeb720580f2"
srcGitRev3="b6505f158283ca5d1ed0409243132b0667d79b7e"
srcGitRev4="d875488a6a95d5487b7c675f79a8dafef210a65f"
srcGitRev5="31635ece3ab71eecbcbc795275cb267d55c38040"
SOURCE_URI="https://github.com/apple/swift/archive/$srcGitRev.tar.gz"
SOURCE_URI_2="https://github.com/apple/swift-clang/archive/$srcGitRev2.tar.gz"
SOURCE_URI_3="https://github.com/apple/swift-llvm/archive/$srcGitRev3.tar.gz"
SOURCE_URI_4="https://github.com/apple/swift-cmark/archive/$srcGitRev4.tar.gz"
SOURCE_URI_5="https://github.com/apple/swift-compiler-rt/archive/$srcGitRev5.tar.gz"
CHECKSUM_SHA256="fcbe48372b783d30b3de30b184d5e70103edcf11c92579dd7451a00279413b97"
CHECKSUM_SHA256_2="c99f546cb15d62193fa266212793e2585e676a372d66fb6d8615d94944af6e4a"
CHECKSUM_SHA256_3="48f4d2a79a0fed160decc00c0826900aefd08621205c078e76e89f483aa26c6a"
CHECKSUM_SHA256_4="19247cd75daacb77937a480aa6b552d47b4735f93b659a429a0e1d854579d05d"
CHECKSUM_SHA256_5="6e9a2c9e240ec96fc28a5085b48a8a8ee0e426e57af067cf15f714002b996ebd"
SOURCE_DIR="swift-$srcGitRev"
SOURCE_DIR_2="swift-clang-$srcGitRev2"
SOURCE_DIR_3="swift-llvm-$srcGitRev3"
SOURCE_DIR_4="swift-cmark-$srcGitRev4"
SOURCE_DIR_5="swift-compiler-rt-$srcGitRev5"
PATCHES="swift_lang-$portVersion.patchset"
PATCHES_2="swift_clang-$portVersion.patchset"
PATCHES_3="swift_llvm-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 !x86 ?x86_64"
SECONDARY_ARCHITECTURES="!x86"
PROVIDES="
swift_lang$secondaryArchSuffix = $portVersion
cmd:sil_func_extractor$secondaryArchSuffix = $portVersion
cmd:sil_llvm_gen$secondaryArchSuffix = $portVersion
cmd:sil_opt$secondaryArchSuffix = $portVersion
cmd:sil_nm$secondaryArchSuffix = $portVersion
cmd:sil_passpipeline_dumper$secondaryArchSuffix = $portVersion
cmd:lldb_moduleimport_test$secondaryArchSuffix = $portVersion
cmd:swift$secondaryArchSuffix = $portVersion
cmd:swiftc$secondaryArchSuffix = $portVersion
cmd:swift_api_digester$secondaryArchSuffix = $portVersion
cmd:swift_api_dump.py$secondaryArchSuffix = $portVersion
cmd:swift_autolink_extract$secondaryArchSuffix = $portVersion
cmd:swift_demangle$secondaryArchSuffix = $portVersion
cmd:swift_format$secondaryArchSuffix = $portVersion
cmd:swift_ide_test$secondaryArchSuffix = $portVersion
cmd:swift_llvm_opt$secondaryArchSuffix = $portVersion
cmd:swift_refactor$secondaryArchSuffix = $portVersion
cmd:swift_reflection_dump$secondaryArchSuffix = $portVersion
cmd:swift_reflection_test_haiku_x86_64$secondaryArchSuffix = $portVersion
cmd:swift_remoteast_test$secondaryArchSuffix = $portVersion
cmd:swift_syntax_test$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libatomic$secondaryArchSuffix
lib:libcharset$secondaryArchSuffix
lib:libedit$secondaryArchSuffix
lib:libexecinfo$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
lib:libicudata$secondaryArchSuffix
lib:libicui18n$secondaryArchSuffix
lib:libicuuc$secondaryArchSuffix
llvm$secondaryArchSuffix >= 5.0.0
lib:libncurses$secondaryArchSuffix
lib:libsqlite3$secondaryArchSuffix
lib:libuuid$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcharset$secondaryArchSuffix
devel:libedit$secondaryArchSuffix
devel:libexecinfo$secondaryArchSuffix
gcc_syslibs$secondaryArchSuffix_devel
devel:libgcc$secondaryArchSuffix
devel:libiconv$secondaryArchSuffix
devel:libicudata$secondaryArchSuffix
devel:libicui18n$secondaryArchSuffix
devel:libicuuc$secondaryArchSuffix
devel:libncurses$secondaryArchSuffix
devel:libsqlite3$secondaryArchSuffix
devel:libuuid$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:clang$secondaryArchSuffix
cmd:clang++$secondaryArchSuffix
cmd:cmake
cmd:diff
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:grep
cmd:groff
cmd:ld$secondaryArchSuffix
cmd:libtool$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:python2
cmd:swig
cmd:sed
cmd:which
"
BUILD()
{
cd ..
mkdir -p swift clang llvm cmark compiler-rt
# Copy all the source files
cp -rd $sourceDir/* swift
cp -rd $sourceDir2/* clang
cp -rd $sourceDir3/* llvm
cp -rd $sourceDir4/* cmark
cp -rd $sourceDir5/* compiler-rt
# Fix permisssions for build-script.
chmod +x ./swift/utils/build-script ./swift/utils/build-script-impl
chmod -R 755 ./swift/utils
export HOST_CC="/bin/clang"
export HOST_CXX="/bin/clang++"
# Build faster by building only for X86
python2 ./swift/utils/build-script -R -m \
--extra-cmake-options='-DLLVM_ENABLE_ASSERTIONS=TRUE \
-DCMAKE_SKIP_RPATH=FALSE -DLLVM_ENABLE_RTTI=ON \
-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_THREADS=YES \
-DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC' \
--stdlib-deployment-targets=haiku-x86_64 $jobArgs
}
INSTALL()
{
mkdir -p $binDir $libDir/swift $libDir/swift/shims \
$libDir/swift/haiku/x86_64 $libDir/swift/clang/include
cd ../build/Unix_Makefiles-ReleaseAssert/swift-haiku-x86_64
# Copy the executables into the binDir.
cp ./bin/* $binDir
cd ./lib/swift/
# Symlink and copy the clang headers.
ln -sfn ../../../llvm-haiku-x86_64/lib/clang/5.0.0/include/ clang
cp -R ./clang/* $libDir/swift/clang/include
cp -R ./shims/* $libDir/swift/shims
# Copy the specific library files.
cp ./haiku/libswiftCore.so $libDir/swift/haiku
cp ./haiku/libswiftGlibc.so $libDir/swift/haiku
cp ./haiku/libswiftRemoteMirror.so $libDir/swift/haiku
cp ./haiku/libswiftSwiftOnoneSupport.so $libDir/swift/haiku
# Copy the essential swiftmodule files.
cp ./haiku/x86_64/SwiftOnoneSupport.swiftmodule $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Glibc.swiftmodule $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Swift.swiftmodule $libDir/swift/haiku/x86_64
# Copy the essential swiftdoc files.
cp ./haiku/x86_64/SwiftOnoneSupport.swiftdoc $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Glibc.swiftdoc $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/Swift.swiftdoc $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/glibc.modulemap $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/swift_begin.o $libDir/swift/haiku/x86_64
cp ./haiku/x86_64/swift_end.o $libDir/swift/haiku/x86_64
}
TEST()
{
python2 utils/build-script -R -t
}