Enable compiling Ruby 1.8 on OS X 10.8+ without extra flags

Because OS X Mountain Lion removed X Windows, compiling Ruby 1.8 would
fail unless the user installed XQuartz manually and passed:

    CPPFLAGS=-I/opt/X11/include rbenv install 1.8.7-p374

This auto-detects if `/opt/X11/include` is present on the system and
configures CPPFLAGS accordingly. However if XQuartz was never installed,
we simply configure Ruby using `--without-tk`.

Fixes #193 #207

References 353246926c
This commit is contained in:
Mislav Marohnić 2013-10-28 00:25:02 +01:00
parent 805051fbdc
commit d13ae0ad52
12 changed files with 25 additions and 17 deletions

View file

@ -422,15 +422,11 @@ build_package_ruby() {
}
build_package_ree_installer() {
build_package_auto_tcltk
local options=""
if [[ "Darwin" = "$(uname)" ]]; then
options="--no-tcmalloc"
# Some versions of REE mistakenly detect Tk support
# on OS X even though X11 is not installed.
if [ ! -d "/usr/include/X11" ]; then
options="$options -c --without-tk"
fi
fi
local option
@ -720,6 +716,18 @@ build_package_ldflags_dirs() {
done
}
build_package_auto_tcltk() {
if [ "Darwin" = "$(uname -s)" ] && [ ! -d /usr/include/X11 ]; then
if [ -d /opt/X11/include ]; then
if [[ "$CPPFLAGS" != *-I/opt/X11/include* ]]; then
export CPPFLAGS="-I/opt/X11/include $CPPFLAGS"
fi
else
package_option ruby configure --without-tk
fi
fi
}
rake() {
if [ -e "./Gemfile" ]; then
bundle exec rake "$@"