mrubyを超漢字で動作させる
Revision | e48596e9e69a17f6a8b8460dbb12d0084ed2ff27 (tree) |
---|---|
Time | 2015-10-13 00:03:58 |
Author | Yukihiro "Matz" Matsumoto <matz@ruby...> |
Commiter | Yukihiro "Matz" Matsumoto |
@@ -1,132 +0,0 @@ | ||
1 | -# Download and unarchive latest Android NDK from https://developer.android.com/tools/sdk/ndk/index.html | |
2 | -# Make custom standalone toolchain as described here (android_ndk/docs/STANDALONE-TOOLCHAIN.html) | |
3 | -# Please export custom standalone toolchain path | |
4 | -# export ANDROID_STANDALONE_TOOLCHAIN=/tmp/android-14-toolchain | |
5 | - | |
6 | -# Add to your build_config.rb | |
7 | -# MRuby::CrossBuild.new('androideabi') do |conf| | |
8 | -# toolchain :androideabi | |
9 | -# end | |
10 | - | |
11 | -MRuby::Toolchain.new(:androideabi) do |conf| | |
12 | - toolchain :gcc | |
13 | - | |
14 | - DEFAULT_ANDROID_TOOLCHAIN = 'gcc' | |
15 | - DEFAULT_ANDROID_TARGET_ARCH = 'arm' | |
16 | - DEFAULT_ANDROID_TARGET_ARCH_ABI = 'armeabi' | |
17 | - DEFAULT_ANDROID_TARGET_PLATFORM = 'android-14' | |
18 | - DEFAULT_GCC_VERSION = '4.6' | |
19 | - DEFAULT_CLANG_VERSION = '3.1' | |
20 | - GCC_COMMON_CFLAGS = %W(-ffunction-sections -funwind-tables -fstack-protector) | |
21 | - GCC_COMMON_LDFLAGS = %W() | |
22 | - | |
23 | - # 'ANDROID_STANDALONE_TOOLCHAIN' or 'ANDROID_NDK_HOME' must be set. | |
24 | - ANDROID_STANDALONE_TOOLCHAIN = ENV['ANDROID_STANDALONE_TOOLCHAIN'] | |
25 | - ANDROID_NDK_HOME = ENV['ANDROID_NDK_HOME'] | |
26 | - | |
27 | - ANDROID_TARGET_ARCH = ENV['ANDROID_TARGET_ARCH'] || DEFAULT_ANDROID_TARGET_ARCH | |
28 | - ANDROID_TARGET_ARCH_ABI = ENV['ANDROID_TARGET_ARCH_ABI'] || DEFAULT_ANDROID_TARGET_ARCH_ABI | |
29 | - ANDROID_TOOLCHAIN = ENV['ANDROID_TOOLCHAIN'] || DEFAULT_ANDROID_TOOLCHAIN | |
30 | - GCC_VERSION = ENV['GCC_VERSION'] || DEFAULT_GCC_VERSION | |
31 | - CLANG_VERSION = ENV['CLANG_VERSION'] || DEFAULT_CLANG_VERSION | |
32 | - | |
33 | - case ANDROID_TARGET_ARCH.downcase | |
34 | - when 'arch-arm', 'arm' then | |
35 | - toolchain_prefix = 'arm-linux-androideabi-' | |
36 | - when 'arch-x86', 'x86' then | |
37 | - toolchain_prefix = 'i686-linux-android-' | |
38 | - when 'arch-mips', 'mips' then | |
39 | - toolchain_prefix = 'mipsel-linux-android-' | |
40 | - else | |
41 | - # Any other architectures are not supported by Android NDK. | |
42 | - # Notify error. | |
43 | - end | |
44 | - | |
45 | - if ANDROID_STANDALONE_TOOLCHAIN == nil then | |
46 | - case RUBY_PLATFORM | |
47 | - when /cygwin|mswin|mingw|bccwin|wince|emx/i | |
48 | - HOST_PLATFORM = 'windows' | |
49 | - when /x86_64-darwin/i | |
50 | - HOST_PLATFORM = 'darwin-x86_64' | |
51 | - when /darwin/i | |
52 | - HOST_PLATFORM = 'darwin-x86' | |
53 | - when /x86_64-linux/i | |
54 | - HOST_PLATFORM = 'linux-x86_64' | |
55 | - when /linux/i | |
56 | - HOST_PLATFORM = 'linux-x86' | |
57 | - else | |
58 | - # Unknown host platform | |
59 | - end | |
60 | - | |
61 | - ANDROID_TARGET_PLATFORM = ENV['ANDROID_TARGET_PLATFORM'] || DEFAULT_ANDROID_TARGET_PLATFORM | |
62 | - | |
63 | - path_to_toolchain = ANDROID_NDK_HOME + '/toolchains/' | |
64 | - path_to_sysroot = ANDROID_NDK_HOME + '/platforms/' + ANDROID_TARGET_PLATFORM | |
65 | - if ANDROID_TOOLCHAIN.downcase == 'gcc' then | |
66 | - case ANDROID_TARGET_ARCH.downcase | |
67 | - when 'arch-arm', 'arm' then | |
68 | - path_to_toolchain += 'arm-linux-androideabi-' | |
69 | - path_to_sysroot += '/arch-arm' | |
70 | - when 'arch-x86', 'x86' then | |
71 | - path_to_toolchain += 'x86-' | |
72 | - path_to_sysroot += '/arch-x86' | |
73 | - when 'arch-mips', 'mips' then | |
74 | - path_to_toolchain += 'mipsel-linux-android-' | |
75 | - path_to_sysroot += '/arch-mips' | |
76 | - else | |
77 | - # Any other architecture are not supported by Android NDK. | |
78 | - end | |
79 | - path_to_toolchain += GCC_VERSION + '/prebuilt/' + HOST_PLATFORM | |
80 | - else | |
81 | - path_to_toolchain += 'llvm-' + CLANG_VERSION + '/prebuilt/' + HOST_PLATFORM | |
82 | - end | |
83 | - else | |
84 | - path_to_toolchain = ANDROID_STANDALONE_TOOLCHAIN | |
85 | - path_to_sysroot = ANDROID_STANDALONE_TOOLCHAIN + '/sysroot' | |
86 | - end | |
87 | - | |
88 | - SYSROOT = path_to_sysroot | |
89 | - | |
90 | - case ANDROID_TARGET_ARCH.downcase | |
91 | - when 'arch-arm', 'arm' then | |
92 | - if ANDROID_TARGET_ARCH_ABI.downcase == 'armeabi-v7a' then | |
93 | - ARCH_CFLAGS = %W(-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16) | |
94 | - ARCH_LDFLAGS = %W(-march=armv7-a -Wl,--fix-cortex-a8) | |
95 | - else | |
96 | - ARCH_CFLAGS = %W(-march=armv5te -mtune=xscale -msoft-float) | |
97 | - ARCH_LDFLAGS = %W() | |
98 | - end | |
99 | - when 'arch-x86', 'x86' then | |
100 | - ARCH_CFLAGS = %W() | |
101 | - ARCH_LDFLAGS = %W() | |
102 | - when 'arch-mips', 'mips' then | |
103 | - ARCH_CFLAGS = %W(-fpic -fno-strict-aliasing -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers) | |
104 | - ARCH_LDFLAGS = %W() | |
105 | - else | |
106 | - # Notify error | |
107 | - end | |
108 | - | |
109 | - case ANDROID_TOOLCHAIN.downcase | |
110 | - when 'gcc' then | |
111 | - ANDROID_CC = path_to_toolchain + '/bin/' + toolchain_prefix + 'gcc' | |
112 | - ANDROID_LD = path_to_toolchain + '/bin/' + toolchain_prefix + 'gcc' | |
113 | - ANDROID_AR = path_to_toolchain + '/bin/' + toolchain_prefix + 'ar' | |
114 | - ANDROID_CFLAGS = GCC_COMMON_CFLAGS + %W(-D__android__ -mandroid --sysroot="#{SYSROOT}") + ARCH_CFLAGS | |
115 | - ANDROID_LDFLAGS = GCC_COMMON_LDFLAGS + %W(-D__android__ -mandroid --sysroot="#{SYSROOT}") + ARCH_LDFLAGS | |
116 | - when 'clang' then | |
117 | - # clang is not supported yet. | |
118 | - when 'clang31', 'clang3.1' then | |
119 | - # clang is not supported yet. | |
120 | - else | |
121 | - # Any other toolchains are not supported by Android NDK. | |
122 | - # Notify error. | |
123 | - end | |
124 | - | |
125 | - [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc| | |
126 | - cc.command = ENV['CC'] || ANDROID_CC | |
127 | - cc.flags = [ENV['CFLAGS'] || ANDROID_CFLAGS] | |
128 | - end | |
129 | - conf.linker.command = ENV['LD'] || ANDROID_LD | |
130 | - conf.linker.flags = [ENV['LDFLAGS'] || ANDROID_LDFLAGS] | |
131 | - conf.archiver.command = ENV['AR'] || ANDROID_AR | |
132 | -end |