-
-
Notifications
You must be signed in to change notification settings - Fork 897
/
setup-osx-native-builders
executable file
·51 lines (40 loc) · 1.58 KB
/
setup-osx-native-builders
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /usr/bin/env bash
# for inspiration / related cross-ruby building, see:
# - 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
# chosen so chruby will see it, should you be a user of chruby
RUBIES_DIR=${HOME}/.rubies
# prerequisites on OSX
if [[ -z "$(which ruby-install)" ]] ; then
echo "ERROR: ruby-install is not installed, please install it: https://github.com/postmodern/ruby-install"
exit 1
fi
set -o errexit
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)
echo "---" > $TMP_CONFIG
for ruby in $RUBIES ; do
ruby_fullname="native-builder-${ruby}"
ruby_minor="${ruby}.0"
rbconfig=$(echo ${RUBIES_DIR}/${ruby_fullname}/lib/ruby/${ruby_minor}/*/rbconfig.rb)
if [[ ! -e $rbconfig ]] ; then
echo "installing $ruby_fullname ..."
ruby-install -i ${RUBIES_DIR}/${ruby_fullname} ruby ${ruby} \
-- \
--enable-static \
--disable-shared \
--without-gmp \
--disable-install-doc
rbconfig=$(echo $rbconfig)
else
echo "ruby $ruby_fullname is installed"
fi
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