Skip to content
This repository was archived by the owner on Oct 25, 2022. It is now read-only.

Commit 4b1a529

Browse files
author
Berend Ozceri
committed
Added support for tvOS SDK builds.
1 parent d01353b commit 4b1a529

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

lib/curl_builder.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ module CurlBuilder
6262
debug_symbols: false,
6363
curldebug: false,
6464
sdk_version: "9.0",
65+
tvos_sdk_version: "none",
6566
osx_sdk_version: "10.10",
6667
libcurl_version: "7.38.0",
6768
architectures: %w(i386 armv7 armv7s arm64 x86_64),
@@ -73,7 +74,10 @@ module CurlBuilder
7374
cleanup: true,
7475
}
7576

76-
VALID_ARGS = {architectures: %w(i386 armv7 armv7s arm64 x86_64)}
77+
VALID_ARGS = {
78+
architectures: %w(i386 armv7 armv7s arm64 x86_64),
79+
architectures_64_bit: %w(arm64 x86_64)
80+
}
7781

7882

7983
attr_accessor :logger
@@ -94,7 +98,7 @@ def build_flags(flags)
9498
flags.collect { |flag, enabled| enabled ? "--with-#{flag}" : "--without-#{flag}" }
9599
end
96100

97-
def filter_valid_archs(archs)
98-
VALID_ARGS[:architectures] & archs
101+
def filter_valid_archs(archs, only_64_bit = false)
102+
VALID_ARGS[(!only_64_bit ? :architectures : :architectures_64_bit)] & archs
99103
end
100104
end

lib/curl_builder/compiler.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ def compile_for(architecture)
5757
def platform_for(architecture)
5858
case architecture
5959
when "x86_64"
60-
setup(:osx_sdk_version) == "none" ? "iPhoneSimulator" : "MacOSX"
60+
setup(:osx_sdk_version) == "none" ? (setup(:tvos_version) == "none" ? "iPhoneSimulator" : "AppleTVSimulator") : "MacOSX"
6161
when "i386"
62-
"iPhoneSimulator"
62+
setup(:tvos_version) == "none" ? "iPhoneSimulator" : "AppleTVSimulator"
6363
else
64-
"iPhoneOS"
64+
setup(:tvos_version) == "none" ? "iPhoneOS" : "AppleTVOS"
6565
end
6666
end
6767

@@ -86,6 +86,8 @@ def find_tool(tool_name, platform)
8686
def sdk_version_for(platform)
8787
if platform == "iPhoneOS" || platform == "iPhoneSimulator"
8888
setup(:sdk_version)
89+
elsif platform == "AppleTVOS" || platform == "AppleTVSimulator"
90+
setup(:tvos_sdk_version)
8991
else
9092
setup(:osx_sdk_version)
9193
end
@@ -98,6 +100,8 @@ def compilation_flags_for(platform, architecture)
98100
elsif platform == "iPhoneOS"
99101
version = architecture == "arm64" ? "6.0" : "5.0"
100102
min_version = "-miphoneos-version-min=#{version}"
103+
elsif platform == "AppleTVOS" || platform == "AppleTVSimulator"
104+
min_version = "-mtvos-version-min=9.0"
101105
else
102106
min_version = "-mmacosx-version-min=10.7"
103107
end
@@ -141,6 +145,7 @@ def configure(architecture, tools, compilation_flags)
141145
--host=#{host}
142146
--disable-shared
143147
--enable-static
148+
--disable-ntlm-wb
144149
#{flags.join(" ")}
145150
--prefix="#{output_dir_for architecture}"
146151
}

lib/curl_builder/parser.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ def parse(args)
9191
setup[:sdk_version] = sdk
9292
end
9393

94+
parser.on("--tvos-sdk-version SDK",
95+
"Use specific SDK version",
96+
" Defaults to #{param(setup[:tvos_sdk_version])}") do |sdk|
97+
setup[:tvos_sdk_version] = sdk
98+
end
99+
94100
parser.on("--osx-sdk-version SDK",
95101
"Use specific SDK version",
96102
" Defaults to #{param(setup[:osx_sdk_version])}") do |sdk|
@@ -150,6 +156,14 @@ def parse(args)
150156

151157
parser.parse(args)
152158

159+
if setup[:sdk_version] != "none" && setup[:tvos_sdk_version] != "none"
160+
raise Errors::TaskError, "Builds with both iOS and tvOS SDKs active are unsupported. Please set either --sdk-version or --tvos-sdk-version to none."
161+
end
162+
163+
if setup[:tvos_sdk_version] != "none"
164+
setup[:architectures] = CurlBuilder.filter_valid_archs(setup[:architectures], true)
165+
end
166+
153167
{setup: setup, protocols: protocols, flags: flags}
154168
end
155169
end

0 commit comments

Comments
 (0)