Commit 3a4344bb authored by Luke Redpath's avatar Luke Redpath

Looks like the -fobj-arc flag we added to OTHER_LD_FLAGS in ea918cd9 was

an unsupported feature as it has now been removed from Xcode 4.3.2, 
causing lib tool to complain about an unrecognised flag.

I considered removing this entirely but have decided to keep it around 
as an option for the time being. You can get the previous behaviour by
adding set_arc_compatibility_flag! to your Podfile.

I'd like to get rid of this entirely eventually. Re-closes #142 unless
anybody has any objections.
parent 23692ea0
......@@ -13,10 +13,8 @@ module Pod
def xcconfig
@xcconfig ||= Xcodeproj::Config.new({
# In a workspace this is where the static library headers should be found.
'PODS_ROOT' => '$(SRCROOT)/Pods',
'PODS_ROOT' => '$(SRCROOT)/Pods',
'ALWAYS_SEARCH_USER_PATHS' => 'YES', # needed to make EmbedReader build
# This makes categories from static libraries work, which many libraries
# require, so we add these by default.
'OTHER_LDFLAGS' => default_ld_flags,
})
end
......@@ -118,7 +116,7 @@ module Pod
def default_ld_flags
flags = %w{-ObjC -all_load}
flags << '-fobjc-arc' if self.requires_arc
flags << '-fobjc-arc' if @podfile.set_arc_compatibility_flag? && self.requires_arc
flags.join(" ")
end
end
......
......@@ -215,6 +215,19 @@ module Pod
@post_install_callback = block
end
# Specifies that the -fobjc-arc flag should be added to the OTHER_LD_FLAGS.
#
# This is used as a workaround for a compiler bug with non-ARC projects.
# (see https://github.com/CocoaPods/CocoaPods/issues/142)
#
# This was originally done automatically but libtool as of Xcode 4.3.2 no
# longer seems to support the -fobjc-arc flag. Therefore it now has to be
# enabled explicitly using this method.
#
# This may be removed in a future release.
def set_arc_compatibility_flag!
@set_arc_compatibility_flag = true
end
# Not attributes
......@@ -236,6 +249,10 @@ module Pod
def generate_bridge_support?
@generate_bridge_support
end
def set_arc_compatibility_flag?
@set_arc_compatibility_flag
end
def post_install!(installer)
@post_install_callback.call(installer) if @post_install_callback
......
......@@ -48,6 +48,10 @@ describe "Pod::Podfile" do
Pod::Podfile.new {}.should.not.generate_bridge_support
Pod::Podfile.new { generate_bridge_support! }.should.generate_bridge_support
end
it 'specifies that ARC compatibility flag should be generated' do
Pod::Podfile.new { set_arc_compatibility_flag! }.should.set_arc_compatibility_flag
end
it "stores a block that will be called with the Installer instance once installation is finished (but the project is not written to disk yet)" do
yielded = nil
......
......@@ -8,7 +8,9 @@ describe Pod::Installer::TargetInstaller do
@target_definition = stub('target', :lib_name => "FooLib")
platform = Pod::Platform.new(:ios)
@podfile = stub('podfile', :platform => platform, :generate_bridge_support? => false)
@podfile = stub('podfile', :platform => platform,
:generate_bridge_support? => false,
:set_arc_compatibility_flag? => false)
@project = Pod::Project.for_platform(platform)
@project.main_group.groups.new('name' => 'Targets Support Files')
......@@ -45,9 +47,20 @@ describe Pod::Installer::TargetInstaller do
@installer.xcconfig.to_hash['HEADER_SEARCH_PATHS'].should.include("\"#{@sandbox.header_search_paths.join(" ")}\"")
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc (to support non-ARC projects on iOS 4.0)' do
@specification.stubs(:requires_arc).returns(true)
it 'does not add the -fobjc-arc to OTHER_LDFLAGS by default as Xcode 4.3.2 does not support it' do
do_install!
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.not.include("-fobjc-arc")
end
describe "when ARC compatibility flag is set" do
before do
@podfile.stubs(:set_arc_compatibility_flag? => true)
end
it 'adds the -fobjc-arc to OTHER_LDFLAGS if any pods require arc (to support non-ARC projects on iOS 4.0)' do
@specification.stubs(:requires_arc).returns(true)
@installer.install!(@pods, @sandbox)
@installer.xcconfig.to_hash['OTHER_LDFLAGS'].split(" ").should.include("-fobjc-arc")
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment