- Timestamp:
- Jul 9, 2020, 8:51:43 AM (4 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-2.1.1
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-2.1.1/tasks/toolchains/android.rake
r331 r439 8 8 /usr/local/opt/android-sdk/ndk-bundle 9 9 /usr/local/opt/android-ndk 10 ~/Android/Sdk/ndk-bundle 10 11 %LOCALAPPDATA%/Android/android-sdk/ndk-bundle 11 12 %LOCALAPPDATA%/Android/android-ndk 13 %LOCALAPPDATA%/Android/Sdk/ndk/* 12 14 ~/Library/Android/sdk/ndk-bundle 13 15 ~/Library/Android/ndk … … 37 39 Set ANDROID_PLATFORM environment variable or set :platform parameter 38 40 EOM 41 end 42 end 43 44 class SysrootNotReady < StandardError 45 def message 46 <<-EOM 47 Couldn't find standard header files 48 Please Move/Copy important file inside 49 <NDK_HOME>/sysroot/usr/include/ 50 to 51 <NDK_HOME>/platforms/<ANDROID_VERSION>/<ARCH>/usr/include/ 52 Higher NDK version will be use. 53 EOM 39 54 end 40 55 end … … 67 82 68 83 def home_path 69 @home_path ||= Pathname (84 @home_path ||= Pathname.new( 70 85 params[:ndk_home] || 71 86 ENV['ANDROID_NDK_HOME'] || … … 74 89 path.gsub! '\\', '/' 75 90 path.gsub! '~', Dir.home || '~' 91 path.gsub!('*') do 92 next nil unless path[-1] == "*" 93 dirs = Dir.glob(path).collect do |d| 94 m = d.match(/(\d+)\.(\d+)\.(\d+)$/) 95 m ? [m[1], m[2], m[3]].collect { |v| v.to_i } : nil 96 end 97 dirs.compact! 98 dirs.sort! do |before, after| 99 f = 0 100 if (f = (after.first <=> before.first)) != 0 101 next f 102 elsif (f = (after[1] <=> before[1])) != 0 103 next f 104 else 105 next after.last <=> before.last 106 end 107 end 108 dirs.empty? ? nil.to_s : dirs.first.join(".") 109 end 76 110 File.directory?(path) 77 111 } || raise(AndroidNDKHomeNotFound) … … 124 158 Dir.glob(path.to_s){ |item| 125 159 next if File.file?(item) 126 path = Pathname (item)160 path = Pathname.new(item) 127 161 break 128 162 } … … 146 180 147 181 def sysroot 148 @sysroot ||= home_path.join('platforms', platform, 182 return @sysroot if @sysroot 183 sysroot_path = home_path.join('platforms', platform, 149 184 case arch 150 185 when /armeabi/ then 'arch-arm' … … 156 191 end 157 192 ).to_s 193 if Dir.exist?(File.join(sysroot_path, "usr", "include")) 194 return @sysroot = sysroot_path 195 else 196 raise(SysrootNotReady) 197 end 158 198 end 159 199 … … 259 299 flags = [] 260 300 301 case RUBY_PLATFORM 302 when /mswin|mingw|win32/ 303 # Build for Android dont need window flag 304 flags += %W(-U_WIN32 -U_WIN64) 305 end 306 261 307 flags += %W(-MMD -MP -D__android__ -DANDROID --sysroot="#{sysroot}") 262 308 flags += ctarget … … 264 310 when :gcc 265 311 when :clang 266 flags += %W(-gcc-toolchain "#{gcc_toolchain_path .to_s}" -Wno-invalid-command-line-argument -Wno-unused-command-line-argument)312 flags += %W(-gcc-toolchain "#{gcc_toolchain_path}" -Wno-invalid-command-line-argument -Wno-unused-command-line-argument) 267 313 end 268 314 flags += %W(-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes)
Note:
See TracChangeset
for help on using the changeset viewer.