Forked from thenoseman/railsexpress-patched-ruby-for-rbenv.sh
Last active
August 29, 2015 14:07
-
-
Save stephanschubert/9345940913306dad3e9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script creates a custom ruby definition for rbenv | |
# which incorporates the rvm patches from skaes. | |
# | |
# (c) [email protected] | |
# | |
rubyexpress_repo="https://github.com/skaes/rvm-patchsets.git" | |
rubybuild_repo="https://github.com/sstephenson/ruby-build.git" | |
mkdir rbenv-railsexpress | |
cd rbenv-railsexpress | |
rm -rf ruby-build | |
rm -rf rvm-patchsets | |
tmp_dir=$(pwd) | |
echo "Fetching repos" | |
git clone ${rubybuild_repo} | |
git clone ${rubyexpress_repo} | |
echo "" | |
for patch_dir in rvm-patchsets/patches/ruby/2.1.* rvm-patchsets/patches/ruby/1.9.* ; do | |
patch_for_mri_version=${patch_dir##*/} | |
ruby_build_file=$(ls -1 ruby-build/share/ruby-build/${patch_for_mri_version}* | grep -e "-p[0-9]\{3,\}$" | sort -n | tail -n 1) | |
if [[ ! -f "${ruby_build_file}" ]]; then | |
ruby_build_file="ruby-build/share/ruby-build/${patch_for_mri_version}" | |
fi | |
echo "Found railsexpress patches for MRI ${patch_for_mri_version} in ${ruby_build_file}" | |
if [[ -f "${ruby_build_file}" ]]; then | |
cp ${ruby_build_file} ${patch_for_mri_version} | |
echo "# Apply railsexpress patches" > railsexpress.tmp | |
echo "build_package_railsexpress() {" >> railsexpress.tmp | |
echo " echo 'Applying patches ...'" >> railsexpress.tmp | |
for patch_file in ${patch_dir}/railsexpress/*; do | |
echo " patch -s -p1 < ${tmp_dir}/${patch_file}" >> railsexpress.tmp | |
done | |
echo "}" >> railsexpress.tmp | |
echo "" >> railsexpress.tmp | |
cat railsexpress.tmp ${patch_for_mri_version} | sed 's/ldflags_dirs/railsexpress ldflags_dirs/g' > ${patch_for_mri_version}-perf | |
rm ${patch_for_mri_version} | |
rm railsexpress.tmp | |
echo "Install patched ruby with 'CONFIGURE_OPTS=\"--disable-install-rdoc\" rbenv install rbenv-railsexpress/${patch_for_mri_version}-perf'" | |
echo "" | |
fi | |
done | |
rm -rf ${tmp_dir}/ruby-build | |
echo "" | |
echo "After installing the patched ruby 'rm -rf ${tmp_dir}' will remove all remainders of this operation" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment