Commit cc355d2e authored by Mislav Marohnić's avatar Mislav Marohnić Committed by GitHub
Browse files

Merge pull request #1015 from yuichiro-naito/support_freebsd_11

support FreeBSD 11-RELEASE
parents c9ba0744 fdcc0a76
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -552,7 +552,9 @@ build_package_standard() {
  local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]"
  local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"

  [ "$package_var_name" = "RUBY" ] && use_homebrew_readline || true
  if [ "$package_var_name" = "RUBY" ]; then
      use_homebrew_readline || use_freebsd_pkg ||true
  fi

  ( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
      export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}"
@@ -918,6 +920,30 @@ use_homebrew_yaml() {
  fi
}

use_freebsd_pkg() {
  # check if FreeBSD
  if [ "FreeBSD" = "$(uname -s)" ]; then
      # use openssl if installed from Ports Collection
      if [ -f /usr/local/include/openssl/ssl.h ]; then
	  package_option ruby configure --with-openssl-dir="/usr/local"
      fi

      # check if 11-R or later
      release="$(uname -r)"
      if [ "${release%%.*}" -ge 11 ]; then
	  # prefers readline to compile most of ruby versions
	  if pkg info -e readline > /dev/null; then
	      # use readline from Ports Collection
	      package_option ruby configure --with-readline-dir="/usr/local"
	  elif pkg info -e libedit > /dev/null; then
	      # use libedit from Ports Collection
	      package_option ruby configure --enable-libedit
	      package_option ruby configure --with-libedit-dir="/usr/local"
	  fi
      fi
  fi
}

use_homebrew_readline() {
  if [[ "$RUBY_CONFIGURE_OPTS" != *--with-readline-dir=* ]]; then
    local libdir="$(brew --prefix readline 2>/dev/null || true)"

test/build.bats

100644 → 100755
+5 −5
Original line number Diff line number Diff line
@@ -204,7 +204,7 @@ OUT
@test "number of CPU cores defaults to 2" {
  cached_tarball "ruby-2.0.0"

  stub uname '-s : echo Darwin'
  stub uname '-s : echo Darwin' false
  stub sysctl false
  stub_make_install

@@ -227,7 +227,7 @@ OUT
@test "number of CPU cores is detected on Mac" {
  cached_tarball "ruby-2.0.0"

  stub uname '-s : echo Darwin'
  stub uname '-s : echo Darwin' false
  stub sysctl '-n hw.ncpu : echo 4'
  stub_make_install

@@ -251,7 +251,7 @@ OUT
@test "number of CPU cores is detected on FreeBSD" {
  cached_tarball "ruby-2.0.0"

  stub uname '-s : echo FreeBSD'
  stub uname '-s : echo FreeBSD' false
  stub sysctl '-n hw.ncpu : echo 1'
  stub_make_install

@@ -324,7 +324,7 @@ OUT
@test "make on FreeBSD 9 defaults to gmake" {
  cached_tarball "ruby-2.0.0"

  stub uname "-s : echo FreeBSD" "-r : echo 9.1"
  stub uname "-s : echo FreeBSD" "-r : echo 9.1" false
  MAKE=gmake stub_make_install

  MAKE= install_fixture definitions/vanilla-ruby
@@ -337,7 +337,7 @@ OUT
@test "make on FreeBSD 10" {
  cached_tarball "ruby-2.0.0"

  stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE"
  stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE" false
  stub_make_install

  MAKE= install_fixture definitions/vanilla-ruby

test/compiler.bats

100644 → 100755
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ DEF
  mkdir -p "$INSTALL_ROOT"
  cd "$INSTALL_ROOT"

  stub uname '-s : echo Darwin'
  stub uname '-s : echo Darwin' '-s : echo Darwin'
  stub sw_vers '-productVersion : echo 10.10'
  stub cc 'false'
  stub brew 'false'