Permalink
Browse files

More cleanup.

  • Loading branch information...
wayneeseguin committed May 14, 2011
1 parent dc43ca6 commit 906ab99cafdeaeb3214dd4683e83464a98973c81
Showing with 51 additions and 48 deletions.
  1. +42 −45 scripts/functions/build
  2. +9 −3 scripts/rvm
View
@@ -3,14 +3,21 @@
__rvm_setup_compile_environment()
{
if [[ "Darwin" = "$(uname)" ]]; then
+ rvm_configure_env=()
local architectures="${rvm_architectures:-"-arch i386 -arch x86_64"}"
- rvm_configure_env="${rvm_configure_env} MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | awk -F'.' '{print $1"."$2}')"
- rvm_configure_env="${rvm_configure_env} CFLAGS='$architectures -g -Os -pipe -no-cpp-precomp'"
- rvm_configure_env="${rvm_configure_env} CCFLAGS='$architectures -g -Os -pipe'"
- rvm_configure_env="${rvm_configure_env} CXXFLAGS='$architectures -g -Os -pipe'"
- rvm_configure_env="${rvm_configure_env} LDFLAGS='$architectures -bind_at_load'"
- rvm_configure_env="${rvm_configure_env} LDSHARED='$architectures cc -dynamiclib -undefined suppress -flat_namespace'"
+ rvm_configure_env+=(
+ "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion |
+ awk -F'.' '{print $1"."$2}')"
+ )
+ rvm_configure_env+=("CFLAGS='$architectures -g -Os -pipe -no-cpp-precomp'")
+ rvm_configure_env+=("CCFLAGS='$architectures -g -Os -pipe'")
+ rvm_configure_env+=("CXXFLAGS='$architectures -g -Os -pipe'")
+ rvm_configure_env+=("LDFLAGS='$architectures -bind_at_load'")
+ rvm_configure_env+=(
+ "LDSHARED='$architectures cc -dynamiclib -undefined suppress -flat_namespace'"
+ )
fi
+ rvm_configure_env="${rvm_configure_env[*]}"
export rvm_configure_env
}
@@ -20,67 +27,54 @@ __rvm_setup_compile_environment()
__rvm_make_flags()
{
# This is only an issue with Darwin :/
- if [[ "Darwin" = "$(uname)" ]] ; then
+ if [[ "Darwin" = "$(uname)" ]]
+ then
# \ls /usr/lib/gcc/x86_64-apple-darwin10
-
# Set the build & host type
- if [[ "Power Macintosh" = "$(/usr/sbin/sysctl -n hw.machine)" ]] ; then
-
- : # Do nothing ?
-
- elif [[ "$(/usr/sbin/sysctl -n hw.cpu64bit_capable)" = 1 \
- || "$(/usr/sbin/sysctl -n hw.optional.x86_64)" = 1 ]] ; then
-
+ if [[ "Power Macintosh" = "$(/usr/sbin/sysctl -n hw.machine)" ]]
+ then
+ true # Do nothing ?
+ elif [[ "$(/usr/sbin/sysctl -n hw.cpu64bit_capable)" = 1 || \
+ "$(/usr/sbin/sysctl -n hw.optional.x86_64)" = 1 ]]
+ then
# 64 bit capable
-
- if [[ "-arch x86_64" = "${rvm_archflags:-""}" ]] ; then
-
+ if [[ "-arch x86_64" = "${rvm_archflags:-""}" ]]
+ then
rvm_configure_flags="${rvm_configure_flags} \
--build=x86_64-apple-darwin$(uname -r) \
--host=x86_64-apple-darwin$(uname -r)"
- elif [[ "-arch i386" = "${rvm_archflags:-""}" ]] ; then
-
+ elif [[ "-arch i386" = "${rvm_archflags:-""}" ]]
+ then
rvm_configure_flags="${rvm_configure_flags} \
--build=i386-apple-darwin$(uname -r) \
--host=i386-apple-darwin$(uname -r)"
-
else
-
rvm_archflags="-arch x86_64"
-
rvm_configure_flags="${rvm_configure_flags} \
--build=x86_64-apple-darwin$(uname -r) \
--host=x86_64-apple-darwin$(uname -r)"
-
fi
-
fi
- if [[ -n "${rvm_archflags:-""}" ]] ; then
-
- ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS
-
+ if [[ -n "${rvm_archflags:-""}" ]]
+ then
+ export ARCHFLAGS="$rvm_archflags"
# Use the latest sdk available.
- if [[ -z "${rvm_sdk:-""}" ]] ; then
-
- rvm_sdk="$(/usr/bin/basename -a /Developer/SDKs/* \
- | awk '/^M/' | \sort | \tail -n 1)"
-
+ if [[ -z "${rvm_sdk:-""}" ]]
+ then
+ rvm_sdk="$(
+ /usr/bin/basename -a /Developer/SDKs/* | awk '/^M/' | \sort | \tail -n 1
+ )"
fi
CFLAGS="${CFLAGS:-"-isysroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}"
-
- export CFLAGS
-
LDFLAGS="${LDFLAGS:-"-Wl,-syslibroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}"
-
- export LDFLAGS
+ export CFLAGS LDFLAGS
# CXXFLAGS="-mmacosx-version-min="$(sw_vers -productVersion \
# | awk -F'.' '{print $1"."$2}')" -isysroot /Developer/SDKs/$rvm_sdk "
# export CXXFLAGS
-
fi
fi
@@ -110,7 +104,10 @@ __rvm_18_compat_ruby()
{
local rubies ruby_name list=()
- rubies=($( cd "$rvm_rubies_path" ; find . -maxdepth 1 -mindepth 1 -type d ))
+ rubies=($(
+ cd "$rvm_rubies_path"
+ find . -maxdepth 1 -mindepth 1 -type d
+ ))
for ruby_name in "${rubies[@]//.\/}"
do
@@ -132,18 +129,18 @@ __rvm_18_compat_ruby()
__rvm_ensure_has_18_compat_ruby()
{
- if [[ -z "$(__rvm_18_compat_ruby)" ]]; then
+ if [[ -z "$(__rvm_18_compat_ruby)" ]]
+ then
local compat_result=0
-
- if ! ( "$rvm_bin_path"/rvm install 1.8.7 ); then
+ if ! ( "$rvm_bin_path"/rvm install 1.8.7 )
+ then
rvm_error "
To proceed rvm requires a 1.8-compatible ruby is installed.
We attempted to install 1.8.7 automatically but it failed.
Please install it manually (or a compatible alternative) to proceed.
"
compat_result=1
fi
-
return $compat_result
fi
View
@@ -16,7 +16,10 @@ then
then
if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then
- printf "\nError: $rvmrc is for rvm settings only.\nrvm CLI may NOT be called from within $rvmrc. \nSkipping the loading of $rvmrc"
+ printf "\nError:
+ $rvmrc is for rvm settings only.
+ rvm CLI may NOT be called from within $rvmrc.
+ Skipping the loading of $rvmrc"
return 1
else
source "$rvmrc"
@@ -105,7 +108,9 @@ then
then
source "$rvm_scripts_path/$script"
else
- printf "WARNING: Could not source script '$rvm_scripts_path/$script', file does not exist. RVM will likely not work as expected.\n"
+ printf "WARNING:
+ Could not source '$rvm_scripts_path/$script' as file does not exist.
+ RVM will likely not work as expected.\n"
fi
done
@@ -130,7 +135,8 @@ then
else
printf "\n\$rvm_path ($rvm_path) does not exist."
fi
- unset rvm_prefix_needs_trailing_slash rvm_rc_files rvm_gems_cache_path rvm_gems_path rvm_project_rvmrc_default rvm_gemset_separator
+ unset rvm_prefix_needs_trailing_slash rvm_rc_files rvm_gems_cache_path \
+ rvm_gems_path rvm_project_rvmrc_default rvm_gemset_separator
fi
if [[ -t 0 ]] && command -v __rvm_project_rvmrc >/dev/null 2>&1

0 comments on commit 906ab99

Please sign in to comment.