diff --git a/.cross_rubies b/.cross_rubies index eecbd327e0..f9828f42a8 100644 --- a/.cross_rubies +++ b/.cross_rubies @@ -2,19 +2,19 @@ 2.7.0:x86_64-w64-mingw32 2.7.0:i686-linux-gnu 2.7.0:x86_64-linux-gnu -2.7.0:x86_64-darwin19 +2.7.0:x86_64-darwin 2.6.0:i686-w64-mingw32 2.6.0:x86_64-w64-mingw32 2.6.0:i686-linux-gnu 2.6.0:x86_64-linux-gnu -2.6.0:x86_64-darwin19 +2.6.0:x86_64-darwin 2.5.0:i686-w64-mingw32 2.5.0:x86_64-w64-mingw32 2.5.0:i686-linux-gnu 2.5.0:x86_64-linux-gnu -2.5.0:x86_64-darwin19 +2.5.0:x86_64-darwin 2.4.0:i686-w64-mingw32 2.4.0:x86_64-w64-mingw32 2.4.0:i686-linux-gnu 2.4.0:x86_64-linux-gnu -2.4.0:x86_64-darwin19 +2.4.0:x86_64-darwin diff --git a/scripts/setup-osx-native-builders b/scripts/setup-osx-native-builders index bc276fe061..9dc8e3c822 100755 --- a/scripts/setup-osx-native-builders +++ b/scripts/setup-osx-native-builders @@ -4,6 +4,9 @@ # - https://github.com/rake-compiler/rake-compiler/blob/master/tasks/bin/cross-ruby.rake # - https://github.com/apolcyn/grpc/blob/master/tools/distrib/build_ruby_environment_macos.sh +# see test/test_gem_platform.rb for context +gem_platform_name="x86_64-darwin" + # chosen so chruby will see it, should you be a user of chruby RUBIES_DIR=${HOME}/.rubies @@ -18,11 +21,12 @@ set -o pipefail CROSS_FILE=".cross_rubies" RUBIES=$(cat $CROSS_FILE | fgrep darwin | cut -d. -f1,2 | sort -u) + RAKE_COMPILER_CONFIG_DIR=${HOME}/.rake-compiler RAKE_COMPILER_CONFIG=${RAKE_COMPILER_CONFIG_DIR}/config.yml +TMP_CONFIG=$(mktemp /tmp/rake-compiler-config.XXXXXXXX) -mkdir -p $RAKE_COMPILER_CONFIG_DIR -echo "---" > $RAKE_COMPILER_CONFIG +echo "---" > $TMP_CONFIG for ruby in $RUBIES ; do ruby_fullname="native-builder-${ruby}" @@ -42,9 +46,9 @@ for ruby in $RUBIES ; do echo "ruby $ruby_fullname is installed" fi - platform=$(basename $(dirname $rbconfig)) - - echo "rbconfig-${platform}-${ruby_minor}: \"${rbconfig}\"" >> $RAKE_COMPILER_CONFIG + echo "rbconfig-${gem_platform_name}-${ruby_minor}: \"${rbconfig}\"" >> $TMP_CONFIG done +mkdir -p $RAKE_COMPILER_CONFIG_DIR +cp $TMP_CONFIG $RAKE_COMPILER_CONFIG cat $RAKE_COMPILER_CONFIG diff --git a/tasks/cross-ruby.rb b/tasks/cross-ruby.rb index 27a1599536..70ab06e9a0 100644 --- a/tasks/cross-ruby.rb +++ b/tasks/cross-ruby.rb @@ -43,8 +43,8 @@ def platform "x86_64-linux" when /\Ai[3-6]86.*linux/ "x86-linux" - when /\Ax86_64-darwin19/ - "x86_64-darwin19" + when /\Ax86_64-darwin/ + "x86_64-darwin" else raise "CrossRuby.platform: unsupported host: #{host}" end @@ -60,8 +60,8 @@ def tool(name) "x86_64-linux-gnu-" when "x86-linux" "i686-linux-gnu-" - when /darwin/ - "" + # when /darwin/ + # "" else raise "CrossRuby.tool: unmatched platform: #{platform}" end) + name @@ -77,8 +77,8 @@ def target_file_format "elf64-x86-64" when "x86-linux" "elf32-i386" - when "x86_64-darwin19" - "Mach-O 64-bit x86-64" + when "x86_64-darwin" + "Mach-O 64-bit x86-64" # hmm else raise "CrossRuby.target_file_format: unmatched platform: #{platform}" end @@ -327,6 +327,10 @@ def verify_dll(dll, cross_ruby) ext.config_options << ENV['EXTOPTS'] ext.cross_compile = true ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq + if RUBY_PLATFORM =~ /darwin/ + # see test/test_gem_platform.rb for context + ext.platform = "x86_64-darwin" + end ext.cross_config_options << "--enable-cross-build" ext.cross_compiling do |spec| libs = dependencies.map { |name, dep| "#{name}-#{dep["version"]}" }.join(', ')