Skip to content

Commit

Permalink
gem: attempt to build a universal-darwin gem
Browse files Browse the repository at this point in the history
related to #2079
  • Loading branch information
flavorjones committed Sep 13, 2020
1 parent 959db1d commit 8bc0e5c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .cross_rubies
Expand Up @@ -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:universal-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:universal-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:universal-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:universal-darwin
11 changes: 6 additions & 5 deletions scripts/setup-osx-native-builders
Expand Up @@ -18,11 +18,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}"
Expand All @@ -42,9 +43,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-universal-darwin-${ruby_minor}: \"${rbconfig}\"" >> $TMP_CONFIG
done

mkdir -p $RAKE_COMPILER_CONFIG_DIR
cp $TMP_CONFIG $RAKE_COMPILER_CONFIG
cat $RAKE_COMPILER_CONFIG
12 changes: 6 additions & 6 deletions tasks/cross-ruby.rb
Expand Up @@ -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 /\Auniversal-darwin/
"universal-darwin"
else
raise "CrossRuby.platform: unsupported host: #{host}"
end
Expand All @@ -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
Expand All @@ -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 "universal-darwin"
"Mach-O 64-bit x86-64" # hmm
else
raise "CrossRuby.target_file_format: unmatched platform: #{platform}"
end
Expand Down

0 comments on commit 8bc0e5c

Please sign in to comment.