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 "$@"

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.6-p383" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p383.tar.gz#4f49544d4a4d0d34e9d86c41e853db2e"
install_package "ruby-1.8.6-p383" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p383.tar.gz#4f49544d4a4d0d34e9d86c41e853db2e" auto_tcltk standard
install_package "rubygems-1.3.7" "http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz#e85cfadd025ff6ab689375adbf344bbe" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.6-p420" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p420.tar.gz#ca1eee44f842e93b5098bc5a2bb9a40b"
install_package "ruby-1.8.6-p420" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p420.tar.gz#ca1eee44f842e93b5098bc5a2bb9a40b" auto_tcltk standard
install_package "rubygems-1.3.7" "http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz#e85cfadd025ff6ab689375adbf344bbe" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p249" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p249.tar.gz#d7db7763cffad279952eb7e9bbfc221c"
install_package "ruby-1.8.7-p249" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p249.tar.gz#d7db7763cffad279952eb7e9bbfc221c" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p302" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p302.tar.gz#f446550dfde0d8162a6ed8d5a38b3ac2"
install_package "ruby-1.8.7-p302" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p302.tar.gz#f446550dfde0d8162a6ed8d5a38b3ac2" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p334" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p334.tar.gz#aacb6ee5dfe2367682bba56af7f415b8"
install_package "ruby-1.8.7-p334" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p334.tar.gz#aacb6ee5dfe2367682bba56af7f415b8" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p352" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p352.tar.gz#0c33f663a10a540ea65677bb755e57a7"
install_package "ruby-1.8.7-p352" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p352.tar.gz#0c33f663a10a540ea65677bb755e57a7" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p357" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p357.tar.gz#b2b8248ff5097cfd629f5b9768d1df82"
install_package "ruby-1.8.7-p357" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p357.tar.gz#b2b8248ff5097cfd629f5b9768d1df82" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p358" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.gz#26bd55358847459a7752acdbd33a535f"
install_package "ruby-1.8.7-p358" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.gz#26bd55358847459a7752acdbd33a535f" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p370" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p370.tar.gz#98b00bbd1cdde3116155edb6e555b781"
install_package "ruby-1.8.7-p370" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p370.tar.gz#98b00bbd1cdde3116155edb6e555b781" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p371" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p371.tar.gz#653f07bb45f03d0bf3910491288764df"
install_package "ruby-1.8.7-p371" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p371.tar.gz#653f07bb45f03d0bf3910491288764df" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby

View file

@ -1,3 +1,3 @@
require_gcc
install_package "ruby-1.8.7-p374" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.gz#b72a0bc5b824398537762e5272bbb8dc"
install_package "ruby-1.8.7-p374" "http://cache.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p374.tar.gz#b72a0bc5b824398537762e5272bbb8dc" auto_tcltk standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz#0c95a9869914ba1a45bf71d3b8048420" ruby