Skip to content

Commit

Permalink
More cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed May 14, 2011
1 parent dc43ca6 commit 906ab99
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 48 deletions.
87 changes: 42 additions & 45 deletions scripts/functions/build
Expand Up @@ -3,14 +3,21 @@
__rvm_setup_compile_environment() __rvm_setup_compile_environment()
{ {
if [[ "Darwin" = "$(uname)" ]]; then if [[ "Darwin" = "$(uname)" ]]; then
rvm_configure_env=()
local architectures="${rvm_architectures:-"-arch i386 -arch x86_64"}" 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="${rvm_configure_env} CFLAGS='$architectures -g -Os -pipe -no-cpp-precomp'" "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion |
rvm_configure_env="${rvm_configure_env} CCFLAGS='$architectures -g -Os -pipe'" awk -F'.' '{print $1"."$2}')"
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+=("CFLAGS='$architectures -g -Os -pipe -no-cpp-precomp'")
rvm_configure_env="${rvm_configure_env} LDSHARED='$architectures cc -dynamiclib -undefined suppress -flat_namespace'" 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 fi
rvm_configure_env="${rvm_configure_env[*]}"
export rvm_configure_env export rvm_configure_env
} }


Expand All @@ -20,67 +27,54 @@ __rvm_setup_compile_environment()
__rvm_make_flags() __rvm_make_flags()
{ {
# This is only an issue with Darwin :/ # This is only an issue with Darwin :/
if [[ "Darwin" = "$(uname)" ]] ; then if [[ "Darwin" = "$(uname)" ]]
then
# \ls /usr/lib/gcc/x86_64-apple-darwin10 # \ls /usr/lib/gcc/x86_64-apple-darwin10

# Set the build & host type # Set the build & host type
if [[ "Power Macintosh" = "$(/usr/sbin/sysctl -n hw.machine)" ]] ; then if [[ "Power Macintosh" = "$(/usr/sbin/sysctl -n hw.machine)" ]]

then
: # Do nothing ? true # Do nothing ?

elif [[ "$(/usr/sbin/sysctl -n hw.cpu64bit_capable)" = 1 || \
elif [[ "$(/usr/sbin/sysctl -n hw.cpu64bit_capable)" = 1 \ "$(/usr/sbin/sysctl -n hw.optional.x86_64)" = 1 ]]
|| "$(/usr/sbin/sysctl -n hw.optional.x86_64)" = 1 ]] ; then then

# 64 bit capable # 64 bit capable

if [[ "-arch x86_64" = "${rvm_archflags:-""}" ]]
if [[ "-arch x86_64" = "${rvm_archflags:-""}" ]] ; then then

rvm_configure_flags="${rvm_configure_flags} \ rvm_configure_flags="${rvm_configure_flags} \
--build=x86_64-apple-darwin$(uname -r) \ --build=x86_64-apple-darwin$(uname -r) \
--host=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} \ rvm_configure_flags="${rvm_configure_flags} \
--build=i386-apple-darwin$(uname -r) \ --build=i386-apple-darwin$(uname -r) \
--host=i386-apple-darwin$(uname -r)" --host=i386-apple-darwin$(uname -r)"

else else

rvm_archflags="-arch x86_64" rvm_archflags="-arch x86_64"

rvm_configure_flags="${rvm_configure_flags} \ rvm_configure_flags="${rvm_configure_flags} \
--build=x86_64-apple-darwin$(uname -r) \ --build=x86_64-apple-darwin$(uname -r) \
--host=x86_64-apple-darwin$(uname -r)" --host=x86_64-apple-darwin$(uname -r)"

fi fi

fi fi


if [[ -n "${rvm_archflags:-""}" ]] ; then if [[ -n "${rvm_archflags:-""}" ]]

then
ARCHFLAGS="$rvm_archflags" ; export ARCHFLAGS export ARCHFLAGS="$rvm_archflags"

# Use the latest sdk available. # Use the latest sdk available.
if [[ -z "${rvm_sdk:-""}" ]] ; then if [[ -z "${rvm_sdk:-""}" ]]

then
rvm_sdk="$(/usr/bin/basename -a /Developer/SDKs/* \ rvm_sdk="$(
| awk '/^M/' | \sort | \tail -n 1)" /usr/bin/basename -a /Developer/SDKs/* | awk '/^M/' | \sort | \tail -n 1

)"
fi fi


CFLAGS="${CFLAGS:-"-isysroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}" CFLAGS="${CFLAGS:-"-isysroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}"

export CFLAGS

LDFLAGS="${LDFLAGS:-"-Wl,-syslibroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}" LDFLAGS="${LDFLAGS:-"-Wl,-syslibroot /Developer/SDKs/$rvm_sdk $rvm_archflags"}"

export CFLAGS LDFLAGS
export LDFLAGS


# CXXFLAGS="-mmacosx-version-min="$(sw_vers -productVersion \ # CXXFLAGS="-mmacosx-version-min="$(sw_vers -productVersion \
# | awk -F'.' '{print $1"."$2}')" -isysroot /Developer/SDKs/$rvm_sdk " # | awk -F'.' '{print $1"."$2}')" -isysroot /Developer/SDKs/$rvm_sdk "
# export CXXFLAGS # export CXXFLAGS

fi fi
fi fi


Expand Down Expand Up @@ -110,7 +104,10 @@ __rvm_18_compat_ruby()
{ {
local rubies ruby_name list=() 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[@]//.\/}" for ruby_name in "${rubies[@]//.\/}"
do do
Expand All @@ -132,18 +129,18 @@ __rvm_18_compat_ruby()


__rvm_ensure_has_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 local compat_result=0

if ! ( "$rvm_bin_path"/rvm install 1.8.7 )
if ! ( "$rvm_bin_path"/rvm install 1.8.7 ); then then
rvm_error " rvm_error "
To proceed rvm requires a 1.8-compatible ruby is installed. To proceed rvm requires a 1.8-compatible ruby is installed.
We attempted to install 1.8.7 automatically but it failed. We attempted to install 1.8.7 automatically but it failed.
Please install it manually (or a compatible alternative) to proceed. Please install it manually (or a compatible alternative) to proceed.
" "
compat_result=1 compat_result=1
fi fi

return $compat_result return $compat_result
fi fi


Expand Down
12 changes: 9 additions & 3 deletions scripts/rvm
Expand Up @@ -16,7 +16,10 @@ then
then then
if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1 if \grep '^\s*rvm .*$' "$rvmrc" >/dev/null 2>&1
then 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 return 1
else else
source "$rvmrc" source "$rvmrc"
Expand Down Expand Up @@ -105,7 +108,9 @@ then
then then
source "$rvm_scripts_path/$script" source "$rvm_scripts_path/$script"
else 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 fi
done done


Expand All @@ -130,7 +135,8 @@ then
else else
printf "\n\$rvm_path ($rvm_path) does not exist." printf "\n\$rvm_path ($rvm_path) does not exist."
fi 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 fi


if [[ -t 0 ]] && command -v __rvm_project_rvmrc >/dev/null 2>&1 if [[ -t 0 ]] && command -v __rvm_project_rvmrc >/dev/null 2>&1
Expand Down

0 comments on commit 906ab99

Please sign in to comment.