Skip to content

Instantly share code, notes, and snippets.

@chendo
Created May 23, 2013 14:31
Show Gist options
  • Save chendo/5636501 to your computer and use it in GitHub Desktop.
Save chendo/5636501 to your computer and use it in GitHub Desktop.
This diff fixes a RubyMotion bug where vendored Xcode projects doesn't find the static libs.
diff --git a/lib/motion/project/vendor.rb b/lib/motion/project/vendor.rb
index 0dccdff..9a94a3b 100644
--- a/lib/motion/project/vendor.rb
+++ b/lib/motion/project/vendor.rb
@@ -166,16 +166,17 @@ EOS
# Unset environment variables that could potentially make the build
# to fail.
%w{CC CXX CFLAGS CXXFLAGS LDFLAGS}.each { |f| ENV[f] &&= nil }
-
+
# Build project into a build directory. We delete the build directory
# each time because Xcode is too stupid to be trusted to use the
# same build directory for different platform builds.
- rm_rf XcodeBuildDir
+ xcode_build_dir = File.expand_path(XcodeBuildDir)
+ rm_rf xcode_build_dir
xcopts = ''
xcopts << "-target \"#{target}\" " if target
xcopts << "-scheme \"#{scheme}\" " if scheme
- sh "/usr/bin/xcodebuild -project \"#{xcodeproj}\" #{xcopts} -configuration \"#{configuration}\" -sdk #{platform.downcase}#{@config.sdk_version} #{@config.arch_flags(platform)} CONFIGURATION_BUILD_DIR=#{XcodeBuildDir} IPHONEOS_DEPLOYMENT_TARGET=#{@config.deployment_target} build"
-
+ sh "/usr/bin/xcodebuild -project \"#{xcodeproj}\" #{xcopts} -configuration \"#{configuration}\" -sdk #{platform.downcase}#{@config.sdk_version} #{@config.arch_flags(platform)} CONFIGURATION_BUILD_DIR=#{xcode_build_dir} IPHONEOS_DEPLOYMENT_TARGET=#{@config.deployment_target} build"
+
# Copy .a files into the platform build directory.
prods = opts.delete(:products)
Dir.glob(File.join(XcodeBuildDir, '*.a')).each do |lib|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment