ruby-common/gem_packages.sh
Marcus Rueckert 0c812e5108 Accepting request 253103 from home:darix:ruby
- we dont always have /usr/bin/ruby, use perl for patching the
  version in the bin wrapper. also replaced the sed for patching
  the shebang line.
- fixed a bad bug in the shebang line. we had an additional "."
  there.

- install gemrc on all distros

- dont delete .a files. there are actually gems where we need them
  like rubygem-libv8 for rubygem-therubyracer

- fix the case where we dont symlink the binaries. 

- gem_cleanup macro was missed when updating for old ruby versions.

- switch from "ruby -rrubygems -e 
  'print Gem::Specification.new.base_dir'"
  to "gem env gemdir"
 

- gem_build_cleanup: also delete static library files

- ruby 1.8 support:
  - gem_packages.sh: change to /usr/src/packages when
    /home/abuild/rpmbuild doesn't exist.
  - gem_packages template:
    - require rbconfigpackagingsupport to fix the ruby_install_name
      dependent variables. we do that for all distros but catch the
      LoadError and continue.
    - and dont use not(), we need to use "!" instead.

OBS-URL: https://build.opensuse.org/request/show/253103
OBS-URL: https://build.opensuse.org/package/show/devel:languages:ruby/ruby-common?expand=0&rev=73
2014-09-29 13:29:35 +00:00

67 lines
1.8 KiB
Bash

#!/bin/bash
# we always start in /home/abuild but in older distros we wouldnt find the sources that way.
# switch to /usr/src/packages/
if [ ! -d $PWD/rpmbuild ] ; then
cd /usr/src/packages/
fi
shopt -s nullglob
# options may be followed by one colon to indicate they have a required argument
if ! options=$(getopt -o dEf -l default-gem:,build-root:,gem-name:,gem-version:,gem2rpm-config: -- "$@")
then
# something went wrong, getopt will put out an error message for us
exit 1
fi
eval set -- "$options"
otheropts="--local -t /usr/lib/rpm/gem_packages.template"
defaultgem=
buildroot=
gemfile=
gemname=
gemversion=
while [ $# -gt 0 ]
do
case $1 in
--default-gem) defaultgem=$2 ; shift;;
--gem-name) gemname="$2" ; shift;;
--gem-version) gemversion="$2" ; shift;;
--build-root) buildroot=$2; shift;;
--gem2rpm-config) gem_config=$2; shift;;
(--) ;;
(-*) otheropts="$otheropts $1";;
(*) gemfile=$1; otheropts="$otheropts $1"; break;;
esac
shift
done
if [ "x$gem_config" = "x" ] ; then
gem_config=$(find $RPM_SOURCE_DIR -name "*gem2rpm.yml")
if [ "x$gem_config" != "x" ] ; then
otheropts="$otheropts --config=$gem_config"
fi
fi
if [ "x$gemfile" = "x" ] ; then
gemfile=$(find . -maxdepth 2 -type f -name "$defaultgem")
# if still empty, we pick the sources
if [ "x$gemfile" = "x" ] ; then
gemfile=$(find $RPM_SOURCE_DIR -name "$defaultgem")
fi
otheropts="$otheropts $gemfile"
fi
# workaround for rubinius bug
# https://github.com/rubinius/rubinius/issues/2732
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
set -x
for ruby in /usr/bin/ruby.* /usr/bin/ruby[0-9].[0-9] ; do
ruby="${ruby#/usr/bin/ruby}"
if [[ $ruby == [0-9]* ]] ; then
ruby=".ruby$ruby"
fi
gemrpm="/usr/bin/gem2rpm${ruby}"
$gemrpm $otheropts
done