16
16
17
17
STRIP=" ${STRIP:- strip} "
18
18
19
- triple=$( " ${CC} " -dumpmachine)
19
+ triple=$( ${CC} -dumpmachine)
20
20
host_platform=" ${triple} "
21
21
target_platform=" ${TARGET_PLATFORM:- ${1:- } } "
22
22
target_platform=" ${target_platform:- ${host_platform} } "
@@ -42,14 +42,17 @@ case "${target_platform}" in
42
42
;;
43
43
x86_64* -darwin* )
44
44
# not for cross compilation
45
- RUBY_TARGET_PLATFORM=" $( ruby -e ' puts Gem::Platform.local.to_s.gsub(/ -darwin-?\d+/, "-darwin") ' ) "
45
+ RUBY_TARGET_PLATFORM=' x86_64 -darwin'
46
46
;;
47
47
arm64* -darwin* )
48
48
# not for cross compilation
49
- RUBY_TARGET_PLATFORM=" $( ruby -e ' puts Gem::Platform.local.to_s.gsub(/ -darwin-?\d+/, "-darwin") ' ) "
49
+ RUBY_TARGET_PLATFORM=' arm64 -darwin'
50
50
;;
51
51
* )
52
- # not for cross compilation
52
+ if [ " ${host_platform} " != " ${target_platform} " ]; then
53
+ echo ' cross compilation not supported'
54
+ exit 1
55
+ fi
53
56
RUBY_TARGET_PLATFORM=" $( ruby -e ' puts Gem::Platform.local.to_s' ) "
54
57
;;
55
58
esac
@@ -81,6 +84,30 @@ if [ "${host_platform}" != "${target_platform}" ]; then
81
84
STRIP=' arm-linux-gnueabihf-strip'
82
85
configure_flags=' --dest-cpu=arm --cross-compiling --dest-os=linux --with-arm-float-abi=hard --with-arm-fpu=neon'
83
86
;;
87
+ x86_64-* linux* )
88
+ CC=' x86_64-linux-gnu-gcc'
89
+ CXX=' x86_64-linux-gnu-g++'
90
+ CC_host=' gcc'
91
+ CXX_host=' g++'
92
+ STRIP=' x86_64-linux-gnu-strip'
93
+ configure_flags=' --dest-cpu=x86_64 --cross-compiling --dest-os=linux'
94
+ ;;
95
+ x86_64* -darwin* )
96
+ CC=' clang -arch x86_64'
97
+ CXX=' clang++ -arch x86_64'
98
+ CC_host=' clang'
99
+ CXX_host=' clang++'
100
+ STRIP=' strip'
101
+ configure_flags=' --dest-cpu=x86_64 --cross-compiling --dest-os=mac'
102
+ ;;
103
+ arm64* -darwin* )
104
+ CC=' clang -arch arm64'
105
+ CXX=' clang++ -arch arm64'
106
+ CC_host=' clang'
107
+ CXX_host=' clang++'
108
+ STRIP=' strip'
109
+ configure_flags=' --dest-cpu=arm64 --cross-compiling --dest-os=mac'
110
+ ;;
84
111
* )
85
112
configure_flags=' '
86
113
;;
0 commit comments