This repository has been archived by the owner on Sep 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor to make it easier to support multiple SDKs.
- Loading branch information
Rob Holland
committed
Jun 11, 2010
1 parent
ed33dfa
commit 592ae03
Showing
41 changed files
with
151 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
require 'rake/clean' | ||
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'icuke', 'sdk') | ||
|
||
SDK_VERSION = '3.1.2' | ||
SDK_ROOT = "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{SDK_VERSION}.sdk" | ||
CFLAGS = '-arch i386 -pipe -ggdb -std=c99 -DTARGET_OS_IPHONE' | ||
SDK_CFLAGS = "-isysroot #{SDK_ROOT} -F/System/Library/PrivateFrameworks -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000" | ||
CC = '/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2' | ||
SUPPORTED_SDKS = ['3'] | ||
|
||
rule '.o' => '.m' do |o| | ||
sh "#{CC} -I. -Ijson -c -o #{o.name} -x objective-c #{CFLAGS} #{SDK_CFLAGS} #{o.source}" | ||
ICuke::SDK.major_versions.each do |sdk| | ||
unless SUPPORTED_SDKS.include?(sdk) | ||
puts "iCuke does not currently support version #{sdk} of the iPhone SDK" | ||
next | ||
end | ||
|
||
task :install do | ||
sh "cd sdk#{sdk} && rake" | ||
end | ||
task :clean do | ||
sh "cd sdk#{sdk} && rake clean" | ||
end | ||
end | ||
|
||
CLEAN.include('**/*.o') | ||
|
||
file 'libicuke.dylib' => FileList['**/*.m'].ext('.o') do |t| | ||
sh "#{CC} -dynamiclib -o #{t.name} #{CFLAGS} #{SDK_CFLAGS} -framework Foundation -framework GraphicsServices -framework UIKit -framework CFNetwork -framework AXRuntime #{t.prerequisites.join(' ')}" | ||
end | ||
|
||
CLEAN.include('libicuke.dylib') | ||
|
||
task :install => 'libicuke.dylib' | ||
task :default => :install |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require File.join(File.dirname(__FILE__), '..', '..', '..', 'lib', 'icuke', 'sdk') | ||
require 'rake/clean' | ||
|
||
version = 3 | ||
ICuke::SDK.use_latest(version) | ||
|
||
CFLAGS = '-arch i386 -pipe -ggdb -std=c99 -DTARGET_OS_IPHONE' | ||
SDK_CFLAGS = "-isysroot #{ICuke::SDK.root} -F/System/Library/PrivateFrameworks -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000" | ||
|
||
rule '.o' => '.m' do |o| | ||
sh "xcrun -sdk #{ICuke::SDK.fullname} gcc -I. -Ijson -c -o #{o.name} -x objective-c #{CFLAGS} #{SDK_CFLAGS} #{o.source}" | ||
end | ||
|
||
CLEAN.include('**/*.o') | ||
|
||
file "../#{ICuke::SDK.dylib}" => FileList['**/*.m'].ext('.o') do |t| | ||
sh "xcrun -sdk #{ICuke::SDK.fullname} gcc -dynamiclib -o #{t.name} #{CFLAGS} #{SDK_CFLAGS} -framework Foundation -framework GraphicsServices -framework UIKit -framework CFNetwork -framework AXRuntime #{t.prerequisites.join(' ')}" | ||
end | ||
|
||
CLEAN.include("../#{ICuke::SDK.dylib}") | ||
|
||
task :install => "../#{ICuke::SDK.dylib}" | ||
task :default => :install |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,4 @@ | |
@interface iCukeServer : iCukeHTTPServer { | ||
} | ||
|
||
+ (void) start; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
require 'icuke/simulator' | ||
require 'icuke/sdk' | ||
require 'icuke/simulator' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
module ICuke | ||
module SDK | ||
def self.all | ||
@all ||= begin | ||
`xcodebuild -showsdks`.grep(/iphonesimulator/).map do |s| | ||
s.sub(/.* iphonesimulator([0-9.]+).*/, '\1').chomp | ||
end.sort | ||
end | ||
end | ||
|
||
def self.installed?(sdk) | ||
all.include?(sdk) | ||
end | ||
|
||
def self.major_versions | ||
all.map { |s| s.split('.').first }.uniq | ||
end | ||
|
||
def self.latest(major_version = nil) | ||
@latest ||= major_version ? all.grep(/^#{major_version}\./).last : all.last | ||
end | ||
|
||
def self.use(version) | ||
unless installed?(version) | ||
raise "The requested SDK version #{version} doesn't appear to be installed" | ||
end | ||
|
||
@sdk = version | ||
end | ||
|
||
def self.use_latest(major_version = nil) | ||
use latest(major_version) | ||
end | ||
|
||
def self.version | ||
require_sdk | ||
|
||
@sdk | ||
end | ||
|
||
def self.major_version | ||
require_sdk | ||
|
||
version.split('.').first | ||
end | ||
|
||
def self.fullname | ||
require_sdk | ||
|
||
"iphonesimulator#{version}" | ||
end | ||
|
||
def self.root | ||
require_sdk | ||
|
||
"/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{version}.sdk" | ||
end | ||
|
||
def self.home | ||
require_sdk | ||
|
||
"#{ENV['HOME']}/Library/Application Support/iPhone Simulator/#{version}" | ||
end | ||
|
||
def self.dylib | ||
require_sdk | ||
|
||
"libicuke-sdk#{version.split('.').first}.dylib" | ||
end | ||
|
||
private | ||
|
||
def self.require_sdk | ||
raise "No SDK has been selected" unless @sdk | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters