#!/usr/bin/env bash # # ruby dependency packages: # source $rvm_scripts_path/initialize source $rvm_scripts_path/utility trap "rm -f $rvm_tmp_path/$$* > /dev/null 2>&1 ; exit" 0 1 2 3 15 if [[ ! -z "$rvm_trace_flag" ]] ; then set -x ; export rvm_trace_flag ; fi action="$(echo $* | awk '{print $1}')" library="$(echo $* | awk '{print $2}')" args=$(echo "$*" | awk '{$1="" ; $2="" ; print}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') install_package() { if [[ ! -z "$rvm_make_flags_flag" ]] ; then __rvm_make_flags ; fi __rvm_pushpop $rvm_src_path $rvm_scripts_path/log "info" "Fetching $package-$version.$archive_format to $rvm_archives_path" if [[ "$archive_format" = "tar.gz" ]] || [[ "$archive_format" = "tgz" ]] ; then $rvm_scripts_path/fetch "$package_url/$package-$version.$archive_format" || (result=$? && return $result) __rvm_run "$package/extract" "tar zxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format to $rvm_src_path" elif [[ "$archive_format" = "tar.bz2" ]] ; then $rvm_scripts_path/fetch "$package_url/$package-$version.$archive_format" || (result=$? && return $result) __rvm_run "$package/extract" "tar jxf $rvm_archives_path/$package-$version.$archive_format -C $rvm_src_path" "Extracting $package-$version.$archive_format to $rvm_src_path" elif [[ "$archive_format" = "zip" ]] ; then $rvm_scripts_path/fetch "$package_url/$package-$version.$archive_format" || (result=$? && return $result) __rvm_run "$package/extract" "unzip -q -o $rvm_archives_path/$package-$version.$archive_format -d $rvm_src_path/$package-$version" "Extracting $package-$version.$archive_format to $rvm_src_path" else echo -e "Unrecognized archive format '$archive_format'" ; return 1 fi builtin cd "$rvm_src_path/$package-$version" __rvm_run "$package/configure" "${configure:-"./configure --prefix=$rvm_usr_path"} $configure_flags" "Configuring $package in $rvm_src_path/$package-$version." unset configure_flags if [[ "$action" = "uninstall" ]] ; then __rvm_run "$package/make.uninstall" "/usr/bin/make uninstall" "Uninstalling $package from $rvm_usr_path" else __rvm_run "$package/make" "/usr/bin/make $rvm_make_flags" "Compiling $package in $rvm_src_path/$package-$version." __rvm_run "$package/make.install" "/usr/bin/make install" "Installing $package to $rvm_usr_path" fi __rvm_pushpop } readline() { package="readline" ; archive_format="tar.gz" package_url="ftp://ftp.gnu.org/gnu/readline" for version in 5.2 6.0 ; do configure_flags="--disable-dependency-tracking --disable-static --enable-shared" install_package done } iconv() { package="libiconv" ; version=1.13.1 ; archive_format="tar.gz" package_url="http://ftp.gnu.org/pub/gnu/libiconv" install_package } curl() { package="curl" ; version=7.19.7 ; archive_format="tar.gz" package_url="http://curl.haxx.se/download" install_package } openssl() { if $rvm_scripts_path/match "$rvm_archflags" "x86_64" ; then export openssl_os="os/compiler darwin64-x86_64-cc" else export openssl_os="os/compiler darwin-i386-cc" fi package="openssl" ; version="0.9.8k" ; archive_format="tar.gz" package_url="http://www.openssl.org/source" configure="./config --prefix=$rvm_usr_path zlib no-asm no-krb5 shared" install_package } zlib() { package="zlib" ; version="1.2.4" ; archive_format="tar.gz" package_url="http://www.zlib.net" install_package } ncurses() { package_url="http://ftp.gnu.org/pub/gnu/ncurses" package="ncurses" ; version="5.7" ; archive_format="tar.gz" configure_flags="--with-shared --disable-rpath --without-debug --without-ada --enable-safe-sprintf --enable-sigwinch --without-progs" install_package } pkgconfig() { package_url="http://pkgconfig.freedesktop.org/releases" package="pkg-config" ; version="0.23" archive_format="tar.gz" install_package } gettext() { package_url="ftp://ftp.gnu.org/pub/gnu/gettext" package="gettext" ; version="0.17" ; archive_format="tar.gz" install_package } glib() { package="glib" ; version="2.23.1" ; archive_format="tar.gz" package_url="http://ftp.gnome.org/pub/gnome/sources/glib/2.23" configure="CC=\"cc -L$rvm_usr_path/lib\" ./configure --prefix=$rvm_usr_path" install_package } mono() { gettext pkgconfig glib __rvm_mono_env package="mono" ; version="2.6.1" ; archive_format="tar.bz2" packge_url="http://ftp.novell.com/pub/mono/sources/mono/" install_package } llvm() { if [[ ! -z "$rvm_make_flags_flag" ]] ; then __rvm_make_flags ; fi __rvm_pushpop $rvm_src_path if [[ ! -d "$rvm_src_path/llvm/.svn" ]] ; then rm -rf "$rvm_src_path/llvm" svn co -r 89156 https://llvm.org/svn/llvm-project/llvm/trunk llvm builtin cd "$rvm_src_path/llvm" ./configure --enable-bindings=none UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make -j2 sudo env UNIVERSAL=1 UNIVERSAL_ARCH="i386 x86_64" ENABLE_OPTIMIZED=1 make install fi __rvm_pushpop } if [[ ! -z "$library" ]] ; then if [[ " readline iconv curl openssl zlib ncurses pkgconfig gettext glib mono llvm " =~ "$library" ]] ; then ${library} else $rvm_scripts_path/log "error" "Package '${library}' is unknown." fi else $rvm_scripts_path/log "info" "Usage: 'rvm package {install,uninstall} {openssl,zlib,readline,iconv,ncurses}'" exit 1 fi