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 #56 from vgorloff/develop
Browse files Browse the repository at this point in the history
RC 1.0.39. Build on Linux host partially restored.
  • Loading branch information
vgorloff authored Jul 23, 2019
2 parents 4f83790 + 6f72d3c commit be893d2
Show file tree
Hide file tree
Showing 20 changed files with 295 additions and 127 deletions.
90 changes: 27 additions & 63 deletions Automation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ def perform()

def buildComponent(component)
if component == "xml" then @archsToBuild.each { |arch| XMLBuilder.new(arch).make }
elsif component == "icu" then buildICU()
elsif component == "curl" then buildCURL()
elsif component == "ssl" then buildSSL()
elsif component == "icu" then @archsToBuild.each { |arch| ICUBuilder.new(arch).make }
elsif component == "icuHost" then ICUHostBuilder.new().make
elsif component == "curl" then @archsToBuild.each { |arch| CurlBuilder.new(arch).make }
elsif component == "ssl" then @archsToBuild.each { |arch| OpenSSLBuilder.new(arch).make }
elsif component == "deps" then buildDeps()
elsif component == "libs"
@archsToBuild.each { |arch| DispatchBuilder.new(arch).make }
Expand All @@ -115,7 +116,8 @@ def buildComponent(component)
elsif component == "llb" then LLBBuilder.new().make
elsif component == "dispatch" then @archsToBuild.each { |arch| DispatchBuilder.new(arch).make }
elsif component == "foundation" then @archsToBuild.each { |arch| FoundationBuilder.new(arch).make }
elsif component == "llvm" then buildLLVM()
elsif component == "cmark" then CMarkBuilder.new().make
elsif component == "llvm" then LLVMBuilder.new().make
else
puts "! Unknown component \"#{component}\"."
usage()
Expand All @@ -137,15 +139,16 @@ def rebuildComponent(component)
end

def cleanComponent(component)
if component == "curl" then cleanCURL()
elsif component == "icu" then cleanICU()
elsif component == "xml" then cleanXML()
elsif component == "ssl" then cleanSSL()
elsif component == "curl" then cleanCURL()
elsif component == "deps" then cleanDeps()
elsif component == "dispatch" then cleanDispatch()
if component == "curl" then @archsToBuild.each { |arch| CurlBuilder.new(arch).clean }
elsif component == "icuHost" then ICUHostBuilder.new().clean
elsif component == "icu" then @archsToBuild.each { |arch| ICUBuilder.new(arch).clean }
elsif component == "xml" then @archsToBuild.each { |arch| XMLBuilder.new(arch).clean }
elsif component == "ssl" then @archsToBuild.each { |arch| OpenSSLBuilder.new(arch).clean }
elsif component == "dispatch" then @archsToBuild.each { |arch| DispatchBuilder.new(arch).clean }
elsif component == "foundation" then @archsToBuild.each { |arch| FoundationBuilder.new(arch).clean }
elsif component == "llvm" then cleanLLVM()
elsif component == "cmark" then CMarkBuilder.new().clean
elsif component == "llvm" then LLVMBuilder.new().clean
elsif component == "deps" then cleanDeps()
elsif component == "libs" then cleanLibs()
elsif component == "swift" then SwiftBuilder.new().clean
elsif component == "spm" then SPMBuilder.new().clean
Expand All @@ -170,6 +173,7 @@ def installComponent(component)
def configureComponent(component)
if component == "swift" then SwiftBuilder.new().configure
elsif component == "dispatch" then @archsToBuild.each { |arch| DispatchBuilder.new(arch).configure }
elsif component == "llvm" then LLVMBuilder.new().configure
else
puts "! Unknown component \"#{component}\"."
usage()
Expand Down Expand Up @@ -352,81 +356,41 @@ def status()
end

def clean()
cleanLLVM()
LLVMBuilder.new().clean
CMarkBuilder.new().clean
cleanDeps()
SwiftBuilder.new().clean
cleanLibs()
end

def build()
LLVMBuilder.new().make
CMarkBuilder.new().make
buildDeps()
buildLLVM()
SwiftBuilder.new().make
@archsToBuild.each { |arch| DispatchBuilder.new(arch).make }
@archsToBuild.each { |arch| FoundationBuilder.new(arch).make }
end

def cleanDeps()
cleanICU()
cleanXML()
cleanSSL()
cleanCURL()
end

def buildDeps()
buildICU()
@archsToBuild.each { |arch| XMLBuilder.new(arch).make }
buildSSL()
buildCURL()
end

def cleanLibs()
cleanDispatch()
@archsToBuild.each { |arch| FoundationBuilder.new(arch).clean }
end

def buildLLVM()
LLVMBuilder.new().make
CMarkBuilder.new().make
end

def cleanLLVM()
LLVMBuilder.new().clean
CMarkBuilder.new().clean
end

def cleanICU()
ICUHostBuilder.new().clean
@archsToBuild.each { |arch| ICUBuilder.new(arch).clean }
@archsToBuild.each { |arch| XMLBuilder.new(arch).clean }
@archsToBuild.each { |arch| OpenSSLBuilder.new(arch).clean }
@archsToBuild.each { |arch| CurlBuilder.new(arch).clean }
end

def buildICU()
def buildDeps()
ICUHostBuilder.new().make
@archsToBuild.each { |arch| ICUBuilder.new(arch).make }
end

def buildSSL()
@archsToBuild.each { |arch| XMLBuilder.new(arch).make }
@archsToBuild.each { |arch| OpenSSLBuilder.new(arch).make }
end

def cleanSSL()
@archsToBuild.each { |arch| OpenSSLBuilder.new(arch).clean }
end

def cleanCURL()
@archsToBuild.each { |arch| CurlBuilder.new(arch).clean }
end

def buildCURL()
@archsToBuild.each { |arch| CurlBuilder.new(arch).make }
end

def cleanXML()
@archsToBuild.each { |arch| XMLBuilder.new(arch).clean }
end

def cleanDispatch()
def cleanLibs()
@archsToBuild.each { |arch| DispatchBuilder.new(arch).clean }
@archsToBuild.each { |arch| FoundationBuilder.new(arch).clean }
end

def resetComponent(component)
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.0.38] - 2019-07-16
### Changed
* Updated component revisions.
* Updated Dispatch to latest revision.

## [1.0.37] - 2019-07-10
### Changed
Expand Down
70 changes: 53 additions & 17 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,59 +11,95 @@

Build of complete tollchain takes ~1.5h. Instead of building it you can just download and use already pre-built package from [Releases](https://github.com/vgorloff/swift-everywhere-toolchain/releases) page.

# Setup and Build
# Setup and Build (macOS)

1. Check that Cmake is installed. Install Cmake if Needed.

```bash
$ which cmake
$ brew install cmake
which cmake
brew install cmake
```

2. Check that Ninja is installed. Install Ninja if Needed.

```bash
$ which ninja
$ brew install ninja
which ninja
brew install ninja
```

3. Check that Autotools is installed. Install Autotools if Needed.

```bash
$ which autoconf
$ brew install autoconf
which autoconf
brew install autoconf

$ which aclocal
$ brew install automake
which aclocal
brew install automake

$ which glibtool
$ brew install libtool
which glibtool
brew install libtool

$ which pkg-config
$ brew install pkg-config
which pkg-config
brew install pkg-config
```

4. Clone this repository.

```bash
$ git clone https://github.com/vgorloff/swift-everywhere-toolchain.git
$ cd swift-everywhere-toolchain
git clone https://github.com/vgorloff/swift-everywhere-toolchain.git
cd swift-everywhere-toolchain
```

5. Copy file `local.properties.yml.template` to `local.properties.yml`

6. Edit file `local.properties.yml` and configure following settings:

- `ndk.dir`: Path to NDK installation directory.
- `ndk.dir.macos`: Path to NDK installation directory.

7. Start a build.

```bash
$ make
make
```

8. Once build completed, toolchain will be saved to folder `ToolChain/swift-android-toolchain` and complessed into archive `ToolChain/swift-android-toolchain.tar.gz`.

# Setup and Build (Vagrant Linux)

1. Clone this repository.

```bash
git clone https://github.com/vgorloff/swift-everywhere-toolchain.git
cd swift-everywhere-toolchain
```

2. Copy file `local.properties.yml.template` to `local.properties.yml`

3. Edit file `local.properties.yml` and configure following settings:

- `ndk.dir.linux-vagrant`: Path to NDK installation directory.

4. Launch Box.

```bash
vagrant up
```

5. Login to Box.

```bash
vagrant ssh
```

6. Start a build.

```bash
cd /vagrant
make
```

7. Once build completed, toolchain will be saved to folder `ToolChain/swift-android-toolchain` and complessed into archive `ToolChain/swift-android-toolchain.tar.gz`.

# Sample Projects

Sample projects can be found in separate [swift-everywhere-samples](https://github.com/vgorloff/swift-everywhere-samples) repository. Please look into `Readme.md` in that repository to get information about how to configure and build sample projects.
12 changes: 7 additions & 5 deletions Scripts/Builders/CMarkBuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ def executeConfigure
cmd << "-DCMAKE_INSTALL_PREFIX=/"
cmd << "-DCMAKE_BUILD_TYPE=Release"
cmd << "-DCMARK_TESTS=false"
cFlags = '-Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector'
cmd << "-DCMAKE_C_FLAGS='#{cFlags}'"
cmd << "-DCMAKE_CXX_FLAGS='#{cFlags}'"
cmd << "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
cmd << "-DCMAKE_OSX_SYSROOT=#{macOSSDK}"
if isMacOS?
cFlags = '-Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector'
cmd << "-DCMAKE_C_FLAGS='#{cFlags}'"
cmd << "-DCMAKE_CXX_FLAGS='#{cFlags}'"
cmd << "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
cmd << "-DCMAKE_OSX_SYSROOT=#{macOSSDK}"
end
cmd << @sources
execute cmd.join(" ")
end
Expand Down
3 changes: 2 additions & 1 deletion Scripts/Builders/ICUHostBuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ def initialize()
end

def executeConfigure
hostSystem = isMacOS? ? "MacOSX" : "Linux"
cmd = ["cd #{@builds} &&"]
cmd << "CFLAGS='-Os'"
cmd << "CXXFLAGS='--std=c++11'"
cmd << "#{@sources}/source/runConfigureICU MacOSX --prefix=#{@installs}"
cmd << "#{@sources}/source/runConfigureICU #{hostSystem} --prefix=#{@installs}"
cmd << "--enable-static --enable-shared=no --enable-extras=no --enable-strict=no --enable-icuio=no --enable-layout=no"
cmd << "--enable-layoutex=no --enable-tools=no --enable-tests=no --enable-samples=no --enable-dyload=no"
execute cmd.join(" ")
Expand Down
33 changes: 23 additions & 10 deletions Scripts/Builders/SwiftBuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ def executeConfigure
cmd << "-DCMAKE_RANLIB=#{@builds}/cmake-ranlib"
cmd << "-DCMAKE_LIBTOOL=#{toolchainPath}/usr/bin/libtool"
cmd << "-DSWIFT_LIPO=#{toolchainPath}/usr/bin/lipo"
cmd << "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
cmd << "-DCMAKE_OSX_SYSROOT=#{macOSSDK}"
cmd << "-DSWIFT_DARWIN_DEPLOYMENT_VERSION_OSX=10.9"
if isMacOS?
cmd << "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9"
cmd << "-DCMAKE_OSX_SYSROOT=#{macOSSDK}"
cmd << "-DSWIFT_DARWIN_DEPLOYMENT_VERSION_OSX=10.9"
else
cmd << "-DCMAKE_C_COMPILER=\"#{@llvm.builds}/bin/clang\" -DCMAKE_CXX_COMPILER=\"#{@llvm.builds}/bin/clang++\""
end

cmd << "-DSWIFT_STDLIB_ENABLE_SIL_OWNERSHIP=FALSE"
cmd << "-DSWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS=TRUE"
Expand Down Expand Up @@ -154,15 +158,24 @@ def executeConfigure
cmd << "-DLIBDISPATCH_CMAKE_BUILD_TYPE=Release"
cmd << "-DSWIFT_ENABLE_LLD_LINKER=FALSE"

cmd << "-DSWIFT_OVERLAY_TARGETS=''" # Disabling builds of Darwin Overlays.
cmd << "-DSWIFT_HOST_VARIANT=macosx"
cmd << "-DSWIFT_HOST_VARIANT_SDK=OSX"
cmd << "-DSWIFT_ENABLE_IOS32=false"
cmd << "-DSWIFT_SDK_OSX_PATH=#{macOSSDK}"
if isMacOS?
cmd << "-DSWIFT_OVERLAY_TARGETS=''" # Disabling builds of Darwin Overlays.
cmd << "-DSWIFT_HOST_VARIANT=macosx"
cmd << "-DSWIFT_HOST_VARIANT_SDK=OSX"
cmd << "-DSWIFT_ENABLE_IOS32=false"
cmd << "-DSWIFT_SDK_OSX_PATH=#{macOSSDK}"
cmd << "-DSWIFT_HOST_TRIPLE=x86_64-apple-macosx10.9"
cmd << "-DSWIFT_SDKS='ANDROID'"
else
cmd << "-DSWIFT_HOST_VARIANT=linux"
cmd << "-DSWIFT_HOST_VARIANT_SDK=LINUX"
cmd << "-DSWIFT_HOST_TRIPLE=armv6-unknown-linux-gnueabihf"
# Workaround for error: Cannot add target-level dependencies to non-existent target "swift-stdlib-linux-x86_64".
# Fix it later so that it should be possible to build Swift for android only
cmd << "-DSWIFT_SDKS='ANDROID;LINUX'"
end

cmd << "-DSWIFT_SDKS='ANDROID'"
cmd << "-DSWIFT_PRIMARY_VARIANT_SDK=ANDROID"
cmd << "-DSWIFT_HOST_TRIPLE=x86_64-apple-macosx10.9"
cmd << "-DSWIFT_PATH_TO_LIBICU_BUILD=#{@builds}" # Value at the moment not really used in build process, but used in Cmake logic routines.

cmd << "-DSWIFT_HOST_VARIANT_ARCH=x86_64"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/Common/Arch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def self.default

# Fixme. Seems `x86` can be used instead.
def self.host
return "darwin"
return "host"
end

def self.x86
Expand Down
Loading

0 comments on commit be893d2

Please sign in to comment.