usr/src/cmd/ruby18/install-sfw
author Jon Tibble <meths@btinternet.com>
Fri, 10 Feb 2012 16:19:42 +0000
branchoi_151a
changeset 114 b6d40d0a7b17
parent 3 ad3552f8e1ef
permissions -rw-r--r--
Added tag oi_151a_prestable1 for changeset b1282e88c680

#!/usr/bin/ksh93 -e
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"@(#)install-sfw	1.9	09/11/20 SMI"
#

# Stop at first error
set -o errexit

PKGVERS=${1}
VERS=$(echo ${PKGVERS} | awk -F. '{print $1"."$2}')
PREFIX=${ROOT}/usr/ruby/${VERS}
BINDIR=${PREFIX}/bin
SHAREDIR=${PREFIX}/share
INFODIR=${PREFIX}/share/info
LIBDIR=${PREFIX}/lib
LOCALEDIR=${LIBDIR}/locale
MAN1DIR=${SHAREDIR}/man/man1
RELEASENUM=$(echo ${SFWRELEASE} | sed -e 's/[^.]*//')

source ${SRC}/tools/install.subr

sed -e 's/CONFIG\[\"CC\"\].*$/CONFIG\[\"CC\"\] = \"\/usr\/sfw\/bin\/gcc\"/' \
-e 's/CONFIG\[\"CFLAGS\"\].*$/CONFIG\[\"CFLAGS\"\] = \"-g -O3 -fPIC\"/' \
-e 's/CONFIG\[\"LDFLAGS\"\].*$/CONFIG\[\"LDFLAGS\"\] = \"-L\/usr\/sfw\/lib -R\/usr\/sfw\/lib\"/' \
-e 's/CONFIG\[\"CPP\"\].*$/CONFIG\[\"CPP\"\] = \"\/usr\/sfw\/bin\/gcc -E\"/' \
-e 's/CONFIG\[\"CPPFLAGS\"\].*$/CONFIG\[\"CPPFLAGS"\] = \"-I\/usr\/sfw\/include\"/' \
-e 's/CONFIG\[\"INSTALL\"\].*$/CONFIG\[\"INSTALL"\] = \"\/usr\/bin\/ginstall -c\" /' \
-e 's/CONFIG\[\"LDSHARED\"\].*$/CONFIG\[\"LDSHARED"\] = \"$(CC) -G\" /' \
-e 's/CONFIG\[\"CCDLFLAGS\"\].*$/CONFIG\[\"CCDLFLAGS\"\] = \"-fPIC\"/' ${LIBDIR}/ruby/1.8/${MACH}-solaris2${RELEASENUM}/rbconfig.rb > rbconfig.mod

echo 'ENV["GEM_HOME"] = "/var/ruby/1.8/gem_home"' >> rbconfig.mod

mv rbconfig.mod ${LIBDIR}/ruby/1.8/${MACH}-solaris2${RELEASENUM}/rbconfig.rb

sed -e '1s;^#!/.*;#!/usr/bin/ruby;' ${BINDIR}/gem > gem.mod
mv gem.mod ${BINDIR}/gem




#
# The ruby manpages are updated by Sun to include a comment, an
# ATTRIBUTES section with stability classification, and a NOTES 
# section containing a pointer to the source package. We do this 
# automatically at install time. If the package is revised, it is
# possible that additional changes may be required.  This can be
# generally be done by updating the sunman-stability file.

# The ruby manpage is also soft linked in /usr/share/man
# /usr/share/man/man1/ruby.1 -->  /usr/ruby/1.8/share/man/man1/ruby.1

MANSCRIPT=sunman-stability
cp ${MAN1DIR}/ruby.1 ${manpage}.sunman
_install M ${manpage}.sunman ${MAN1DIR}/ruby.1 444
_install L ../../../ruby/${VERS}/share/man/man1/ruby.1 ${ROOT}/usr/share/man/man1/ruby.1
rm -f ${manpage}.sunman

(cd ./Solaris
for manpage in *.1
do
  _install N ${manpage} ${MAN1DIR}/${manpage} 444
done)

_install L ../../../ruby/${VERS}/share/man/man1/gem.1 ${ROOT}/usr/share/man/man1/gem.1

(cd ./Solaris/scripts 
for script in gemri gemwhich gemlock gem_server gem_mirror index_gem_repository.rb update_rubygems
do
  _install S ${script} ${BINDIR}/${script} 555
done)

#
# The ruby executable scripts are soft linked in /usr/bin with its version information
# For example:
# /usr/bin/ruby18  -->  ../ruby/1.8/bin/ruby
# And soft links to those scripts are added in the same directory (/usr/bin)
# For example:
# /usr/bin/ruby    --> ./ruby18
(cd ${ROOT}/usr/bin
bin_list=$(/usr/bin/ls -1 $BINDIR)
for name in ${bin_list}
do
  _install L  ../ruby/${VERS}/bin/${name} ${ROOT}/usr/bin/${name}18
  _install L  ./${name}18 ${ROOT}/usr/bin/${name}
  # protofix chokes on the parameterized paths in prototype*.tmpl files
  # using chmod instead
  chmod 555 ../ruby/${VERS}/bin/${name} 
done)

chmod 555 ${ROOT}/usr/ruby/${VERS}/lib/libruby.so.1
chmod 444 ${ROOT}/usr/ruby/${VERS}/lib/libruby-static.a

# Set the mode of include files in usr/ruby/${VERS}/lib/ruby/${VERS}/${MACH}-solaris2${RELEASENUM} to 644
(cd ${ROOT}/usr/ruby/${VERS}/lib/ruby/${VERS}/${MACH}-solaris2${RELEASENUM}
header_list=$(/usr/bin/ls -1 *.h)
for file in ${header_list}
do
  chmod 644 ${file}
done)

exit 0