1 %global rvm_dir /usr/lib/rvm
4 # RVM can not be sourced with default /bin/sh
5 %define _buildshell /bin/bash
8 Summary: Ruby Version Manager
9 Version: 4 # Version will be appended the commit date
10 # choose a version from https://github.com/wayneeseguin/rvm/tags
13 URL: http://rvm.beginrescueend.com/
14 Group: Applications/System
15 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
17 BuildRequires: bash curl git
18 BuildRequires: gcc-c++ patch chrpath readline readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel autoconf automake libtool bison
19 BuildRequires: sed grep tar gzip bzip2 make file
21 Requires(pre): shadow-utils
23 Requires: bash curl git
24 # Basics for building ruby 1.8/1.9
25 Requires: gcc-c++ patch readline readline-devel zlib-devel libyaml-devel libffi-devel openssl-devel autoconf automake libtool bison
27 Requires: sed grep tar gzip bzip2 make file
30 RVM is the Ruby Version Manager (rvm). It manages Ruby interpreter environments
31 and switching between them.
33 This package is meant for use by multiple users maintaining a shared copy of
34 RVM. Users added to the '%{rvm_group}' group will be able to modify all aspects
35 of RVM. These users will also have their default umask modified ("g+w") to allow
36 group write permission (usually resulting in a umask of "0002") in order to
37 ensure correct permissions for the shared RVM content.
39 RVM is activated for all logins by default. To disable remove
40 %{_sysconfdir}/profile.d/rvm.sh and source rvm from each users shell.
48 for i in `env | grep ^rvm_ | cut -d"=" -f1`; do
52 # Install everything into one directory
54 export rvm_ignore_rvmrc=1 \
55 rvm_user_install_flag=0 \
56 rvm_path="%{buildroot}%{rvm_dir}" \
57 rvm_man_path="%{buildroot}%{_mandir}" \
59 \curl -L https://get.rvm.io | bash -s stable --version %{release}
62 # So members of the rvm group can write to it
63 find %{buildroot}%{rvm_dir} -exec chmod ug+w {} \;
64 find %{buildroot}%{rvm_dir} -type d -exec chmod g+s {} \;
66 mkdir -p %{buildroot}%{_sysconfdir}
68 # We use selfcontained so binaries end up in rvm/bin
69 cat > %{buildroot}%{_sysconfdir}/rvmrc <<END_OF_RVMRC
70 # Setup default configuration for rvm.
71 # If an rvm install exists in the home directory, don't load this.'
72 if [[ ! -s "\${HOME}/.rvm/scripts/rvm" ]]; then
74 # Only users in the rvm group need the umask modification
75 for i in \$(id -G -n); do
76 if [ \$i = "rvm" ]; then
82 export rvm_user_install_flag=1
83 export rvm_path="%{rvm_dir}"
87 mkdir -p %{buildroot}%{_sysconfdir}/profile.d
89 cat > %{buildroot}%{_sysconfdir}/profile.d/rvm.sh <<END_OF_RVMSH
92 if [ -s "\${HOME}/.rvm/scripts/rvm" ]; then
93 source "\${HOME}/.rvm/scripts/rvm"
94 elif [ -s "%{rvm_dir}/scripts/rvm" ]; then
95 source "%{rvm_dir}/scripts/rvm"
99 chmod 755 %{buildroot}%{_sysconfdir}/profile.d/rvm.sh
101 # At this point, install of RVM is finished
102 # Now install some rubies
104 # Run this in a subshell so the rvm loading does not infect our current shell.
106 export rvm_ignore_rvmrc=1
107 export rvm_user_install_flag=0
108 export rvm_path="%{buildroot}%{rvm_dir}"
109 export rvm_man_path="%{buildroot}%{_mandir}"
110 source ${rvm_path}/scripts/rvm
111 gemi='gem install --no-ri --no-rdoc'
113 #touch $rvm_path/RELEASE
114 ruby_tag=ruby-1.9.3-p286
115 rvm install $ruby_tag
118 #$gemi whatever_gem_you_need
120 #ruby_tag=ruby-1.8.7-p352
121 #rvm install $ruby_tag
126 export br=%{buildroot}
129 rm -rf $br/usr/lib/rvm/src/*
131 find $br/usr/lib/rvm/log -type f -exec rm {} \;
134 #find $br -type f -print0 |xargs -0 file --no-dereference --no-pad |grep 'not stripped' |cut -f1 -d: |xargs -r strip
136 # Strip and Fix bad paths in generated files
137 # That is not optimized, but that is not supposed to be done often
138 for f in `find $br -type f -print0 |xargs -0 file --no-dereference --no-pad |grep ': ELF' |cut -f1 -d:`; do
140 grep "$br" $f || continue
141 line=`chrpath -l $f` || continue
142 echo $line |grep "$br" || continue
143 chrpath -r `echo $line |cut -f2 -d= |sed "s,$br,,"` $f
146 # Replace bad paths in text files
147 find $br -type f \( -name \*.log -o -name \*.la \) -print0 |xargs -0 -r sed -i "s,$br,,g"
148 find $br -type f -print0 |xargs -0 file --no-dereference --no-pad |grep ': .* text' |cut -f1 -d: |xargs -r sed -i "s,$br,,g"
150 # Replace bad paths in all remaining files
151 # Padding with zeroes broke the LOAD_PATH in libruby, therefore prepend path with harmless forward slashes
152 printf -vch "%${#br}s" ""
153 slashes=$(printf "%s" "${ch// //}")
154 find $br -type f -print0 | xargs -0 sed -i "s,$br,$slashes,g"
156 # Fix symlinks with bad path
157 for f in `find $br -type l |grep "$br"`; do
158 ln -sfn `readlink -f $f |sed "s,$br,,"` $f
161 find $br -maxdepth 1 -name '.*' -exec rm -rf {} \;
162 rm $br/usr/share/man/man1/rvm.1.gz
168 getent group %{rvm_group} >/dev/null || groupadd -r %{rvm_group}
172 %defattr(-,root,root)
173 %config(noreplace) /etc/rvmrc
174 %config(noreplace) /etc/profile.d/rvm.sh
175 %attr(-,root,%{rvm_group}) %{rvm_dir}
179 * Fri May 18 2013 Christoph Dwertmann - 4.xxx
180 - downloads RVM instead of relying on local sources
181 - works with latest RVM and Fedora
182 - removed ruby build dependency
183 - no more clashing with distribution ruby
185 * Fri Mar 30 2012 Alexandre Fouche - 3.xxx
186 Add some rubies and gems to compile:
187 - 1.9.2-p290 + bundler, bluepill, whenever
188 - 1.9.3-p0 + bundler, bluepill, whenever
190 * Thu Mar 29 2012 Alexandre Fouche - 2.xxx
191 - Adapt <https://github.com/mdkent/rvm-rpm/blob/master/SPECS/rvm-ruby.spec> to make it work from RVM git source directly
192 - Strip binaries, libraries, ...
194 * Thu Mar 29 2012 Alexandre Fouche - 1.xxx
195 - Adapt <https://github.com/mdkent/rvm-rpm/blob/master/SPECS/rvm-ruby.spec> to make it work from RVM git source directly
197 * Tue Dec 13 2011 Matthew Kent <mkent@magoazul.com> - 1.10.0-2
198 - New upstream release
200 - Rename rvm_user_install to rvm_user_install_flag
201 - Rename rake wrapper to rvm-rake
202 - Add file dependency
204 * Thu Aug 4 2011 Matthew Kent <mkent@magoazul.com> - 1.6.32-1
205 - New upstream release
207 * Tue Apr 19 2011 Matthew Kent <mkent@magoazul.com> - 1.6.3-1
208 - Initial package based off Gentoo work