Unverified Commit 47eda174 authored by Mislav Marohnić's avatar Mislav Marohnić
Browse files

Remove implicit LDFLAGS, CPPFLAGS, and "ldflags_dirs" build step

The default settings for LDFLAGS and CPPFLAGS were there since the initial commit to ruby-build:

    LDFLAGS="-L${PREFIX_PATH}/lib"
    CPPFLAGS="-I${PREFIX_PATH}/include"

However, it's not clear to me what these settings help with. A typical Ruby installation will initialize files in these directories, but it will do so regardless of the environment variables.

So, let's remove them and see what breaks.
parent 4bf2fece
Loading
Loading
Loading
Loading
+2 −17
Original line number Diff line number Diff line
@@ -1190,21 +1190,9 @@ build_package_verify_openssl() {
  ' "$(basename "$(type -p yum apt-get | head -1)")" >&4 2>&1
}

# Ensure that directories listed in LDFLAGS exist
# Kept for backward compatibility with 3rd-party definitions.
build_package_ldflags_dirs() {
  local ldflags
  read -d '' -r -a ldflags <<<"$LDFLAGS" || true
  local index=0
  local dir
  while [ "$index" -lt "${#ldflags[@]}" ]; do
    dir=""
    case "${ldflags[index]}" in
    -L  ) dir="${ldflags[index+1]}" ;;
    -L* ) dir="${ldflags[index]#-L}" ;;
    esac
    [ -z "$dir" ] || mkdir -p "$dir"
    index=$((index+1))
  done
  true
}

build_package_enable_shared() {
@@ -1511,9 +1499,6 @@ else
  fi
fi

export LDFLAGS="-L${PREFIX_PATH}/lib ${LDFLAGS}"
export CPPFLAGS="-I${PREFIX_PATH}/include ${CPPFLAGS}"

unset RUBYOPT
unset RUBYLIB

+1 −1
Original line number Diff line number Diff line
@@ -26,5 +26,5 @@ fi

cat > "$file" <<EOS
!TODO! copy openssl line from other release with the same major.minor version
install_package "ruby-${version}" "${url}#${sha256}" ldflags_dirs enable_shared standard verify_openssl
install_package "ruby-${version}" "${url}#${sha256}" enable_shared standard verify_openssl
EOS
+3 −3
Original line number Diff line number Diff line
@@ -748,7 +748,7 @@ DEF
  assert_failure "ruby-build: TMPDIR=$TMPDIR is set to a non-accessible location"
}

@test "initializes LDFLAGS directories" {
@test "does not initialize LDFLAGS directories" {
  cached_tarball "ruby-2.0.0"

  export LDFLAGS="-L ${BATS_TEST_DIRNAME}/what/evs"
@@ -757,6 +757,6 @@ install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz" l
DEF
  assert_success

  assert [ -d "${INSTALL_ROOT}/lib" ]
  assert [ -d "${BATS_TEST_DIRNAME}/what/evs" ]
  assert [ ! -d "${INSTALL_ROOT}/lib" ]
  assert [ ! -d "${BATS_TEST_DIRNAME}/what/evs" ]
}