%global rvm_dir /usr/lib/rvm %global rvm_group rvm # RVM can not be sourced with default /bin/sh %define _buildshell /bin/bash Name: rvm-ruby Summary: Ruby Version Manager Version: 4 # Version will be appended the commit date Release: 1.20.9 License: ASL 2.0 URL: http://rvm.beginrescueend.com/ Group: Applications/System #Source: %{name}-%{version}.tar #BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n) BuildRequires: bash curl git BuildRequires: gcc-c++ patch chrpath readline readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel BuildRequires: sed grep tar gzip bzip2 make file Requires(pre): shadow-utils # For rvm Requires: bash curl git # Basics for building ruby 1.8/1.9 #Requires: gcc-c++ patch readline readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel # Used by the scripts Requires: sed grep tar gzip bzip2 make file %description RVM is the Ruby Version Manager (rvm). It manages Ruby interpreter environments and switching between them. This package is meant for use by multiple users maintaining a shared copy of RVM. Users added to the '%{rvm_group}' group will be able to modify all aspects of RVM. These users will also have their default umask modified ("g+w") to allow group write permission (usually resulting in a umask of "0002") in order to ensure correct permissions for the shared RVM content. RVM is activated for all logins by default. To disable remove %{_sysconfdir}/profile.d/rvm.sh and source rvm from each users shell. %build %install rm -rf %{buildroot} # Clean the env for i in `env | grep ^rvm_ | cut -d"=" -f1`; do unset $i; done # Install everything into one directory ( export rvm_ignore_rvmrc=1 \ rvm_user_install_flag=0 \ rvm_path="%{buildroot}%{rvm_dir}" \ rvm_man_path="%{buildroot}%{_mandir}" \ HOME=%{buildroot} \curl -L https://get.rvm.io | bash -s stable --version %{release} ) # So members of the rvm group can write to it find %{buildroot}%{rvm_dir} -exec chmod ug+w {} \; find %{buildroot}%{rvm_dir} -type d -exec chmod g+s {} \; mkdir -p %{buildroot}%{_sysconfdir} # We use selfcontained so binaries end up in rvm/bin cat > %{buildroot}%{_sysconfdir}/rvmrc < %{buildroot}%{_sysconfdir}/profile.d/rvm.sh < ${FILE}.tmp mv ${FILE}.tmp ${FILE} echo "Done!" else echo "New string '${NEW_STRING}' is longer than old" \ "string '${OLD_STRING}'. Skipping." fi done fi } # Strip object files in ar archives from bad path strings for f in `find $br -type f -name \*.a`; do td=`mktemp -d` pushd $td ar x $f for g in `find . -type f -print0 |xargs -0 file --no-dereference --no-pad |grep ': ELF' |cut -f1 -d:`; do strip $g grep "$br" $g || continue # Replace the bad path with the good one, padded by nulls patch_strings_in_file $g "$br" done ar r $f * popd rm -rf $td done # Replace paths in libraries strings for f in `find $br/usr/lib/rvm/rubies -type f -print0 |xargs -0 file --no-dereference --no-pad |grep ': ELF' |cut -f1 -d:`; do grep "$br" $f || continue # Replace the bad path with the good one, padded by nulls patch_strings_in_file $f "$br" done # Fix symlinks with bad path for f in `find $br -type l |grep "$br"`; do ln -sfn `readlink -f $f |sed "s,$br,,"` $f done find $br -maxdepth 1 -name '.*' -exec rm -rf {} \; rm $br/usr/share/man/man1/rvm.1.gz %clean rm -rf %{buildroot} %pre getent group %{rvm_group} >/dev/null || groupadd -r %{rvm_group} exit 0 %files %defattr(-,root,root) %config(noreplace) /etc/rvmrc %config(noreplace) /etc/profile.d/rvm.sh %attr(-,root,%{rvm_group}) %{rvm_dir} %{_mandir}/man1/* %changelog * Fri May 18 2013 Christoph Dwertmann - 4.xxx - downloads RVM instead of relying on local sources - works with latest RVM and Fedora - removed ruby build dependency - no more clashing with distribution ruby * Fri Mar 30 2012 Alexandre Fouche - 3.xxx Add some rubies and gems to compile: - 1.9.2-p290 + bundler, bluepill, whenever - 1.9.3-p0 + bundler, bluepill, whenever * Thu Mar 29 2012 Alexandre Fouche - 2.xxx - Adapt to make it work from RVM git source directly - Strip binaries, libraries, ... * Thu Mar 29 2012 Alexandre Fouche - 1.xxx - Adapt to make it work from RVM git source directly * Tue Dec 13 2011 Matthew Kent - 1.10.0-2 - New upstream release - Drop rvm_prefix - Rename rvm_user_install to rvm_user_install_flag - Rename rake wrapper to rvm-rake - Add file dependency * Thu Aug 4 2011 Matthew Kent - 1.6.32-1 - New upstream release * Tue Apr 19 2011 Matthew Kent - 1.6.3-1 - Initial package based off Gentoo work